Skip to content

Shaders: model v_permlane16_b32 in whole-wave sections - #98

Open
tedin7 wants to merge 1 commit into
Marvisak:mainfrom
tedin7:vic-permlane16
Open

tedin7 wants to merge 1 commit into
Marvisak:mainfrom
tedin7:vic-permlane16

Conversation

@tedin7

@tedin7 tedin7 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

What

  • Whole-wave sections (emit/wave.rs): model v_permlane16_b32 next to v_permlanex16_b32. Lane i of a row picks nibble i of {src2, src1} from its own row of 16 (permlanex16: from the other row of its 32).
  • Both only when every lane is active; with fi/bound_ctrl an inactive lane's read differs, so a partial EXEC stays unknown instead of being guessed.

Why

  • v_permlane16_b32 fell into the catch-all, so its result was Sym::Unknown and a reduction/prefix using it (a row total read from lane 15 of the own row) was no longer recognised as a wave operation.

Tested
Linux x86_64 only, synthetic code words (assembled with llvm-mc gfx1030), no game files:

  • New test permlane16_reads_the_lanes_own_row: a wave32 sum (DPP row reduction, permlane16 -1,-1, permlanex16 -1,-1, add) must come out as the active-lane AddU. Before the fix it fails (None), after it passes.
  • cargo test -j4 --manifest-path Cargo.toml -p victory-shader : 52 passed
  • cargo clippy -j4 -p victory-shader --tests : no warnings in wave.rs
  • rustfmt --check --edition 2024 crates/victory-shader/src/emit/wave.rs : clean

Not run: Windows runtime, any GPU, the HLSL diff tests.

Not touched: console_lanes in lower.rs does not list v_permlane* (it lists ds_swizzle, permute, v_mbcnt, v_readlane, DPP). Left alone to keep this to one change.

A wave reduction that reads a row total with v_permlane16_b32 left the value unknown, so the wave operation was not recognised. It now picks within the lane own row, like v_permlanex16_b32 picks from the other row, and both only with every lane active (fi and bound_ctrl decide what an inactive lane reads).
@DaviTostes

Copy link
Copy Markdown

Tested f468457 stacked on #39 on Arch Linux x86_64, rustc 1.98.1: pass.

  • cargo test --workspace: 155 passed, 0 failed, 3 ignored; merge with Build: make workspace tests run on Linux #39 clean.
  • The PR adds one #[test] for the whole-wave v_permlane16_b32 section modelling, included in that run.
  • No game data used.

AI-assisted (DeepSeek V4.1 Flash coding agent).

@lordon1a

Copy link
Copy Markdown
Contributor

Verified f468457a1 on Windows 11 (x86_64-pc-windows-gnullvm, rustc 1.100.0, applied cleanly to main@4c0bb89): pass.

  • cargo xtask policy: 151 files ok
  • cargo test -p victory-shader -- --skip v_med3_f32_matches_rdna2_with_nan: 69 passed, 0 failed.

AI-assisted.

@NolanCotter NolanCotter mentioned this pull request Nov 24, 2026
3 tasks done
edsuuu referenced this pull request in edsuuu/VI-BR-PORT Nov 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
r4tedx added a commit to r4tedx/VIctory that referenced this pull request Nov 24, 2026
…73d66, and Marvisak#180)

The wave64 stack (Marvisak#223, Marvisak#233, Marvisak#320, Marvisak#439, with Peter Bonanni's
whole-wave sections across the halves, 9b73d66) merged with Marvisak#180 (twin
descriptor loads and quad gradients for compute samples), at 24b3bcc.
That commit has one parent (e49302a); Marvisak#180's changes come in without
its commits. Marvisak#233 is in this tree as 1eb9995, the same tree as
3098672, so each file was merged with 3098672 as the base instead of
the e0865d2 git chooses.

Conflict resolutions:
- emit/wave.rs, v_permlane16/x16 in whole-wave sections: Marvisak#98's "every
  lane active" and 9b73d66's "or fi set" are both kept, for both
  instructions.
- emit/lower.rs, Lower::new: Marvisak#320's test for lane reads and writes in
  divergent programs counts live instructions only, as Marvisak#233's does
  with Marvisak#309 (dead SGPR-spill lane instructions are no lane reads).
  Marvisak#307's waterfall arm of v_readfirstlane still comes before the
  console-flow arm; Marvisak#320 adds no arm of its own.
- Compute samples with implicit derivatives (Marvisak#160, Marvisak#180, Marvisak#306): Marvisak#180
  decides plain and biased samples, all of Marvisak#160's forms of them
  (implicit_derivatives from sample_form: _o, _cl, cube, a16), with
  Marvisak#160's bias address (bias_at) and level clamp; Marvisak#306's validator 1.8
  is now declared only for what still uses the host's derivatives in
  compute (comparison samples, op 64). The Marvisak#306 test of image_sample
  now asserts no 1.8 (48-byte PSV0) and still validates and creates
  the pipeline; a twin test with image_sample_c asserts 1.8.
- sgpr_spill test (Marvisak#309): without forwarding, the per-lane form still
  stops with "a lane mask holding lanes elsewhere read as data", but
  emit now takes the console flow (Marvisak#320); the test checks both, and
  that forwarded spills do not ask for the console flow.
- Mechanical: per_lane_only in two hand-built Parts in emit/lower.rs
  tests; emit/mod.rs module order (split_tests before threading).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NolanCotter NolanCotter mentioned this pull request Nov 24, 2026
3 tasks done
r4tedx added a commit to r4tedx/VIctory that referenced this pull request Nov 24, 2026
Marvisak#439's branch, shader/console-flow-lds, went from e49302a to f653ea4.
The stack came into this tree through integration/wave64-with-180,
whose commit has one parent, so the four commits are picked onto this
tree in order rather than merged:

- a32c177: test, LDS written and read in different masked blocks.
- 8876ed3: the startup warning on hosts without 64-lane waves says
  what the stack does now (one string in crates/victory-gpu/src/host.rs).
- 416714c, from Raxstreams's pull request #2 (git author
  Peter Bonanni): ds_bpermute_b32 lowered as a read within the lane's
  own 32-lane half.
- f653ea4: tests for it, and the plan document.

Conflict resolution, crates/victory-shader/src/emit/lower.rs,
Lower::new, `in_half`: Marvisak#180's `implicit_derivatives` and 416714c's
`ds_bpermute_b32` are both kept. The three `permute` conditions took
416714c's text unchanged; Marvisak#98's v_permlane16 handling is in
emit/wave.rs and its name does not contain "permute", so they do not
meet. The added and removed lines of this merge are the same as those
of `git diff e49302a f653ea4`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@mercuryVM mercuryVM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested f468457 on Windows 11, RTX 5070, MSVC: the workspace passes (170 outside victory-shader; victory-shader --lib single-threaded: 58; older base). victory translate <title exe> --validate --pipelines gives the same counts before and after: 12 of 12 programs emitted, 12 validated, 12 pipelines.

  • v_permlane16_b32 picks within the lane's own row (l & !15) and v_permlanex16_b32 from the other row of its half. Both pick with nibble l & 15 of {src2, src1}, which is the RDNA2 definition.
  • Restricting both to exec == all is the right fix and also tightens the existing permlanex16 arm. With inactive lanes, what a lane reads depends on FI and BOUND_CTRL, so leaving it Unknown instead of guessing is correct.
  • The new test is a real console expansion of a wave32 sum (DPP row reduction, then permlane16 and permlanex16). It turns from None into Active(AddU).

No issues found.

AI-assisted (Claude Code).

mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 24, 2026
…le-wave sections

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mercuryVM pushed a commit to mercuryVM/VIctory that referenced this pull request Nov 24, 2026
The same-row sibling of v_permlanex16_b32: each lane reads src0 of the
lane picked by its nibble of {src2, src1}, in its own row of 16 of the
32-lane half — the shared arm just skips the row flip. IR-modeled in
ir.rs and whole-wave-modeled in wave.rs (open PR Marvisak#98) but refused at
valu_op's fallthrough on main.

Smoke test runs the identity-pick selector program through opcode 0x377
(the same-row form) feeding an LDS store.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Xeltax pushed a commit to Xeltax/VIcky that referenced this pull request Nov 24, 2026
@zed6000

zed6000 commented Nov 24, 2026

Copy link
Copy Markdown

Measured on real data. I merged this PR onto main ffe310e and ran victory translate --validate --list over shaders.rpf from a retail 1.0.2.1 dump, then compared the result with main program by program. This is part of the offline benchmark in #1247.

29 compute programs that translate and validate on main stop translating with this PR. All 29 now fail with:

emit: a whole-wave section step the simulation does not follow

That reason covers 5 programs on main and 51 with this PR. The PR gains no programs on this data.

The unit tests pass, as the earlier comments say. The failure shows up only on the title's own code: the new modelling makes the whole-wave simulation refuse sections that it accepted before. Shader names and code are not included, per the asset policy. I can check a revised version against the same data.

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
KainanP pushed a commit to KainanP/VIctory that referenced this pull request Nov 24, 2026
…fied together

Merges Marvisak#156 Marvisak#162 Marvisak#168 Marvisak#169 Marvisak#368 Marvisak#379 Marvisak#456 Marvisak#587 Marvisak#990 Marvisak#1021 Marvisak#1048 Marvisak#1052 Marvisak#1053
Marvisak#1095 Marvisak#1142 Marvisak#1190 Marvisak#1211 Marvisak#1223 Marvisak#1259 Marvisak#1293 on top of the bundle of Marvisak#1402
(which is on Marvisak#1319, on main ffe310e), each head unchanged. Hunks that
conflicted in emit/lower.rs, emit/valu_tests.rs and emit/diff_tests.rs were
merged by keeping both sides (additions next to each other); a PR was kept
only if cargo clippy -p victory-shader --all-targets -- -D warnings still
passed with it. No instruction name is handled in two places.

Marvisak#98 is not in this version: an offline measurement on a retail dump showed
it loses 31 programs that validate on Marvisak#1402.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(381 passed, 6 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
KainanP added a commit to KainanP/VIctory that referenced this pull request Nov 24, 2026
Marvisak#704 + Marvisak#1511

- emit/mod.rs: the bundle structures the program before tracking resources
  (resource::track takes the structure since the bundle); Marvisak#309 forwards spilled SGPRs,
  which rewrites the IR. Order kept: forward, then structure, then track.
- emit/wave.rs: no conflict on this Marvisak#1511 head. On the previous bundle (which carried
  Marvisak#98's v_permlane16 tests) both sides added tests at the end of the module and the
  bundle's side was closed before Marvisak#309's tests; without Marvisak#98 git merges the two test
  lists itself, with Marvisak#309's tests as separate items of `mod tests` (not nested).
- sgpr_spill.rs (new in Marvisak#309, no textual conflict): its test helper called
  resource::track with the old 3-argument signature; adapted to the bundle's
  (structure first, passed to track). Test-only change.
KainanP added a commit to KainanP/VIctory that referenced this pull request Nov 24, 2026
…ge samples) onto Marvisak#309 + Marvisak#180 + Marvisak#704 + Marvisak#1511

PR Marvisak#160 head 5ce85c5, merged onto integ/next-v3 (0bb7335). The bundle
(Marvisak#1511) already carries Marvisak#306 (a16 bias as f16, a16 derivatives 32-bit),
10ac6ce (cube gradient samples, image_sample_d_cl) and cbc8c33 (image_get_lod
on cubes); Marvisak#180 adds compute image_sample/_b as sampleGrad with quad gradients.
Where Marvisak#160 and the bundle implement the same thing, they read the same address
layout: offset, bias and reference a full dword each (a16 bias an f16 in the low
half), derivatives 32-bit unless _g16, a16 packing only coordinates and level or
clamp. The bundle's Marvisak#306 layout is kept as the base and Marvisak#160's forms are added
to it.

gfx10/fields.rs (image_addr_dwords): both sides size derivatives by _g16 and
pack only coordinates and levels with a16. Kept the bundle's Marvisak#306 version (a g16
token rather than Marvisak#160's ends_with("_g16"), which gives the same count for every
opcode name) together with its a16_keeps_derivatives_32bit_outside_g16 test.

emit/host.rs (1 hunk): Marvisak#160 adds a test-host arm for Levels/CubeLevels/Depth
SRVs; the bundle (Marvisak#704) extended the UAV arm to BufferUav with a stride column.
Both arms kept: Marvisak#160's arm first, then the bundle's UAV arm unchanged.

emit/lower.rs:
1. Free functions after half_outputs: the bundle added half_inputs and Marvisak#160
   added SampleForm/sample_form/GATHER_AT_LEVEL in the same place. Kept both.
2. Opcode match: the bundle added "image_sample_d" | "image_sample_d_cl" to the
   fixed list, and Marvisak#160 replaced the list with the parsed form (_ if form.is_some()).
   Took Marvisak#160's. d_cl is the form {d, cl}, so it still lowers to SampleGrad with
   its clamp.
3-4. Address layout: the bundle had (Marvisak#306) first = offset + bias + cmp
   full dwords, 32-bit derivatives (2 per direction on a cube, 10ac6ce), and
   `at` = first + grads, from which the a16-packed coordinates and level start.
   Marvisak#160 had the same layout as whole/per_direction/first, plus _g16 derivatives and
   _cl. Kept the bundle's names and layout (first, graded, at, addr_dword) and put
   Marvisak#160's pieces on them: first is now o + b + c from the form (it was
   offset_word + (name == image_sample_b) + cmp); per_direction halves the
   derivative dwords for _g16 only; grad_at, coord_at, bias_at, float and known
   (Marvisak#160) read through the bundle's addr_dword in place of Marvisak#160's duplicate `raw`.
   Marvisak#306's to_float/addr_val pair for coordinates and Marvisak#160's float(coord_at(k))
   compute the same thing; the latter is kept because the level, clamp and known
   checks use it. The a16 refusal of comparisons in the bundle's code is
   dropped, as in Marvisak#160 (the reference is a full dword).
   Also, without a textual conflict: Marvisak#160 refused level queries on cubes
   ("... or a level query"), but the bundle lowers image_get_lod on cubes
   (cbc8c33). That refusal is dropped and only texel coordinates (both sides)
   and texel offsets (Marvisak#160) are refused on cubes. The bundle's `face` variable is
   kept in place of Marvisak#160's `cube_face`.
5. sample (60): the bundle's constant-offset code is the base code with
   addr_dword. Marvisak#160 moved offsets before the match (immediates in -8..7, otherwise
   a coordinate shift at a level known here) and added the clamp. Took Marvisak#160's
   version, reading the word with addr_dword.
6. sampleBias (61): bundle addr_val(offset_word, 0) + to_float, Marvisak#160
   float(bias_at). Both read the same position, an f16 low half with a16. Kept the
   bundle's comment and Marvisak#160's reader, plus Marvisak#160's clamp.
7. sampleGrad (63): the bundle reads `graded` 32-bit derivatives per direction,
   turns cube face derivatives into direction derivatives after reading, and
   reads its own _cl clamp. Marvisak#160 reads through grad_at (g16 too) with a per-face
   branch. Kept the bundle's structure (loop over `graded`, then the cube
   conversion) reading through Marvisak#160's grad_at, so _g16 works. The bundle's inner
   clamp is dropped for Marvisak#160's clamp, which comes from the same position
   (coordinate `coords`) and now covers every _cl form. Marvisak#160's `_cd` shortcut
   comment is kept.
8. sampleCmp/LevelZero (64/65): the bundle reads addr_dword(first - 1) and Marvisak#160
   reads float((o + b, None)). These are the same dword, since first = o + b + c
   and c is set. Kept the bundle's line. Marvisak#160's clamp is pushed for SampleCmp.
9. sampleLevel (62): bundle name == "image_sample_l" with addr_val(at,
   coords), Marvisak#160 f.l with float(coord_at(coords)). These are the same position.
   Took the form test so that _l_o and the others are covered.
10. gather (default arm): the bundle's checks and per-lane offsets are the base
    code with addr_dword. Marvisak#160 moved the checks into the op choice (level 0,
    comparison gathers, GATHER_AT_LEVEL) and the offsets ahead of the match.
    Took Marvisak#160's.
Duplicate method: 10ac6ce (bundle) and Marvisak#160 both add Lower::cube_gradient with
the same table (u, v move by 2 ds, 2 dt, the major axis by 0). With no conflict
git kept both. Kept Marvisak#160's, which shares by_face with cube_direction, and
removed the bundle's.

Marvisak#180 interaction (integration fix from
Marvisak#160 (comment), r4tedx):
Marvisak#180's compute image_sample/_b arm (sampleGrad from quad gradients) dropped the
level clamp, and before 5703405 it also read the bias at dword 0. With Marvisak#160,
_b_o, _cl and _b_cl_o reach that arm. The arm now reads the bias with
float(self, bias_at) (after the offset word, an f16 with a16; this is the same
position 5703405's addr_val(offset_word, 0) + to_float read) and pushes Marvisak#160's
level clamp instead of undef.

Marvisak#160 x Marvisak#306 interaction (no textual conflict; emit/shader.rs, lower.rs):
Marvisak#306 declares dx.valver 1.8 for a compute module with an implicit-derivative
sample (cs_derivatives, which Marvisak#180's sampleGrad arm also sets). Validator 1.8
counts a sample's level clamp (a non-undef clamp operand) as TiledResources use,
and 1.6 does not. Marvisak#160's _cl forms in compute (Marvisak#180's arm with the clamp above,
and SampleCmp for _c_cl) therefore failed "Flags must match usage" in
sample_and_gather_forms_lower_to_valid_dxil, comparisons_and_comparison_gathers_
match_per_texel_comparisons and texel_offsets_and_levels_sample_the_texels_they_name
(declared and actual flags differ by exactly 1 << 12). Marvisak#160 alone declares 1.6,
where this does not apply. Added flags::TILED_RESOURCES (bit 12, SFI0 0x100). It is
set when a sample takes a level clamp (Shader::lod_clamp) and the module declares
valver 1.8. Still needed on this Marvisak#1511 head: its Marvisak#1402 (119b763) only skips two
of Marvisak#306's own tests when dxil.dll is older than validator 1.8 and does not change
what Marvisak#306 declares.

Checked (on the previous Marvisak#1511 head, 289f241, which also carried Marvisak#98; this
replay was checked with cargo check --workspace --all-targets --all-features and
the full suite at the end of the line): cargo build --workspace --all-targets, clippy -D warnings, xtask
policy. cargo test --workspace on an RTX: 427 passed, 0 failed, 6 ignored. With
VICTORY_WARP=1 --no-fail-fast: 426 passed, 1 failed (valu_tests::
v_cndmask_on_an_untracked_mask_tests_this_lanes_bit, which also fails on the base),
6 ignored. #[test] count: base 424 + 8 from Marvisak#160 = 432 in the tree; the
victory-shader lib lists all 204 of its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KainanP added a commit to KainanP/VIctory that referenced this pull request Nov 24, 2026
…, Marvisak#320, Marvisak#439) onto Marvisak#160 + Marvisak#309 + Marvisak#180 + Marvisak#704 + Marvisak#1511

PR Marvisak#439 head 28aca3b (46 commits over main: Marvisak#223 wave-range targets, Marvisak#233
split halves and the console flow, Marvisak#320 lane reads where lanes branch,
Marvisak#439 LDS in one console wave, whole-wave sections across the halves,
ds_bpermute, numeric selects), merged onto the Marvisak#160 merge (b821b31), as the wave64 line of integ/next-v3.

emit/wave.rs: no conflict on this Marvisak#1511 head. The previous head carried
Marvisak#98 (f468457, v_permlane16 modelled next to v_permlanex16, only with every
lane active), which conflicted with Marvisak#439's a31c82e (an inactive lane also
accepted when fi, opsel bit 0, is set). Marvisak#98 is no longer in the bundle, so
the whole-wave simulation is Marvisak#439's: v_permlanex16 only, under
`exec == all || v.opsel & 1 != 0`.

structure.rs (1 hunk): the bundle only reformatted `paired_masks`; Marvisak#439
moved it after the new `execs`/`others`/`pairs` fields because `pairs`
borrows `self.masks` before `paired_masks` moves it. Kept Marvisak#439's order with
the bundle's formatting.

emit/waterfall_tests.rs (3 hunks):
1-2. The bundle split `build` into `build_with(words, buffers, nonuniform)`
   (a program with no per-lane handle, whose first-lane read is a wave
   operation); Marvisak#439 split the same function into `native`, `lower_as`
   (per-lane or console flow) and `host_shader`. Kept Marvisak#439's helpers and
   the bundle's `build_with` on top of them (lower_as(.., false), the
   bundle's two asserts, host_shader). host_shader keeps the stride_table
   field (Marvisak#704), which git merged outside the hunk.
3. Tests at the end of the file: the bundle's side ends inside the `for`
   loop of a_descriptor_only_read_as_data_gives_its_views_size, Marvisak#439's
   inside the `for target` loop of its last test. The bundle's test is
   closed before Marvisak#439's tests, so none is nested in another.

emit/lower.rs (6 hunks):
1, 3. Lower fields and their initializers: the bundle's `mask_scc` (Marvisak#309,
   SCC of a mask operation read as data) and Marvisak#439's `opaque_open` (stops
   the recursion of a mask copied dword by dword). Both kept.
2. Which compute programs need the console's lanes. The bundle (Marvisak#309) counts
   only live instructions (`sgpr_spill::dead`: lane moves forwarding left
   unread are not lowered); Marvisak#439 split the test into in-half reads, whole
   reads and masks held as numbers and added the split/console-flow choice.
   Kept Marvisak#439's structure, reading `live()` for reads_whole and in_half, and
   for lane_access_outside_sections (the console-flow trigger for lane reads
   where lanes branch differently). 1ca87f7 (in Marvisak#439) notes that the tester
   tree's `live()` filter belongs here once Marvisak#309 is in.
4-5. Selects on masks the structure does not follow. The bundle (48a41fb,
   from Marvisak#585) added `mask_cond` for v_cndmask_b32 and the v_*_co_ci_u32
   carry-ins: inline 0/-1 constants, the tracked boolean, else with console
   lanes this lane's bit of the register's number (pair in wave64). Marvisak#439
   (e461457, 1ca87f7, ccd9c44) takes, for v_cndmask only, the structure's
   boolean for masks held as numbers (`Structured::others`, which also finds
   the high word written by another instruction), only where the host lane
   is the console lane (not split in halves without the console flow), and
   declares console lanes for them only on a second lowering after the
   first stops on such a select (`lower`). Combined in `mask_cond`: tracked
   boolean, then Marvisak#439's `others` boolean, then the bundle's register number,
   both under Marvisak#439's condition (console lanes and not split without the
   console flow; the bundle's number path called lane_bit, which is wrong in
   a split program, where Marvisak#439 asserts it is never called). Both instructions
   use it; v_cndmask now also takes the bundle's inline constants.
   Without a textual conflict git had also kept the bundle's unconditional
   rule (any untracked select or carry-in declares console lanes) inside
   Marvisak#439's masks_held, which undid 1ca87f7 (a select nothing reads made a
   wave64 program in a group of more than 64 threads untranslatable on a
   32-lane host). The rule now counts live instructions and applies only on
   Marvisak#439's second lowering, which now also follows an untracked carry-in
   ("a carry-in from an untracked mask", UNTRACKED_CARRY). It covers every
   untracked selector, not only Marvisak#439's held masks with an opaque or constant
   atom, since the bundle's number path needs console lanes for selectors
   outside `others` too; on the first lowering nothing changes.
6. lower.rs test helper: Marvisak#439's three new Parts fields with the bundle's
   formatting.

Not textual, did not compile (test code only): Marvisak#439 gives `emit` a Target
and `lower::Parts` target/console_cf/per_lane_only. Tests that came with
the bundle, Marvisak#704, Marvisak#309 and Marvisak#160 used the old forms: image_tests.rs `lower`,
emit/mod.rs (3 emit calls, the stride-table Parts), lower.rs (2 Parts in
the int64 atomics tests), root_view_tests.rs, sgpr_spill.rs tests and
victory-gpu raw_view_tests.rs. They pass Target::ANY, console_cf false and
per_lane_only false, as Marvisak#439 did for the upstream tests.

Not textual, test-only (split_tests.rs): with Marvisak#309 a v_readlane whose
result nothing reads is dead (not lowered and, above, not counted).
saveexec_scc_tests_new_exec_not_saved_exec and
loops_leave_on_the_new_exec_of_saveexec used `v_readlane_b32 s14, v0, 10`
with s14 unread only to take the console flow. After the merge the loop
test failed on the RTX (per-lane form, lane t counted t + 1 iterations
where the console counts 64; it passes on Marvisak#439 alone), and the saveexec
test passed without taking the console flow (its per-lane result is also
42). Both now read s14 once (`s_mov_b32 s15, s14`, the branch over the
body +4), and a first lowering of each was checked to ask for the console
flow again on a 32..32 target.

Marvisak#180 interaction: r4tedx's integration (24b3bcc, from Marvisak#180 5ff639e) put
`implicit_derivatives` among the in-half reads that make a program need
console lanes. The Marvisak#180 merged here is aa69258, whose last commit takes
quad gradients out of the console-lanes test altogether ("a quad's four
lanes share a host wave of any size"), so there is no such term to place.
The quad reads stay inside one host wave in both Marvisak#439 forms (each half is a
host wave in the split and in the console flow, and in the console flow
samples run in every lane and are kept by a select on EXEC).

Checked on the previous Marvisak#1511 head (289f241, with Marvisak#98; this replay was
checked with cargo check --workspace --all-targets --all-features and the
full suite at the end of the line), on an RTX 4060 Laptop (32..32): cargo test --workspace --locked:
468 passed, 0 failed, 6 ignored (base 427 + 41). The 41 tests Marvisak#439 adds all
pass; the GPU ones ran on the RTX in two 32-lane halves ("split true").
VICTORY_WARP=1: 467 passed, 1 failed, 6 ignored; the failure is
valu_tests::v_cndmask_on_an_untracked_mask_tests_this_lanes_bit, which
fails on the base too (a fixed-WaveSize pipeline on WARP). victory-shader
lib tests listed: 204 -> 244 (Marvisak#439 adds 40 there and 1 in victory-gpu).
cargo clippy --workspace --all-targets -D warnings and cargo xtask policy
clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KainanP added a commit to KainanP/VIctory that referenced this pull request Nov 24, 2026
…sak#98, Marvisak#334 to Marvisak#492, validation)

The line rebuilt on the bundles' current heads (Marvisak#1402 119b763, Marvisak#1492 5bbc098
without Marvisak#98, Marvisak#1504 1d41891, Marvisak#1511 ca601f0) with every merge replayed, and the
merges after this file's first version (Marvisak#334, Marvisak#346, Marvisak#1024, Marvisak#211, Marvisak#492): merge
order, the runner's numbers on 967d3ae (RTX 571, WARP 570 + the known Marvisak#1084
failure, all features 580; Marvisak#98's one test leaves), what is not included (Marvisak#98,
Marvisak#282 for Marvisak#346, Marvisak#693 for Marvisak#1024, Marvisak#306's latest commit), and the open pull
requests whose head is contained here (109, from the 18:24 collection).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
@zed6000

zed6000 commented Nov 24, 2026

Copy link
Copy Markdown

Follow-up on main's new head 70564ae, with the same method (victory translate --validate --list on shaders.rpf 1.0.2.1, dxil.dll 1.8.2502, compared program by program). Merged onto 70564ae, this PR stops 44 compute programs that validate there from translating. That is up from 29 on ffe310e. All 44 now fail with:

emit: a whole-wave section step the simulation does not follow

It gains no programs. As noted on #1247, the losses disappear in integ/next only where this change was hand-merged with #439's emit/wave.rs. On top of #223, #233 and #320 alone, the losses remain. Offline counts only; no program names or data.

mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 25, 2026
Where a fork-only change duplicates upstream's own version of a feature,
upstream's is kept and the fork's dropped:
- victory-shader is upstream's crate with the fork-only merges replayed
  onto it oldest first; those that do not apply onto upstream are dropped
  (37 of 63: among them Marvisak#704/raw views, gather4_l, the lane-mask and Marvisak#308
  ports, Marvisak#947, Marvisak#1022, Marvisak#1112, Marvisak#1090, Marvisak#1182). Marvisak#284 (legacy fused madds) and
  Marvisak#98 (permlane16 in whole-wave sections) are dropped too: the first
  disagrees with upstream's hardware-checked model, the second refused 46
  programs upstream translates.
- translate: upstream's --cache replaces Marvisak#254's write-cache and work queue;
  Marvisak#378, Marvisak#517, Marvisak#673 and the victory.toml console are re-applied.
- victory-gpu: upstream's stride table, page table and heap views replace
  the fork's Marvisak#704/stride-table wiring; fork-only fixes re-applied on top.

Package (shaders.rpf, translate --validate --list, counts): vertex/pixel
emitted 12559 -> 14295 of 14337, compute 2359 -> 2628 validated, mesh
2730 -> 2811 validated. Tests: the failures left (rect fourth corner,
two stride tests, row order, gather4 at a level, memory table, dynamic
heap slots) fail on upstream main as well on this host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-shader/src/emit/wave.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

@zed6000

zed6000 commented Nov 25, 2026

Copy link
Copy Markdown

For the maintainers, alongside the triage above: the head it reviewed (f468457) is the head I measured offline, and it loses programs on the title's shaders. Merged onto 70564ae and compared program by program (victory translate --validate --list, shaders.rpf 1.0.2.1, dxil.dll 1.8.2502), 44 compute programs that validate on 70564ae stop translating. On ffe310e it was 29. They all fail with "a whole-wave section step the simulation does not follow", and the PR gains no programs.

The triage's behaviour note is the likely cause: v_permlanex16_b32 now gives an unknown result when EXEC is not full. Sections the simulation followed before therefore become unknown and are refused. The unit test only covers the full-EXEC case, so it passes. Keeping the previous v_permlanex16_b32 behaviour for partial EXEC, and adding v_permlane16_b32 only alongside it, may keep the new opcode without the losses. That's a guess from the note; I haven't tested it. Details are in the comments above and in #1247.

@zed6000

zed6000 commented Nov 25, 2026

Copy link
Copy Markdown

Tested the guess above: it holds. On 70564ae + this PR, I changed one line in emit/wave.rs, so that the full-EXEC condition applies only to the newly modelled v_permlane16_b32 and v_permlanex16_b32 keeps main's behaviour:

-                    (Some(s1), Some(s2)) if exec == all => {
+                    (Some(s1), Some(s2)) if exec == all || n == "v_permlanex16_b32" => {

Result, program by program over shaders.rpf (1.0.2.1, dxil.dll 1.8.2502):

Build Change vs 70564ae
70564ae + this PR as is 0 gained, 44 lost
70564ae + this PR + the line above 0 gained, 0 lost: all 44 validate again

permlane16_reads_the_lanes_own_row still passes, as do the other wave tests, on an RX 7900 XTX.

The PR's reasoning, that fi/bound_ctrl decide what an inactive lane reads, may well be right for both opcodes. If so, the stricter rule for v_permlanex16_b32 is a separate change from adding v_permlane16_b32, and it costs 44 programs on this title. It might be better split out, perhaps decoding the opsel bits instead of refusing outright. Offline counts only; no program names or data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants