Shaders: trace multi-term, scaled, masked, and phi-joined addresses in resource tracking #645

Closed
nathanbzrr wants to merge 1 commit from upstream-pr/645 into main
nathanbzrr commented 2026-11-24 06:06:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by nathanbzrr on 2026-11-24T06:06:16Z.


Summary

Fixes five resource-address tracking failures in crates/victory-shader/src/resource.rs and adds SSA-dominance-safe relative offset lowering in crates/victory-shader/src/emit/lower.rs blocking compute, raytracing/BVH, and multi-term buffer shaders:

  1. Defect A: RootType::Constants dword 0 was treated as a pointer base whenever param_of saw dword 0, colliding with real base pointers ("an address not from a root parameter", "an offset from a root parameter", or "an address from a root parameter that is no address").
  2. Defect B: Adding more than one dynamic term ((base + row) + col, or base + dyn plus soffset/vaddr) discarded base.
  3. Defect C: Standard GFX10 address instructions (s_addk_i32, s_lshl{1..4}_add_u32, v_lshl_add_u32, v_add3_u32, v_add_nc_i32, subtractions on the minuend, aligned constant s_or_b32/v_or_b32, and address-local v_mov_b32 -> v_readfirstlane_b32/v_readlane_b32) were untraced.
  4. Defect D: High-half validation rejected v_add_co_ci_u32(want, 0, _), skipped table dynamic carries (high == None), and did not strip VA-preserving and masks (mask & 0xFF == 0xFF).
  5. Defect E: Control-flow joined (if/else) and loop-carried induction pointer Phis failed immediately with "an address from a phi".

Changes (crates/victory-shader/src/resource.rs, emit/lower.rs, emit/valu_tests.rs)

  • Add RelOffset { value, base, extra_dynamic } to Address (keeping Address: Copy and keeping dynamic populated for downstream readers such as translate.rs).
  • Restrict root-parameter pointer bases in sum_value to Table, ResourceHeap, SamplerHeap, and Descriptor.
  • Add memoized DAG sum tracing with cycle-safe Phi base validation (requiring at least one non-cyclic edge and a matching base across all non-cyclic edges), multi-term retention (multi: bool), and all listed GFX10 address ops without double-counting s.offset or extra_dynamic.
  • Update high_half, carried(Term, Term), and Source::Built mask stripping (set_bits) to accept v_add_co_ci_u32, Term::Const(0) table carries, VA masks, and high-half phis.
  • Implement address_offset and rel_offset in emit/lower.rs with per-call local caching for non-phi expressions and global addr_phis caching resolved in fill_phis to preserve DXIL SSA dominance across blocks, wired into flat(), code_smem(), and built_offset().
  • Add 5 unit tests in resource.rs and 3 end-to-end DXIL + D3D12 GPU/WARP compute dispatch tests (root_srv_*) in emit/valu_tests.rs.

Verification

Isolated verification on branch shader/resource-address-tracing (499bd98):

  • rustfmt --edition 2024 --config skip_children=true --check crates/victory-shader/src/resource.rs crates/victory-shader/src/emit/lower.rs crates/victory-shader/src/emit/valu_tests.rs (passed)
  • cargo test -p victory-shader -- --test-threads=1 (77 passed, 0 failed, 0 ignored)
  • VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-shader root_srv_ -- --test-threads=1 (3 passed, 0 failed, 0 ignored, 74 filtered out)
  • cargo clippy -p victory-shader --all-targets (0 warnings)
  • cargo xtask policy (151 files ok)

