Repository navigation
Shaders: track every incoming edge of a lane-mask phi - #385
nathanbzrr wants to merge 1 commit into
Conversation
|
Thanks @nathanbzrr for this lane-mask phi fix. I tested head Result: 1 passed, 0 failed (75 filtered out). The synthetic shader test exercises a lane-mask phi join with multiple incoming edges and checks the resulting values. It validates the translator’s modeled case, not execution in a title. |
|
Tested Offline,
Every join refusal is gone. 24 more compute programs translate; 70 programs now stop at In the world, pixel shader AI-assisted (Claude Code, Claude Opus 5.5); no game data. |
|
Tested offline against main
|
|
Measured on the full retail shader pack (26,503 containers) with
|
|
In-game data on where the pixel program named in this PR's description sits in a frame, from a run on Windows 10 with an RTX 3070. The short version: it draws into the HDR scene target the final image is built from, and that target is empty. Setup: What I captured: I saved every render target of one frame in the world with
About merging with #439's stack: the pixel program still fails with that reason on the stack above. #439's stack has its own handling for masks that start as a constant ( @nathanbzrr @r4tedx if a version of this fix lands on top of #439's stack (or #439 takes this case), I can run the same capture and say whether that HDR target fills. I'm testing with Claude's help, and Claude drafted this comment. |
|
@walterwallaceson, the 34 dropped draws give us a specific way to check an integration: first see whether the pipeline for AI-assisted (Codex). |
|
@walterwallaceson @nullmarsh, one detail changes what’s worth testing next. The RX 9060 XT report already follows If either of you has the local shader inspection handy, could you report the opcode at AI-assisted (Codex). |
|
@walterwallaceson @nullmarsh, I traced the failing pixel shader locally. At the join reported at I pushed a capture branch at That gets us to the capture you offered: on the same scene and the rest of your original stack, do the formerly dropped draws now execute, and does the RGBA16F target change? I have checked pipeline creation here. I haven’t measured writes to the title’s HDR target. No game data attached. AI-assisted (Codex). |
catminou4
left a comment
There was a problem hiding this comment.
Test-merge with current main (ffe310e) conflicts — needs a rebase. Main moved recently (PR #566 waterfall loops touched lower.rs/resource.rs/valu_tests.rs), so shader PRs opened before it need rebasing. I'll re-review once it merges cleanly.
|
Follow-up on the capture branch at
All 27 gains are pixel programs. Matching programs by source container hash, none that validated on #439 fails on the branch. Refusals fell by 27 in total. The largest drops were Local title data was used for this comparison; only counts, refusal reasons and hashes are reported here. This doesn't answer the HDR-target question. That still needs the in-game capture. AI-assisted (Claude Code). |
|
@r4tedx The in-game capture, on your base: #439
Your base lacks #346: 983 indirect rectangle-list draws dropped on So your fix makes these draws run, but the dump shows no change from them or from #346. Not checked: their inputs, later writes, or correctness (qntic's #298 report). AI-assisted (Claude Code, Claude Opus 5.5); no game data. |
|
@nullmarsh, thanks. This is the A/B the capture branch was for, and it settles one part. On What that means for the PRs:
If your trace can show, for one of the 252 draws, which views are bound and whether those resources hold nonzero data at that point, that would separate the two cases. Also, are 324 and 252 the same four frames counted the same way? Or does the scene issue fewer of these draws on No new tests for this reply. My earlier check of AI-assisted (Claude Code). |
|
@r4tedx Your two questions, from dump runs on
Not known: which views b375 samples; texture-UAV writes (the trace names buffer UAVs only). Next: the same run with #305. AI-assisted (Claude Code, Claude Opus 5.5); no game data. |
|
@r4tedx Follow-up with #305 (
An end-of-frame dump can't tell "never wrote" from "cleared later", and their 64-bit image writes aren't visible to my trace. This base has no #587. AI-assisted (Claude Code, Claude Opus 5.5); no game data. |
|
@nullmarsh, thanks. That's the run I was about to prepare a branch for, so I've dropped mine. Two things follow from it:
I haven't run either of them on this base. The title was not used for this reply. AI-assisted (Claude Code). |
c1bfb02 to
7420237
Compare
|
Rebased onto 1. Whole-mask & cross-lane reads after a per-lane join (
|
7420237 to
a3defec
Compare
|
Updated
Verification (
|
|
Code review and RTX 5090 + WARP + DXIL verification at head
Solid fix and welcome |
|
From a tester working with Claude (AI-assisted, Claude Code): an offline check of this PR over a whole title's shader pack (25,889 distinct containers through
Not run: your GPU tests, and the title in a game run. Translation only. |
|
@nathanbzrr I found a case outside the phi-edge tests where the same console-wave scan matters. A Wave32 compute shader uses I put a standalone patch directly on your head. It checks both sources in reachable compute blocks. Inline zero and all-ones still work at any host wave size. The new select regression covered nine 32-lane readbacks, including a scalar input with only bit 31 set and git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr385-direct-select-mask
git cherry-pick 1c73d188cb19e1ff8d0598124972ba897ed94e80
cargo test --locked -p victory-shader --lib direct_select_uses_this_lanes_mask_bit -- --nocaptureFor the merge overlap with #2967, there is also a combined branch that preserves both PR histories and #171's signed carry fix. Your per-edge For wider coverage I also ran the combined production change with the carry regression. The library suite stopped at the heap-texture test tracked in #2571. Excluding that one test gave 321 passed, 3 ignored and the same two stride failures and gather failure seen on this host. The final targeted run included both new regressions and the saved-EXEC refusal control. AI-assisted. All tests used synthetic shader inputs. |
Rebased onto main, reconciled with uniform/per-lane mask-data joins, and turned `fill_phis` into a fixpoint loop (`fill_mask_phis` + `fill_data_phis`) so a loop mask phi materialized later by a uniform data join is always populated instead of emitting an empty `phi i1` (thanks to @tyr0nsur for identifying this bug). Also align `mask_uses_console_lanes` with `lower.rs` by filtering unreachable predecessors via `st.reach` and checking `st.other` on `v_cndmask_b32` selectors.
a3defec to
9099742
Compare
|
@nathanbzrr I rebased the direct-select mask fix onto your current head, On
On your PR branch at git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr385-rebased-direct-select
git merge --ff-only FETCH_HEAD
cargo test --locked -p victory-shader --lib direct_select_uses_this_lanes_mask_bit -- --nocaptureAI-assisted with Codex. |
fuzeofficlal
left a comment
There was a problem hiding this comment.
Splitting emit/lower/phi.rs brings emit/lower.rs down to 515,626 bytes (under the 524,288-byte policy limit) and the added structure/lowering/execution tests pass on RTX 5090 and WARP, but there are two correctness issues and a formatting check failure to resolve before merging:
- Non-uniform EXEC split misclassified as uniform (
emit/lower.rs:8238-8247,emit/lower/phi.rs:121-154):uniform_joinandforward_uniformonly inspect immediate predecessors' exits, treating anyLaneExit::Jumppredecessor as uniform. Consider a Wave32 shader that initializess2to0, narrowsEXECto lanes0..16(saving the originalEXECins7), and branches ons_cbranch_execzso the nonempty arm copiess7intos2and jumps to the join while the skip arm also reaches the join via an unconditionals_branch, whereEXECis restored andv_cndmask_b32selects ons2. On GFX10, the nonempty arm writes the wave-wide SGPRs2, so all 32 lanes should select true; because both immediate predecessors end inJump,uniform_joinreturnstrueandfill_mask_phisfeeds per-lanephi_edgebooleans (trueto lanes0..15,falseto lanes16..31). Please keep rejecting joins unless uniformity across earlier EXEC splits is proven, and add a readback test covering twoJumppredecessors. avoidsvs.no_mask_lane_on_edgemodel mismatch (emit/lower.rs:8177-8190,emit/lower/phi.rs:155-158):avoidsreadsst.phi_masks[&ph.value][n](falling back tost.masks.get(&ph.args[n])), whereasfill_mask_phissynthesizesfalseviano_mask_lane_on_edgewhenst.masks.get(&arg)isNoneand!uniform. Ifphi_masksstores a non-FALSEboolean derived from an unmasked data operand along that edge, the boolean model queried byavoidsdiverges from thefalseconstant emitted into the phi.- Formatting:
rustfmt --edition 2024 --checkfails on newly added code incrates/victory-shader/src/emit/lower/phi.rs(lines 34, 412) and the new tests incrates/victory-shader/src/emit/valu_tests.rs(lines 2557–2599).
Verified locally on Windows 11 x64 (RTX 5090 + WARP, 90997428):
cargo run --locked -p xtask -- policy(192 files ok) andcargo clippy --workspace --all-targets -- -D warnings(default and--all-features): clean.structure::tests: 16 passed (1 ignored);emit::lower::tests: 33 passed;emit::lower::phi::tests: 11 passed; RTX 5090 &VICTORY_WARP=1valu_tests::lane_mask_phi_*: 6 passed, 0 failed.
|
@nathanbzrr @fuzeofficlal I reproduced both findings on
The RTX 5080, Windows inbox WARP, and WARP 1.0.22 each returned the same 72/192 incorrect words. For 16 active lanes, lanes 16–31 read The second regression is a synthetic pixel shader. One arm overwrites the interpolation j coordinate. On that incoming edge, the original interpolation proof reads The structure, lowering, phi and emitter test groups passed, including the existing valid interpolation and execution controls. I also ran shader Clippy with all features and the asset-policy check. This commit is based directly on the PR head and is independent of my earlier direct-select fix. Patch and both regressions git fetch https://github.com/steven-seagull27/VIctory.git codex/pr385-divergent-mask-joins
git cherry-pick 21e8b7098ae9b5b14c9698b4bc59a74ba5556c32AI-assisted with Codex. Synthetic inputs on native Windows. |
Dukestar69
left a comment
There was a problem hiding this comment.
LGTM — verified on Windows (RTX 5090 + WARP):
cargo test -p victory-shader --lib lane_mask_phi_passed (6/6: 4emit::lower::phi::tests::+ both Wave32 GPU testslane_mask_phi_joins_execute_correctlyandlane_mask_phi_whole_read_and_readlane_execute_correctlyexecuted on RTX 5090 hardware; WARP skipped Wave32 cleanly)cargo test -p victory-shader --lib structure::(16/16) andemit::lower::tests::(33/33) passedcargo clippy -p victory-shader --all-targets -- -D warningspassed with 0 warningscargo xtask policypassed (192 files ok)
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Addresses the
a lane-mask join of an untracked masktranslation failure category listed in #293 (3 shaders / ~66 dropped draws and dispatches per frame, including compute2561af9577c47289and pixelb37565055f2f7d3b).Problem
When a lane-mask
Phimerges a tracked mask with a constant or scalar-built mask (for example an exit-mask or accumulator phi initialized to0before a branch/loop, or reset to a constant on a back edge),structurepreviously failed witha lane-mask join of an untracked maskinstead of tracking every incoming edge of the phi.What changed
crates/victory-shader/src/structure.rs:Structured::phi_masksviaPhiJoinandLanes::{derived_phis, phi_joins, phi_join_ids}.joinsandphi_joinsinLanes::check_joins, propagating derived status until fixpoint before buildingphi_masksinfinish().crates/victory-shader/src/emit/lower.rs:pending_masksbeforedata_phisinLower::fill_phisusingStructured::phi_masks.console_lanesthroughphi_masks(includingv_cndmask_b32andv_*_co_ci_u32selects) when an incoming edge needs lane-bit extraction of a constant/scalar mask.flags::WAVE_OPSinLower::lane_bit.Relation to other PRs
structureandemit::loweracross shader stages and both Wave32 and Wave64.Tests (synthetic GFX10 only, no game files)
crates/victory-shader/src/structure.rs:mask_phi_joining_constant_and_compare_records_edge_boolsloop_mask_accumulator_from_zero_tracks_phi_and_edgesloop_mask_phi_reset_to_constant_on_back_edgecrates/victory-shader/src/emit/lower.rs:lane_mask_phi_joining_zero_and_compare_lowerswave64_loop_mask_accumulator_from_zero_lowerslane_mask_phi_with_partial_constant_enables_console_lanescrates/victory-shader/src/emit/valu_tests.rs:lane_mask_phi_joins_execute_correctly(viabuild_wave32_cs/dispatch_wave32), testing branch join with zero, partial constant mask enablingconsole_lanes, and loop mask accumulation - validated withdxil.dlland executed on both hardware GPU and WARP.a345127:rustfmt --edition 2024 --checkcleancargo clippy -p victory-shader --all-targetsclean (0 warnings)cargo test --workspace(271 passed, 0 failed, 4 ignored)151 files ok)Not verified
No game files. AI-assisted; reviewed and verified with the tests above.