Shaders: lower v_permlane16_b32 and v_permlanex16_b32 #49

Open
Altorru wants to merge 1 commit from upstream-pr/49 into main
Altorru commented 2026-11-25 06:06:46 +00:00 (Migrated from github.com)
First-time contributor

Imported from Zettrox/ztrx. Originally posted by Altorru on 2026-11-25T05:58:47Z.


Both instructions decode and their operands were known, but neither had a lowering, so any shader using one failed with '... is not supported' and its pipeline was dropped (issue #38 names a compute program stopped by v_permlanex16_b32). Each lane now reads src0 of a lane in its own 32-lane half, picked by nibble (lane & 15) of {src2, src1}: within its own row of 16 for v_permlane16, or the other row for v_permlanex16. The pick stays inside a half, so a console wave of 64 run as two host waves of 32 needs no exchange. Programs using either now ask for console lane order, as other cross-lane code does. The lowering is taken from fxceless/victory-fork@31714de; the console-lane detection and a host test are added here. Verification: cargo test -p victory-shader passes (171 tests; the new permlane16_and_x16_lower test builds both instructions and checks the cross-lane op is emitted).

<!-- greyfinch-sync:Zettrox/ztrx:issue:6598257859 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/49). Originally posted by [Altorru](https://github.com/Altorru) on 2026-11-25T05:58:47Z. --- Both instructions decode and their operands were known, but neither had a lowering, so any shader using one failed with '`...` is not supported' and its pipeline was dropped (issue #38 names a compute program stopped by v_permlanex16_b32). Each lane now reads src0 of a lane in its own 32-lane half, picked by nibble (lane & 15) of {src2, src1}: within its own row of 16 for v_permlane16, or the other row for v_permlanex16. The pick stays inside a half, so a console wave of 64 run as two host waves of 32 needs no exchange. Programs using either now ask for console lane order, as other cross-lane code does. The lowering is taken from fxceless/victory-fork@31714de; the console-lane detection and a host test are added here. Verification: `cargo test -p victory-shader` passes (171 tests; the new permlane16_and_x16_lower test builds both instructions and checks the cross-lane op is emitted).
hamdog0203 commented 2026-11-25 12:07:13 +00:00 (Migrated from github.com)
Author
First-time contributor

Imported from Zettrox/ztrx. Originally posted by hamdog0203 on 2026-11-25T11:50:53Z.


Independent verification on NVIDIA RTX 4060 (8 GB, Wave32, driver 621.35) + WARP + Windows SDK dxil.dll (10.0.26100.0), Windows 11 x64 (26200.9974), rustc 1.98.1, audited at commit e06eef85826bb942178fb2e8cabd3065996df158:

  • Code & security review: Clean, self-contained lowering for v_permlane16_b32 and v_permlanex16_b32 restricted to crates/victory-shader/src/emit/lower.rs (no unsafe, no external deps).
  • CI checks:
    • cargo clippy --workspace --all-targets --locked -- -D warnings: passed (0 warnings)
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed (0 warnings)
    • cargo test --workspace --locked: all crates passed with 0 failures (victory_shader: 211 passed, 2 ignored; xtask asset-policy: 4 passed)
    • cargo test --locked -p victory-shader --lib permlane16_and_x16_lower -- --nocapture: passed
  • Additional RTX 4060 + dxil.dll execution check: Since the PR's unit test only checks IR lowering (lower_with), I also temporarily ran a 32-lane compute test in an isolated worktree lowering both v_permlane16_b32 (0x377) and v_permlanex16_b32 (0x378) and probing lanes across both 16-lane rows (0, 7, 8, 15, 16, 23, 24, 31) via v_readlane_b32. Both variants validated cleanly against dxil.dll and returned the expected permuted values on the RTX 4060 (Wave32) without skipping.

Note: I did not run a live game/title shader pack pass, only synthetic hardware and workspace verification.

<!-- greyfinch-sync:Zettrox/ztrx:comment:7161577282 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/49#issuecomment-7161577282). Originally posted by [hamdog0203](https://github.com/hamdog0203) on 2026-11-25T11:50:53Z. --- Independent verification on NVIDIA RTX 4060 (8 GB, Wave32, driver 621.35) + WARP + Windows SDK `dxil.dll` (`10.0.26100.0`), Windows 11 x64 (`26200.9974`), `rustc 1.98.1`, audited at commit `e06eef85826bb942178fb2e8cabd3065996df158`: - **Code & security review:** Clean, self-contained lowering for `v_permlane16_b32` and `v_permlanex16_b32` restricted to `crates/victory-shader/src/emit/lower.rs` (no `unsafe`, no external deps). - **CI checks:** - `cargo clippy --workspace --all-targets --locked -- -D warnings`: passed (0 warnings) - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: passed (0 warnings) - `cargo test --workspace --locked`: all crates passed with 0 failures (`victory_shader`: 211 passed, 2 ignored; `xtask` asset-policy: 4 passed) - `cargo test --locked -p victory-shader --lib permlane16_and_x16_lower -- --nocapture`: passed - **Additional RTX 4060 + `dxil.dll` execution check:** Since the PR's unit test only checks IR lowering (`lower_with`), I also temporarily ran a 32-lane compute test in an isolated worktree lowering both `v_permlane16_b32` (`0x377`) and `v_permlanex16_b32` (`0x378`) and probing lanes across both 16-lane rows (`0, 7, 8, 15, 16, 23, 24, 31`) via `v_readlane_b32`. Both variants validated cleanly against `dxil.dll` and returned the expected permuted values on the RTX 4060 (Wave32) without skipping. Note: I did not run a live game/title shader pack pass, only synthetic hardware and workspace verification.
Aniseto commented 2026-11-25 14:11:06 +00:00 (Migrated from github.com)
Author
First-time contributor

Imported from Zettrox/ztrx. Originally posted by Aniseto on 2026-11-25T14:09:21Z.


Ran the shader tests at e06eef8 (clean PR head on main 90b529f):

System

  • GPU: NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB), driver 32.0.16.2124
  • CPU: Intel Core i5-12400F, 64 GB RAM
  • OS: Windows 11 Pro build 26200 x64
  • Toolchain: Rust 1.98.1 (pinned by rust-toolchain.toml), MSVC 14.44.35207, DXIL validator 1.9.2609.5 (VICTORY_DXIL), debug build

