From 3aeea948cb2f5e50942380adfe76b0aecf7116f4 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Wed, 13 Sep 2017 06:35:05 -0500 Subject: [PATCH] Add env key to disable 2MB suballocation. Change-Id: Icca3041c3578aa180a656c01aae62f2ad6e8b583 [ROCm/ROCR-Runtime commit: 42756616822c9711b73e3bda8dc3ce4f5453dda1] --- .../hsa-runtime/core/runtime/amd_memory_region.cpp | 3 ++- .../rocr-runtime/runtime/hsa-runtime/core/util/flag.h | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) 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_;