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;