From 640ca3ba4f367e49e9f6238989b652a3803e2982 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Tue, 19 Dec 2017 18:57:29 -0600 Subject: [PATCH] Merge system heap info. Workaround pending thunk spec clarification. Change-Id: I9d96227efde3a551157733cf4050d474d1e658f2 [ROCm/ROCR-Runtime commit: fe1763848a339f74a2574dbd87a492e6be42305f] --- .../runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp | 5 +++++ .../runtime/hsa-runtime/core/runtime/amd_memory_region.cpp | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp index 0a58d2986f..7c76fa4875 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_cpu_agent.cpp @@ -77,6 +77,11 @@ void CpuAgent::InitRegionList() { }); if (system_prop != mem_props.end()) { + // CRAT/KFD workaround + for (auto idx = system_prop + 1; idx != mem_props.end(); idx++) { + if (idx->HeapType == HSA_HEAPTYPE_SYSTEM) system_prop->SizeInBytes += idx->SizeInBytes; + } + MemoryRegion* system_region_fine = new MemoryRegion(true, is_apu_node, this, *system_prop); 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 1bf62157c9..8c9785b95b 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 @@ -136,9 +136,7 @@ MemoryRegion::MemoryRegion(bool fine_grain, bool full_profile, core::Agent* owne (full_profile) ? os::GetUserModeVirtualMemorySize() : kGpuVmSize; } - // Temporary workaround for CRAT issue. - max_single_alloc_size_ = AlignDown(size_t(-1), kPageSize_); - // max_single_alloc_size_ = AlignDown(static_cast(GetPhysicalSize()), kPageSize_); + max_single_alloc_size_ = AlignDown(static_cast(GetPhysicalSize()), kPageSize_); mem_flag_.ui32.CoarseGrain = (fine_grain) ? 0 : 1;