rocr/aie: Support VMEM handle creation
Adds support for AllocateMemoryOnly inside XDNA driver. Move the IsLocalMemory() check inside the KFD driver since the XDNA driver can, and needs to, create handles on system memory buffer objects. Changed handle variable name from thunk_handle to user_mode_driver_handle, which is more representative if we support non-GPU drivers. Change-Id: I95db9d575afd1ab0ff2de74cea5175d9a12a721b
Этот коммит содержится в:
коммит произвёл
David Yat Sin
родитель
54a459c05c
Коммит
4bf102dc6b
@@ -3111,20 +3111,22 @@ hsa_status_t Runtime::VMemoryHandleCreate(const MemoryRegion* region, size_t siz
|
||||
uint64_t flags_unused,
|
||||
hsa_amd_vmem_alloc_handle_t* memoryOnlyHandle) {
|
||||
const AMD::MemoryRegion* memRegion = static_cast<const AMD::MemoryRegion*>(region);
|
||||
if (!memRegion->IsLocalMemory()) return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
|
||||
if (!IsMultipleOf(size, memRegion->GetPageSize()))
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
|
||||
ScopedAcquire<KernelSharedMutex> lock(&memory_lock_);
|
||||
void* thunk_handle;
|
||||
hsa_status_t status = region->Allocate(size, alloc_flags, &thunk_handle, 0);
|
||||
void *user_mode_driver_handle;
|
||||
hsa_status_t status =
|
||||
region->Allocate(size, alloc_flags, &user_mode_driver_handle, 0);
|
||||
if (status == HSA_STATUS_SUCCESS) {
|
||||
memory_handle_map_.emplace(std::piecewise_construct,
|
||||
std::forward_as_tuple(thunk_handle),
|
||||
std::forward_as_tuple(region, size, flags_unused, thunk_handle, alloc_flags));
|
||||
std::forward_as_tuple(user_mode_driver_handle),
|
||||
std::forward_as_tuple(region, size, flags_unused,
|
||||
user_mode_driver_handle,
|
||||
alloc_flags));
|
||||
|
||||
*memoryOnlyHandle = MemoryHandle::Convert(thunk_handle);
|
||||
*memoryOnlyHandle = MemoryHandle::Convert(user_mode_driver_handle);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user