GPU: an acceleration structure's view address is its location #2098
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2098
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2098"
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?
@moe-miau on GitHub · 2026-11-25 04:52 UTC · original
moe-miau:fix/gpu-as-view-address→main· +49 −3 · 1 files · 1 commits · openWhat
A ray tracing acceleration structure's shader view has no resource. The title creates it with
pResource = NULL, and its description holds the structure's address: D3D12'sLocation, dwords 4 and 5 of the title's view words.HostHeap's view addresses only knew buffer views, throughbuffer_range. For such a slot the entry was 0.The world's ray traced pass,
f607780aa8e502d0(program A of #1968), takes its BVH's address from exactly this view. It loads the descriptor at table offset 0x80 and masks dwords 0-1 into a 40-bit base (s_and_b32 s4, s20, 0xffffff00,s_and_b32 s5, s21, 0xff), whichLower::view_addressesserves from the view addresses. It then walks the BVH withimage_bvh64_intersect_ray, in a loop the title bounds at 65,535 iterations per wave (s_cmpk_lt_u32 s27, 0xffff). With an entry of 0 it walks whatever lies at address 0, not the BVH the title built.In the logs, A's view at
s1+32isbuffer None words [0, 11, 5768, 0, 1595719680, 13, ...]: dimension 11 (D3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTURE), location0xd_5f1c_0000.Change
descriptor/host.rs:view_address(view). An acceleration structure's shader view gives its location; any other view its buffer's first byte, as before, or 0.write_addressuses it.descriptor::host::tests::an_acceleration_structures_view_address_is_its_location: the entry for such a view is its location, a placed buffer view keeps its own address, and no view gives zeros. It fails onmain(left: [.., 0, 0]) and passes with the change.Relation to #1906
#1906 gives a table made afresh in the dynamic slots its view-address entries. Without it, A's table on a capped heap reads past the end of the buffer, which is the hang several testers confirmed it removes. #1906 writes those entries through the same
write_address, so with #1906 alone A's BVH base is 0. This PR is the other half: the entry is the structure's location. The two touch neighbouring lines: merged together, they conflict only inwrite_address's doc comment, where both sentences belong.Tested
Windows 11 26300, RTX 4070 SUPER 12 GB, driver 32.0.16.1742, Ryzen 7 7700X. Title 1.0.2.1, Series X profile, diag build. Scripted Enter presses to the intro cutscene at about 90 s, 6-minute runs. Base:
main940d32f+ #1775 + #1762 + #1906 (astrosteveo's rebase01ba70d). #1968's program C was not reached in these runs (never bound).What this does not show on this card: a difference in the picture. In a third run with this PR, a local log read the two acceleration structures A binds (
0xd_5f1c_0000,0xd_6016_0000, taken from an earlier run's log; the title's addresses have been the same in every run so far) every time A was dispatched: 553 times over 3.5 minutes. They held only zeros, in the host copy A reads and in title memory. The world's BVH is never built here. Five of the BVH builder's programs (XboxBvhBuilder.dll:14394a322f6dd5c2,28918b7150a7aad5,caa78b8ca62bc3d6,e63d22c4def9ba6a,f6eb6498409ca974) are 64-lane programs this card refuses.So on NVIDIA this change gives A the right address, and its effect waits for the builder to run there. On a GPU that runs the builder (64-lane hosts), A should now walk the BVH the title built instead of address 0. I have no such GPU to check that.
cargo test -p victory-gpu --locked: 142 passed, 2 failed, 2 ignored. The two failures (descriptor::host::tests::dynamic_slots_are_held_until_released,memory::tests::lists_share_a_table_and_copies_keep_their_views) fail the same way onmainon this card (the 1,000,000 view heap cap).cargo clippy --workspace --all-targets --locked -- -D warnings, also with--all-features: clean.cargo xtask policy: 182 files ok.AI-assisted (Claude Code). Runs done on my machine.
🤖 Generated with Claude Code
@Marvisak on GitHub · 2026-11-25 10:37 UTC · original · edited 2026-11-26 01:21 UTC
Automated triage for the maintainers.
Merge candidate. The head is rebased (
543d868) and merges cleanly into currentmain. The change is the same as before. Indescriptor/host.rs,write_addressnow takes its address from the newview_address. For an SRV of dimensionD3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTURE, that is the description'sLocation(dwords 4-5, which matches theD3D12_SHADER_RESOURCE_VIEW_DESClayout). Every other view keepsbuffer_rangeas before. Such a view has no resource, somainwrote 0 for it. #1906, now inmain, writes the dynamic-slot entries through the same function, so this is the other half of that fix. The unit test runs without a device and checks the acceleration-structure entry, a placed buffer view and an empty slot. CI (check) passes on this head.Generated by Claude Code
@moe-miau on GitHub · 2026-11-25 16:49 UTC · original
Rebased onto
main67e8ae1(head33a65d1).mainnow writes 16-byte view-address entries with texture size words (texture_words); the only conflict waswrite_address, which keepsmain's new form and takes its address fromview_address. The test now checks 16-byte entries (an acceleration structure's and a placed buffer's address in dwords 0-1, zeros after).cargo test -p victory-gpu: 194 passed, 2 failed (dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views, the same asmainon this RTX 4070 SUPER); both clippy configurations andcargo xtask policyclean.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.