Results

  • cargo test --locked -p victory-shader --lib permlane16_and_x16_lower -- --nocapture: 1 passed, 0 failed, 0 ignored, 212 filtered out (exit 0)
  • cargo test --locked -p victory-shader --lib -- --test-threads=1: 211 passed, 0 failed, 2 ignored (exit 0)
  • cargo test --locked -p victory-shader --lib emit::intersect_tests::the_32_bit_node_test_in_a_host_buffer_matches_the_reference_on_the_card -- --exact --nocapture: 1 passed, 0 failed, 0 ignored (exit 0). That test asserts an SM 6.6 device is available, so the GPU path ran on this adapter.

What this adds
The existing report in this thread is on an RTX 4060 (Ampere) with the Windows SDK dxil.dll 10.0.26100.0. This adds a Blackwell wave32 part on driver 32.0.16.2124 with DXIL validator 1.9.2609.5. The new permlane16_and_x16_lower test passes here; it checks the emitted lowering only, so it does not by itself prove the permute runs on the GPU. The extra synthetic hardware probe in the earlier report used local changes and was not reproduced here.

Not tested
The title's shader pack, live pipeline creation, retail runs, a WARP control lane, the console compiler's DXC, release profile, AMD and Intel GPUs.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

<!-- greyfinch-sync:Zettrox/ztrx:comment:7164841675 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/49#issuecomment-7164841675). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-25T14:09:21Z. --- Ran the shader tests at `e06eef8` (clean PR head on `main` `90b529f`): **System** - GPU: NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB), driver 32.0.16.2124 - CPU: Intel Core i5-12400F, 64 GB RAM - OS: Windows 11 Pro build 26200 x64 - Toolchain: Rust 1.98.1 (pinned by `rust-toolchain.toml`), MSVC 14.44.35207, DXIL validator 1.9.2609.5 (`VICTORY_DXIL`), debug build **Results** - `cargo test --locked -p victory-shader --lib permlane16_and_x16_lower -- --nocapture`: 1 passed, 0 failed, 0 ignored, 212 filtered out (exit 0) - `cargo test --locked -p victory-shader --lib -- --test-threads=1`: 211 passed, 0 failed, 2 ignored (exit 0) - `cargo test --locked -p victory-shader --lib emit::intersect_tests::the_32_bit_node_test_in_a_host_buffer_matches_the_reference_on_the_card -- --exact --nocapture`: 1 passed, 0 failed, 0 ignored (exit 0). That test asserts an SM 6.6 device is available, so the GPU path ran on this adapter. **What this adds** The existing report in this thread is on an RTX 4060 (Ampere) with the Windows SDK `dxil.dll` 10.0.26100.0. This adds a Blackwell wave32 part on driver 32.0.16.2124 with DXIL validator 1.9.2609.5. The new `permlane16_and_x16_lower` test passes here; it checks the emitted lowering only, so it does not by itself prove the permute runs on the GPU. The extra synthetic hardware probe in the earlier report used local changes and was not reproduced here. **Not tested** The title's shader pack, live pipeline creation, retail runs, a WARP control lane, the console compiler's DXC, release profile, AMD and Intel GPUs. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/49:upstream-pr/49'
git switch 'upstream-pr/49'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/49'
git switch 'upstream-pr/49'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/49'
git switch 'upstream-pr/49'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/49'
git switch 'main'
git merge --squash 'upstream-pr/49'
git switch 'main'
git merge --ff-only 'upstream-pr/49'
git switch 'main'
git merge 'upstream-pr/49'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Zettrox/ztrx!49
No description provided.