Shaders: programs without FMad disable math refactoring #1856

Open
github-bot wants to merge 3 commits from github-bot/gh-1856 into main AGit
Owner

@⁠rminzao on GitHub · 2026-11-24 23:30 UTC · original
rminzao:shaders-unfused-mul-add → main · +57 −0 · 2 files · 3 commits · open

Claimed in #1633 (claim).

Problem

On the Intel UHD (the test host's default adapter on this laptop; same failures as #1829), the host fuses a multiply and an add the console rounds apart. The lowering emits plain fmul + fadd for v_mac_f32, v_mad_f32 and the BVH intersection arithmetic, and the shader flags leave math refactoring allowed. The driver then contracts them into an FMA. On main at 70564ae, on an Intel UHD Graphics (driver 31.0.101.4146), four tests fail:

  • emit::bvh_tests::intersections_on_the_gpu_equal_the_reference, ..._with_64_bit_pointers_... and ..._on_nodes_in_title_memory_...: the triangle's t is 1 ULP off the reference, with det and the barycentrics equal.
  • emit::semantics_tests::arithmetic_matches_the_hardware: v_mac_f32 of (2^-126, -2^-126, +0) gives -0 instead of +0, on 102 inputs. A fused tiny product flushes with its sign; an unfused one doesn't.

Fix

The shader flags get DisableMathRefactoring (bit 1) when the program emits no FMad. DXIL has no fused f32 op, so v_fma_f32/v_fmac_f32/v_fma_mix* (and the f16 shortcuts) rely on the host fusing FMad. Turning refactoring off everywhere stops that: with the flag on every program, Host::fuses_fmad reports false on NVIDIA and the FMA probes then mismatch like WARP. Programs that use FMad therefore keep today's behaviour, and every other program now rounds its multiplies and adds apart, as the console does.

Programs with both fused and unfused multiply-adds are still left to the host (the existing multiply-adds are fused only where the host fuses defect).

Tested

Intel UHD Graphics (driver 31.0.101.4146) and RTX 4050 Laptop (driver 595.97), Windows 11. The first version of this description credited the RTX 4050 with the Intel results; see the correction comment.

  • Intel UHD: the four tests above now pass (victory-shader 200 → 205 passed). The remaining failures (victory-shader: 5, victory-gpu: 3) fail the same way on main. They're the 1,000,000 view-heap cap, castable formats, wave-32 permute pipelines, 64-bit image atomics and the FSPX dot test, each with its own open PRs.
  • RTX 4050 (test device forced to the high-performance adapter): those four already pass on main. With the PR, nothing changes (207 passed, the same 3 failures as main).
  • hosts_that_do_not_fuse_are_named: both adapters still fuse FMad (true).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean. rustfmt --check: no new diffs.

Not run on AMD. fuses_fmad notes that the RX 6700 XT fuses FMad too, so the same split should apply there, but I couldn't check it. Not measured either: the cost of the lost fusion in programs without FMad.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠rminzao** on GitHub · 2026-11-24 23:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/1856) `rminzao:shaders-unfused-mul-add` → `main` · +57 −0 · 2 files · 3 commits · open Claimed in #1633 ([claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633)). ## Problem On the Intel UHD (the test host's default adapter on this laptop; same failures as #1829), the host fuses a multiply and an add the console rounds apart. The lowering emits plain `fmul` + `fadd` for `v_mac_f32`, `v_mad_f32` and the BVH intersection arithmetic, and the shader flags leave math refactoring allowed. The driver then contracts them into an FMA. On `main` at 70564ae, on an Intel UHD Graphics (driver 31.0.101.4146), four tests fail: - `emit::bvh_tests::intersections_on_the_gpu_equal_the_reference`, `..._with_64_bit_pointers_...` and `..._on_nodes_in_title_memory_...`: the triangle's `t` is 1 ULP off the reference, with `det` and the barycentrics equal. - `emit::semantics_tests::arithmetic_matches_the_hardware`: `v_mac_f32` of (2^-126, -2^-126, +0) gives -0 instead of +0, on 102 inputs. A fused tiny product flushes with its sign; an unfused one doesn't. ## Fix The shader flags get `DisableMathRefactoring` (bit 1) when the program emits no `FMad`. DXIL has no fused f32 op, so `v_fma_f32`/`v_fmac_f32`/`v_fma_mix*` (and the f16 shortcuts) rely on the host fusing `FMad`. Turning refactoring off everywhere stops that: with the flag on every program, `Host::fuses_fmad` reports `false` on NVIDIA and the FMA probes then mismatch like WARP. Programs that use `FMad` therefore keep today's behaviour, and every other program now rounds its multiplies and adds apart, as the console does. Programs with both fused and unfused multiply-adds are still left to the host (the existing `multiply-adds are fused only where the host fuses` defect). ## Tested Intel UHD Graphics (driver 31.0.101.4146) and RTX 4050 Laptop (driver 595.97), Windows 11. The first version of this description credited the RTX 4050 with the Intel results; see the correction comment. - Intel UHD: the four tests above now pass (`victory-shader` 200 → 205 passed). The remaining failures (`victory-shader`: 5, `victory-gpu`: 3) fail the same way on `main`. They're the 1,000,000 view-heap cap, castable formats, wave-32 permute pipelines, 64-bit image atomics and the FSPX dot test, each with its own open PRs. - RTX 4050 (test device forced to the high-performance adapter): those four already pass on `main`. With the PR, nothing changes (207 passed, the same 3 failures as `main`). - `hosts_that_do_not_fuse_are_named`: both adapters still fuse `FMad` (`true`). - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. `rustfmt --check`: no new diffs. Not run on AMD. `fuses_fmad` notes that the RX 6700 XT fuses `FMad` too, so the same split should apply there, but I couldn't check it. Not measured either: the cost of the lost fusion in programs without `FMad`. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The host fused v_mac_f32, v_mad_f32 and the BVH intersection arithmetic,
which the console rounds apart (NVIDIA: the BVH t 1 ULP off, a tiny
v_mac_f32 product keeping its sign). Programs that emit FMad keep
refactoring, which they need for the host to fuse at all.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pins the flag with two lowered programs: v_fma_f32 keeps refactoring,
v_mul_f32 + v_add_f32 sets DisableMathRefactoring. The decision moves to
Shader::settle_flags so the test reads it as finish() does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The fusion that broke the unfused multiply-adds was measured on the Intel
UHD, not NVIDIA: the RTX 4050 already rounds them apart.

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

@⁠welisonzika14-jpg on GitHub · 2026-11-24 23:38 UTC · original

Blackwell data point. RTX 5070 (driver 621.24, Windows 11, Rust 1.98.1 MSVC), 70564ae, head e3a1704, cargo test -p victory-gpu -p victory-shader --lib, no game files.

  • On main the four tests from the description pass here: the three bvh_tests::intersections_on_the_gpu_equal_the_reference* tests and semantics_tests::arithmetic_matches_the_hardware. So this card does not show the 1 ULP / -0 problem that the RTX 4050 (Ada) shows. I cannot say why; it may be the GPU generation or the driver.
  • With this PR, the same tests still pass, hosts_that_do_not_fuse_are_named passes, and the failures are exactly the five that main already has here (2 in victory-gpu, 3 in victory-shader, see #1744). Nothing new.

So no regression on Blackwell, but this card cannot confirm the fix either, because it does not hit the bug on main. I only ran the unit tests, not the title.

Written with AI help (Claude/Kiro). The numbers are from runs on my machine.

**@⁠welisonzika14-jpg** on GitHub · 2026-11-24 23:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/1856#issuecomment-7147622248) Blackwell data point. RTX 5070 (driver 621.24, Windows 11, Rust 1.98.1 MSVC), `70564ae`, head `e3a1704`, `cargo test -p victory-gpu -p victory-shader --lib`, no game files. - On `main` the four tests from the description pass here: the three `bvh_tests::intersections_on_the_gpu_equal_the_reference*` tests and `semantics_tests::arithmetic_matches_the_hardware`. So this card does not show the 1 ULP / -0 problem that the RTX 4050 (Ada) shows. I cannot say why; it may be the GPU generation or the driver. - With this PR, the same tests still pass, `hosts_that_do_not_fuse_are_named` passes, and the failures are exactly the five that `main` already has here (2 in `victory-gpu`, 3 in `victory-shader`, see #1744). Nothing new. So no regression on Blackwell, but this card cannot confirm the fix either, because it does not hit the bug on `main`. I only ran the unit tests, not the title. Written with AI help (Claude/Kiro). The numbers are from runs on my machine.
Author
Owner

@⁠dpalacios69 on GitHub · 2026-11-24 23:39 UTC · original

Checked e3a1704 on top of main 70564ae on Linux: cargo test -p victory-shader gives 118 passed, 0 failed, 1 ignored; clippy reports only an existing unused field (rovs, lower.rs:61). The diff matches the title (fused is set only in Lower::fmad, NO_REFACTORING is raised otherwise) but adds no test: a synthetic one asserting the 1 << 1 bit with and without an FMad would pin it. Not tested: validation with dxil.dll of the new flag, and any GPU run. AI-assisted analysis.

**@⁠dpalacios69** on GitHub · 2026-11-24 23:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/1856#issuecomment-7147645548) Checked `e3a1704` on top of `main` `70564ae` on Linux: `cargo test -p victory-shader` gives 118 passed, 0 failed, 1 ignored; clippy reports only an existing unused field (`rovs`, `lower.rs:61`). The diff matches the title (`fused` is set only in `Lower::fmad`, `NO_REFACTORING` is raised otherwise) but adds no test: a synthetic one asserting the `1 << 1` bit with and without an FMad would pin it. Not tested: validation with `dxil.dll` of the new flag, and any GPU run. AI-assisted analysis.
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 23:43 UTC · original

Ampere counterpart to the RTX 4050 run: RTX 3070 8 GB, driver 616.56, plus WARP, Windows 11, debug, e3a1704 (on main 70564ae). cargo test -p victory-shader --locked: 206 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA failures on main, so there are no new ones.

AI-assisted (Claude Code). Synthetic tests only.

**@⁠upipibi** on GitHub · 2026-11-24 23:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/1856#issuecomment-7147715719) Ampere counterpart to the RTX 4050 run: RTX 3070 8 GB, driver 616.56, plus WARP, Windows 11, debug, `e3a1704` (on `main` `70564ae`). `cargo test -p victory-shader --locked`: 206 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA failures on `main`, so there are no new ones. AI-assisted (Claude Code). Synthetic tests only.
Author
Owner

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

@⁠dpalacios69 thanks. Added only_programs_with_fmad_let_the_host_refactor in 23e3b5a: it lowers a v_fma_f32 program and a v_mul_f32 + v_add_f32 one, and asserts the first keeps refactoring and the second sets DisableMathRefactoring (bit 1). The decision moved to Shader::settle_flags, so the test reads it the way finish() does. Checked that the test fails when the flag is set unconditionally. On dxil.dll: the GPU tests on the RTX 4050 create their pipelines with the flag set, so the runtime accepted the containers; I did not run the standalone validator.

@⁠welisonzika14-jpg thanks for the Blackwell run. Good to know the RTX 5070 does not show it on main. On the RTX 4050 Laptop (Ada, driver 595.97) all four tests fail on main on every run, so it looks generation- or driver-specific; the change keeps the same results where the host does not fuse them.

victory-shader on the 4050 at 23e3b5a: 205 passed, 5 failed (the same 5 as main), clippy clean.

AI-assisted (Claude Code).

**@⁠rminzao** on GitHub · 2026-11-24 23:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/1856#issuecomment-7147791928) @⁠dpalacios69 thanks. Added `only_programs_with_fmad_let_the_host_refactor` in 23e3b5a: it lowers a `v_fma_f32` program and a `v_mul_f32` + `v_add_f32` one, and asserts the first keeps refactoring and the second sets `DisableMathRefactoring` (bit 1). The decision moved to `Shader::settle_flags`, so the test reads it the way `finish()` does. Checked that the test fails when the flag is set unconditionally. On `dxil.dll`: the GPU tests on the RTX 4050 create their pipelines with the flag set, so the runtime accepted the containers; I did not run the standalone validator. @⁠welisonzika14-jpg thanks for the Blackwell run. Good to know the RTX 5070 does not show it on `main`. On the RTX 4050 Laptop (Ada, driver 595.97) all four tests fail on `main` on every run, so it looks generation- or driver-specific; the change keeps the same results where the host does not fuse them. `victory-shader` on the 4050 at 23e3b5a: 205 passed, 5 failed (the same 5 as `main`), clippy clean. AI-assisted (Claude Code).
Author
Owner

@⁠rminzao on GitHub · 2026-11-25 01:06 UTC · original

Correction: the four failures are on the Intel iGPU, not the RTX 4050.

The laptop has an RTX 4050 Laptop GPU and an Intel UHD Graphics. Host::new(false) creates the device on the default adapter (D3D12CreateDevice(None, ...)), and here that is the Intel UHD. I checked by printing the device's adapter (GetAdapterLuid → EnumAdapterByLuid). So every "hardware" result in the description came from the Intel UHD (driver 31.0.101.4146), which matches the Intel report in #1829. It also explains @⁠welisonzika14-jpg's result: NVIDIA doesn't show the bug.

I re-ran everything with a local, uncommitted switch that creates the test device on the high-performance adapter (EnumAdapterByGpuPreference):

victory-shader --lib Intel UHD RTX 4050 Laptop (595.97)
main 70564ae 200 passed, 9 failed 206 passed, 3 failed
this PR (23e3b5a) 205 passed, 5 failed 207 passed, 3 failed
fuses FMad true true
  • On the Intel UHD, the PR fixes the four failures listed in #1829's "different results" (arithmetic_matches_the_hardware and the three BVH intersection tests).
  • On the RTX 4050, those four already pass on main. The PR changes nothing there and FMad still fuses. The 3 failures are the view-heap cap and structured-view ones that other PRs cover.

I've updated the description. Sorry for the wrong attribution.

AI-assisted (Claude Code).

**@⁠rminzao** on GitHub · 2026-11-25 01:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/1856#issuecomment-7149208357) **Correction: the four failures are on the Intel iGPU, not the RTX 4050.** The laptop has an RTX 4050 Laptop GPU and an Intel UHD Graphics. `Host::new(false)` creates the device on the default adapter (`D3D12CreateDevice(None, ...)`), and here that is the Intel UHD. I checked by printing the device's adapter (`GetAdapterLuid` → `EnumAdapterByLuid`). So every "hardware" result in the description came from the Intel UHD (driver 31.0.101.4146), which matches the Intel report in #1829. It also explains @⁠welisonzika14-jpg's result: NVIDIA doesn't show the bug. I re-ran everything with a local, uncommitted switch that creates the test device on the high-performance adapter (`EnumAdapterByGpuPreference`): | `victory-shader --lib` | Intel UHD | RTX 4050 Laptop (595.97) | |---|---|---| | `main` 70564ae | 200 passed, 9 failed | 206 passed, 3 failed | | this PR (23e3b5a) | 205 passed, 5 failed | 207 passed, 3 failed | | `fuses FMad` | true | true | - On the Intel UHD, the PR fixes the four failures listed in #1829's "different results" (`arithmetic_matches_the_hardware` and the three BVH intersection tests). - On the RTX 4050, those four already pass on `main`. The PR changes nothing there and `FMad` still fuses. The 3 failures are the view-heap cap and structured-view ones that other PRs cover. I've updated the description. Sorry for the wrong attribution. AI-assisted (Claude Code).
Author
Owner

@⁠rminzao on GitHub · 2026-11-25 03:31 UTC · original

@⁠dpalacios69 thanks. The test came in the next commit, 23e3b5a: emit::lower::tests::only_programs_with_fmad_let_the_host_refactor lowers a v_fma_f32 program and a v_mul_f32 + v_add_f32 one, and asserts that only the first leaves refactoring allowed, i.e. NO_REFACTORING (bit 1) is set on the second. It checks the flag, not the GPU result; the device behaviour is what the BVH and arithmetic_matches_the_hardware tests cover on the Intel UHD.

AI-assisted (Claude Code).

**@⁠rminzao** on GitHub · 2026-11-25 03:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/1856#issuecomment-7152000373) @⁠dpalacios69 thanks. The test came in the next commit, `23e3b5a`: `emit::lower::tests::only_programs_with_fmad_let_the_host_refactor` lowers a `v_fma_f32` program and a `v_mul_f32` + `v_add_f32` one, and asserts that only the first leaves refactoring allowed, i.e. `NO_REFACTORING` (bit 1) is set on the second. It checks the flag, not the GPU result; the device behaviour is what the BVH and `arithmetic_matches_the_hardware` tests cover on the Intel UHD. AI-assisted (Claude Code).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 07:25 UTC · original · edited 2026-11-26 02:17 UTC

Automated triage for the maintainers.

Merge candidate (recommending a look, not an approval). Reviewed at 60bc6a1, which merges cleanly into main.

Shader::settle_flags (crates/victory-shader/src/emit/shader.rs) sets shader-flag bit 1 (NO_REFACTORING, DXIL's disable-math-refactoring) unless the program emitted an FMad. Lower::fmad in emit/lower.rs is the only place that emits FMad (tertiary.f32, op 46) and now marks fused, so programs that need the host to fuse keep today's behaviour, and the others keep their multiplies and adds apart, as the console rounds them. The new test only_programs_with_fmad_let_the_host_refactor checks the flag for both cases. The evidence is main's own hardware tests (arithmetic_matches_the_hardware and the three BVH intersection tests), which fail on Intel UHD and pass with this change. The patch is the same as the head that was a merge candidate before the conflict. CI: check passing.

On your reply: the rebase keeps main's uses_lane_index and has_half_wave_mask next to refactoring, as you describe. Thanks.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 07:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/1856#issuecomment-7155852677) · edited 2026-11-26 02:17 UTC <!-- victory-triage v1 head=60bc6a153cee9386495e0fd0fc4aa2e5c3c9c445 verdict=merge-candidate at=2026-11-26T02:17:10Z --> Automated triage for the maintainers. **Merge candidate** (recommending a look, not an approval). Reviewed at `60bc6a1`, which merges cleanly into `main`. `Shader::settle_flags` (`crates/victory-shader/src/emit/shader.rs`) sets shader-flag bit 1 (`NO_REFACTORING`, DXIL's disable-math-refactoring) unless the program emitted an `FMad`. `Lower::fmad` in `emit/lower.rs` is the only place that emits `FMad` (`tertiary.f32`, op 46) and now marks `fused`, so programs that need the host to fuse keep today's behaviour, and the others keep their multiplies and adds apart, as the console rounds them. The new test `only_programs_with_fmad_let_the_host_refactor` checks the flag for both cases. The evidence is `main`'s own hardware tests (`arithmetic_matches_the_hardware` and the three BVH intersection tests), which fail on Intel UHD and pass with this change. The patch is the same as the head that was a merge candidate before the conflict. CI: `check` passing. On your reply: the rebase keeps `main`'s `uses_lane_index` and `has_half_wave_mask` next to `refactoring`, as you describe. Thanks. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 12:06 UTC · original

Offline measurement on a retail dump

Result: no count change against main.

I merged head 0489d107 onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

**@⁠sinan-cmyk** on GitHub · 2026-11-25 12:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/1856#issuecomment-7161939379) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 0489d107 onto `main` 940d32f (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 23,918 on `main`, 23,918 with this PR. No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Author
Owner

@⁠rminzao on GitHub · 2026-11-26 01:43 UTC · original

Rebased onto main (63bcca4) and pushed 60bc6a1. The only conflict was in Lowered's test-only fields: main added uses_lane_index and has_half_wave_mask where this PR adds refactoring, so it keeps all three.

cargo test -p victory-shader --lib on the Intel UHD (31.0.101.4146): 296 passed, 7 failed. main gives 291 passed, 11 failed. The four this PR fixes still pass (arithmetic_matches_the_hardware and the three BVH intersection tests), and the 7 left fail the same way on main. Clippy is clean.

AI-assisted (Claude Code).

**@⁠rminzao** on GitHub · 2026-11-26 01:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/1856#issuecomment-7180056229) Rebased onto `main` (63bcca4) and pushed `60bc6a1`. The only conflict was in `Lowered`'s test-only fields: `main` added `uses_lane_index` and `has_half_wave_mask` where this PR adds `refactoring`, so it keeps all three. `cargo test -p victory-shader --lib` on the Intel UHD (31.0.101.4146): 296 passed, 7 failed. `main` gives 291 passed, 11 failed. The four this PR fixes still pass (`arithmetic_matches_the_hardware` and the three BVH intersection tests), and the 7 left fail the same way on `main`. Clippy is clean. _AI-assisted (Claude Code)._
Author
Owner

@⁠catminou4 on GitHub · 2026-11-24 23:52 UTC · original · approved these changes

Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae), cargo test -p victory-shader --locked → 119 passed, 0 failed. GPU execution tests are #[cfg(all(test, windows))] and run only on Windows.

Programs without FMad disable math refactoring: feature-gated optimization — conservative and correct.

**@⁠catminou4** on GitHub · 2026-11-24 23:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/1856#pullrequestreview-6049333835) · **approved these changes** Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae), cargo test -p victory-shader --locked → 119 passed, 0 failed. GPU execution tests are #[cfg(all(test, windows))] and run only on Windows. Programs without FMad disable math refactoring: feature-gated optimization — conservative and correct.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 16:38 UTC · original · approved these changes

Reviewed 60bc6a153cee9386495e0fd0fc4aa2e5c3c9c445 (merged cleanly onto 63bcca43c6a00a758510398fa43096ce7e4f7df0) and verified on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP + dxil.dll).

