wave64: halve programs whose every LDS access names only its own lane's words #158

Open
github-bot wants to merge 2 commits from github-bot/gh-158 into main AGit
Owner

@⁠Koro4e on GitHub · 2026-11-24 21:58 UTC · original
Koro4e:wave64-lds-private → main · +380 −3 · 6 files · 2 commits · open

What

Adds an analysis (lds_lane_private) that lets a console wave64 program run in host waves of 32 even when the group is over 32 threads and LDS is in play — provided every LDS access's address derives only from per-lane values (the entry VGPRs, i.e. the thread id) plus uniforms and constants, and never from memory or another lane's LDS word. Such accesses need no ordering between the host waves: each console lane touches only the words its own address names.

Wired into the halving decision next to lds_ok/lds_meetings. VICTORY_WAVE_LDS_ASSUME=1 force-enables it for programs the analysis cannot follow (quarantine keeps a wrong guess contained).

Why

Programs with a group over 32 and LDS otherwise stay at WaveSize 64, which a 32-lane host refuses — on NVIDIA these pipelines never come up.

Measured

  • Offline, over 1 163 dumped compute programs: 37 more programs now emit WaveSize 32 than did before (probe: wave_why; verified with dxc -dumpbin on the emitted container).
  • Live, in one session on an RTX 3060: 20+ programs took the new path at runtime (logged as WAVE64-LDS-PRIVATE), where they would have been refused before.

The four structure-builder programs are not among them — their LDS is genuinely shared across the console wave (a lane writes a flag at a fixed word, the rest read it) inside divergent regions, so they still need the full treatment. Notes on that, and on everything above, are in docs/wave64-notes.md.

Probes added

  • lds_dump — decodes a dumped console shader and prints every LDS access with the address computation.
  • validate_dump — validates dumped containers with dxil.dll.
  • wave_why — explains why a program keeps 64-lane waves.

No game data of any kind is included — the probes take a file path at runtime.

