Shaders: skip redundant heap clamps on host memory/consts, clear stale DOUBLES flag, fix v_permlane and wave32 f64 sum (#505) #598

Open
github-bot wants to merge 1 commit from github-bot/gh-598 into main AGit
Owner

@⁠orazal12 on GitHub · 2026-11-25 02:49 UTC · original
orazal12:fix/issue-505-dxil-bugs → main · +347 −6 · 5 files · 1 commits · open

Addresses DXIL regressions introduced between 2119b0e and a803c87 (Refs #505):

  • Skip redundant VIEW_LIMIT clamps on host-owned memory & in-bounds constants: Lower::memory() now uses heap_handle_unclamped for host-owned SLOT_MEMORY indices, and heap_handle skips emitting dx.op.binary.i32 UMin for compile-time constants already within bounds. Dynamic title-controlled heap indices and out-of-bounds constants still clamp.
  • Clear stale flags::DOUBLES after dead-code elimination: tracks TypeDef::Double in Usage::doubles and clears flags::DOUBLES in Shader::finish() when opt::DEAD removes all double ops.
  • Include v_permlane* in console_lanes: adds || n.starts_with(v_permlane) in lower.rs so v_permlane16_b32/v_permlanex16_b32 shaders emit WaveSize metadata and don't trip debug_assert!(self.console_lanes).
  • Fix active_f64_sum wave32 exchange guard: matches shape() (!self.local && self.exchange.as_ref().is_some_and(|e| !e.1)) so small groups / local waves on 32-lane GPUs don't emit invalid LDS exchange barriers.

Verification:

  • cargo test -p victory-shader --offline: 218 passed, 0 failed (4 new unit tests validating with dxil.dll)
  • cargo test -p xtask --offline: 4 passed (asset policy check ok)
  • cargo clippy -p victory-shader --all-targets --offline -- -D warnings: 0 warnings
**@⁠orazal12** on GitHub · 2026-11-25 02:49 UTC · [original](https://github.com/fxceless/victory-fork/pull/598) `orazal12:fix/issue-505-dxil-bugs` → `main` · +347 −6 · 5 files · 1 commits · open Addresses DXIL regressions introduced between `2119b0e` and `a803c87` (Refs #505): - **Skip redundant `VIEW_LIMIT` clamps on host-owned memory & in-bounds constants**: `Lower::memory()` now uses `heap_handle_unclamped` for host-owned `SLOT_MEMORY` indices, and `heap_handle` skips emitting `dx.op.binary.i32` UMin for compile-time constants already within bounds. Dynamic title-controlled heap indices and out-of-bounds constants still clamp. - **Clear stale `flags::DOUBLES` after dead-code elimination**: tracks `TypeDef::Double` in `Usage::doubles` and clears `flags::DOUBLES` in `Shader::finish()` when `opt::DEAD` removes all double ops. - **Include `v_permlane*` in `console_lanes`**: adds `|| n.starts_with(v_permlane)` in `lower.rs` so `v_permlane16_b32`/`v_permlanex16_b32` shaders emit `WaveSize` metadata and don't trip `debug_assert!(self.console_lanes)`. - **Fix `active_f64_sum` wave32 exchange guard**: matches `shape()` (`!self.local && self.exchange.as_ref().is_some_and(|e| !e.1)`) so small groups / local waves on 32-lane GPUs don't emit invalid LDS exchange barriers. **Verification:** - `cargo test -p victory-shader --offline`: 218 passed, 0 failed (4 new unit tests validating with `dxil.dll`) - `cargo test -p xtask --offline`: 4 passed (asset policy check ok) - `cargo clippy -p victory-shader --all-targets --offline -- -D warnings`: 0 warnings
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:47:08 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/valu_tests.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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