mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:50:52 +01:00
[PR #954] [MERGED] test: indirect RT scratch size without nested std::max, miscompiled by MSVC 19.52 (TEST-INDIRECT-RT-ARENA) #991
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#991
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/954
Author: @TheGeogeo
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD
Base:
main← Head:fix/indirect-rt-arena📝 Commits (1)
f4fc762test: compute the indirect RT scratch size without nested std::max (TEST-INDIRECT-RT-ARENA)📊 Changes
1 file changed (+4 additions, -2 deletions)
View changed files
📝
runtime/test/d3d12_indirect_rt_test.cpp(+4 -2)📄 Description
Claimed in the coordination issue as: TEST-INDIRECT-RT-ARENA
What and why
d3d12_indirect_rtandd3d12_indirect_rt_upload_sysmemstopped atGPU address arena full ... buffer size in KiB: 105903andFAIL: CreateCommittedResource(compaction/clone buffers)on an RTX 3080.The sizes are not the problem. Printed on that GPU, in bytes (hex, result/scratch): BLAS
a00/200, TLAS800/300, the compaction BLAS from the layera00/200, and fromvkGetAccelerationStructureBuildSizesKHRb00/500. The compaction scratch buffer should be0x600bytes.The cause is the compiler. MSVC 19.52.37029 (toolset 14.52) at
/O2 /Ob1compiles the test'sto this.
_Right$is meant to hold the inner result, but nothing inmainstores it under that name. It shares its stack slot withtv7896, the savedvkDestroyDevicepointer. The code loads that pointer and reads the first eight bytes of the function as the size:That value is not a size, so
arena_allocaterefused it for being larger than the arena. The message prints the size throughint(Width / 1024), so105903may be truncated.The fix takes the maximum of the three values with one
std::maxover a list (and includes<algorithm>for it). The layer and the arena allocator are unchanged. Nothing is skipped.Tested
Windows 11, MSVC 19.52.37029 (
RelWithDebInfo).After the rebase on
main6293c1c4(d6b40a0a, same patch as2bd79535). The head is nowf4fc7623on58be9cdf, with the same patch;runtime/onmaindid not change between the two, so these were not rerun:main, both tests fail witharena full ... buffer size in KiB: 105903. With this commit both pass, 4 runs out of 4.ctest -j 1 --timeout 300: 259 passed, 1 failed, 12 skipped,gameinputdisabled. The failure isd3d12_execute_indirect_validation, also failing in the first run below (#1066 is open for it). The skipped tests are the 12 listed below.First run, on
maina2892784:LEONIDA_ARENA_LOG=1the first allocation after the RT buffers is0x600bytes, as expected.cmovb. Compiled with 14.52 and linked the same way, it fails. Adding only aprintfof the values after the calculation also made the 14.52 build pass, so the failure depends on the surrounding code.gta6rt_d3d12_comsources, built with the same flags, have nocmovfrom a_Left$/_Right$slot that is never stored.<algorithm>: pass.ctest -j 1 --timeout 300: 257 passed, 1 failed, 12 skipped (the log of the baselinef3e26be7: 255 passed, 3 failed, 12 skipped). The only failure isd3d12_execute_indirect_validation, which also fails in the baseline and is known (#306, #749). Every other result is unchanged. Skipped, as in the baseline (the run predates the<algorithm>line):shader_library_corpus,bink_decode,bink_abi,bink_play_headless,fsr_dispatch,bvh_builder,bink_audio,vk_sync_validation,d3d12_sparse_queue_family_contract,d3d12_rgb9e5_rtv,d3d12_boot_movie,d3d12_first_light. Disabled:gameinput.git diff --checkandpython -I scripts/check_no_game_data.py runtime/test/d3d12_indirect_rt_test.cpp: clean.a902c78a) and #710 (296508e1) each merge onto this commit without conflicts. Neither changes this calculation. Those merged trees were not built.No CPU regression: the fault is in the code the compiler makes for this function, and a small standalone copy of the calculation, built with the same options, does not reproduce it.
With GPU-assisted validation on, the RayQueryKHR check misses on
mainand on this branch alike, with fourVUID-vkCmdBuildAccelerationStructuresKHR-pInfos-12281reports; #710 describes the same result and covers the addresses. It is a separate topic and was not rerun here.Not covered: the parts of these tests that need
glslangValidator(the drawing andRayQueryKHRchecks) are not built on this PC, the validation layer was off, GCC and Clang were not used. Whether other MSVC 14.52 builds have the same fault elsewhere was only checked in the files above.GPUs tested: NVIDIA GeForce RTX 3080, driver 621.24, Windows 11
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.