diff --git a/projects/clr/rocclr/device/pal/paldevice.cpp b/projects/clr/rocclr/device/pal/paldevice.cpp index c6aa33fe94d2..ce65660fef73 100644 --- a/projects/clr/rocclr/device/pal/paldevice.cpp +++ b/projects/clr/rocclr/device/pal/paldevice.cpp @@ -352,14 +352,14 @@ void NullDevice::fillDeviceInfo(const Pal::DeviceProperties& palProp, info_.globalMemSize_ = (static_cast(std::min(GPU_MAX_HEAP_SIZE, 100u)) * static_cast(localRAM) / 100u); - uint uswcPercentAvailable = - ((static_cast(heaps[Pal::GpuHeapGartUswc].logicalSize) / Mi) > 1536 && IS_WINDOWS) - ? 75 - : 50; + const uint64_t gartSize = static_cast(heaps[Pal::GpuHeapGartUswc].logicalSize); + + // The aperture is host DRAM the GPU addresses directly, so discount it by at most + // 25%, capped at 4 GiB, rather than the 50/75% heuristic. Applies to every APU. + const uint64_t gartCredit = gartSize - std::min(gartSize / 4, 4 * Gi); + if (settings().apuSystem_) { - info_.globalMemSize_ += - (static_cast(heaps[Pal::GpuHeapGartUswc].logicalSize) * uswcPercentAvailable) / - 100; + info_.globalMemSize_ += gartCredit; } // Find the largest heap form FB memory @@ -373,10 +373,10 @@ void NullDevice::fillDeviceInfo(const Pal::DeviceProperties& palProp, #if IS_WINDOWS if (settings().apuSystem_) { - info_.maxMemAllocSize_ = std::max( - (static_cast(heaps[Pal::GpuHeapGartUswc].logicalSize) * uswcPercentAvailable) / - 100, - info_.maxMemAllocSize_); + // One allocation is not confined to a single heap, so the ceiling is the whole pool: + // carve-out plus aperture. Measured on gfx1151 at 100 GiB across a carve-out split + // 64 GiB visible plus 32 GiB invisible. + info_.maxMemAllocSize_ = info_.globalMemSize_; } #endif info_.maxMemAllocSize_ = diff --git a/projects/clr/rocclr/device/pal/palsettings.cpp b/projects/clr/rocclr/device/pal/palsettings.cpp index b5d169aa1225..d28f8a87b61b 100644 --- a/projects/clr/rocclr/device/pal/palsettings.cpp +++ b/projects/clr/rocclr/device/pal/palsettings.cpp @@ -217,7 +217,9 @@ bool Settings::create(const Pal::DeviceProperties& palProp, supportDepthsRGB_ = true; } if (use64BitPtr_) { - maxAllocSize_ = 64ULL * Gi; + // Unified memory APUs address the carve-out and the aperture as one pool, which + // already exceeds 64 GiB on shipping parts. + maxAllocSize_ = 256ULL * Gi; } else { maxAllocSize_ = 3ULL * Gi; }