Repository navigation
Conversation
|
I checked two live SM 6.6 shaders in addition to the dead-atomic regression. Both start with the atomic feature bits set. The raw heap UAV needs only the heap atomic feature, and the R32G32_UINT texture needs both the typed and heap atomic features. On main 13f91ca, the raw case retains the typed bit and DXIL validator 1.9.2609 reports "Flags must match usage." On 9a9cfac, both shaders validate and WARP reads back [0x23456789, 1] from each UAV. Six paired runs reproduced the difference. The focused shader, bitcode and existing 64-bit image atomic tests passed. The serial shader suite went from 267 passed, 4 failed, 3 ignored to 270 passed, 3 failed, 3 ignored, with the same gather, permute and edge-flagged mesh failures in both arms. Strict shader Clippy in both configurations and asset policy passed. A hand-built phi mixing raw heap and binding handles also hit a separate DXIL resource-handle validation error. The attached test uses valid direct handles. Test-only commit 32083a8 is directly on your head. If you include it, please keep the Git author on cherry-pick or add this trailer when folding it into another commit: Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com |
|
Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP + Verification (
|
The walk no longer follows phis and selects: lowering joins heap indices, not handles, and the validator refuses a join of handles, so an entry on an edge the writer drops cannot set a feature. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Thank you both. andrewpozdnakov7-jpg: your test is on the branch as its own commit, fuzeofficlal: on the phi edges. I looked for where a handle phi could come from and found none. Lowering joins the heap index ( On #2610: agreed, same pattern on adjacent lines. A shared Verification of — Fable |
|
Correct mirroring of DXC's own computation (the AtomicBinOp/AtomicCompareExchange case in DxilShaderFlags): typed iff the annotateHandle kind is 1-10, heap iff the annotated source is createHandleFromHeap. Deriving both from the written instructions fixes the stale-flag case (atomic on a folded-away edge) and the over-declared case (raw heap atomic also declaring typed). The single-source assumption (handles never joined) matches what the validator enforces anyway. |
|
Independent WARP/CPU verification (claim: #1633)
Commands / results (baseline =
Negative control: with the call to Code review: No bugs found. Handle tracing looks through annotateHandle/select/phi with a visited set (terminates on phi cycles); the features now follow only written atomics. Nit (non-blocking): Not tested: physical GPU hardware (RX 7800 XT or any), retail game run, release build, other crates. AI use: Claude Code (Claude Sonnet 5.5) ran the commands and reviewed the diff; the results above are from the actual runs. |
The fourth case of the two features: typed, not from the heap. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
AMD/RADV offline check of the head commit (no game run).
The 751 world shaders contain no 64-bit atomic whose typed/heap flags this PR derives differently, so the offline check cannot exercise it: the branch's own tests are the evidence, and Not tested in a game run; not tested on NVIDIA. |
|
Re-verified
Removing the |
|
Automated triage for the maintainers. Merge candidate (recommend a look). Heads-up: it touches the same lines of CI: Generated by Claude Code |
Dukestar69
left a comment
There was a problem hiding this comment.
Tested merged onto origin/main (63bcca4) on Windows 11 x64:
cargo test -p victory-shader --lib emit::bitcode::tests: 13 passed, 0 failed, 1 ignored (including newuses_tracks_atomic64_typed_and_heap_flags).cargo test -p victory-shader --lib emit::shader::tests: 3 passed, 0 failed (including newheap_atomics_declare_their_resource_kind_and_keep_both_wordsanda_64_bit_atomic_on_an_untaken_path_declares_no_atomic64_features).cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed 5f9481e89a0fd2bb60b424d7eeb6bc520917d949.
LGTM — deriving ATOMIC64_TYPED (0x40_0000) and ATOMIC64_HEAP (0x1000_0000) from the live instructions in Module::uses() and applying/clearing them in Shader::finish() cleanly prevents unused or untaken-path 64-bit atomics and non-typed/non-heap combinations from over-declaring SFI0 feature bits.
Verified locally on Windows (hardware GPU + WARP + SDK DXIL validator):
cargo xtask policy(191 files ok) andcargo clippy -p victory-shader --all-targets/--all-features(-D warnings) pass cleanly.emit::bitcode::tests(13 passed, 1 ignored),emit::shader::tests(3 passed), andemit::valu_tests::image_atomics_of_64_bits(passed under bothVICTORY_WARP=0andVICTORY_WARP=1) all pass.
Non-blocking notes:
rustfmt --edition 2024 --checkflags wrapping/line-width diffs on the added code incrates/victory-shader/src/emit/bitcode.rs(including line 542 exceeding 100 columns and the new test lines) andcrates/victory-shader/src/emit/shader.rs(new test lines).- In
heap_atomics_declare_their_resource_kind_and_keep_both_words, seedingATOMIC64_TYPED | ATOMIC64_HEAPbefores.finish()tests clearing unused bits rather than setting missing ones, andcompute_pipelineunwraps unconditionally if a WARP SM 6.6 runtime lacks the optional 64-bit atomic capability. Inuses_tracks_atomic64_typed_and_heap_flags, theatomicCompareExchange.i64case uses opcode78with ani32placeholder (fine for name-based unit coverage).
Follow-up to
286a00e("Shaders: the DXIL writer leaves out what no edge or reader reaches").Problem
Shader::finishtakesRESOURCE_HEAP,SAMPLER_HEAP,WAVE_OPSandINT64fromModule::uses, that is, from the instructions the writer emits. The two 64-bit atomic features are not on that list.Lower::imageraisesINT64 | ATOMIC64_TYPED | ATOMIC64_HEAPwhen it lowers a wide image atomic, and nothing takes the last two back.So when a program's only 64-bit atomic sits behind a branch on a constant, the writer leaves the atomic out and
finishclearsINT64, but the module flags and SFI0 still declareAtomicInt64OnTypedResourceandAtomicInt64OnHeapResource. DXC computes both from the atomics that are in the module (DxilShaderFlags.cpp, theAtomicBinOp/AtomicCompareExchangecase), so the declared flags no longer match usage.The same holds for a live atomic on a raw buffer from the heap: it needs the heap feature only, and a module that also declares the typed one is refused. andrewpozdnakov7-jpg measured that on
13f91cabelow (validator 1.9.2609: "Flags must match usage").Fix
Module::usesalso reportsatomic64_typedandatomic64_heap, from each writtendx.op.atomicBinOp.i64/dx.op.atomicCompareExchange.i64:annotateHandlekind is 1-10 (textures and typed buffers, DXC'sDXIL::IsTyped);createHandleFromHeapcall.Shader::finishsets or clearsATOMIC64_TYPEDandATOMIC64_HEAPfrom that, beside the four flags it already derives.emit::bitcode::tests::uses_tracks_atomic64_typed_and_heap_flags(untaken path: neither; raw buffer from the heap: heap only; typed texture from a binding: typed only; typed texture from the heap, compare-exchange: both);emit::shader::tests::a_64_bit_atomic_on_an_untaken_path_declares_no_atomic64_features(SFI0 declares none of the three, and the validator accepts the container where there is one);emit::shader::tests::heap_atomics_declare_their_resource_kind_and_keep_both_words, by andrewpozdnakov7-jpg (32083a8, his commit unchanged): a live raw and a live typed heap atomic, each validated, its SFI0 bits checked, and run on WARP with both words read back.Verification
GitHub Actions on
windows-latest(run 45681220813), head5f9481eplus a CI-only change that narrows the jobs to two packages:cargo clippy -p victory-shader -p xtask --all-targets --locked -- -D warnings: passed--all-features: passedcargo test -p victory-shader -p xtask --locked:273 passed; 0 failed; 3 ignored, andxtask6 passed; 0 failedBy others, on the first commit
9a9cfac(see the comments): andrewpozdnakov7-jpg's paired runs of the two live shaders on main and on the PR; fuzeofficlal's run on an RTX 5090 and WARP withdxil.dll.Not checked by me: the rest of the workspace, a real GPU, and game shaders.
Notes
6c140f1, after fuzeofficlal's review). Lowering joins heap indices and makes the handle after the join,Shader::opruns an operation on each of two chosen handles and selects the result, and the validator refuses a join of handles, so an atomic's handle has one annotation and one source. The first commit walked through joins and could have counted an entry on an edge the writer drops.Module::usesand the test module ofemit/bitcode.rs, as Shaders: scope DXIL bitcode liveness to reachable blocks and live phi edges #2657 does, and the same lines ofusesandfinishas Shaders: derive TYPED_UAV_LOADS and ROVs flags from surviving calls #2610 (TYPED_UAV_LOADS,ROVS). None depends on another; later ones may need a rebase.INT64raised at lowering before the operand is read).— Neon & Fable