Skip to content

d3d12_title_va_test: a BLAS build in title memory no resource covers (RT-BVH-BUILD-TITLE-VA) - #1816

Open
Snooozs wants to merge 3 commits into
ProjectLeonida:mainfrom
Snooozs:bvh-build-title-va-test
Open

Snooozs wants to merge 3 commits into
ProjectLeonida:mainfrom
Snooozs:bvh-build-title-va-test

Conversation

@Snooozs

@Snooozs Snooozs commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Item: RT-BVH-BUILD-TITLE-VA (#1608). Test only.

I claimed this item to translate the addresses of acceleration-structure builds. #1723 merged that fix first, and it covers more (the BLAS addresses in TLAS instances, copies sized by the build), so my version is dropped. What is left is one case its tests don't have.

d3d12_xdxr_rt_test builds into slot-133 buffers. The new check_bvh_build in d3d12_title_va_test builds a BLAS with the vertices, indices, destination and scratch all in the title's own memory and no resource over any of it, so every address goes through a title window. The test shader reads the header back at the destination and it must have the triangles' bounds. Before anything is submitted, the test checks that every address got a GPU copy, so a missing translation fails without losing the device.

The check is skipped with LEONIDA_GEOMETRY_MB > 0 (d3d12_geometry_views), like the geometry-only checks next to it are skipped without it.

Tested on RTX 5060 Ti, driver 621.01, Windows 10 22H2, main 0d80bc5df:

  • d3d12_title_va and d3d12_title_va_shadow pass, bounds -5 0 1 to 4 8 9. d3d12_com, d3d12_xdxr_rt, xbox_bvh_builder, d3d12_rebound_* and d3d12_api_descriptor_copy* pass.
  • Negative control: with LEONIDA_RT_AS=off the builds are dropped, and the test fails at the address check, before the submission.
  • d3d12_geometry_views fails on this machine, at !root_blob.empty() in main, before any check runs (the Windows 10 host serializer returned no blob for the heap-directly-indexed root signature). This change does not touch that code. I did not run it on main without the change.
  • Not run in the game.

Noticed while placing the check: a stream pool's two alias ranges stay in the table after the pool's memory is freed (remove_title_memory and dropping the pair do not remove them). When the test allocated its block at those addresses, two parts of it shared one copy and the build read zeros. That is why the check runs before check_stream_pool. Whether the retail title ever reuses a pool's addresses I have not checked.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

d3d12_xdxr_rt_test builds into slot-133 buffers. Nothing built with every
address (vertices, indices, destination, scratch) in the title's own
memory with no resource over it, which is reached through title windows.
The header read back at the destination must have the triangles' bounds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@potatoe0100

Copy link
Copy Markdown
Contributor

Tested on Windows 11 (26300), NVIDIA GeForce RTX 4060, driver 621.14, VS 2022 RelWithDebInfo + Ninja, merged onto main 384abe5: d3d12_title_va and d3d12_title_va_shadow pass with the same bounds (-5 0 1 to 4 8 9), and d3d12_geometry_views, d3d12_xdxr_rt, xbox_bvh_builder*, xdxr_build* and vk_xdxr_postbuild_readback pass too. So d3d12_geometry_views passes on Windows 11 here, and the !root_blob.empty() failure you saw looks specific to the Windows 10 serializer. Negative control repeated: with LEONIDA_RT_AS=off, d3d12_title_va fails. Test-only change, and it reads fine to me.

AI-assisted (Claude).

@PierreEbele

Copy link
Copy Markdown
Contributor

Reviewed cf8490c: coverage-only addition. I only read the code for the new check (it needs Windows + MSVC + GPU, so it was not executed): the dispatch mirrors check_title_memory's proven root-view pattern, and the asserted box at destination bytes 16-39 matches MODE_HEADER in runtime/src/xdxr_build.comp, with expected bounds {-5,0,1}/{4,8,9} correct for the six vertices. What did run (Linux): check_no_game_data.py on the file -> clean; the portable title_va_alias test builds and passes on the PR tree; Linux-built sources are unchanged from main. A GPU run of the d3d12_title_va / d3d12_title_va_shadow ctest entries remains the one open check. Nits: the check never bumps the checks counter its siblings do, and the file header could note that LEONIDA_RT_AS=khr/off in a user environment would fail this check. No finding. AI-assisted review.

Recommendation: Merge

@Snooozs

Snooozs commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @potatoe0100 and @PierreEbele.

  • Merged current main (be2f402) into the branch; it was on 0d80bc5, which may be why the linux-gpu-tools and macos jobs of the last run failed (cs_imgatomic_ext there). This change adds a Windows test and can't reach those jobs.
  • The two nits are in: the check counts itself (checks), and the comment on it names LEONIDA_RT_AS=khr and off as what fails it.
  • The open check, the GPU run: RTX 5060 Ti, NVIDIA 621.01, Windows 10 19045, MSVC, on the merged branch: d3d12_title_va, d3d12_title_va_shadow and d3d12_title_window_cap pass. Negative control again: with LEONIDA_RT_AS=off d3d12_title_va_test stops at the address check before the submission.

AI-assisted (Claude Code, Claude Opus 5.5).

Snooozs added a commit to Snooozs/leonida that referenced this pull request Nov 25, 2026
…fail it

Review notes by PierreEbele on ProjectLeonida#1816.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fail it

Review notes by PierreEbele on ProjectLeonida#1816.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Snooozs

Snooozs commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

The red CI jobs here are failures that main has now too, each with an open fix:

Nothing in this PR touches those files. AI-assisted (Claude Code).

@BadgersMC

Copy link
Copy Markdown
Contributor

Independent native Windows GPU check of 97070ee127 merged locally onto upstream fbf100b1b1 (#2350). The merge was clean and the staged diff touched only runtime/test/d3d12_title_va_test.cpp.

  • d3d12_title_va, d3d12_title_va_shadow, and d3d12_title_window_cap all passed. The two BVH readbacks each returned the expected bounds, (-5, 0, 1) to (4, 8, 9).
  • Negative control: LEONIDA_RT_AS=off failed at aliases.shader_va(va + at) != va + at before submitting the BVH command list. This confirms the fixture detects the missing address translation.

RTX 3060 Ti 8 GiB, NVIDIA 610.88, Windows 11 build 26100, MSVC 19.44 RelWithDebInfo. Synthetic inputs only. AI-assisted testing.

@Snooozs
Snooozs force-pushed the bvh-build-title-va-test branch from 97070ee to 1eea816 Compare November 27, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants