Shaders: one back edge per block, so vkd3d-proton converts #439's loops (stacked on #439) #2309

Open
github-bot wants to merge 74 commits from github-bot/gh-2309 into main AGit
Owner

@⁠desplmfao on GitHub · 2026-11-25 10:19 UTC · original
desplmfao:fix/w64-nvidia-compile → main · +4971 −1457 · 28 files · 74 commits · open

Stacked on #439 (r4tedx; it contains #233 and #320). The two commits on top of it are the change. The first is powplusplus's d48ec76 from #1885, cherry-picked with its author kept; the second is ours.

Problem

On NVIDIA (32-lane waves) under Wine/Proton, vkd3d-proton converts each pipeline's DXIL to SPIR-V with dxil-spirv, inside the title's process. Some of #439's console-flow programs have a block that branches back to two loop headers, e.g. br c, 191, 126, where 191 is the inner loop's header and 126 the outer one's. Others have a loop header with three back edges.

dxil-spirv's structurizer expects one back edge per block and per header ("DXIL seems to obey this", forward_visit_resolve). It reads the extra edge as a forward edge, makes a cycle, and recurses until the stack runs out (LoopMergeTracer::trace_from_parent, about 100k frames). With a large stack it uses memory instead (40 GB before I killed it), or the pipeline thread hangs. In the title, the process ends while those pipelines are created, or no pipeline ever finishes.

main has the same shapes in 7 programs. They convert because those programs have no WaveReadLaneAt, and dxil-spirv only walks the graph before fixing it up in flatten_subgroup_shuffles, which runs only when a shader reads other lanes. #439 adds the lane reads, and then the same shapes are fatal.

How it was found

  1. The pipeline journal (#491, VICTORY_PIPELINE_JOURNAL=1). On #439 the title's process died during world load, with no crash log and no GPU fault. The journal's pending notes named the pipelines being created at that moment: b2ff2ef0d6c98dd7, fdd56d97a806bcca, 32ed072b9f845048 and others.
  2. Offline reproduction. Their containers came from the title's shaders.rpf and were translated with #439. A native dxil-spirv build, capped in memory, then crashed on them the same way: it reached 40 GB uncapped and overflowed the stack when capped. gdb showed the recursion (LoopMergeTracer::trace_from_parent, about 100k frames).
  3. The cause. Diffing the DXIL against main showed the block that branches back to two loop headers.
  4. Confirmed in the title with #2292 (VICTORY_PIPELINE_SOFT_CRASH=1). Without this fix, the same two programs are caught as stack overflows (0xc00000fd) inside vkd3d-proton.

Change

All in crates/victory-shader/src/emit/bitcode.rs:

  • 364c1bc (powplusplus, from #1885): Module::single_latches gives each loop header one back edge.
  • 91e3bdf: a block that branches back to two headers sends its edge to the outer header through a new block of its own, fixing that header's phis. The block stays the inner loop's exiting latch, as DXC makes them. The empty-latch fold at write time no longer folds a latch into a block that already branches back, which would undo the split.

The change is generic: lower.rs and wave.rs are untouched, so it should not conflict with #2214.

Tested

  • dxil-spirv (native build, capped at 3 GB):
    • Before: it crashes on fdd56d97a806bcca (InstanceCulling:CS_Prop_BatchNoCull) and 32ed072b9f845048 (deferred_tiled:CS_LaserLightShadowRaytracing).
    • After: both convert, pass spirv-val, and vkCreateComputePipelines returns VK_SUCCESS on native NVIDIA (RTX 5080, no Wine).
  • All 413 dumped programs of the title: only the 8 with these loop shapes change, and the other 405 give byte-identical output. All 8 convert and create on NVIDIA (0.3–1.5 s each).
  • In the title (RTX 5080, Linux, Proton with vkd3d-proton 3.2.0): with #439 alone, the process died or the pipeline workers stalled while these pipelines were created. With this change, all of them create, including the five large *:CS_RaytracingResolve programs, and the run goes past that point.
  • cargo test -p victory-shader --lib: 151 passed on Linux, and 178 passed, 0 failed for the Windows build under Proton on the RTX 5080. That includes the new a_block_branching_back_to_two_headers_gets_one_back_edge and empty_latches_to_two_headers_fold_once.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • #1885 (powplusplus): its first commit is included here. Its second commit (larger pipeline thread stacks) is not.
  • #1145 also changes latch folding. #1540 guards a branch whose two arms are both back edges, in lower.rs.
  • #2214 (draft, also on #439): its barrier wait loops add more nested loops with lane reads, so it probably hits the same converter limit on NVIDIA under vkd3d-proton. This change applies to any form.
  • #2220: the same wave64 problem on native D3D12, where the pipelines are refused instead.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠desplmfao** on GitHub · 2026-11-25 10:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2309) `desplmfao:fix/w64-nvidia-compile` → `main` · +4971 −1457 · 28 files · 74 commits · open **Stacked on #439** (r4tedx; it contains #233 and #320). The two commits on top of it are the change. The first is powplusplus's `d48ec76` from #1885, cherry-picked with its author kept; the second is ours. ## Problem On NVIDIA (32-lane waves) under Wine/Proton, vkd3d-proton converts each pipeline's DXIL to SPIR-V with dxil-spirv, inside the title's process. Some of #439's console-flow programs have a block that branches back to **two** loop headers, e.g. `br c, 191, 126`, where 191 is the inner loop's header and 126 the outer one's. Others have a loop header with three back edges. dxil-spirv's structurizer expects one back edge per block and per header ("DXIL seems to obey this", `forward_visit_resolve`). It reads the extra edge as a forward edge, makes a cycle, and recurses until the stack runs out (`LoopMergeTracer::trace_from_parent`, about 100k frames). With a large stack it uses memory instead (40 GB before I killed it), or the pipeline thread hangs. In the title, the process ends while those pipelines are created, or no pipeline ever finishes. `main` has the same shapes in 7 programs. They convert because those programs have no `WaveReadLaneAt`, and dxil-spirv only walks the graph before fixing it up in `flatten_subgroup_shuffles`, which runs only when a shader reads other lanes. #439 adds the lane reads, and then the same shapes are fatal. ## How it was found 1. **The pipeline journal (#491, `VICTORY_PIPELINE_JOURNAL=1`).** On #439 the title's process died during world load, with no crash log and no GPU fault. The journal's pending notes named the pipelines being created at that moment: `b2ff2ef0d6c98dd7`, `fdd56d97a806bcca`, `32ed072b9f845048` and others. 2. **Offline reproduction.** Their containers came from the title's `shaders.rpf` and were translated with #439. A native dxil-spirv build, capped in memory, then crashed on them the same way: it reached 40 GB uncapped and overflowed the stack when capped. gdb showed the recursion (`LoopMergeTracer::trace_from_parent`, about 100k frames). 3. **The cause.** Diffing the DXIL against `main` showed the block that branches back to two loop headers. 4. **Confirmed in the title** with #2292 (`VICTORY_PIPELINE_SOFT_CRASH=1`). Without this fix, the same two programs are caught as stack overflows (`0xc00000fd`) inside vkd3d-proton. ## Change All in `crates/victory-shader/src/emit/bitcode.rs`: - **`364c1bc`** (powplusplus, from #1885): `Module::single_latches` gives each loop header one back edge. - **`91e3bdf`**: a block that branches back to two headers sends its edge to the outer header through a new block of its own, fixing that header's phis. The block stays the inner loop's exiting latch, as DXC makes them. The empty-latch fold at write time no longer folds a latch into a block that already branches back, which would undo the split. The change is generic: `lower.rs` and `wave.rs` are untouched, so it should not conflict with #2214. ## Tested - **dxil-spirv (native build, capped at 3 GB):** - Before: it crashes on `fdd56d97a806bcca` (`InstanceCulling:CS_Prop_BatchNoCull`) and `32ed072b9f845048` (`deferred_tiled:CS_LaserLightShadowRaytracing`). - After: both convert, pass `spirv-val`, and `vkCreateComputePipelines` returns `VK_SUCCESS` on native NVIDIA (RTX 5080, no Wine). - **All 413 dumped programs of the title:** only the 8 with these loop shapes change, and the other 405 give byte-identical output. All 8 convert and create on NVIDIA (0.3–1.5 s each). - **In the title** (RTX 5080, Linux, Proton with vkd3d-proton 3.2.0): with #439 alone, the process died or the pipeline workers stalled while these pipelines were created. With this change, all of them create, including the five large `*:CS_RaytracingResolve` programs, and the run goes past that point. - `cargo test -p victory-shader --lib`: 151 passed on Linux, and 178 passed, 0 failed for the Windows build under Proton on the RTX 5080. That includes the new `a_block_branching_back_to_two_headers_gets_one_back_edge` and `empty_latches_to_two_headers_fold_once`. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. ## Related - #1885 (powplusplus): its first commit is included here. Its second commit (larger pipeline thread stacks) is not. - #1145 also changes latch folding. #1540 guards a branch whose two arms are both back edges, in `lower.rs`. - #2214 (draft, also on #439): its barrier wait loops add more nested loops with lane reads, so it probably hits the same converter limit on NVIDIA under vkd3d-proton. This change applies to any form. - #2220: the same wave64 problem on native D3D12, where the pipelines are refused instead. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
How one console wave64 runs as two 32-lane host waves under our
per-lane structurisation, what has to cross halves, why exchanges need
uniform regions, how to test on a machine with both GPU kinds, and the
order of the remaining steps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A compute shader that reads other lanes declares the console's wave
size. NVIDIA runs waves of 32 lanes only (D3D12 reports 32..32), so a
console wave64 program of that kind was refused at pipeline creation
and its dispatches were dropped without saying why.

The host's wave range (D3D12 options 1) now goes into translation as
`emit::Target`. A shader that needs a wave size the host does not run
stops there with the reason, the shader cache keys entries by the range,
and the run logs the range once with a warning when 64-lane waves are
missing. `victory translate --host-lanes 32-32` counts these shaders
without a GPU.

This is the first step towards running these programs as two 32-lane
waves on such hosts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`emit::host::Host::on(name)` and `VICTORY_ADAPTER` choose a hardware
adapter by part of its description, and `adapters()` lists them, so a
machine with an AMD and an NVIDIA GPU can run a test on each: the
native wave64 form as the reference on the one with 64-lane waves, the
32-lane form on the other. A new test checks on every adapter that a
wave64 program reading other lanes translates exactly when the adapter
runs 64-lane waves, and that the adapter then takes it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On a host without 64-lane waves (NVIDIA), a console wave64 compute
program whose lanes read only their own 32-lane half (DPP, ds_swizzle)
now declares WaveSize(32) instead of failing to translate. It must
read no mask whole, test no bit of a mask held as a number, have no
whole-wave sections and use no LDS. Every other wave64 program that
depends on the lane layout still stops with the reason from the
previous step. Mask ballots, wave reductions and lane-bit tests refuse
the split form as a safety net.

New GPU tests run hand-assembled programs on every hardware adapter
and check each lane against the console's layout. On an RTX 5070 the
split form is exact for 1-D groups of 32, 64 and 128 threads and for
3-D groups up to 8x8x4. A Radeon iGPU runs the same programs natively
as the reference, and a read across halves (v_readlane 40) still needs
64-lane waves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A console wave64 program that reads masks whole or lanes of the other
half now runs on a host without 64-lane waves when its group is one
console wave (64 threads or fewer, no LDS). It runs as the console
does ("console flow"):

- `structure::structure_console` never resolves mask joins from what
  the lanes arriving know (every lane arrives); `Structured::execs`
  gives each vector instruction's EXEC bit.
- Vector instructions are guarded by EXEC. Branches are the console's
  s_cbranch_*: EXEC, VCC and mask-operation SCC tests are the console
  wave's, from both halves' ballots exchanged through group-shared
  memory between group barriers, which every thread reaches since both
  halves branch alike.
- Masks read whole are the exchanged ballots. v_readlane and
  v_readfirstlane read the owning half; v_writelane, v_mbcnt and mask
  bit tests use the console lane.

The per-lane form is tried first; a program that needs the console
flow is lowered again from the console structure.

GPU tests on an RTX 5070 are exact against the console: s_bcnt1 over
both halves (64, 48 and 32 threads), v_readlane 40, an exchange inside
a branch only the lower half takes, and a loop the halves leave at
different iterations with a lane read in each. The last one shows that
the per-lane form, which hosts with 64-lane waves get, is wrong for it
(on a Radeon iGPU): noted in docs/wave64-on-wave32.md, not changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A wave64 program split over two 32-lane waves took the DPP row index
from the host lane, so the upper half (console rows 2 and 3) read
row_mask bits 0 and 1. The row now comes from the console lane there.
New test: v_mov_b32_dpp with row_mask:0x3 writes lanes 0 to 31 only,
exact on an RTX 5070 (split) and a Radeon iGPU (native).

Found in review against #189 and #192, which both get this right.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
v_readfirstlane reads the console wave's first lane. A wave64 program
with DPP or ds_swizzle and a v_readfirstlane was split into two 32-lane
waves, where the upper half read its own first lane: with all 64 lanes
active, lanes 32 to 63 got lane 32's value where the console gives
lane 0's (measured on an RTX 5070).

Such programs now take the console flow, which reads the first lane in
EXEC of the whole console wave (groups of at most 64 threads, no LDS),
or stop with the reason as they did before the split existed.

New test, exact on an RTX 5070 and a Radeon iGPU. Found by running the
same program against #192, which has the same result on both adapters.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
On the console v_readlane and v_writelane ignore EXEC, and a wave runs a
loop while any of its lanes does. The per-lane form runs branches and
loops per lane, so a lane that left a loop or skipped a branch is not
there to be read or written, and never sees the scalars set inside
(#225):

- a loop lane t runs t times, reading lane L in each iteration: 12 of
  32 lanes wrong in waves of 32 (RTX 5070, Radeon iGPU), 24 of 64 in
  waves of 64 (Radeon);
- v_writelane to lane 40 inside a branch only lanes below 20 take: lane
  40 was never written.

A compute program with v_readlane or v_writelane, a branch that is not
uniform, no ds_(b)permute and no whole-wave sections now runs in the
console flow on every host. Where the host runs the console's wave
size, one host wave is the console wave: ballots are the wave's own and
nothing is exchanged, so any group size and LDS are fine. A program the
console flow cannot lower keeps the per-lane form
(`Parts::per_lane_only`), so nothing that translated before is refused.

Both cases are now exact on an RTX 5070 (wave32 natively, wave64 in two
halves) and on a Radeon iGPU (both natively).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The loop form compilers emit keeps the lanes that are done in an exit
mask that starts as 0 (s_mov_b64 s[2:3], 0; in the loop s_or_b64
s[2:3], vcc, s[2:3] and s_andn2_b64 exec, exec, s[2:3]). In the console
flow every mask join is a phi, and its incoming values had to be masks
derived from EXEC or a VALU result, so such a loop stopped with "a
lane-mask join of an untracked mask".

`Structured::others` gives the lane's bit of the other values read as
masks (constants, uniform selects, opaque ones), and the console flow's
mask joins take them. The per-lane form is unchanged.

New test: a loop in that form with a lane read in every iteration and
the exit mask counted afterwards. It was refused on an RTX 5070 before
and is exact there (in two halves) and on a Radeon iGPU now.

Found through the test report on #233 that tried #269's programs.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Drivers create pipelines from some modules the DXIL validator refuses
(D3D12 checks only the container hash we write). The hand-assembled
split and console-flow programs now go through dxil.dll's validator
before pipeline creation, where one is installed. All of them pass.

Prompted by a report on #233 of pipelines created from modules that
fail validation.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
On the console one wave shares LDS without s_barrier, because it runs
an instruction in all 64 lanes before the next. A wave64 program of one
console wave per group that uses LDS stopped on hosts without 64-lane
waves (`a wave64 group sharing LDS without barriers`), and so did such
a program with cross-lane reads.

Both now take the console flow there. The halves reach every LDS
access together, and a group barrier before each access puts it after
every earlier one, whichever half made it.

What still stops says why: a group of more than 64 threads, ds_permute
across the halves, or a whole-wave section.

Two new tests (LDS written and read across the halves, one with the
lower half kept busy first) are exact on an RTX 5070 and a Radeon iGPU.
They also pass on the RTX 5070 with the barrier left out, so they check
the result, not that the barrier is needed.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The validator's message for an operation the stage or the entry's
properties do not allow ("Entry function performs some operation that
is incompatible with the shader stage or other entry properties") names
neither the operation nor the property, and it is the only message when
the call is in the entry function itself.

`victory translate --validate` now adds to each validator failure what
our own module declares and calls: its thread-group size, its wave size
and its dx.op operations (`emit::last_module_summary`, kept per thread
when a module is finished). Nothing of the console program is in it, so
a report of counts per reason is enough to see what the refused modules
have in common.

Prompted by a report on #233: modules that fail validation with that
message and still create pipelines, 20 of them new with #320, which I
cannot reproduce with hand-assembled programs.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The scan test of the previous commit goes through the carry of a prefix
sum only. These cover the other branch, where each half's reduction is
exchanged and combined: the sum of the lane ids, their maximum (in the
upper half), their minimum (in the lower half) and their bitwise or,
and a sum over a mask of lanes below 40, which straddles the halves.
A group with a partial upper half, or none, still stops with the
section's reason.

All exact on an RTX 5070 (two halves) and a Radeon iGPU (native).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
One console wave with no s_barrier whose LDS write and read sit in
different exec-masked blocks: every lane (or, after a 4096-iteration
loop, only lanes 32..63) writes dword t, then lanes 0..31 read dword
t + 32. A third case has the same masks with no branch around either
access. Hand-assembled; exact on an RTX 5070 (two 32-lane waves, console
flow) and a Radeon iGPU (one 64-lane wave).

The pattern is the one a reviewer measured stale reads for on #189. The
console flow orders the first two cases twice: a branch on EXEC is
decided by both halves through an exchange (a group barrier), and each
LDS access has a group barrier before it, so they also pass with the
second left out. The third has no branch, and with the barrier before
each LDS access left out the lower half of the RTX 5070 reads 0 in 20 of
20 runs (exact in 20 of 20 with it): the first test here that fails
without that barrier.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The startup warning on hosts without 64-lane waves still said every
console wave64 compute program that reads other lanes is dropped, and its
literal carried a run of spaces from a lost line continuation. It now
says such programs run as two 32-lane waves where there is a form for
them, and that the rest do not translate.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Cases for the ds_bpermute_b32 lowering of the commit before, each lane
checked on an RTX 5070 (two 32-lane waves) and a Radeon iGPU (one
64-lane wave): EXEC over part of each half, two console waves per group,
groups of 48 and 32 threads (a source lane that is not there reads 0),
and beside a v_readlane across the halves, which takes the console flow
on a host without 64-lane waves.

Also formats that commit's new lines for this crate's line width, and
the plan now lists ds_bpermute as an in-half read; ds_permute stays
open.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
In the console flow on a host without 64-lane waves, a whole-wave section
that leaves a float sum, minimum or maximum stopped with "a
floating-point whole-wave operation across 32-lane halves". Each half's
result now crosses as its bits, like the integer ones: minimum and
maximum through FMin / FMax, a sum as the two halves' sums added last,
and a prefix sum in the upper half adds the lower half's total. Groups of
exactly 64 threads, as for integers.

A sum's additions are in one more order than the console's and the host
wave's own, so its last bits may differ, as they already may in one host
wave.

Tests (hand-assembled, each lane checked on an RTX 5070 and a Radeon
iGPU): the lane ids as floats, their sum, maximum (in the upper half) and
minimum (in the lower half) with identities 0.0, -inf and +inf, a sum
over a mask that straddles the halves, and an inclusive prefix sum.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The wave64 plan had per-console-wave arrival counters with a bounded wait
for groups of more than 64 threads. A wait is met only if the partner
half runs meanwhile, which D3D12 does not promise and an RTX 5070 does not
do in the LDS tests, so that plan is dropped. For programs without LDS,
each console wave becomes a host group of its own (64 threads, the
dispatch's x count multiplied), which is the console flow as it is.
Groups that share LDS stay open, with the candidates named.

The group sizes and counts come from an offline translate over a local
copy of the title's shaders; no program content is in the document.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A v_cndmask_b32 whose selector derives from neither EXEC nor a compare (a
constant, a number built from scalars) stopped with "a select on an
untracked mask". In compute the lane can test its own bit of such a mask
by its console lane, as guards on such masks already do: the select now
takes the lane's bit from the structure's other masks, and a program
with such a select declares the console's wave size like the ones that
guard on them. Other stages are unchanged.

The high dword of a wave64 mask held as a number was found only when one
instruction wrote both dwords; written by two (s_mov_b32 each), lanes 32
to 63 tested the low dword's bits. The structure pass now records the
pair a mask's reader takes, and that is used where no single writer
exists. This applied to guards on such masks too.

Test (hand-assembled, each lane checked on an RTX 5070 and a Radeon
iGPU): a select on a mask of two constants and on one with a bit that
depends on the group, as a wave64 and as a wave32 program, in groups of
64 and 32 threads.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A loop-carried EXEC phi can depend on a latch phi that is not otherwise used. Discover deferred inputs before emitting mask phis, including inputs discovered while walking the deferred worklist. Extend the authored lane-read loop fixture by adding a second predecessor of the latch.
The test of the commit before dispatched on WARP only, which has no
32-lane waves, so it checked emission alone. It now runs like the other
lane-read loop test: emitted for each hardware adapter's waves,
validated, dispatched, and every lane compared (lane t stores t + 40).
Exact on an RTX 5070 (two 32-lane waves) and a Radeon iGPU; without the
structure change it stops with "a lane-mask join of an untracked mask".

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Two defects found with a contributor's fixture (a waterfall loop over
lane classes with a whole-wave section inside, reported on #439).

A mask copied dword by dword (EXEC restored with two s_mov_b32) is held
as a number, and that number is known only as the mask's own dword. In
the console flow the lowering followed that in a circle until the stack
ran out, which takes the process with it. It now stops with "an opaque
lane mask".

On a host that runs the console's wave size, a program with a lane read
in a divergent branch took the console flow only if it had no whole-wave
section, so one with both stopped with "a lane mask holding lanes
elsewhere read as data" there while a 32-lane host ran it. The rule
counted the lane reads sections make themselves; it now looks for a lane
read or write outside the sections and lets sections be, which the
console flow lowers as wave operations like the per-lane form. Such
programs fall back to the per-lane form as before if the console flow
cannot lower them.

Tests (hand-assembled): a lane read in a branch beside a whole-wave sum,
each lane checked on an RTX 5070 and a Radeon iGPU; and a mask copied
dword by dword, which overflowed the stack before and stops now.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A compute program with a numeric select declared the console's wave size
whether or not anything read the select's result. On a host without
64-lane waves that refused a wave64 program in a group of more than 64
threads only for a select nothing consumes, where it translated before
selects on numeric masks were lowered.

The ordinary lowering now runs first. Only when it stops on a select
with an untracked mask is the program lowered again with numeric selects
counted among the masks held as numbers.

From r4tedx/VIctory#5 (MichaelSmithAI). Picked onto shader/console-flow-lds
by r4.: the selector scan iterates every instruction here (the tester
tree's `live()` filter is another PR's), and the new lines are formatted
for this crate.
The in-half form cannot read the high word of a numeric mask. Let an unused select drop out and use the existing full-wave retry when its result is needed. Exercise both cases alongside a live swizzle and DPP read.
Keep the host wave target and console-flow lowering while bringing in per-lane waterfall resource tracking. Use the structured program for resource tracking in translation and tests, and prefer proved per-lane descriptor reads before the general console read-first-lane path.
The comment on the console flow's SCC said both write the old EXEC to
their scalar destination. Only saveexec does; wrexec writes the new EXEC
to both, so either write names the mask SCC tests.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
# Conflicts:
#	crates/victory-shader/src/emit/split_tests.rs
Lane t stays in the loop for t + 1 iterations and a scalar counts the
wave's iterations: 64. With the console flow branching on the saved EXEC
(fixed in 2466184) the loop ran once more with no lane in it and the
count was 65, on an RTX 5070 in the console flow. The program reads a
lane, so hosts with 64-lane waves run it in the console flow too (exact
on a Radeon iGPU).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
# Conflicts:
#	crates/victory-shader/src/emit/split_tests.rs
Main lowers a descriptor each lane holds by the path it took
(Source::LanePhi, #566) as a DXIL phi over the edges into the join. In
the console flow every lane reaches the join by the edge the wave took,
so the phi gave every lane that edge's descriptor, silently: the joined
if/else program of the waterfall tests, lowered in the console flow,
sampled the second texture in all 32 lanes where lanes 0-15 hold the
first (RTX 5070; the module passes dxil.dll).

The console flow now stops with its own reason there. A program that
takes the console flow only for its lane reads keeps the per-lane form
where that translates; one that needs it for the host's wave size stops
with the reason.

Found on the testers' branch, where #566 and the console flow first met.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A program with a named lane read and branches its lanes take differently
asks for the console flow on every host. With a descriptor joined per
lane the console flow refuses it (b623fd3), and emit keeps the per-lane
form: checked for any host, a 32-lane host and a 32-64 one, each module
validated by dxil.dll when present.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Clippy (chunks_exact_to_as_chunks, an error under -D warnings in CI)
on the test carried in 1f53745. No change in what it checks.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The GPU tests walk every hardware adapter and expect each to take the
console's wave-size-dependent programs in one form or the other. An
integrated GPU with narrower waves (an Intel UHD reporting 16-16 was
reported on #439) runs none of them: the translator refuses, correctly,
and 30 tests failed there for expecting a pipeline. The list now leaves
such an adapter out, by its wave range, as it already left out the
software renderer by name. An adapter no SM 6.6 device can be made on
stays listed, for its user to skip as before.

Checked on an RTX 5070 (32-32) and a Radeon iGPU (32-64): both still
listed, each_adapter_gets_what_it_runs and two split tests exact. Not
checked on a 16-lane adapter (none here).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The tests that walk every hardware adapter (split_tests, the lane-read
loop tests, each_adapter_gets_what_it_runs) opened each one by name, so
neither VICTORY_ADAPTER nor VICTORY_WARP=1 kept them off a card: a run
meant for the software renderer still dispatched on every GPU in the
machine.

The adapter list now honours them. VICTORY_TEST_ADAPTERS=<part of a
name>[,<part>...] lists only the adapters whose description holds one
of the parts; without it VICTORY_ADAPTER=<part> does the same, so one
setting keeps a whole shader test run on one adapter; VICTORY_WARP=1
lists none. An adapter that is left out is not opened at all.

Checked on a machine with an RTX 5070 and a Radeon iGPU, with two of
these tests: VICTORY_ADAPTER=Radeon and VICTORY_TEST_ADAPTERS=radeon
run on the Radeon only; VICTORY_WARP=1 and a name that matches nothing
run on no adapter.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Conflicts were where main's write marks (`emit::Options`, `emit_with`,
`translate_with`, `Parts::view_marks`) and its warm-up (`translate
--cache`, `host_shader` returning whether the entry was cached) met the
branch's `Target`:

- emit: `Options` gains `target` (default `Target::ANY`), so main's
  `emit_with` and `translate_with` keep their signatures; `emit(..,
  target)` and `translate_for(c, target)` stay as they were and fill it
  in. `Parts` has both `target` and `view_marks`. Main's retry with
  `structure::killing` is kept as it is.
- shader cache: `host_shader(container, target)` translates with main's
  write marks for `target` and keeps main's (result, cached) pair; the
  branch's key function is renamed `host_key`, since main now has a
  `key` for the build.
- `translate --cache` (new on main) asks `shader_cache::host_target()`,
  which is what a run's `pipeline::translate` uses, so warm entries are
  keyed as the run looks them up; `--cache` refuses `--host-lanes`.
- `translate` (the census) passes its target with main's `view_marks:
  true`; `--pipelines` documents both the host's wave sizes and main's
  pipeline library.
- victory-gpu `Host` keeps both `target` and main's `heap_atomics64`.
- The `Parts` and `emit` call sites main added (the `fuses_fmad` probe
  in `emit/host.rs` and tests in bvh, memory, semantics, stride,
  synthetic, valu and `emit::tests`) pass `Target::ANY`.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Main's newer lowering is kept as it is around the console flow: the
waterfall loop's `v_readfirstlane_b32` and the spilled-SGPR
`v_readlane_b32` keep their arms before the console-flow ones, the
helper-lane read stays in the per-lane `v_readfirstlane_b32`, and
`lane_bit_of`, `mask_number`, the heap and view guards and the write
marks are untouched. Resolutions worth knowing:

- `mask_dword`: the console flow's exchanged ballot comes first, then
  the split form's refusal, then main's `mask_number` for masks holding
  lanes elsewhere (per-lane form only: in the console flow every lane is
  at the block that writes the mask).
- `emit`: one `parts(st, res, console_cf)` closure serves the per-lane
  pass, the `CONSOLE_FLOW` retry with `structure_console`, and main's
  retry with `structure::killing` (pixel discards; never both).
- `structure`: `structure_as(program, helpers, console)` behind
  `structure`, `killing` and `structure_console`; `Structured` has both
  `execs` and main's `restored` / `discards`.
- Test host: `Host::new` takes `VICTORY_ADAPTER` first, else main's
  first adapter that is a GPU (so a machine without one still skips);
  `adapters()` and `Host::on` keep their own hardware test.
- Main's per-lane reasoning that does not hold where the wave takes the
  branches is switched off in the console flow: `never_taken` and the
  branch conditions `live_edges` collects (a lane comes along an edge
  whatever its own condition is, and SGPRs are the wave's). The console
  flow fills phis as it did before the merge.
- Main's 16-bit whole-wave section (`Shape::Half`) reduces over the host
  wave and reads lane `hi` of it: refused in a program split in halves,
  as the other reductions are.
- The `Parts` sites main added pass `console_cf: false`.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Main's `v_cndmask_b32` now takes masks that derive from neither EXEC nor
a compare (`Structured::other`, inline constants) and tests the lane's
bit of the number. In a wave64 program run as two 32-lane waves without
the console flow, `lane_bit` has only the host lane: lanes 32..63 would
test the low word. Guards and branch conditions on such masks already
keep a program out of that form, a select's mask does not, so the merged
code reached `lane_bit`'s debug assertion (and, without assertions, the
wrong bits).

`lane_bit` now returns the refusal instead of asserting. The select then
has no result, and the program stops with that reason if the result is
used.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings main (940d32f), the two lower levels' merges of it, and the
console-flow branch's adapter filter for the every-adapter tests
(d8921a5), which this branch did not have yet.

- `emit`: the `parts` closure takes `per_lane_only` too. A program that
  stops with `CONSOLE_FLOW` is lowered from `structure_console`, and
  falls back to the per-lane form (`per_lane_only`) with the console
  flow's reason when that fails, as before; main's retry with
  `structure::killing` stays a separate arm.
- `Structured::others` is dropped for main's `Structured::other`, which
  is the same map (masks that derive from neither EXEC nor a VALU
  result): the console flow's mask joins read `other`.
- The `Parts` sites main added pass `per_lane_only: false`.
- `split_tests`: this branch's tests, then the lower level's new
  `selects_on_numeric_masks_are_refused_in_halves`.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings main (940d32f) through the three lower levels' merges, and the
adapter filter for the every-adapter tests (d8921a5).

- `v_cndmask_b32`: main takes selectors from `Structured::other` and
  inline constants; this branch defers a select on a mask held as a
  number until its result is used. Together: a uniform selector (main's
  `s_cselect` case) needs no lanes and is lowered as on main; a constant
  lane set or a number built from scalars tests the console lane's bit
  where there are console lanes outside the in-half form, and is
  deferred (`UNTRACKED_SELECT`, then the pass with console lanes) in
  compute otherwise. The numeric-select pass counts inline constant
  selectors as masks held as numbers too. Other stages keep main's
  refusals.
- `ds_bpermute_b32`: one arm, main's (its 16-bit offset, `lane_bit_of`),
  gathering within the reader's 32-lane half as this branch lowers it
  (RDNA 2). In wave32 programs that is what main did; in wave64 ones main
  gathered across the whole wave. The form decision keeps treating it as
  an in-half read.
- `Structured::others` is main's `Structured::other`; `pairs` reads it.
- The group barrier before an LDS access in the console flow also
  precedes main's byte and half accesses.
- `split_tests`: the lower level's constant-mask select test becomes
  `selects_on_constant_masks_beside_in_half_reads`: here such a program
  takes the console flow on a host without 64-lane waves instead of
  stopping.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A compute program's image_sample or image_sample_b has no valid DXIL
form yet: the module fails validation with "an operation that is
incompatible with the shader stage" (#201). Drivers take such a module
in the per-lane form. In the console flow in two 32-lane halves the
same module also carries group barriers inside its branches and loops,
and a title run on an RTX 4070 lost its device in a submission of two
of them (ptfx_CS_lightAtlas_Sprite and _Trail, reported on #233 from
fxceless/victory-gta6@e9765a7). That is the best-supported reading,
not a proven cause.

On a host without 64-lane waves such a program now stops, by name,
with "an implicit-derivative sample in the console flow on a host
without 64-lane waves". The per-lane form and hosts with 64-lane waves
are unchanged.

Offline over the title's shader pack (local title data, CPU only,
counts only; 32-lane host): exactly 12 compute programs change, all from
"emitted, fails validation" to this refusal; none that validates is
lost. Both programs named in the report and the one tied to an earlier
RTX 3080 report are among them. None of the 12 ran on a 32-lane card
before this stack.

Test (CPU only, no device): emit::tests::
implicit_samples_stop_the_console_flow_in_halves; it fails with the
guard disabled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A wave64 program that restores EXEC dword by dword from a mask
(s_mov_b32 exec_lo, s12; s_mov_b32 exec_hi, s13) leaves the structure
pass holding the mask as a number that is known only as the mask's own
dword. With console lanes the lowering followed that in a circle until
the stack ran out, which ends the whole process: a translator run, or
the runtime translating a title's shader. Reproduced at this level after
the merge with main 940d32f with the test below (stack overflow).

The opaque-mask arm now stops with "an opaque lane mask" when it meets
the mask it is already reading, as #439 has done since f12df1e. Test
taken from there: a_mask_copied_dword_by_dword_stops_instead_of_recursing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The copied-mask recursion guard that came with it (7147671) is the one
this branch has had since f12df1e: its field, initialiser and test are
kept once, as they were here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
vkd3d-proton's DXIL conversion keeps one back edge per loop header, as
DXC's code has. With several, the others stay in the header's forward
predecessors and form a cycle, and in programs with wave shuffles its
dominator search then recursed without end: the thread overflowed its
stack and, under Wine, hung. The ray-tracing shadow passes do this once
they translate. The back edges of a header with several now go through
one new block that joins their phi values.

(cherry picked from commit d48ec767ba)
The console flow's nested loops leave an inner loop's latch straight to
the outer loop's header: one block that branches back to two headers.
dxil-spirv keeps one back edge per block and takes the other for a
forward edge. In a program with WaveReadLaneAt its shuffle pass
(flatten_subgroup_shuffles) analyses the CFG before anything rewrites
extra back edges, and its loop-exit search (LoopMergeTracer) recurses
over that cycle without end: the pipeline thread overflows its stack, or
with a large stack eats memory until the process dies (fdd56d97a806bcca
on #439, which adds the lane reads; seen natively, 40 GB in 40 s).

single_latches (#1885, one back edge per header) now also sends such a
block's edge to the outer header through a new block of its own, so the
block stays the inner loop's exiting latch, as in DXC's loops. The
write-time fold of empty latches no longer folds one into a block that
already branches back, which would undo that.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: GPT-6.2 Sol (Codex) <[email protected]>
Co-Authored-By: GPT-6.2 Sol (Codex) <[email protected]>
Co-Authored-By: GPT-6.2 Sol (Codex) <[email protected]>
Co-Authored-By: GPT-6.2 Sol (Codex) <[email protected]>
Co-Authored-By: GPT-6.2 Sol (Codex) <[email protected]>
Co-Authored-By: GPT-6.2 Sol (Codex) <[email protected]>
Co-Authored-By: GPT-6.2 Sol (Codex) <[email protected]>
80f5663 took SGPR spills out of the lane reads that ask for the console's
wave size, so a compute program whose only lane reads and writes are
spills lost WaveSize on every host, Target::ANY included, where main
gives the console's wave size and emulates the lane writes. Keep main's
per-lane form there: on a host that runs the console's wave size, any
v_readlane/v_writelane still asks for it. On a 32-lane host spills stay
per-lane with no wave size, and the console flow still skips them.

The test now wants WaveSize(64) on ANY and none on 32-32, both from the
first (per-lane) pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brings d5f8f2c (SGPR spills keep main's wave size where the host runs
it). `whole` keeps this branch's ds_bpermute_b32 exception beside
#320's named_lane.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolutions:
- emit/host.rs: main's shared WARP device, WARP lock and from_device
  (#244) with #439's adapter list and Host::on; create_device takes the
  adapter Host::on found.
- emit/lower.rs: main's #573 ds_bpermute_b32 form (half base only in a
  native wave64); main's scalar_def helpers and uniform_join next to
  #439's numeric and console_read_lane; the lane-mask join takes #439's
  console-flow masks (`other`) and main's number/no-mask arms, with
  #439's lane_bit returning a Result.
- apps/victory main.rs: main's NonZeroUsize jobs with #439's host_lanes.
- Tests from main pass #439's new arguments (emit's Target,
  Parts::target/console_cf/per_lane_only, Options::target);
  a_scalar_result_needs_no_exec lowers the per-lane form (per_lane_only),
  since a v_readlane past a per-lane branch now asks for the console flow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
bitcode.rs: main moved block folding into Module::plan. This branch's
rule sits there now: an empty latch is not folded into a block that
already branches back (branches_back over plan's edges), and
single_latches/successors follow the edges plan writes (Module::term, so
a constant branch's dead edge is not counted).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With #439 merged into main 63bcca4, lower.rs grew to 559,370 bytes, past
the asset policy's 524,288-byte limit (xtask repository_passes_policy).
Its inline test module moves to its own file unchanged (dedented only);
lower.rs is now 506,198 bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:01:51 +00:00
Author
Owner

@⁠desplmfao on GitHub · 2026-11-25 11:18 UTC · original

@⁠catminou4 thanks. The size comes from the stacking: this PR's diff against main includes all of #439 (and #320/#233 with it), and that's where the +3,763 lines, the docs and the --host-lanes CLI come from. The change itself is only the last two commits, both in crates/victory-shader/src/emit/bitcode.rs: 364c1bc (powplusplus's commit from #1885) and 91e3bdf. Compare against #439's head to see just those.

r4tedx is taking both commits into #439 (see #439). Once they're in, I'll close this one as included.

**@⁠desplmfao** on GitHub · 2026-11-25 11:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/2309#issuecomment-7160873842) @⁠catminou4 thanks. The size comes from the stacking: this PR's diff against `main` includes all of #439 (and #320/#233 with it), and that's where the +3,763 lines, the docs and the `--host-lanes` CLI come from. The change itself is only the last two commits, both in `crates/victory-shader/src/emit/bitcode.rs`: `364c1bc` (powplusplus's commit from #1885) and `91e3bdf`. Compare against #439's head to see just those. r4tedx is taking both commits into #439 (see https://git.gtahub.st/github/Marvisak--VIctory/pulls/439). Once they're in, I'll close this one as included.
Author
Owner

@⁠desplmfao on GitHub · 2026-11-25 11:32 UTC · original

Update after r4tedx's note on #439: this stays its own PR. I've merged #439's current head (3fab5a1) into it (no conflicts, merged rather than rebased). The change is still the two commits in bitcode.rs, 364c1bc (powplusplus, from #1885) and 91e3bdf. On the merge, cargo test -p victory-shader --lib (Linux) gives 151 passed, and clippy is clean. To review just the change, compare against #439's head.

**@⁠desplmfao** on GitHub · 2026-11-25 11:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2309#issuecomment-7161171127) Update after r4tedx's note on #439: this stays its own PR. I've merged #439's current head (`3fab5a1`) into it (no conflicts, merged rather than rebased). The change is still the two commits in `bitcode.rs`, `364c1bc` (powplusplus, from #1885) and `91e3bdf`. On the merge, `cargo test -p victory-shader --lib` (Linux) gives 151 passed, and clippy is clean. To review just the change, compare against #439's head.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:22 UTC · original · edited 2026-11-26 02:18 UTC

Automated triage for the maintainers.

Needs work. ec845d6 merges cleanly and CI check passes, but the diff against main (+4,971 / -1,457, 28 files) is almost entirely #439 (r4tedx's wave64 console flow, merged with main on update/439-main), plus this PR's own rule in Module::plan (crates/victory-shader/src/emit/bitcode.rs: one back edge per block, commits 364c1bc/91e3bdf) and the move of lower.rs's tests to emit/lower/tests.rs. Merging it would land #439 in a rebased form that #439's own thread has not reviewed; #439 itself still conflicts with main (marked needs-rebase for 3fab5a1).

What would move this forward: #439 rebased and decided on its own (or the maintainer choosing to take it through this branch), and then this PR reduced to its own commits on top, so the back-edge rule can be reviewed by itself.

On your replies: the plan placement and the Module::term use for constant branches sound right, and the tests move fixes the policy failure, but they do not change the stacking problem above. Also note #2084 and #2117 add to lower.rs as well; once the tests move lands, they will need to follow it.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2309#issuecomment-7166738625) · edited 2026-11-26 02:18 UTC <!-- victory-triage v1 head=ec845d633b47e4f98789a8f0353c172f3070d942 verdict=needs-work at=2026-11-26T02:24:00Z --> Automated triage for the maintainers. **Needs work.** `ec845d6` merges cleanly and CI `check` passes, but the diff against `main` (+4,971 / -1,457, 28 files) is almost entirely #439 (r4tedx's wave64 console flow, merged with `main` on `update/439-main`), plus this PR's own rule in `Module::plan` (`crates/victory-shader/src/emit/bitcode.rs`: one back edge per block, commits `364c1bc`/`91e3bdf`) and the move of `lower.rs`'s tests to `emit/lower/tests.rs`. Merging it would land #439 in a rebased form that #439's own thread has not reviewed; #439 itself still conflicts with `main` (marked needs-rebase for `3fab5a1`). What would move this forward: #439 rebased and decided on its own (or the maintainer choosing to take it through this branch), and then this PR reduced to its own commits on top, so the back-edge rule can be reviewed by itself. On your replies: the `plan` placement and the `Module::term` use for constant branches sound right, and the tests move fixes the policy failure, but they do not change the stacking problem above. Also note #2084 and #2117 add to `lower.rs` as well; once the tests move lands, they will need to follow it. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠desplmfao on GitHub · 2026-11-25 15:43 UTC · original

Thanks for the triage. On the three points:

  1. Landing order: agreed. #439 itself conflicts with main right now, and this PR is stacked on it, so I'll follow #439's next head. Once #439 is in, I'll merge main here (no rebase or force-push, to keep the review history) so the diff comes down to the two bitcode.rs commits.
  2. 364c1bc (from #1885): I'm asking @⁠powplusplus on #1885 whether it lands there or here, so it doesn't land twice. If #1885 lands first, I'll drop it from here.
  3. Native D3D12: the change rewrites the DXIL the translator emits, so it applies on any host, not just under vkd3d-proton. Of the title's 413 dumped programs, the 405 without these loop shapes give byte-identical output, so native D3D12 sees no change for them. The 8 that change get a different but equivalent control-flow graph: the second back edge goes through its own latch block, and the phis are rewritten to it. I haven't run those 8 on a native Windows driver. That would be the one thing worth checking there, and I'll ask on the PR for someone with Windows to try them.
**@⁠desplmfao** on GitHub · 2026-11-25 15:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/2309#issuecomment-7167270927) Thanks for the triage. On the three points: 1. **Landing order:** agreed. #439 itself conflicts with `main` right now, and this PR is stacked on it, so I'll follow #439's next head. Once #439 is in, I'll merge `main` here (no rebase or force-push, to keep the review history) so the diff comes down to the two `bitcode.rs` commits. 2. **`364c1bc` (from #1885):** I'm asking @⁠powplusplus on #1885 whether it lands there or here, so it doesn't land twice. If #1885 lands first, I'll drop it from here. 3. **Native D3D12:** the change rewrites the DXIL the translator emits, so it applies on any host, not just under vkd3d-proton. Of the title's 413 dumped programs, the 405 without these loop shapes give byte-identical output, so native D3D12 sees no change for them. The 8 that change get a different but equivalent control-flow graph: the second back edge goes through its own latch block, and the phis are rewritten to it. I haven't run those 8 on a native Windows driver. That would be the one thing worth checking there, and I'll ask on the PR for someone with Windows to try them.
Author
Owner

@⁠desplmfao on GitHub · 2026-11-26 01:18 UTC · original

#439 has conflicted with main since this morning, so this PR now sits on update/439-main (f7d4feb). That branch is #439's head 3fab5a1 with main (63bcca4) merged in, and r4tedx's commits are unchanged. f93574a merges it here.

  • main moved block layout and folding into Module::plan, so this PR's rule now sits there. An empty latch is not folded into a block that already branches back, counted over the edges plan writes.
  • successors() uses Module::term, so a branch on a constant doesn't count its dead edge.
  • Clippy is clean, with and without diagnostics. victory-shader under vkd3d-proton gives 340 passed. The 8 failures are the same 8 that plain main fails there.
  • The bitcode tests pass, including empty_latches_to_two_headers_fold_once.

When #439 is updated upstream, this PR follows its head again.

**@⁠desplmfao** on GitHub · 2026-11-26 01:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/2309#issuecomment-7179642422) #439 has conflicted with `main` since this morning, so this PR now sits on [`update/439-main`](https://github.com/desplmfao/VIctory/tree/update/439-main) (`f7d4feb`). That branch is #439's head `3fab5a1` with `main` (`63bcca4`) merged in, and r4tedx's commits are unchanged. `f93574a` merges it here. - `main` moved block layout and folding into `Module::plan`, so this PR's rule now sits there. An empty latch is not folded into a block that already branches back, counted over the edges `plan` writes. - `successors()` uses `Module::term`, so a branch on a constant doesn't count its dead edge. - Clippy is clean, with and without diagnostics. victory-shader under vkd3d-proton gives 340 passed. The 8 failures are the same 8 that plain `main` fails there. - The bitcode tests pass, including `empty_latches_to_two_headers_fold_once`. When #439 is updated upstream, this PR follows its head again.
Author
Owner

@⁠desplmfao on GitHub · 2026-11-26 01:30 UTC · original

The check failure on f93574a was the asset policy's file size limit: with #439 merged into main, crates/victory-shader/src/emit/lower.rs reached 559,370 bytes, past the 524,288-byte limit (xtask repository_passes_policy). 68ba2de on update/439-main moves lower.rs's inline test module unchanged into emit/lower/tests.rs, leaving lower.rs at 506,198 bytes. ec845d6 merges it here.

Anything that changes lower.rs's tests (this PR, #439, or another PR stacked on them) now has to edit emit/lower/tests.rs. A PR that still adds tests inline in lower.rs will conflict, or push the file back over the limit.

**@⁠desplmfao** on GitHub · 2026-11-26 01:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2309#issuecomment-7179834815) The `check` failure on `f93574a` was the asset policy's file size limit: with #439 merged into `main`, `crates/victory-shader/src/emit/lower.rs` reached 559,370 bytes, past the 524,288-byte limit (`xtask` `repository_passes_policy`). `68ba2de` on `update/439-main` moves `lower.rs`'s inline test module unchanged into `emit/lower/tests.rs`, leaving `lower.rs` at 506,198 bytes. `ec845d6` merges it here. Anything that changes `lower.rs`'s tests (this PR, #439, or another PR stacked on them) now has to edit `emit/lower/tests.rs`. A PR that still adds tests inline in `lower.rs` will conflict, or push the file back over the limit.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2309'
git switch 'github-bot/gh-2309'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2309'
git switch 'github-bot/gh-2309'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2309'
git switch 'main'
git merge --squash 'github-bot/gh-2309'
git switch 'main'
git merge --ff-only 'github-bot/gh-2309'
git switch 'main'
git merge 'github-bot/gh-2309'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2309
No description provided.