From 35a0855e4e5e9932d18efe9953c80a9a8013aad3 Mon Sep 17 00:00:00 2001 From: Xiaomeng Hou Date: Wed, 22 Feb 2023 15:53:49 +0800 Subject: [PATCH] SWDEV-373400 - Lower the threshold of single alloc percent for APUs w/ small VRAM Change-Id: Ie8e3504a0c468bc44633991cdfde66bcf0b74f06 --- rocclr/device/rocm/rocdevice.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rocclr/device/rocm/rocdevice.cpp b/rocclr/device/rocm/rocdevice.cpp index 287ece39b5..eacb2f4467 100644 --- a/rocclr/device/rocm/rocdevice.cpp +++ b/rocclr/device/rocm/rocdevice.cpp @@ -1245,6 +1245,13 @@ bool Device::populateOCLDeviceConstants() { assert(global_segment_size > 0); info_.globalMemSize_ = static_cast(global_segment_size); + // For APU with vram size <= 512MiB, use a smaller single alloc percentage + if (info_.globalMemSize_ <= 536870912) { + if (flagIsDefault(GPU_SINGLE_ALLOC_PERCENT)) { + GPU_SINGLE_ALLOC_PERCENT = 75; + } + } + gpuvm_segment_max_alloc_ = uint64_t(info_.globalMemSize_ * std::min(GPU_SINGLE_ALLOC_PERCENT, 100u) / 100u); assert(gpuvm_segment_max_alloc_ > 0);