2018-10-31 01:29:32 +08:00
|
|
|
/*
|
2022-09-16 22:29:51 +08:00
|
|
|
* Copyright (C) 2022 Intel Corporation
|
2018-10-31 01:29:32 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2018-11-11 05:25:48 +08:00
|
|
|
#include <cstdint>
|
2018-10-31 01:29:32 +08:00
|
|
|
#include <string>
|
2019-11-02 02:00:26 +08:00
|
|
|
#include <vector>
|
2022-09-16 22:29:51 +08:00
|
|
|
#include "page_info.h"
|
|
|
|
#include "shared_mem_info.h"
|
|
|
|
#include "physical_allocation_info.h"
|
2018-10-31 01:29:32 +08:00
|
|
|
|
2019-01-19 04:44:23 +08:00
|
|
|
namespace aub_stream {
|
2018-10-31 01:29:32 +08:00
|
|
|
|
2022-11-18 20:32:39 +08:00
|
|
|
enum class ProductFamily : uint32_t;
|
|
|
|
|
2021-02-16 18:20:34 +08:00
|
|
|
struct AllocationParams;
|
2018-11-11 05:25:48 +08:00
|
|
|
struct HardwareContext;
|
2018-10-31 01:29:32 +08:00
|
|
|
|
2022-09-16 22:29:51 +08:00
|
|
|
struct AubManagerOptions {
|
2022-11-18 20:32:39 +08:00
|
|
|
uint32_t version{};
|
2022-09-16 22:29:51 +08:00
|
|
|
uint32_t productFamily{};
|
|
|
|
uint32_t devicesCount{};
|
|
|
|
uint64_t memoryBankSize{};
|
|
|
|
uint32_t stepping{};
|
|
|
|
bool localMemorySupported{};
|
|
|
|
uint32_t mode{};
|
|
|
|
uint64_t gpuAddressSpace{};
|
|
|
|
SharedMemoryInfo sharedMemoryInfo{};
|
|
|
|
bool throwOnError{};
|
|
|
|
};
|
|
|
|
|
2018-10-31 01:29:32 +08:00
|
|
|
class AubManager {
|
|
|
|
public:
|
2018-11-11 05:25:48 +08:00
|
|
|
virtual ~AubManager() = default;
|
2019-02-20 05:50:52 +08:00
|
|
|
|
2019-02-07 20:43:13 +08:00
|
|
|
virtual HardwareContext *createHardwareContext(uint32_t device, uint32_t engine, uint32_t flags) = 0;
|
2019-02-20 05:50:52 +08:00
|
|
|
|
|
|
|
virtual void open(const std::string &aubFileName) = 0;
|
|
|
|
virtual void close() = 0;
|
|
|
|
virtual bool isOpen() = 0;
|
|
|
|
virtual const std::string getFileName() = 0;
|
2019-10-03 04:42:40 +08:00
|
|
|
virtual void pause(bool onoff) = 0;
|
2019-02-20 05:50:52 +08:00
|
|
|
|
2019-04-01 15:33:19 +08:00
|
|
|
virtual void addComment(const char *message) = 0;
|
2021-02-16 18:20:34 +08:00
|
|
|
virtual void writeMemory(uint64_t gfxAddress, const void *memory, size_t size, uint32_t memoryBanks, int hint, size_t pageSize) = 0;
|
2019-11-20 08:49:20 +08:00
|
|
|
virtual void writePageTableEntries(uint64_t gfxAddress, size_t size, uint32_t memoryBanks, int hint,
|
2019-11-02 02:00:26 +08:00
|
|
|
std::vector<PageInfo> &lastLevelPages, size_t pageSize) = 0;
|
|
|
|
|
|
|
|
virtual void writePhysicalMemoryPages(const void *memory, std::vector<PageInfo> &pages, size_t size, int hint) = 0;
|
2019-05-28 22:24:26 +08:00
|
|
|
virtual void freeMemory(uint64_t gfxAddress, size_t size) = 0;
|
2018-10-31 01:29:32 +08:00
|
|
|
|
2020-08-31 15:37:36 +08:00
|
|
|
static AubManager *create(uint32_t productFamily, uint32_t devicesCount, uint64_t memoryBankSize, uint32_t stepping,
|
2020-02-26 23:36:55 +08:00
|
|
|
bool localMemorySupported, uint32_t streamMode, uint64_t gpuAddressSpace);
|
2021-02-16 18:20:34 +08:00
|
|
|
|
2022-11-18 20:32:39 +08:00
|
|
|
static AubManager *create(ProductFamily productFamily, uint32_t devicesCount, uint64_t memoryBankSize, uint32_t stepping,
|
|
|
|
bool localMemorySupported, uint32_t streamMode, uint64_t gpuAddressSpace);
|
|
|
|
|
2021-02-16 18:20:34 +08:00
|
|
|
virtual void writeMemory2(AllocationParams allocationParams) = 0;
|
2022-09-16 22:29:51 +08:00
|
|
|
|
|
|
|
static AubManager *create(const struct AubManagerOptions &options);
|
|
|
|
|
|
|
|
virtual bool reservePhysicalMemory(AllocationParams allocationParams, PhysicalAllocationInfo &physicalAllocInfo) = 0;
|
|
|
|
virtual bool mapGpuVa(uint64_t gfxAddress, size_t size, PhysicalAllocationInfo physicalAllocInfo) = 0;
|
2018-10-31 01:29:32 +08:00
|
|
|
};
|
|
|
|
|
2019-01-19 04:44:23 +08:00
|
|
|
} // namespace aub_stream
|