Raising flags::NO_REFACTORING (1 << 1) in Shader::settle_flags when a shader emits no FMad cleanly prevents host drivers from fusing separately-rounded fmul + fadd sequences while keeping dx.entryPoints shader flags valid (dxil.dll clean).

A couple of non-blocking follow-up points worth keeping in mind:

  • self.s.fused is set when Lower::fmad is emitted rather than checking live dx.op.tertiary.f32 opcode 46 calls remaining after Shader::finish() dead-code pruning, so a dead/unused FMad still leaves refactoring enabled.
  • v_cvt_f32_u32 currently routes through self.fmad(hi, 65536.0, lo) even though hi * 65536.0 is exact in f32, which also clears NO_REFACTORING for shaders that otherwise have no FMad.
  • Budget note: emit/lower.rs reaches 522,169 B (+1,606 B, 2,119 B under the 524,288 B cap), so stacking with #379 (+2,815 B) exceeds the cap by 696 B.

Verification

  • cargo run -p xtask -- policy (191 files ok), cargo clippy (default & --all-features) clean, changed lines rustfmt-clean.
  • emit::lower:: (34/34), emit::shader:: (1/1), and emit::semantics_tests (34 passed, 1 ignored) on both RTX 5090 and WARP with dxil.dll active.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 16:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/1856#pullrequestreview-6077676670) · **approved these changes** Reviewed `60bc6a153cee9386495e0fd0fc4aa2e5c3c9c445` (merged cleanly onto `63bcca43c6a00a758510398fa43096ce7e4f7df0`) and verified on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP + `dxil.dll`). Raising `flags::NO_REFACTORING` (`1 << 1`) in `Shader::settle_flags` when a shader emits no `FMad` cleanly prevents host drivers from fusing separately-rounded `fmul` + `fadd` sequences while keeping `dx.entryPoints` shader flags valid (`dxil.dll` clean). A couple of non-blocking follow-up points worth keeping in mind: - `self.s.fused` is set when `Lower::fmad` is emitted rather than checking live `dx.op.tertiary.f32` opcode 46 calls remaining after `Shader::finish()` dead-code pruning, so a dead/unused `FMad` still leaves refactoring enabled. - `v_cvt_f32_u32` currently routes through `self.fmad(hi, 65536.0, lo)` even though `hi * 65536.0` is exact in `f32`, which also clears `NO_REFACTORING` for shaders that otherwise have no `FMad`. - Budget note: `emit/lower.rs` reaches `522,169 B` (`+1,606 B`, `2,119 B` under the `524,288 B` cap), so stacking with `#379` (`+2,815 B`) exceeds the cap by `696 B`. ### Verification - `cargo run -p xtask -- policy` (`191 files ok`), `cargo clippy` (default & `--all-features`) clean, changed lines `rustfmt`-clean. - `emit::lower::` (**34/34**), `emit::shader::` (**1/1**), and `emit::semantics_tests` (**34 passed, 1 ignored**) on both RTX 5090 and WARP with `dxil.dll` active.
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/1856/head:github-bot/gh-1856'
git switch 'github-bot/gh-1856'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1856'
git switch 'github-bot/gh-1856'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1856'
git switch 'github-bot/gh-1856'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1856'
git switch 'main'
git merge --squash 'github-bot/gh-1856'
git switch 'main'
git merge --ff-only 'github-bot/gh-1856'
git switch 'main'
git merge 'github-bot/gh-1856'
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!1856
No description provided.