diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp index 1e44e14236..0961dcb6bb 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp @@ -171,7 +171,8 @@ hsa_status_t MemoryRegion::Allocate(size_t size, AllocateFlags alloc_flags, (alloc_flags & AllocateDoubleMap ? 1 : 0); // Only allow using the suballocator for ordinary VRAM. - bool useSubAlloc = IsLocalMemory(); + bool useSubAlloc = !core::Runtime::runtime_singleton_->flag().disable_fragment_alloc(); + useSubAlloc &= IsLocalMemory(); useSubAlloc &= (alloc_flags == AllocateRestrict); useSubAlloc &= (size <= fragment_allocator_.max_alloc()); if (useSubAlloc) { diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/util/flag.h b/projects/rocr-runtime/runtime/hsa-runtime/core/util/flag.h index 49298177dd..1de3b15abc 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/util/flag.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/util/flag.h @@ -88,6 +88,9 @@ class Flag { var = os::GetEnvVar("HSA_TOOLS_REPORT_LOAD_FAILURE"); report_tool_load_failures_ = (var == "0") ? false : true; + + var = os::GetEnvVar("HSA_DISABLE_FRAGMENT_ALLOCATOR"); + disable_fragment_alloc_ = (var == "1") ? true : false; } bool check_flat_scratch() const { return check_flat_scratch_; } @@ -104,14 +107,16 @@ class Flag { bool sdma_wait_idle() const { return sdma_wait_idle_; } + bool report_tool_load_failures() const { return report_tool_load_failures_; } + + bool disable_fragment_alloc() const { return disable_fragment_alloc_; } + uint32_t max_queues() const { return max_queues_; } size_t scratch_mem_size() const { return scratch_mem_size_; } std::string tools_lib_names() const { return tools_lib_names_; } - bool report_tool_load_failures() const { return report_tool_load_failures_; } - private: bool check_flat_scratch_; bool enable_vm_fault_message_; @@ -121,6 +126,7 @@ class Flag { bool sdma_wait_idle_; bool enable_queue_fault_message_; bool report_tool_load_failures_; + bool disable_fragment_alloc_; uint32_t max_queues_;