VMM: Fix flags when allocating memory handle

When allocating a memory handle, the NoAddress thunk flag should be set
so that this allocation does not have a virtual address range.
Also, skip mapping the memory when allocating a memory handle

Change-Id: I1c168bc00ddbc158d447197c4dc25f96bad02b19


[ROCm/ROCR-Runtime commit: 29efd8eccd]
Tento commit je obsažen v:
David Yat Sin
2024-01-10 00:39:19 +00:00
rodič a8664a7471
revize 7c35d797d9
@@ -200,11 +200,15 @@ hsa_status_t MemoryRegion::AllocateImpl(size_t& size, AllocateFlags alloc_flags,
if (IsSystem() && (alloc_flags & AllocateNonPaged))
kmt_alloc_flags.ui32.NonPaged = 1;
// Allocating a memory handle for virtual memory
kmt_alloc_flags.ui32.NoAddress = !!(alloc_flags & AllocateMemoryOnly);
// Allocate pseudo fine grain memory
kmt_alloc_flags.ui32.CoarseGrain = (alloc_flags & AllocatePCIeRW ? 0 : kmt_alloc_flags.ui32.CoarseGrain);
kmt_alloc_flags.ui32.NoSubstitute = (alloc_flags & AllocatePinned ? 1 : kmt_alloc_flags.ui32.NoSubstitute);
// Only allow using the suballocator for ordinary VRAM.
if (IsLocalMemory()) {
if (IsLocalMemory() && !kmt_alloc_flags.ui32.NoAddress) {
bool subAllocEnabled = !core::Runtime::runtime_singleton_->flag().disable_fragment_alloc();
// Avoid modifying executable or queue allocations.
bool useSubAlloc = subAllocEnabled;
@@ -230,6 +234,8 @@ hsa_status_t MemoryRegion::AllocateImpl(size_t& size, AllocateFlags alloc_flags,
*address = AllocateKfdMemory(kmt_alloc_flags, owner()->node_id(), size);
}
if (kmt_alloc_flags.ui32.NoAddress) return HSA_STATUS_SUCCESS;
if (*address != nullptr) {
// Commit the memory.
// For system memory, on non-restricted allocation, map it to all GPUs. On