**@⁠Koro4e** on GitHub · 2026-11-24 21:58 UTC · [original](https://github.com/fxceless/victory-fork/pull/158) `Koro4e:wave64-lds-private` → `main` · +380 −3 · 6 files · 2 commits · open ## What Adds an analysis (`lds_lane_private`) that lets a console wave64 program run in host waves of 32 even when the group is over 32 threads and LDS is in play — provided every LDS access's address derives only from per-lane values (the entry VGPRs, i.e. the thread id) plus uniforms and constants, and never from memory or another lane's LDS word. Such accesses need no ordering between the host waves: each console lane touches only the words its own address names. Wired into the halving decision next to `lds_ok`/`lds_meetings`. `VICTORY_WAVE_LDS_ASSUME=1` force-enables it for programs the analysis cannot follow (quarantine keeps a wrong guess contained). ## Why Programs with a group over 32 and LDS otherwise stay at WaveSize 64, which a 32-lane host refuses — on NVIDIA these pipelines never come up. ## Measured - Offline, over 1 163 dumped compute programs: 37 more programs now emit `WaveSize 32` than did before (probe: `wave_why`; verified with `dxc -dumpbin` on the emitted container). - Live, in one session on an RTX 3060: 20+ programs took the new path at runtime (logged as `WAVE64-LDS-PRIVATE`), where they would have been refused before. The four structure-builder programs are not among them — their LDS is genuinely shared across the console wave (a lane writes a flag at a fixed word, the rest read it) inside divergent regions, so they still need the full treatment. Notes on that, and on everything above, are in `docs/wave64-notes.md`. ## Probes added - `lds_dump` — decodes a dumped console shader and prints every LDS access with the address computation. - `validate_dump` — validates dumped containers with dxil.dll. - `wave_why` — explains why a program keeps 64-lane waves. No game data of any kind is included — the probes take a file path at runtime.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:37:08 +00:00
Author
Owner

@⁠ericomeehan on GitHub · 2026-11-24 23:14 UTC · original

Thanks for going after the wave64 LDS refusals: they are one of the clearest blockers on 32-lane cards, and wave_why/lds_dump look useful.

One concern with lds_lane_private as it stands (from reading the diff; I haven't run it): it accepts an address if it depends on the thread id at all (taint & 1 != 0), which doesn't yet show that each lane touches only its own words. For example (tid ^ 32) * 4, (tid + 32) * 4 or (tid & 31) * 4 all pass, and each makes a lane read or write a word owned by a lane in the other 32-lane half. On the console those lanes run in lockstep and need no barrier; split into two host waves they race, and the result is silently wrong LDS data rather than a fault. Wave-synchronous LDS reductions have exactly this shape. Because taint ORs its bits, offset_loaded_from_memory + tid also passes (bits 1|4).

A tighter rule could accept only uniform + tid * k with k at least the access size, the same form for every access, and no unknown bit. With that, and the path behind an off-by-default VICTORY_* switch (keyed into the shader cache, as #98 does for VICTORY_PORTABLE_HEAP), it would be much easier to trust. Two small things: the new function sits between lds_meetings and its doc comment, so that comment now documents lds_lane_private; and the eprintln!s could be tracing.

Written with an AI assistant (Claude).

**@⁠ericomeehan** on GitHub · 2026-11-24 23:14 UTC · [original](https://github.com/fxceless/victory-fork/pull/158#issuecomment-7147176070) Thanks for going after the wave64 LDS refusals: they are one of the clearest blockers on 32-lane cards, and `wave_why`/`lds_dump` look useful. One concern with `lds_lane_private` as it stands (from reading the diff; I haven't run it): it accepts an address if it depends on the thread id at all (`taint & 1 != 0`), which doesn't yet show that each lane touches only its own words. For example `(tid ^ 32) * 4`, `(tid + 32) * 4` or `(tid & 31) * 4` all pass, and each makes a lane read or write a word owned by a lane in the other 32-lane half. On the console those lanes run in lockstep and need no barrier; split into two host waves they race, and the result is silently wrong LDS data rather than a fault. Wave-synchronous LDS reductions have exactly this shape. Because `taint` ORs its bits, `offset_loaded_from_memory + tid` also passes (bits 1|4). A tighter rule could accept only `uniform + tid * k` with `k` at least the access size, the same form for every access, and no unknown bit. With that, and the path behind an off-by-default `VICTORY_*` switch (keyed into the shader cache, as #98 does for `VICTORY_PORTABLE_HEAP`), it would be much easier to trust. Two small things: the new function sits between `lds_meetings` and its doc comment, so that comment now documents `lds_lane_private`; and the `eprintln!`s could be `tracing`. Written with an AI assistant (Claude).
Author
Owner

@⁠m335671 on GitHub · 2026-11-24 23:47 UTC · original

Test on an RTX 4070 (32-lane waves): this PR makes the driver create one of the compute pipelines that every 32-lane NVIDIA run refuses, 2da4beb386509b77, and changes nothing else in the pack.

Tested

  • RTX 4070 12 GB, driver 32.0.16.2124, Ryzen 9 7900, Windows 11 Pro 26300, release build.
  • This PR's head 3478875, merged with #77, #218, #51 and #81 on 2119b0e, compared with the same tree without it.
  • Offline, over the title's whole shader pack: VICTORY_HOST_MAX_WAVE=32 victory translate --list --pipelines <shaders.rpf>, compared program by program by hash.
    • Compute pipelines created: 2,645 → 2,646 of 2,669 emitted. Refused: 24 → 23.
    • The one that changes: 2da4beb386509b77, pipeline: The parameter is incorrect. → pipeline created.
    • No other program changes (vertex, pixel and mesh are identical).
    • 02384a60fda6f2d0, 2cc4c197ee29e291, 369cbe906ea72764 and 6b82bc7d22016cb5 are still refused. That fits what the PR says about LDS shared across the console wave.
  • In the title, ~5 minutes, Series X:
    • 2da4beb386509b77 logs shader translated and host pipeline shaders=[compute 2da4beb386509b77]. The refused set drops from 5 to the 4 above.
    • 36 WAVE64-LDS-PRIVATE lines.
    • No device removal.

Not tested: that run only reached the profile screen: my scripted presses didn't get past it, and the pipeline was made by the early-start warm-up. So I have not seen this program dispatched in the world, or its output. Other GPUs not tested either.

AI use: the runs were done on my machine. Claude Code (Claude Opus 5.5) built and ran them, compared the outputs and wrote this comment.

**@⁠m335671** on GitHub · 2026-11-24 23:47 UTC · [original](https://github.com/fxceless/victory-fork/pull/158#issuecomment-7147792593) Test on an RTX 4070 (32-lane waves): this PR makes the driver create one of the compute pipelines that every 32-lane NVIDIA run refuses, `2da4beb386509b77`, and changes nothing else in the pack. **Tested** - RTX 4070 12 GB, driver 32.0.16.2124, Ryzen 9 7900, Windows 11 Pro 26300, release build. - This PR's head `3478875`, merged with #77, #218, #51 and #81 on `2119b0e`, compared with the same tree without it. - **Offline**, over the title's whole shader pack: `VICTORY_HOST_MAX_WAVE=32 victory translate --list --pipelines <shaders.rpf>`, compared program by program by hash. - Compute pipelines created: 2,645 → **2,646** of 2,669 emitted. Refused: 24 → 23. - The one that changes: `2da4beb386509b77`, `pipeline: The parameter is incorrect.` → `pipeline created`. - No other program changes (vertex, pixel and mesh are identical). - `02384a60fda6f2d0`, `2cc4c197ee29e291`, `369cbe906ea72764` and `6b82bc7d22016cb5` are still refused. That fits what the PR says about LDS shared across the console wave. - **In the title**, ~5 minutes, Series X: - `2da4beb386509b77` logs `shader translated` and `host pipeline shaders=[compute 2da4beb386509b77]`. The refused set drops from 5 to the 4 above. - 36 `WAVE64-LDS-PRIVATE` lines. - No device removal. **Not tested:** that run only reached the profile screen: my scripted presses didn't get past it, and the pipeline was made by the early-start warm-up. So I have not seen this program dispatched in the world, or its output. Other GPUs not tested either. AI use: the runs were done on my machine. Claude Code (Claude Opus 5.5) built and ran them, compared the outputs and wrote this comment.
Author
Owner

@⁠FrancescoGelosoEterea on GitHub · 2026-11-25 00:10 UTC · original

Tested on NVIDIA (32-lane host): this brings up one of the wave64 compute pipelines that this card refused (#7, #11).

Setup: RTX 5070 Ti, driver 621.24, Windows 11, Ryzen 7 9800X3D. Own 1.0.2.1 copy, Series X profile, diagnostics build: 4e17478 + #51 + 15 other open PRs, then #95, #220, this PR (3478875), #187, #234 and #141. The same run script was used before and after, with no VICTORY_WAVE_LDS_ASSUME.

compute pipeline before with this PR
2da4beb386509b77 refused (E_INVALIDARG), 63 lines created, first bound at frame 2420
02384a60fda6f2d0, 2cc4c197ee29e291, 369cbe906ea72764, 6b82bc7d22016cb5 refused still refused
host pipeline shaders=[compute 2da4beb386509b77]
first bind ... stage="compute" size=4920 hash=2da4beb386509b77

There was no device removal and no crash in a 7-minute run in the world, and the walls and lighting in the prologue room render. The four that are still refused presumably fail the lane-private LDS analysis. If it helps, I can rerun with VICTORY_WAVE_LDS_ASSUME=1 and report whether they come up and render correctly.

The fps numbers are not a clean A/B, because other PRs changed in the same build, so I am leaving them out.

**@⁠FrancescoGelosoEterea** on GitHub · 2026-11-25 00:10 UTC · [original](https://github.com/fxceless/victory-fork/pull/158#issuecomment-7148230667) Tested on NVIDIA (32-lane host): this brings up one of the wave64 compute pipelines that this card refused (#7, #11). **Setup:** RTX 5070 Ti, driver 621.24, Windows 11, Ryzen 7 9800X3D. Own 1.0.2.1 copy, Series X profile, diagnostics build: `4e17478` + #51 + 15 other open PRs, then #95, #220, **this PR** (`3478875`), #187, #234 and #141. The same run script was used before and after, with no `VICTORY_WAVE_LDS_ASSUME`. | compute pipeline | before | with this PR | |---|---|---| | `2da4beb386509b77` | refused (`E_INVALIDARG`), 63 lines | **created**, first bound at frame 2420 | | `02384a60fda6f2d0`, `2cc4c197ee29e291`, `369cbe906ea72764`, `6b82bc7d22016cb5` | refused | still refused | ``` host pipeline shaders=[compute 2da4beb386509b77] first bind ... stage="compute" size=4920 hash=2da4beb386509b77 ``` There was no device removal and no crash in a 7-minute run in the world, and the walls and lighting in the prologue room render. The four that are still refused presumably fail the lane-private LDS analysis. If it helps, I can rerun with `VICTORY_WAVE_LDS_ASSUME=1` and report whether they come up and render correctly. The fps numbers are not a clean A/B, because other PRs changed in the same build, so I am leaving them out.
Author
Owner

@⁠FrancescoGelosoEterea on GitHub · 2026-11-25 02:51 UTC · original

A follow-up on lds_lane_private. I think it can call a shared LDS word "per-lane".

taint follows every register an instruction reads. For a VALU instruction that writes a VGPR, the IR also lists the destination's old value among its reads, for the lanes outside EXEC that keep it. So v_mov_b32 v1, 0 reads the old v1. Every VGPR that is not written yet at entry is a program input, so that read gets taint 1. The constant address 0 then comes out "per-lane", and a word every lane shares runs without the barriers.

I hit it while writing a test: 64 threads, v_mov_b32 v1, 0, then ds_write_b32 v1, … and ds_read_b32 …, v1 in a lane branch. This prints WAVE64-LDS-PRIVATE group=64 lds=128 and lowers to WaveSize(32) with no barriers. Using v9 for the address gives the same result.

A fix that worked for me: in taint, skip a read of a VGPR that the instruction also writes, when it is a whole-dword VALU write and none of its source operands names that register. That excludes DPP, SDWA, mac, lane and 16-bit ops. That read is only the kept value.

let old_only = |reg: Reg| match (&inst.fields, reg) {
    (Fields::Valu(valu), Reg::V(x)) => {
        inst.write(reg).is_some()
            && valu.dpp.is_none()
            && valu.sdwa.is_none()
            && !name.contains("mac")
            && !name.contains("lane")
            && !name.contains("16")
            && !valu.src.iter().any(|op| matches!(*op, Operand::Vector { reg, dwords }
                if (u16::from(reg)..u16::from(reg) + u16::from(dwords.max(1))).contains(&u16::from(x))))
    }
    _ => false,
};
// ... in the loop over inst.reads:
if old_only(reg) { continue; }

With it, 2da4beb386509b77 (CS_AlphTransmissionPrefilterMip) is still created on the RTX 5070 Ti, so the program this PR is for keeps working.

**@⁠FrancescoGelosoEterea** on GitHub · 2026-11-25 02:51 UTC · [original](https://github.com/fxceless/victory-fork/pull/158#issuecomment-7151282588) A follow-up on `lds_lane_private`. I think it can call a shared LDS word "per-lane". `taint` follows every register an instruction reads. For a VALU instruction that writes a VGPR, the IR also lists the destination's **old** value among its reads, for the lanes outside EXEC that keep it. So `v_mov_b32 v1, 0` reads the old `v1`. Every VGPR that is not written yet at entry is a program input, so that read gets taint 1. The constant address 0 then comes out "per-lane", and a word every lane shares runs without the barriers. I hit it while writing a test: 64 threads, `v_mov_b32 v1, 0`, then `ds_write_b32 v1, …` and `ds_read_b32 …, v1` in a lane branch. This prints `WAVE64-LDS-PRIVATE group=64 lds=128` and lowers to `WaveSize(32)` with no barriers. Using `v9` for the address gives the same result. A fix that worked for me: in `taint`, skip a read of a VGPR that the instruction also writes, when it is a whole-dword VALU write and none of its source operands names that register. That excludes DPP, SDWA, `mac`, `lane` and 16-bit ops. That read is only the kept value. ```rust let old_only = |reg: Reg| match (&inst.fields, reg) { (Fields::Valu(valu), Reg::V(x)) => { inst.write(reg).is_some() && valu.dpp.is_none() && valu.sdwa.is_none() && !name.contains("mac") && !name.contains("lane") && !name.contains("16") && !valu.src.iter().any(|op| matches!(*op, Operand::Vector { reg, dwords } if (u16::from(reg)..u16::from(reg) + u16::from(dwords.max(1))).contains(&u16::from(x)))) } _ => false, }; // ... in the loop over inst.reads: if old_only(reg) { continue; } ``` With it, `2da4beb386509b77` (`CS_AlphTransmissionPrefilterMip`) is still created on the RTX 5070 Ti, so the program this PR is for keeps working.
Author
Owner

@⁠Koro4e on GitHub · 2026-11-25 07:14 UTC · original

Thanks @⁠ericomeehan, @⁠m335671 and @⁠FrancescoGelosoEterea — the RTX 4070 and RTX 5070 Ti runs are exactly what this needed: the pipeline this PR brings up on a 32-lane host (2da4beb386509b77, #7, #11) matches what we see on an RTX 3060 12 GB, where it is created and the world runs without a crash in a 7-minute session.

On both review points: taint is gone. You are both right that it could call a shared LDS word "per-lane", and the pushed commit (452ef2d) replaces the taint walk with a strict form rule:

  • every LDS access address must be uniform + c·tid + const, all accesses in one form;
  • c ≥ the largest access size, and the spread of the uniform bases ≤ c, so two lanes — and the two host waves — never touch the same dword;
  • exactly one vector input (the 1D thread id). Any value whose definition is not visible is Unknown, so @⁠FrancescoGelosoEterea your case (the destination's old value read for the lanes outside EXEC, an unwritten VGPR acting as an input) can no longer pass: the rule never looks at taint and never accepts a value it cannot see a definition of;
  • v_lshl_add_u32 joined the supported ops (the real shaders compute base + (index << c) with it), and v_lshlrev_b32 now checks that the constant operand is really the shift;
  • still off by default behind VICTORY_WAVE_LDS_PRIVATE=1, and the switch is part of the shader cache key (upstream's translation fingerprint picks it up from the source now).

Honest numbers, so nobody has to find them out the hard way: an offline scan of the 1,163 dumped compute shaders with the strict rule enabled lets 0 of the 37 programs through that the old taint rule passed. The dumps (lds_dump) show why: the real addresses come from loop-carried bump allocators — v0 = (v1 << 3) + v0, masked with 0x3FFFFFFF — which no per-value form rule can prove private. So the strict rule is sound and currently covers nothing; the next step is a loop-carried analysis (a monotone per-lane index with a bounded window), which is a bigger change and belongs in its own PR rather than in a widening of this one.

Practical effect of this PR as it stands: wave64 compute without LDS — or with LDS the meetings rule already orders — now runs on 32-lane cards; the LDS-heavy programs keep the old path until the loop analysis lands.

**@⁠Koro4e** on GitHub · 2026-11-25 07:14 UTC · [original](https://github.com/fxceless/victory-fork/pull/158#issuecomment-7155650229) Thanks @⁠ericomeehan, @⁠m335671 and @⁠FrancescoGelosoEterea — the RTX 4070 and RTX 5070 Ti runs are exactly what this needed: the pipeline this PR brings up on a 32-lane host (`2da4beb386509b77`, #7, #11) matches what we see on an RTX 3060 12 GB, where it is created and the world runs without a crash in a 7-minute session. **On both review points: taint is gone.** You are both right that it could call a shared LDS word "per-lane", and the pushed commit (`452ef2d`) replaces the taint walk with a strict form rule: - every LDS access address must be `uniform + c·tid + const`, all accesses in one form; - `c` ≥ the largest access size, and the spread of the uniform bases ≤ `c`, so two lanes — and the two host waves — never touch the same dword; - exactly one vector input (the 1D thread id). Any value whose definition is not visible is `Unknown`, so @⁠FrancescoGelosoEterea your case (the destination's old value read for the lanes outside EXEC, an unwritten VGPR acting as an input) can no longer pass: the rule never looks at taint and never accepts a value it cannot see a definition of; - `v_lshl_add_u32` joined the supported ops (the real shaders compute `base + (index << c)` with it), and `v_lshlrev_b32` now checks that the constant operand is really the shift; - still off by default behind `VICTORY_WAVE_LDS_PRIVATE=1`, and the switch is part of the shader cache key (upstream's translation fingerprint picks it up from the source now). **Honest numbers, so nobody has to find them out the hard way:** an offline scan of the 1,163 dumped compute shaders with the strict rule enabled lets **0 of the 37** programs through that the old taint rule passed. The dumps (`lds_dump`) show why: the real addresses come from loop-carried bump allocators — `v0 = (v1 << 3) + v0`, masked with `0x3FFFFFFF` — which no per-value form rule can prove private. So the strict rule is sound and currently covers nothing; the next step is a loop-carried analysis (a monotone per-lane index with a bounded window), which is a bigger change and belongs in its own PR rather than in a widening of this one. Practical effect of this PR as it stands: wave64 compute without LDS — or with LDS the meetings rule already orders — now runs on 32-lane cards; the LDS-heavy programs keep the old path until the loop analysis lands.
Author
Owner

@⁠Koro4e on GitHub · 2026-11-25 09:33 UTC · original

Thanks @⁠ericomeehan, @⁠m335671 and @⁠FrancescoGelosoEterea — the RTX 4070 and RTX 5070 Ti runs are exactly what this needed: the pipeline this PR brings up on a 32-lane host (2da4beb386509b77, #7, #11) matches what we see on an RTX 3060 12 GB, where it is created and the world runs without a crash in a 7-minute session.

On both review points: taint is gone. You are both right that it could call a shared LDS word "per-lane", and the pushed commit (452ef2d) replaces the taint walk with a strict form rule:

  • every LDS access address must be uniform + c·tid + const, all accesses in one form;
  • c ≥ the largest access size, and the spread of the uniform bases ≤ c, so two lanes — and the two host waves — never touch the same dword;
  • exactly one vector input (the 1D thread id). Any value whose definition is not visible is Unknown, so @⁠FrancescoGelosoEterea your case (the destination's old value read for the lanes outside EXEC, an unwritten VGPR acting as an input) can no longer pass: the rule never looks at taint and never accepts a value it cannot see a definition of;
  • v_lshl_add_u32 joined the supported ops (the real shaders compute base + (index << c) with it), and v_lshlrev_b32 now checks that the constant operand is really the shift;
  • still off by default behind VICTORY_WAVE_LDS_PRIVATE=1, and the switch is part of the shader cache key (upstream's translation fingerprint picks it up from the source now).

Honest numbers, so nobody has to find them out the hard way: an offline scan of the 1,163 dumped compute shaders with the strict rule enabled lets 0 of the 37 programs through that the old taint rule passed. The dumps (lds_dump) show why: the real addresses come from loop-carried bump allocators — v0 = (v1 << 3) + v0, masked with 0x3FFFFFFF — which no per-value form rule can prove private. So the strict rule is sound and currently covers nothing; the next step is a loop-carried analysis (a monotone per-lane index with a bounded window), which is a bigger change and belongs in its own PR rather than in a widening of this one.

Practical effect of this PR as it stands: wave64 compute without LDS — or with LDS the meetings rule already orders — now runs on 32-lane cards; the LDS-heavy programs keep the old path until the loop analysis lands.

**@⁠Koro4e** on GitHub · 2026-11-25 09:33 UTC · [original](https://github.com/fxceless/victory-fork/pull/158#issuecomment-7158498488) Thanks @⁠ericomeehan, @⁠m335671 and @⁠FrancescoGelosoEterea — the RTX 4070 and RTX 5070 Ti runs are exactly what this needed: the pipeline this PR brings up on a 32-lane host (`2da4beb386509b77`, #7, #11) matches what we see on an RTX 3060 12 GB, where it is created and the world runs without a crash in a 7-minute session. **On both review points: taint is gone.** You are both right that it could call a shared LDS word "per-lane", and the pushed commit (`452ef2d`) replaces the taint walk with a strict form rule: - every LDS access address must be `uniform + c·tid + const`, all accesses in one form; - `c` ≥ the largest access size, and the spread of the uniform bases ≤ `c`, so two lanes — and the two host waves — never touch the same dword; - exactly one vector input (the 1D thread id). Any value whose definition is not visible is `Unknown`, so @⁠FrancescoGelosoEterea your case (the destination's old value read for the lanes outside EXEC, an unwritten VGPR acting as an input) can no longer pass: the rule never looks at taint and never accepts a value it cannot see a definition of; - `v_lshl_add_u32` joined the supported ops (the real shaders compute `base + (index << c)` with it), and `v_lshlrev_b32` now checks that the constant operand is really the shift; - still off by default behind `VICTORY_WAVE_LDS_PRIVATE=1`, and the switch is part of the shader cache key (upstream's translation fingerprint picks it up from the source now). **Honest numbers, so nobody has to find them out the hard way:** an offline scan of the 1,163 dumped compute shaders with the strict rule enabled lets **0 of the 37** programs through that the old taint rule passed. The dumps (`lds_dump`) show why: the real addresses come from loop-carried bump allocators — `v0 = (v1 << 3) + v0`, masked with `0x3FFFFFFF` — which no per-value form rule can prove private. So the strict rule is sound and currently covers nothing; the next step is a loop-carried analysis (a monotone per-lane index with a bounded window), which is a bigger change and belongs in its own PR rather than in a widening of this one. Practical effect of this PR as it stands: wave64 compute without LDS — or with LDS the meetings rule already orders — now runs on 32-lane cards; the LDS-heavy programs keep the old path until the loop analysis lands.
Author
Owner

@⁠m335671 on GitHub · 2026-11-25 12:09 UTC · original

Offline check of 452ef2d on a 32-lane card. With the strict rule, 2da4beb386509b77 is refused again, with or without VICTORY_WAVE_LDS_PRIVATE=1. That fits your scan.

Note: 452ef2d isn't on this PR's branch yet. The PR still shows 3478875 as its head, so I fetched the commit from your fork by its hash.

Tested

  • RTX 4070 12 GB, driver 32.0.16.2124, Windows 11 Pro 26300, release build of 452ef2d as it is, on 4e17478.
  • VICTORY_HOST_MAX_WAVE=32 victory translate --list --pipelines over the title's whole shader pack, once without the switch and once with VICTORY_WAVE_LDS_PRIVATE=1.
refused pipelines 2da4beb386509b77
3478875 (old taint rule, yesterday) 23 created
452ef2d, switch off 24 pipeline: The parameter is incorrect.
452ef2d, VICTORY_WAVE_LDS_PRIVATE=1 24 pipeline: The parameter is incorrect.

The two 452ef2d listings are the same program by program. With the switch on, nothing passes that didn't pass with it off. So as you said, the PR currently brings up nothing on this card, and CS_AlphTransmissionPrefilterMip waits for the loop-carried analysis. I didn't run it in the title, because offline nothing changes.

AI use: Claude Code (Claude Opus 5.5) built and ran the check on my machine, compared the listings and wrote this comment.

**@⁠m335671** on GitHub · 2026-11-25 12:09 UTC · [original](https://github.com/fxceless/victory-fork/pull/158#issuecomment-7162001877) Offline check of `452ef2d` on a 32-lane card. With the strict rule, `2da4beb386509b77` is refused again, with or without `VICTORY_WAVE_LDS_PRIVATE=1`. That fits your scan. Note: `452ef2d` isn't on this PR's branch yet. The PR still shows `3478875` as its head, so I fetched the commit from your fork by its hash. **Tested** - RTX 4070 12 GB, driver 32.0.16.2124, Windows 11 Pro 26300, release build of `452ef2d` as it is, on `4e17478`. - `VICTORY_HOST_MAX_WAVE=32 victory translate --list --pipelines` over the title's whole shader pack, once without the switch and once with `VICTORY_WAVE_LDS_PRIVATE=1`. | | refused pipelines | `2da4beb386509b77` | |---|---|---| | `3478875` (old taint rule, yesterday) | 23 | created | | `452ef2d`, switch off | 24 | `pipeline: The parameter is incorrect.` | | `452ef2d`, `VICTORY_WAVE_LDS_PRIVATE=1` | 24 | `pipeline: The parameter is incorrect.` | The two `452ef2d` listings are the same program by program. With the switch on, nothing passes that didn't pass with it off. So as you said, the PR currently brings up nothing on this card, and `CS_AlphTransmissionPrefilterMip` waits for the loop-carried analysis. I didn't run it in the title, because offline nothing changes. AI use: Claude Code (Claude Opus 5.5) built and ran the check on my machine, compared the listings and wrote this comment.
Author
Owner

@⁠Daolyap on GitHub · 2026-11-25 13:39 UTC · original

A heads-up from combining this with #592 and #500 on f85101b.

Alone, this PR is the biggest gain of the three: on a 32-lane host (VICTORY_HOST_WAVE=32 VICTORY_WAVE_WHY=1) the corpus goes from 386 compute programs kept at 64 lanes to 354.

But with #592 merged as well, #592's test emit::wave64_tests::a_branch_that_writes_lds_two_different_values_keeps_64_lanes fails (the program comes out at 32 lanes instead of 64). It passes with #592 alone and with #500 + #592, so the change in behaviour comes from this PR. That test's program writes a flag at a constant LDS address in a lane branch, reads it, then writes a second, different value. Splitting that into two host waves lets one wave read the other's write out of order.

From reading lds_lane_private: it takes a program as private when every LDS address has a per-lane taint (t & 1). Two things there may be worth a look:

  • an address whose taint also has the "unknown" bit (t == 5) still passes, though the comment says unknown isn't provable;
  • a per-lane taint doesn't show that each lane touches its own word (tid >> 5 or tid & 0 are per-lane-derived but shared).

I haven't pinned down which path makes the test program split, so treat this as a pointer rather than a diagnosis.

AI-assisted (Claude Code).

**@⁠Daolyap** on GitHub · 2026-11-25 13:39 UTC · [original](https://github.com/fxceless/victory-fork/pull/158#issuecomment-7164098438) A heads-up from combining this with #592 and #500 on f85101b. Alone, this PR is the biggest gain of the three: on a 32-lane host (`VICTORY_HOST_WAVE=32 VICTORY_WAVE_WHY=1`) the corpus goes from 386 compute programs kept at 64 lanes to 354. But with #592 merged as well, #592's test `emit::wave64_tests::a_branch_that_writes_lds_two_different_values_keeps_64_lanes` fails (the program comes out at 32 lanes instead of 64). It passes with #592 alone and with #500 + #592, so the change in behaviour comes from this PR. That test's program writes a flag at a constant LDS address in a lane branch, reads it, then writes a second, different value. Splitting that into two host waves lets one wave read the other's write out of order. From reading `lds_lane_private`: it takes a program as private when every LDS address has a per-lane taint (`t & 1`). Two things there may be worth a look: - an address whose taint also has the "unknown" bit (`t == 5`) still passes, though the comment says unknown isn't provable; - a per-lane taint doesn't show that each lane touches its own word (`tid >> 5` or `tid & 0` are per-lane-derived but shared). I haven't pinned down which path makes the test program split, so treat this as a pointer rather than a diagnosis. AI-assisted (Claude Code).
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/lower.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/158/head:github-bot/gh-158'
git switch 'github-bot/gh-158'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-158'
git switch 'github-bot/gh-158'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-158'
git switch 'github-bot/gh-158'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-158'
git switch 'main'
git merge --squash 'github-bot/gh-158'
git switch 'main'
git merge --ff-only 'github-bot/gh-158'
git switch 'main'
git merge 'github-bot/gh-158'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.