No game files. AI-assisted; reviewed and verified with the tests above.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6575761889 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/645). Originally posted by [nathanbzrr](https://github.com/nathanbzrr) on 2026-11-24T06:06:16Z. --- ## Summary Fixes five resource-address tracking failures in `crates/victory-shader/src/resource.rs` and adds SSA-dominance-safe relative offset lowering in `crates/victory-shader/src/emit/lower.rs` blocking compute, raytracing/BVH, and multi-term buffer shaders: 1. **Defect A:** `RootType::Constants` dword 0 was treated as a pointer base whenever `param_of` saw dword `0`, colliding with real base pointers (`"an address not from a root parameter"`, `"an offset from a root parameter"`, or `"an address from a root parameter that is no address"`). 2. **Defect B:** Adding more than one dynamic term (`(base + row) + col`, or `base + dyn` plus `soffset`/`vaddr`) discarded `base`. 3. **Defect C:** Standard GFX10 address instructions (`s_addk_i32`, `s_lshl{1..4}_add_u32`, `v_lshl_add_u32`, `v_add3_u32`, `v_add_nc_i32`, subtractions on the minuend, aligned constant `s_or_b32`/`v_or_b32`, and address-local `v_mov_b32` -> `v_readfirstlane_b32`/`v_readlane_b32`) were untraced. 4. **Defect D:** High-half validation rejected `v_add_co_ci_u32(want, 0, _)`, skipped table dynamic carries (`high == None`), and did not strip VA-preserving `and` masks (`mask & 0xFF == 0xFF`). 5. **Defect E:** Control-flow joined (`if/else`) and loop-carried induction pointer `Phi`s failed immediately with `"an address from a phi"`. ### Changes (`crates/victory-shader/src/resource.rs`, `emit/lower.rs`, `emit/valu_tests.rs`) - Add `RelOffset { value, base, extra_dynamic }` to `Address` (keeping `Address: Copy` and keeping `dynamic` populated for downstream readers such as `translate.rs`). - Restrict root-parameter pointer bases in `sum_value` to `Table`, `ResourceHeap`, `SamplerHeap`, and `Descriptor`. - Add memoized DAG sum tracing with cycle-safe `Phi` base validation (requiring at least one non-cyclic edge and a matching `base` across all non-cyclic edges), multi-term retention (`multi: bool`), and all listed GFX10 address ops without double-counting `s.offset` or `extra_dynamic`. - Update `high_half`, `carried(Term, Term)`, and `Source::Built` mask stripping (`set_bits`) to accept `v_add_co_ci_u32`, `Term::Const(0)` table carries, VA masks, and high-half phis. - Implement `address_offset` and `rel_offset` in `emit/lower.rs` with per-call local caching for non-phi expressions and global `addr_phis` caching resolved in `fill_phis` to preserve DXIL SSA dominance across blocks, wired into `flat()`, `code_smem()`, and `built_offset()`. - Add 5 unit tests in `resource.rs` and 3 end-to-end DXIL + D3D12 GPU/WARP compute dispatch tests (`root_srv_*`) in `emit/valu_tests.rs`. ## Verification Isolated verification on branch `shader/resource-address-tracing` (`499bd98`): - `rustfmt --edition 2024 --config skip_children=true --check crates/victory-shader/src/resource.rs crates/victory-shader/src/emit/lower.rs crates/victory-shader/src/emit/valu_tests.rs` (passed) - `cargo test -p victory-shader -- --test-threads=1` (77 passed, 0 failed, 0 ignored) - `VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-shader root_srv_ -- --test-threads=1` (3 passed, 0 failed, 0 ignored, 74 filtered out) - `cargo clippy -p victory-shader --all-targets` (0 warnings) - `cargo xtask policy` (151 files ok) No game files. AI-assisted; reviewed and verified with the tests above.
LAKSHYA-cmd-tech commented 2026-11-24 06:54:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T06:15:37Z.

Review: APPROVED


Tested on Windows 11 with Rust 1.98.1 (x86_64-pc-windows-msvc).

  • cargo test -p victory-shader: all 77 tests passed cleanly (0 failed).
  • All 5 resource address tracking tests ( wo_term_dynamic_addresses_produce_rel_offset,
    oot_constants_dword0_is_offset_not_base, scaled_subtracted_add3_addk_and_aligned_or_addresses, high_half_carry_va_mask_and_table_carry, and phi_joined_and_loop_carried_addresses) passed.
  • All 3 end-to-end DXIL compute dispatch tests (
    oot_srv_s_lshl2_add_u32_with_root_constant_dword0,
    oot_srv_two_term_v_add_co_and_v_lshl_add,
    oot_srv_loop_carried_pointer_induction_phi) passed.
  • cargo xtask policy: 151 files ok.
  • Verified DAG sum tracing with cycle-safe Phi base validation, SSA-dominance-safe relative offset lowering in emit/lower.rs, and GFX10 address op lowering. Resolves key blockers for raytracing/BVH compute shaders in #614.
<!-- greyfinch-sync:Marvisak/VIctory:review:6034554968 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/645#pullrequestreview-6034554968). Originally posted by [LAKSHYA-cmd-tech](https://github.com/LAKSHYA-cmd-tech) on 2026-11-24T06:15:37Z. **Review:** APPROVED --- Tested on Windows 11 with Rust 1.98.1 (x86_64-pc-windows-msvc). - cargo test -p victory-shader: all 77 tests passed cleanly (0 failed). - All 5 resource address tracking tests ( wo_term_dynamic_addresses_produce_rel_offset, oot_constants_dword0_is_offset_not_base, scaled_subtracted_add3_addk_and_aligned_or_addresses, high_half_carry_va_mask_and_table_carry, and phi_joined_and_loop_carried_addresses) passed. - All 3 end-to-end DXIL compute dispatch tests ( oot_srv_s_lshl2_add_u32_with_root_constant_dword0, oot_srv_two_term_v_add_co_and_v_lshl_add, oot_srv_loop_carried_pointer_induction_phi) passed. - cargo xtask policy: 151 files ok. - Verified DAG sum tracing with cycle-safe Phi base validation, SSA-dominance-safe relative offset lowering in emit/lower.rs, and GFX10 address op lowering. Resolves key blockers for raytracing/BVH compute shaders in #614.
xiao47576-glitch commented 2026-11-24 08:02:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by xiao47576-glitch on 2026-11-24T07:49:56Z.


I tested PR #645 (499bd98) against main (d2a4bae) on Windows Server 2025 using D3D12 WARP. Main rejected a root SRV plus a byte offset from the first root-constant dword. On this PR, both operand orders read the expected values at offsets 0, 4, 48, and 112 bytes, plus a fixed 12-byte load offset.

I found one carry case the tracker still accepts:

s_add_u32    s0, s4, s10
s_cmp_eq_u32 s10, 0
s_addc_u32   s1, s5, 0

Here s[4:5] holds the root SRV address and s10 is the byte offset. When the offset is zero, the comparison sets SCC to 1 even though the low add produced no carry. The tracker also accepts a high add with immediate 1 and a signed low add.

Download the tested source patch

With the patch applied, the tracker rejected all three cases. All 12 valid WARP reads returned the expected values, and all 78 shader tests passed. Only the valid reads were dispatched on WARP. The effect on the opening cutscene in #255 is still untested. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7125420146 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/645#issuecomment-7125420146). Originally posted by [xiao47576-glitch](https://github.com/xiao47576-glitch) on 2026-11-24T07:49:56Z. --- I tested PR #645 (`499bd98`) against `main` (`d2a4bae`) on Windows Server 2025 using D3D12 WARP. Main rejected a root SRV plus a byte offset from the first root-constant dword. On this PR, both operand orders read the expected values at offsets 0, 4, 48, and 112 bytes, plus a fixed 12-byte load offset. I found one carry case the tracker still accepts: ```asm s_add_u32 s0, s4, s10 s_cmp_eq_u32 s10, 0 s_addc_u32 s1, s5, 0 ``` Here `s[4:5]` holds the root SRV address and `s10` is the byte offset. When the offset is zero, the comparison sets SCC to 1 even though the low add produced no carry. The tracker also accepts a high add with immediate 1 and a signed low add. [Download the tested source patch](https://github.com/user-attachments/files/35320599/VIctory-645-scalar-carry.patch.txt) With the patch applied, the tracker rejected all three cases. All 12 valid WARP reads returned the expected values, and all 78 shader tests passed. Only the valid reads were dispatched on WARP. The effect on the opening cutscene in #255 is still untested. AI-assisted.
TrashTalker3460 commented 2026-11-24 09:06:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by TrashTalker3460 on 2026-11-24T08:13:51Z.


Offline translation and validation of 499bd98 against main at d2a4bae: +32 programs validate, 0 regressions.

Setup:

  • The title's shaders.rpf plus its executable and 16 DLLs: 26,148 programs.
  • victory translate --validate --list, validated with DXC 1.9 (1.9.2609.5).
  • Built on Linux. The base is main plus #235 for the Linux build, and a local hook that runs dxv off Windows; neither touches translation.
  • Offline only: no pipelines, no title run.
Stage main: emitted / validated #645: emitted / validated change
compute (of 2,581) 1,693 / 1,670 1,721 / 1,698 +28 / +28
mesh (of 8,506) 8,191 / 8,129 8,191 / 8,129 +0 / +0
vertex and pixel (of 14,013) 12,284 / 12,184 12,288 / 12,188 +4 / +4

What changed:

  • Regressions (validated on main, not with this PR): 0.
  • Outcome changes: 32 programs go from refused to validated, and no other program changes outcome.
    • 24 were refused with resources: an address from a phi (Defect E).
    • 8 were refused with resources: an address not from a root parameter.
  • Reason changes on programs still refused:
    • One program moves from an address not from a root parameter to emit: a descriptor read only as data. It was refused on main too, so this isn't a regression.
    • 4 compute programs are still refused with an address from a phi. All 4 are in the same shader group and fail at nearly the same offset (0x508/0x510), so they are likely one pattern the phi tracing doesn't yet accept.

Caveat: these numbers are from main at d2a4bae.

  • main has moved since (now dd273df).
  • This PR no longer merges cleanly: crates/victory-shader/src/emit/valu_tests.rs conflicts with #140 (v_cmp_class_f16), which first appears at merge 80c0d12.
  • I didn't resolve the conflict myself, so I haven't measured this PR on current main. I can rerun after a rebase.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7125881448 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/645#issuecomment-7125881448). Originally posted by [TrashTalker3460](https://github.com/TrashTalker3460) on 2026-11-24T08:13:51Z. --- **Offline translation and validation of `499bd98` against `main` at `d2a4bae`: +32 programs validate, 0 regressions.** **Setup:** - The title's `shaders.rpf` plus its executable and 16 DLLs: 26,148 programs. - `victory translate --validate --list`, validated with DXC 1.9 (`1.9.2609.5`). - Built on Linux. The base is `main` plus #235 for the Linux build, and a local hook that runs `dxv` off Windows; neither touches translation. - Offline only: no pipelines, no title run. | Stage | main: emitted / validated | #645: emitted / validated | change | |---|---:|---:|---:| | compute (of 2,581) | 1,693 / 1,670 | 1,721 / 1,698 | +28 / +28 | | mesh (of 8,506) | 8,191 / 8,129 | 8,191 / 8,129 | +0 / +0 | | vertex and pixel (of 14,013) | 12,284 / 12,184 | 12,288 / 12,188 | +4 / +4 | **What changed:** - **Regressions** (validated on `main`, not with this PR): **0**. - **Outcome changes:** 32 programs go from refused to validated, and no other program changes outcome. - 24 were refused with `resources: an address from a phi` (Defect E). - 8 were refused with `resources: an address not from a root parameter`. - **Reason changes on programs still refused:** - One program moves from `an address not from a root parameter` to `emit: a descriptor read only as data`. It was refused on `main` too, so this isn't a regression. - 4 compute programs are still refused with `an address from a phi`. All 4 are in the same shader group and fail at nearly the same offset (`0x508`/`0x510`), so they are likely one pattern the phi tracing doesn't yet accept. **Caveat: these numbers are from `main` at `d2a4bae`.** - `main` has moved since (now `dd273df`). - This PR no longer merges cleanly: `crates/victory-shader/src/emit/valu_tests.rs` conflicts with #140 (`v_cmp_class_f16`), which first appears at merge `80c0d12`. - I didn't resolve the conflict myself, so I haven't measured this PR on current `main`. I can rerun after a rebase.
slint6614-dev commented 2026-11-24 10:03:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by slint6614-dev on 2026-11-24T09:24:29Z.


Measured on the full retail shader pack (26,503 containers) with victory translate --validate --pipelines (pipelines created on an AMD RX 9070, Windows 11, dxil.dll from SDK 10.0.26100). Counts are emitted / validated / pipelines. This PR conflicts with current main (lower.rs), so it was measured on its own base, against main 1f858b0 before #612 (VS/PS 12272 / 12172, CS 1693 / 1670, MS 8191 / 8129).

CS 1721 / 1698 (+28 validated): "resources: an address from a phi" 28 → 4 and "an address not from a root parameter" 73 → 64. VS/PS +4 validated, MS unchanged.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7127371931 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/645#issuecomment-7127371931). Originally posted by [slint6614-dev](https://github.com/slint6614-dev) on 2026-11-24T09:24:29Z. --- Measured on the full retail shader pack (26,503 containers) with `victory translate --validate --pipelines` (pipelines created on an AMD RX 9070, Windows 11, dxil.dll from SDK 10.0.26100). Counts are emitted / validated / pipelines. This PR conflicts with current main (`lower.rs`), so it was measured on its own base, against main 1f858b0 before #612 (VS/PS 12272 / 12172, CS 1693 / 1670, MS 8191 / 8129). CS 1721 / **1698** (+28 validated): "resources: an address from a phi" 28 → 4 and "an address not from a root parameter" 73 → 64. VS/PS +4 validated, MS unchanged.
catminou4 commented 2026-11-24 11:03:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T10:19:52Z.

Review: COMMENTED


Conflicts with current main (ffe310e) — resource.rs (+1326/-96) and lower.rs (+593) are both hot after the recent shader merges; needs a rebase before anything else.

I can't responsibly approve a 2329-line tracer rework on a conflicted base without running it, and the merged tree is exactly where the five "Defect A-E" fixes interact with #566's waterfall changes. The structure (SSA-dominance-safe relative offsets, multi-term/scaled/masked/phi-joined address tracing) sounds like the right direction for the resource-tracking failures, and the +295 lines in valu_tests.rs suggest host coverage on Windows.

After a rebase I'll run cargo test -p victory-shader --locked on macOS and do a full pass on the tracer invariants (the sums cache from #139 and the dominance reasoning are the parts most likely to interact badly with other in-flight PRs).

<!-- greyfinch-sync:Marvisak/VIctory:review:6037425892 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/645#pullrequestreview-6037425892). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T10:19:52Z. **Review:** COMMENTED --- Conflicts with current main (`ffe310e`) — `resource.rs` (+1326/-96) and `lower.rs` (+593) are both hot after the recent shader merges; needs a rebase before anything else. I can't responsibly approve a 2329-line tracer rework on a conflicted base without running it, and the merged tree is exactly where the five "Defect A-E" fixes interact with #566's waterfall changes. The structure (SSA-dominance-safe relative offsets, multi-term/scaled/masked/phi-joined address tracing) sounds like the right direction for the resource-tracking failures, and the +295 lines in `valu_tests.rs` suggest host coverage on Windows. After a rebase I'll run `cargo test -p victory-shader --locked` on macOS and do a full pass on the tracer invariants (the `sums` cache from #139 and the dominance reasoning are the parts most likely to interact badly with other in-flight PRs).
pablogonz12 commented 2026-11-24 17:04:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pablogonz12 on 2026-11-24T16:20:43Z.


Measured on Linux (RX 9070 XT, RADV/Mesa 26.3.1, GE-Proton11-14, vkd3d-proton master), head 499bd98 merged onto a tree that already carries other merged fixes (its offline base is 692 of 751 of the world shader set, not main's number):

  • offline victory translate of the 751-program world set: 692 -> 700; all 700 pass dxil-spirv and spirv-val --target-env vulkan1.3 and build a RADV pipeline.
  • failure classes: "an address from a phi" 6 -> 0, "not from a root parameter" 3 -> 1; the other classes are untouched.
  • cargo test -p victory-shader --lib: 122 pass, 1 known pre-existing failure, 1 ignored; no new failures.
  • cargo xwin clippy --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings: clean.
    Not tested: in-game on this branch; native Windows.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7137514782 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/645#issuecomment-7137514782). Originally posted by [pablogonz12](https://github.com/pablogonz12) on 2026-11-24T16:20:43Z. --- Measured on Linux (RX 9070 XT, RADV/Mesa 26.3.1, GE-Proton11-14, vkd3d-proton master), head 499bd98 merged onto a tree that already carries other merged fixes (its offline base is 692 of 751 of the world shader set, not main's number): - offline `victory translate` of the 751-program world set: 692 -> 700; all 700 pass dxil-spirv and `spirv-val --target-env vulkan1.3` and build a RADV pipeline. - failure classes: "an address from a phi" 6 -> 0, "not from a root parameter" 3 -> 1; the other classes are untouched. - `cargo test -p victory-shader --lib`: 122 pass, 1 known pre-existing failure, 1 ignored; no new failures. - `cargo xwin clippy --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings`: clean. Not tested: in-game on this branch; native Windows.
nathanbzrr commented 2026-11-24 22:02:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by nathanbzrr on 2026-11-24T21:55:25Z.


Rebased onto origin/main (ffe310e) at 6817902 and addressed the scalar-carry review finding.

@catminou4 @xiao47576-glitch

Rebase integration (ffe310e)

  • Integrated #566 waterfall tracking/lowering in crates/victory-shader/src/resource.rs and crates/victory-shader/src/emit/lower.rs, preserving the 4-argument resource::track(..., st) signature (#801).
  • Merged #612's read_phis worklist in emit/lower.rs (fill_phis) alongside pending_addr_phis.
  • Kept #140 (v_cmp_class_f16_matches_rdna2) and wrapped run_root_srv_cases with ONE_AT_A_TIME.lock() (#433) in crates/victory-shader/src/emit/valu_tests.rs.

Soundness fix (s_addc_u32 / s_subb_u32 carry)

  • Updated high-half carry matching in crates/victory-shader/src/resource.rs so s_addc_u32 and s_subb_u32 require:
    1. a zero constant addend (Term::Const(c) if c == 0, rejecting non-zero immediates), and
    2. an scc value traceable to a matching s_add_u32 on the corresponding low-half value (including loop-carried phi induction chains), rejecting clobbered scc producers (s_cmp_eq_u32, s_add_i32, or unrelated s_add_u32).
  • Added negative test coverage in resource::tests::scalar_carry_requires_matching_add_u32_scc_and_zero_const.

Verification (6817902)

  • rustfmt --edition 2024 --check crates/victory-shader/src/emit/valu_tests.rs: clean (resource.rs and emit/lower.rs only retain pre-existing upstream formatting diffs on origin/main).
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean.
  • cargo test --workspace --locked: 351 passed; 0 failed; 6 ignored (victory-shader: 129 passed; 0 failed; 1 ignored; xtask: 4 passed).
  • VICTORY_WARP=1 cargo test -p victory-shader --locked -- root_srv: 3 passed; 0 failed.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7145567276 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/645#issuecomment-7145567276). Originally posted by [nathanbzrr](https://github.com/nathanbzrr) on 2026-11-24T21:55:25Z. --- Rebased onto `origin/main` (`ffe310e`) at `6817902` and addressed the scalar-carry review finding. @catminou4 @xiao47576-glitch ### Rebase integration (`ffe310e`) - Integrated `#566` waterfall tracking/lowering in `crates/victory-shader/src/resource.rs` and `crates/victory-shader/src/emit/lower.rs`, preserving the 4-argument `resource::track(..., st)` signature (`#801`). - Merged `#612`'s `read_phis` worklist in `emit/lower.rs` (`fill_phis`) alongside `pending_addr_phis`. - Kept `#140` (`v_cmp_class_f16_matches_rdna2`) and wrapped `run_root_srv_cases` with `ONE_AT_A_TIME.lock()` (`#433`) in `crates/victory-shader/src/emit/valu_tests.rs`. ### Soundness fix (`s_addc_u32` / `s_subb_u32` carry) - Updated high-half carry matching in `crates/victory-shader/src/resource.rs` so `s_addc_u32` and `s_subb_u32` require: 1. a zero constant addend (`Term::Const(c) if c == 0`, rejecting non-zero immediates), and 2. an `scc` value traceable to a matching `s_add_u32` on the corresponding low-half value (including loop-carried `phi` induction chains), rejecting clobbered `scc` producers (`s_cmp_eq_u32`, `s_add_i32`, or unrelated `s_add_u32`). - Added negative test coverage in `resource::tests::scalar_carry_requires_matching_add_u32_scc_and_zero_const`. ### Verification (`6817902`) - `rustfmt --edition 2024 --check crates/victory-shader/src/emit/valu_tests.rs`: clean (`resource.rs` and `emit/lower.rs` only retain pre-existing upstream formatting diffs on `origin/main`). - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: clean. - `cargo test --workspace --locked`: `351 passed; 0 failed; 6 ignored` (`victory-shader`: `129 passed; 0 failed; 1 ignored`; `xtask`: `4 passed`). - `VICTORY_WARP=1 cargo test -p victory-shader --locked -- root_srv`: `3 passed; 0 failed`.
upstream-sync closed this pull request 2026-11-24 23:04:19 +00:00
nathanbzrr commented 2026-11-24 23:05:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by nathanbzrr on 2026-11-24T22:03:22Z.


Closing this PR as superseded by recent main (70564ae):

  • 27c3dc9 (Shaders and GPU: title memory at raw addresses through a page table, decision 0005) and 0f63757 (GPU: root views of programs that use title memory go through the page table) now intercept the data-computed address failure classes in Tracer::address() (including "an address from a phi", "an address with two computed terms", "an address with an untracked high half", "an address not from a root parameter", and "an address from a root parameter that is no address") and route them through the MEMORY page table, alongside USER_DATA handling for spilled compute root parameters.
  • Maintaining the pre-27c3dc9 ~2,388-line tracer rework would conflict with decision 0005 and 0f63757's root-view page-table aliasing model; any remaining descriptor-heap address edge cases can be targeted cleanly in a focused follow-up PR on main.

Thanks @catminou4 and @xiao47576-glitch for the detailed reviews!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7145742469 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/645#issuecomment-7145742469). Originally posted by [nathanbzrr](https://github.com/nathanbzrr) on 2026-11-24T22:03:22Z. --- Closing this PR as superseded by recent `main` (`70564ae`): - `27c3dc9` (*Shaders and GPU: title memory at raw addresses through a page table*, decision 0005) and `0f63757` (*GPU: root views of programs that use title memory go through the page table*) now intercept the data-computed address failure classes in `Tracer::address()` (including `"an address from a phi"`, `"an address with two computed terms"`, `"an address with an untracked high half"`, `"an address not from a root parameter"`, and `"an address from a root parameter that is no address"`) and route them through the `MEMORY` page table, alongside `USER_DATA` handling for spilled compute root parameters. - Maintaining the pre-`27c3dc9` ~2,388-line tracer rework would conflict with decision 0005 and `0f63757`'s root-view page-table aliasing model; any remaining descriptor-heap address edge cases can be targeted cleanly in a focused follow-up PR on `main`. Thanks @catminou4 and @xiao47576-glitch for the detailed reviews!

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!645
No description provided.