On an RTX 5070 Ti (NVIDIA 617.42) a 4,090 MiB arena-shaped buffer may use
the DEVICE_LOCAL | HOST_VISIBLE type and a 4,092 MiB one may not, so
LEONIDA_ARENA_MB=4096 (4,095 MiB, the workaround from #1537) placed the
whole arena in system memory: 4 GiB more host commit, and every
default-heap buffer read over PCIe.
With Resizable BAR, create_arena now tries 16 MiB smaller sizes, by at
most an eighth, and keeps the largest whose buffer may still use that type
(device_local_arena_bytes in arena_size.h). The cap is logged like the
other device caps. Without Resizable BAR nothing changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
strtoull("-5") wraps to 2^64-5, so decide_arena_size clamped it to the
4095 MiB maximum. strtoll clamps "-5" and "-99999999999999999999" to the
16 MiB floor, as the header comment documents.
Adds checks for "-5", the huge negative and the huge positive to
arena_size_test. Other inputs keep their results.
create_arena clamped LEONIDA_ARENA_MB to 16..4095 MiB and never read the device's buffer limits. The RX 6800
(AMD 26.11.2) reports 2 GiB for both, so LEONIDA_ARENA_MB=3000 made d3d12_compute_test fail under
LEONIDA_VK_VALIDATION=1: one vkAllocateMemory over maxMemoryAllocationSize per device. The size is now decided by
src/arena_size.h (min of the request, maxBufferSize and, for the buffer's memory requirement, maxMemoryAllocationSize,
rounded down to MiB), read with the device's other Vulkan 1.3 properties into VulkanDeviceInfo (0: query; a test sets
a smaller one), and logged once when a limit cuts the request. arena_size_test checks the decision on the CPU;
d3d12_compute_test checks the arena against the real limits and a simulated 32 MiB maxMemoryAllocationSize. Tested
on an RX 6800, Windows 11, AMD 26.11.2: ctest 133/133, and the 3000 MiB validation run now passes with no errors.
Co-Authored-By: Claude Opus <noreply@anthropic.com>