wsl/libhsakmt: adapt to the new check for kernel object
Signed-off-by: Flora Cui <flora.cui@amd.com> Reviewed-by: Longlong Yao <Longlong.Yao@amd.com> Part-of: <http://10.67.69.192/wsl/rocr-runtime/-/merge_requests/99>
This commit is contained in:
zatwierdzone przez
Frank Min
rodzic
72cbeeff6d
commit
c5d7d487dc
@@ -212,6 +212,9 @@ HSAKMT_STATUS hsaKmtAllocMemoryAlignInternal(HSAuint32 PreferredNode,
|
||||
create_info.flags.physical_contiguous = MemFlags.ui32.Contiguous;
|
||||
create_info.flags.locked = MemFlags.ui32.NoSubstitute;//AllocatePinned
|
||||
create_info.flags.virtual_alloc = MemFlags.ui32.OnlyAddress;
|
||||
create_info.flags.blit_kernel_object =
|
||||
(MemFlags.ui32.ExecuteBlit && MemFlags.ui32.ExecuteAccess &&
|
||||
(create_info.domain == thunk_proxy::AllocDomain::kSystem));
|
||||
/*when only alloc virtual or only physical, it's vmm allocation, force to local*/
|
||||
if (create_info.flags.virtual_alloc || create_info.flags.physical_only
|
||||
|| create_info.flags.physical_contiguous) {
|
||||
|
||||
@@ -65,6 +65,7 @@ ErrorCode GpuMemory::Init(const GpuMemoryCreateInfo &create_info) {
|
||||
desc_.flags.is_imported_sys_memfd = create_info.flags.sysmem_ipc_sig_importer;
|
||||
desc_.flags.is_sysmem_exporter = create_info.flags.sysmem_ipc_sig_exporter;
|
||||
desc_.flags.is_va_required = create_info.flags.alloc_va;
|
||||
desc_.flags.is_blit_kernel_object = create_info.flags.blit_kernel_object;
|
||||
|
||||
/* we can't tell the allocation is regular vmm or ipc mem at creation stage,
|
||||
they share same creation parameters, so forcing all vram allocations to
|
||||
|
||||
+10
-5
@@ -521,15 +521,20 @@ uint32_t ComputeQueue::UpdateIndexStride(uint32_t srd, bool wave32) {
|
||||
}
|
||||
|
||||
uint64_t ComputeQueue::GetKernelObjAddr(uint64_t addr) const {
|
||||
//TODO: convert dev_addr to host_addr
|
||||
/* convert dev_addr to host_addr */
|
||||
auto code = get_gpu_mem((void*)addr);
|
||||
if (code && code->IsBlitKernelObject()) {
|
||||
return code->GpuAddress();
|
||||
}
|
||||
|
||||
uint64_t host_addr = 0;
|
||||
auto ret = hsakmt_hsa_ven_amd_loader_query_host_address(reinterpret_cast<const void *>(addr),
|
||||
reinterpret_cast<const void **>(&host_addr));
|
||||
if (ret == HSA_STATUS_ERROR_INVALID_ARGUMENT) {
|
||||
return 0;
|
||||
if (ret == HSA_STATUS_SUCCESS) {
|
||||
return host_addr;
|
||||
}
|
||||
|
||||
return host_addr;
|
||||
pr_err("failed to query host address for kernel object %p, ret=%d\n", (void*)addr, ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ComputeQueue::RingDoorbell() {
|
||||
|
||||
Reference in New Issue
Block a user