Revert "rocr: river interface changes" (#724)
This commit reverts the following related commits which cause test failures:6d15779b3erocr/driver: add PC sampling support to driver interface56cb9390ffrocr/driver: add PC sampling support to driver interface76bf829f09rocr/driver: add ASAN header page management to Driver classa47c060d6arocr/driver: add ASAN header page management to Driver class02d7eaf3b7rocr: add memory sharing call to Driver interface9312468655rocr: add memory sharing call to Driver interface
This commit is contained in:
@@ -698,102 +698,5 @@ hsa_status_t KfdDriver::GetWallclockFrequency(uint32_t node_id, uint64_t* freque
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
hsa_status_t KfdDriver::ShareMemory(void* mem, size_t size,
|
||||
HsaSharedMemoryHandle* share_mem) const {
|
||||
assert(share_mem);
|
||||
|
||||
if (HSAKMT_CALL(hsaKmtShareMemory(mem, size, share_mem)) != HSAKMT_STATUS_SUCCESS) {
|
||||
return HSA_STATUS_ERROR;
|
||||
}
|
||||
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
hsa_status_t KfdDriver::RegisterSharedHandle(const HsaSharedMemoryHandle* share_mem, void** mem,
|
||||
uint64_t* size) const {
|
||||
assert(share_mem);
|
||||
assert(mem);
|
||||
assert(size);
|
||||
|
||||
if (HSAKMT_CALL(hsaKmtRegisterSharedHandle(share_mem, mem, size)) != HSAKMT_STATUS_SUCCESS) {
|
||||
return HSA_STATUS_ERROR;
|
||||
}
|
||||
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
hsa_status_t KfdDriver::ReplaceAsanHeaderPage(void* mem) const {
|
||||
if (HSAKMT_CALL(hsaKmtReplaceAsanHeaderPage(mem)) != HSAKMT_STATUS_SUCCESS) {
|
||||
return HSA_STATUS_ERROR;
|
||||
}
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
hsa_status_t KfdDriver::ReturnAsanHeaderPage(void* mem) const {
|
||||
if (HSAKMT_CALL(hsaKmtReturnAsanHeaderPage(mem)) != HSAKMT_STATUS_SUCCESS) {
|
||||
return HSA_STATUS_ERROR;
|
||||
}
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
hsa_status_t KfdDriver::PcSamplingQueryCapabilities(uint32_t node_id, void* sample_info,
|
||||
uint32_t sample_info_sz,
|
||||
uint32_t* sz_needed) const {
|
||||
HSAKMT_STATUS status = HSAKMT_CALL(
|
||||
hsaKmtPcSamplingQueryCapabilities(node_id, sample_info, sample_info_sz, sz_needed));
|
||||
if (status == HSAKMT_STATUS_KERNEL_ALREADY_OPENED) {
|
||||
return static_cast<hsa_status_t>(HSA_STATUS_ERROR_RESOURCE_BUSY);
|
||||
}
|
||||
if (status != HSAKMT_STATUS_SUCCESS) {
|
||||
return HSA_STATUS_ERROR;
|
||||
}
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
hsa_status_t KfdDriver::PcSamplingCreate(uint32_t node_id, HsaPcSamplingInfo* sample_info,
|
||||
uint32_t* trace_id) const {
|
||||
HSAKMT_STATUS status = HSAKMT_CALL(hsaKmtPcSamplingCreate(node_id, sample_info, trace_id));
|
||||
if (status == HSAKMT_STATUS_KERNEL_ALREADY_OPENED) {
|
||||
return static_cast<hsa_status_t>(HSA_STATUS_ERROR_RESOURCE_BUSY);
|
||||
}
|
||||
if (status != HSAKMT_STATUS_SUCCESS) {
|
||||
return HSA_STATUS_ERROR;
|
||||
}
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
hsa_status_t KfdDriver::PcSamplingDestroy(uint32_t node_id, uint32_t trace_id) const {
|
||||
HSAKMT_STATUS status = HSAKMT_CALL(hsaKmtPcSamplingDestroy(node_id, trace_id));
|
||||
if (status == HSAKMT_STATUS_KERNEL_ALREADY_OPENED) {
|
||||
return static_cast<hsa_status_t>(HSA_STATUS_ERROR_RESOURCE_BUSY);
|
||||
}
|
||||
if (status != HSAKMT_STATUS_SUCCESS) {
|
||||
return HSA_STATUS_ERROR;
|
||||
}
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
hsa_status_t KfdDriver::PcSamplingStart(uint32_t node_id, uint32_t trace_id) const {
|
||||
HSAKMT_STATUS status = HSAKMT_CALL(hsaKmtPcSamplingStart(node_id, trace_id));
|
||||
if (status == HSAKMT_STATUS_KERNEL_ALREADY_OPENED) {
|
||||
return static_cast<hsa_status_t>(HSA_STATUS_ERROR_RESOURCE_BUSY);
|
||||
}
|
||||
if (status != HSAKMT_STATUS_SUCCESS) {
|
||||
return HSA_STATUS_ERROR;
|
||||
}
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
hsa_status_t KfdDriver::PcSamplingStop(uint32_t node_id, uint32_t trace_id) const {
|
||||
HSAKMT_STATUS status = HSAKMT_CALL(hsaKmtPcSamplingStop(node_id, trace_id));
|
||||
if (status == HSAKMT_STATUS_KERNEL_ALREADY_OPENED) {
|
||||
return static_cast<hsa_status_t>(HSA_STATUS_ERROR_RESOURCE_BUSY);
|
||||
}
|
||||
if (status != HSAKMT_STATUS_SUCCESS) {
|
||||
return HSA_STATUS_ERROR;
|
||||
}
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
} // namespace AMD
|
||||
} // namespace rocr
|
||||
|
||||
@@ -136,19 +136,6 @@ public:
|
||||
const HsaMemMapFlags* mem_flags, uint32_t num_nodes,
|
||||
const uint32_t* nodes) const override;
|
||||
hsa_status_t MakeMemoryUnresident(const void* mem) const override;
|
||||
hsa_status_t ShareMemory(void* mem, size_t size, HsaSharedMemoryHandle* share_mem) const override;
|
||||
hsa_status_t RegisterSharedHandle(const HsaSharedMemoryHandle* share_mem, void** mem,
|
||||
uint64_t* size) const override;
|
||||
hsa_status_t ReplaceAsanHeaderPage(void* mem) const override;
|
||||
hsa_status_t ReturnAsanHeaderPage(void* mem) const override;
|
||||
hsa_status_t PcSamplingQueryCapabilities(uint32_t node_id, void* sample_info,
|
||||
uint32_t sample_info_sz,
|
||||
uint32_t* sz_needed) const override;
|
||||
hsa_status_t PcSamplingCreate(uint32_t node_id, HsaPcSamplingInfo* sample_info,
|
||||
uint32_t* trace_id) const override;
|
||||
hsa_status_t PcSamplingDestroy(uint32_t node_id, uint32_t trace_id) const override;
|
||||
hsa_status_t PcSamplingStart(uint32_t node_id, uint32_t trace_id) const override;
|
||||
hsa_status_t PcSamplingStop(uint32_t node_id, uint32_t trace_id) const override;
|
||||
|
||||
hsa_status_t OpenSMI(uint32_t node_id, int* fd) const override;
|
||||
|
||||
|
||||
@@ -351,92 +351,6 @@ public:
|
||||
/// @return HSA_STATUS_SUCCESS if the driver successfully makes the memory
|
||||
virtual hsa_status_t MakeMemoryUnresident(const void* mem) const = 0;
|
||||
|
||||
/// @brief Shares memory with another process.
|
||||
/// @param[in] mem Pointer to the memory to be shared.
|
||||
/// @param[in] size Size of the memory to be shared.
|
||||
/// @param[out] share_mem Pointer to the shared memory handle.
|
||||
/// @return HSA_STATUS_SUCCESS if the memory was successfully shared, or an error code.
|
||||
virtual hsa_status_t ShareMemory(void* mem, size_t size, HsaSharedMemoryHandle* share_mem) const {
|
||||
return HSA_STATUS_ERROR_INVALID_AGENT;
|
||||
}
|
||||
|
||||
/// @brief Registers a shared memory handle.
|
||||
/// @param[in] share_mem Pointer to the shared memory handle.
|
||||
/// @param[out] mem Pointer to the memory.
|
||||
/// @param[out] size Size of the memory.
|
||||
/// @return HSA_STATUS_SUCCESS if the memory was successfully registered, or an error code.
|
||||
virtual hsa_status_t RegisterSharedHandle(const HsaSharedMemoryHandle* share_mem, void** mem,
|
||||
uint64_t* size) const {
|
||||
return HSA_STATUS_ERROR_INVALID_AGENT;
|
||||
}
|
||||
|
||||
/// @brief Replaces the ASAN header page with a valid one.
|
||||
/// @param[in] mem Pointer to the memory to be replaced.
|
||||
/// @return HSA_STATUS_SUCCESS if the ASAN header page was successfully replaced, or an error
|
||||
/// code.
|
||||
virtual hsa_status_t ReplaceAsanHeaderPage(void* mem) const {
|
||||
return HSA_STATUS_ERROR_INVALID_AGENT;
|
||||
}
|
||||
|
||||
/// @brief Returns the ASAN header page to its original state.
|
||||
/// @param[in] mem Pointer to the memory to be returned.
|
||||
/// @return HSA_STATUS_SUCCESS if the ASAN header page was successfully returned, or an error
|
||||
/// code.
|
||||
virtual hsa_status_t ReturnAsanHeaderPage(void* mem) const {
|
||||
return HSA_STATUS_ERROR_INVALID_AGENT;
|
||||
}
|
||||
|
||||
/// @brief Queries the PC sampling capabilities.
|
||||
/// @param[in] node_id Node ID of the agent
|
||||
/// @param[in] sample_info Pointer to the sample information
|
||||
/// @param[in] sample_info_sz Size of the sample information
|
||||
/// @param[out] sz_needed Size of the sample information needed
|
||||
/// @return HSA_STATUS_SUCCESS if the PC sampling capabilities were successfully queried, or an
|
||||
/// error code.
|
||||
virtual hsa_status_t PcSamplingQueryCapabilities(uint32_t node_id, void* sample_info,
|
||||
uint32_t sample_info_sz,
|
||||
uint32_t* sz_needed) const {
|
||||
return HSA_STATUS_ERROR_INVALID_AGENT;
|
||||
}
|
||||
|
||||
/// @brief Creates a PC sampling session.
|
||||
/// @param[in] node_id Node ID of the agent
|
||||
/// @param[in] sample_info Pointer to the sample information
|
||||
/// @param[out] trace_id Pointer to the trace ID
|
||||
/// @return HSA_STATUS_SUCCESS if the PC sampling session was successfully created, or an error
|
||||
/// code.
|
||||
virtual hsa_status_t PcSamplingCreate(uint32_t node_id, HsaPcSamplingInfo* sample_info,
|
||||
uint32_t* trace_id) const {
|
||||
return HSA_STATUS_ERROR_INVALID_AGENT;
|
||||
}
|
||||
|
||||
/// @brief Destroys a PC sampling session.
|
||||
/// @param[in] node_id Node ID of the agent
|
||||
/// @param[in] trace_id Trace ID of the PC sampling session
|
||||
/// @return HSA_STATUS_SUCCESS if the PC sampling session was successfully destroyed, or an error
|
||||
/// code.
|
||||
virtual hsa_status_t PcSamplingDestroy(uint32_t node_id, uint32_t trace_id) const {
|
||||
return HSA_STATUS_ERROR_INVALID_AGENT;
|
||||
}
|
||||
|
||||
/// @brief Starts a PC sampling session.
|
||||
/// @param[in] node_id Node ID of the agent
|
||||
/// @param[in] trace_id Trace ID of the PC sampling session
|
||||
/// @return HSA_STATUS_SUCCESS if the PC sampling session was successfully started, or an error
|
||||
/// code.
|
||||
virtual hsa_status_t PcSamplingStart(uint32_t node_id, uint32_t trace_id) const {
|
||||
return HSA_STATUS_ERROR_INVALID_AGENT;
|
||||
}
|
||||
|
||||
/// @brief Stops a PC sampling session.
|
||||
/// @param[in] node_id Node ID of the agent
|
||||
/// @param[in] trace_id Trace ID of the PC sampling session
|
||||
/// @return HSA_STATUS_SUCCESS if the PC sampling session was successfully stopped, or an error
|
||||
/// code.
|
||||
virtual hsa_status_t PcSamplingStop(uint32_t node_id, uint32_t trace_id) const {
|
||||
return HSA_STATUS_ERROR_INVALID_AGENT;
|
||||
}
|
||||
|
||||
/// Unique identifier for supported kernel-mode drivers.
|
||||
const DriverType kernel_driver_type_;
|
||||
|
||||
|
||||
@@ -508,22 +508,6 @@ class Runtime {
|
||||
return **driver;
|
||||
}
|
||||
|
||||
/// @brief Check if the drivers of the agents are different.
|
||||
/// @param [in] agents Array of agents to check.
|
||||
/// @param [in] num_agents Number of agents in the array.
|
||||
/// @return True if the drivers of the agents are different, false otherwise.
|
||||
static bool IsDifferentDriver(Agent* agents, uint32_t num_agents) {
|
||||
if (num_agents == 0 || agents == nullptr) return true;
|
||||
|
||||
auto first_driver_type = agents[0].driver().kernel_driver_type_;
|
||||
for (uint32_t i = 1; i < num_agents; ++i) {
|
||||
if (agents[i].driver().kernel_driver_type_ != first_driver_type) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<Driver>>& AgentDrivers() { return agent_drivers_; }
|
||||
|
||||
static bool IsGPUDriver(DriverType driver_type) {
|
||||
|
||||
@@ -2553,14 +2553,14 @@ hsa_status_t GpuAgent::PcSamplingIterateConfig(hsa_ven_amd_pcs_iterate_configura
|
||||
return HSA_STATUS_ERROR;
|
||||
|
||||
// First query to get size of list needed
|
||||
hsa_status_t ret = driver().PcSamplingQueryCapabilities(node_id(), NULL, 0, &size);
|
||||
if (ret != HSA_STATUS_SUCCESS || size == 0) return ret;
|
||||
HSAKMT_STATUS ret = HSAKMT_CALL(hsaKmtPcSamplingQueryCapabilities(node_id(), NULL, 0, &size));
|
||||
if (ret != HSAKMT_STATUS_SUCCESS || size == 0) return HSA_STATUS_ERROR;
|
||||
|
||||
std::vector<HsaPcSamplingInfo> sampleInfoList(size);
|
||||
ret = driver().PcSamplingQueryCapabilities(node_id(), sampleInfoList.data(),
|
||||
sampleInfoList.size(), &size);
|
||||
ret = HSAKMT_CALL(hsaKmtPcSamplingQueryCapabilities(node_id(), sampleInfoList.data(), sampleInfoList.size(),
|
||||
&size));
|
||||
|
||||
if (ret != HSA_STATUS_SUCCESS) return ret;
|
||||
if (ret != HSAKMT_STATUS_SUCCESS) return HSA_STATUS_ERROR;
|
||||
|
||||
for (uint32_t i = 0; i < size; i++) {
|
||||
hsa_ven_amd_pcs_configuration_t hsaPcSampling;
|
||||
@@ -2586,9 +2586,10 @@ hsa_status_t GpuAgent::PcSamplingCreate(pcs::PcsRuntime::PcSamplingSession& sess
|
||||
|
||||
// Pass the sampling information to the kernel driver to create PC
|
||||
// sampling session.
|
||||
ret = driver().PcSamplingCreate(node_id(), &sampleInfo, &thunkId);
|
||||
if (ret != HSA_STATUS_SUCCESS) {
|
||||
return ret;
|
||||
HSAKMT_STATUS retkmt = HSAKMT_CALL(hsaKmtPcSamplingCreate(node_id(), &sampleInfo, &thunkId));
|
||||
if (retkmt != HSAKMT_STATUS_SUCCESS) {
|
||||
return (retkmt == HSAKMT_STATUS_KERNEL_ALREADY_OPENED) ? (hsa_status_t)HSA_STATUS_ERROR_RESOURCE_BUSY
|
||||
: HSA_STATUS_ERROR;
|
||||
}
|
||||
|
||||
debug_print("Created PC sampling session with thunkId:%d\n", thunkId);
|
||||
@@ -2794,7 +2795,7 @@ hsa_status_t GpuAgent::PcSamplingCreateFromId(HsaPcSamplingTraceId ioctlId,
|
||||
hsa_status_t GpuAgent::PcSamplingDestroy(pcs::PcsRuntime::PcSamplingSession& session) {
|
||||
if (PcSamplingStop(session) != HSA_STATUS_SUCCESS) return HSA_STATUS_ERROR;
|
||||
|
||||
hsa_status_t ret = driver().PcSamplingDestroy(node_id(), session.ThunkId());
|
||||
HSAKMT_STATUS retKmt = HSAKMT_CALL(hsaKmtPcSamplingDestroy(node_id(), session.ThunkId()));
|
||||
hsa_ven_amd_pcs_method_kind_t sampling_method = session.method();
|
||||
|
||||
pcs_data_t* pcs_data = nullptr;
|
||||
@@ -2826,7 +2827,7 @@ hsa_status_t GpuAgent::PcSamplingDestroy(pcs::PcsRuntime::PcSamplingSession& ses
|
||||
// Update the trap handler to clear any associated device data
|
||||
UpdateTrapHandlerWithPCS(nullptr, nullptr);
|
||||
|
||||
return ret;
|
||||
return (retKmt == HSAKMT_STATUS_SUCCESS) ? HSA_STATUS_SUCCESS : HSA_STATUS_ERROR;
|
||||
}
|
||||
|
||||
hsa_status_t GpuAgent::PcSamplingStart(pcs::PcsRuntime::PcSamplingSession& session) {
|
||||
@@ -2893,9 +2894,8 @@ hsa_status_t GpuAgent::PcSamplingStart(pcs::PcsRuntime::PcSamplingSession& sessi
|
||||
}
|
||||
|
||||
// Start the sampling session in the kernel driver
|
||||
if (driver().PcSamplingStart(node_id(), session.ThunkId()) == HSA_STATUS_SUCCESS) {
|
||||
if (HSAKMT_CALL(hsaKmtPcSamplingStart(node_id(), session.ThunkId())) == HSAKMT_STATUS_SUCCESS)
|
||||
return HSA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
debug_print("Failed to start PC sampling session with thunkId:%d\n", session.ThunkId());
|
||||
// Clean up if starting the session failed
|
||||
@@ -2915,8 +2915,8 @@ hsa_status_t GpuAgent::PcSamplingStop(pcs::PcsRuntime::PcSamplingSession& sessio
|
||||
session.stop();
|
||||
|
||||
// Stop PC sampling in the kernel driver
|
||||
hsa_status_t ret = driver().PcSamplingStop(node_id(), session.ThunkId());
|
||||
if (ret != HSA_STATUS_SUCCESS)
|
||||
HSAKMT_STATUS retKmt = HSAKMT_CALL(hsaKmtPcSamplingStop(node_id(), session.ThunkId()));
|
||||
if (retKmt != HSAKMT_STATUS_SUCCESS)
|
||||
throw AMD::hsa_exception(HSA_STATUS_ERROR, "Failed to stop PC Sampling session.");
|
||||
|
||||
// Determine the sampling method and corresponding data
|
||||
|
||||
@@ -368,7 +368,7 @@ hsa_status_t Runtime::FreeMemory(void* ptr) {
|
||||
}
|
||||
|
||||
if (alloc_flags & core::MemoryRegion::AllocateAsan)
|
||||
assert(region->owner()->driver().ReturnAsanHeaderPage(ptr) == HSA_STATUS_SUCCESS);
|
||||
assert(HSAKMT_CALL(hsaKmtReturnAsanHeaderPage(ptr)) == HSAKMT_STATUS_SUCCESS);
|
||||
|
||||
const hsa_status_t err = region->Free(ptr, size);
|
||||
if (err != HSA_STATUS_SUCCESS) {
|
||||
@@ -1297,7 +1297,6 @@ hsa_status_t Runtime::IPCCreate(void* ptr, size_t len, hsa_amd_ipc_memory_t* han
|
||||
if (info.agentBaseAddress != ptr || info.sizeInBytes != len)
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
|
||||
Agent* agent = Agent::Convert(info.agentOwner);
|
||||
bool useFrag = (block.base != ptr || block.length != len);
|
||||
// Assume all pointers and blocks are 4Kb aligned.
|
||||
uint32_t fragOffset = (reinterpret_cast<uint8_t*>(ptr) -
|
||||
@@ -1311,7 +1310,7 @@ hsa_status_t Runtime::IPCCreate(void* ptr, size_t len, hsa_amd_ipc_memory_t* han
|
||||
|
||||
if (!ipc_dmabuf_supported_) {
|
||||
HsaSharedMemoryHandle *sHandle = reinterpret_cast<HsaSharedMemoryHandle*>(handle);
|
||||
if (agent->driver().ShareMemory(block.base, block.length, sHandle) != HSA_STATUS_SUCCESS)
|
||||
if (HSAKMT_CALL(hsaKmtShareMemory(block.base, block.length, sHandle)) != HSAKMT_STATUS_SUCCESS)
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
|
||||
hsa_status_t err = HSA_STATUS_SUCCESS;
|
||||
@@ -1332,6 +1331,7 @@ hsa_status_t Runtime::IPCCreate(void* ptr, size_t len, hsa_amd_ipc_memory_t* han
|
||||
handle->handle[1] = dmaBufFdHandleHi;
|
||||
handle->handle[2] = getpid(); // socket server name handle
|
||||
|
||||
Agent *agent = Agent::Convert(info.agentOwner);
|
||||
handle->handle[3] = agent->device_type() == Agent::kAmdCpuDevice;
|
||||
// System sub allocations are not supported for now.
|
||||
if (handle->handle[3] && useFrag) return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
@@ -1472,9 +1472,6 @@ hsa_status_t Runtime::IPCAttach(const hsa_amd_ipc_memory_t* handle, size_t len,
|
||||
bool isFragment = false;
|
||||
uint32_t fragOffset = 0;
|
||||
|
||||
if (Runtime::IsDifferentDriver(*agents, num_agents)) return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
core::Driver* driver = &agents[0]->driver();
|
||||
|
||||
auto fixFragment = [&](amdgpu_bo_handle ldrm_bo) {
|
||||
if (isFragment) {
|
||||
importAddress = reinterpret_cast<uint8_t*>(importAddress) + fragOffset;
|
||||
@@ -1486,17 +1483,14 @@ hsa_status_t Runtime::IPCAttach(const hsa_amd_ipc_memory_t* handle, size_t len,
|
||||
allocation_map_[importAddress].ldrm_bo = ldrm_bo;
|
||||
};
|
||||
|
||||
auto importMemory = [&](unsigned int numNodes, HSAuint32* nodes, amdgpu_bo_import_result* res) {
|
||||
if (ipc_dmabuf_supported_) {
|
||||
int ret = IPCClientImport(importHandle.handle[2], dmaBufFDHandle, res, numNodes, nodes,
|
||||
&importAddress, &importSize);
|
||||
if (ret != HSAKMT_STATUS_SUCCESS) return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
} else {
|
||||
hsa_status_t ret = driver->RegisterSharedHandle(
|
||||
reinterpret_cast<const HsaSharedMemoryHandle*>(&importHandle), &importAddress,
|
||||
&importSize);
|
||||
if (ret != HSA_STATUS_SUCCESS) return ret;
|
||||
}
|
||||
auto importMemory = [&](unsigned int numNodes, HSAuint32 *nodes,
|
||||
amdgpu_bo_import_result *res) {
|
||||
int ret = ipc_dmabuf_supported_ ?
|
||||
IPCClientImport(importHandle.handle[2], dmaBufFDHandle, res,
|
||||
numNodes, nodes, &importAddress, &importSize) :
|
||||
HSAKMT_CALL(hsaKmtRegisterSharedHandle(reinterpret_cast<const HsaSharedMemoryHandle*>(&importHandle),
|
||||
&importAddress, &importSize));
|
||||
if (ret != HSAKMT_STATUS_SUCCESS) return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
|
||||
return HSA_STATUS_SUCCESS;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user