Shaders: a table's address is not checked for a high half #2546
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!2546
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2546/head"
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?
@Halfect on GitHub · 2026-11-25 15:34 UTC · original
Halfect:fix/table-address-high-half→main· +27 −6 · 1 files · 1 commits · closed without mergingWhat
In
traced_address, an address whose base is a table (Table/ResourceHeap/SamplerHeap) had its high half checked anyway: it had to be the constant 0 or a provable carry, otherwise the tracer failed withan address into a descriptor heap with an untracked high half. A table's base is a 32-bit address whose high half is zero, and an offset added to it stays inside the same 4 GiB, so the high half of such an address carries no information — programs whose high half the tracer could not follow were rejected for no reason. The check now runs only for a root descriptor, the one case with its own 64-bit address in two dwords.This is the table half of the correction #2268 measured on the corpus (
an address in an SGPR that is no root parameter, 195 programs on940d32f): the geometry-placement part of that class is #2284, which deliberately left this out. The two changes touch different decisions in the same file and merge cleanly either way.Test
a_tables_address_is_not_checked_for_a_high_half: a load whose base is a one-SGPR table parameter with the address's high half taken from an unrelated system SGPR. It fails onmainwith the untracked-high-half error and resolves to the table with this change.Validation (Windows, CPU-only; no GPU, no game data)
cargo test --locked -p victory-shader --lib: 245 passed, 3 failed — the three failures are the D3D12-device dispatch tests (stride_testspair andgathers_at_a_level_match_the_hardware) that fail identically on unmodified940d32fon this machine (dispatch failed: 内存资源不足); all 34resource::tests pass, including the new one.cargo clippy --locked -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 182 files ok.git diff --check: clean.The corpus measurement behind the correction is #2268's; I cannot re-run the title's programs here, so a fresh corpus A/B on this head would be welcome.
AI-assisted (Kimi). The correction itself is @bittertea0323's from #2268 (co-author on the commit); this PR packages it with a regression test.
@Marvisak on GitHub · 2026-11-25 15:56 UTC · original · edited 2026-11-25 16:49 UTC
Automated triage for the maintainers.
Merge candidate.
Tracer::traced_addressincrates/victory-shader/src/resource.rsno longer checks the high half of an address based on a descriptor table or heap. Root descriptors, whose high half comes from the parameter, are still checked.Changed since the last review (new head
af4abca, rebased onto67e8ae1): CI passes now. The earlier failure inheap_direct_texture_reads_mark_their_heap_indexwas a test-harness issue that main fixed in67e8ae1.On your reply: your argument holds when checked against the code.
RootType::Descriptorhas aparam_word(param, 1).Addresscarries onlyparam,offsetanddynamic, so the high half never affects which table or offset is resolved.There is still no title run or corpus A/B showing which values these high halves hold, so the maintainer should weigh that. The new test pins the case of an unknown system scalar as the high half.
CI:
checkpassing.Generated by Claude Code
@Halfect on GitHub · 2026-11-25 16:10 UTC · original
Thanks — both points addressed in
af4abca(rebased onto current main67e8ae1, no conflicts).The CI failure is unrelated to this change and already fixed on main. The head's CI ran before
67e8ae1("Shader tests: the compute harness zeroes its UAVs"), whose message describes exactly this failure: on the CI's WARP the 512 KiB mark buffer ofheap_direct_texture_reads_mark_their_heap_indexcame back holding the page table an earlier test had uploaded and freed, so the test saw thousands of bits besides the one the shader set ("the slot read"). The failing run was on the pre-fix harness. Checked as asked: on this machine the test fails identically without my change — it aborts withSTATUS_ACCESS_VIOLATIONon unmodified67e8ae1as well as on this head (this machine's D3D12 environment also fails the three known device dispatch tests on an unmodified base). The change itself cannot reach that test's outcome either way: its program's heap-address high half is the constant 0 (s_mov_b32 s5, 0before the load), which the old check already accepted, so tracing resolves it exactly as before.On runtime evidence for the loosened check. The change is reject-only: for any program the old tracer accepted, the resolved address is bit-identical (the check only returned an error; removing it changes nothing else), so no previously working program can change behavior. For a newly accepted address the skipped check is vacuous by construction: a table/heap base is a 32-bit user-data value (high half zero), and the offset is added with 32-bit wraparound, so the address's high half is never dereferenced — it carries no information whether the tracer follows it or not. I have no title data or corpus access here, so I cannot produce the title-run note; a corpus A/B on this head would still be welcome.
Validation on
af4abca(Windows, CPU-only; no GPU, no game data):cargo test --locked -p victory-shader --lib resource::: 34 passed / 0 failed, includinga_tables_address_is_not_checked_for_a_high_half.stride_testspair,gathers_at_a_level_match_the_hardware) that fail identically on unmodified67e8ae1on this machine;heap_direct_texture_reads_mark_their_heap_indexaborts the harness process with an access violation on both trees here, so it was run separately (same result on both).cargo clippy --locked -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 184 files ok.git diff --check: clean.AI-assisted (Kimi).
@Marvisak on GitHub · 2026-11-25 22:10 UTC · original
Automated triage for the maintainers, second look (a review against current
main, with builds and tests where they could change the verdict).Closing because lifting the check changes no program today and weakens a soundness check. No title program is refused with "untracked high half" on
main; the 195GS_VoxelizeGenericprograms of #2268 stop earlier, and geometry stages are not lowered at all. The console reads the full 64-bit address, so a high half that is real data points somewhere other than the table, and the new test pins exactly that case as acceptable. Worth reconsidering together with merged-GS translation (#2284), with the high halves those programs actually hold.If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.
Pull request closed