perf(shader,gpu): add opt-in SM 6.2 native half emission gated on Native16BitShaderOpsSupported (VICTORY_NATIVE_FP16=1) #420

Closed
github-bot wants to merge 660 commits from github-bot/gh-420 into main AGit
Owner

@⁠Vladimir-Human on GitHub · 2026-11-28 15:22 UTC · original
Vladimir-Human:perf/optin-native-sm62-fp16 → main · +61173 −5593 · 208 files · 660 commits · closed without merging

Implements an opt-in, hardware-capability-gated SM 6.2 native half foundation for item #1 from #401 (VICTORY_NATIVE_FP16=1, default OFF = 0).

Summary (1be693f)

  • Capability gate & cache isolation (host.rs, shader_cache.rs, pipeline/library.rs): requires both VICTORY_NATIVE_FP16=1 and D3D12_FEATURE_DATA_D3D12_OPTIONS4::Native16BitShaderOpsSupported == true (falls back cleanly to baseline widened FP32 translation otherwise); keys shader/PSO disk caches separately when active.
  • Shader translation (emit/bitcode.rs, bitcode/opt.rs, lower.rs, mod.rs, shader.rs, container.rs): selects SM 6.2 where compatible (SFI0 bit 18 NativeLowPrecision + DXIL entry metadata bit 23), lowers native binary16 constants, bitcasts, fadd/fsub/fmul/fmad, min/max, comparisons, fpext/fptrunc, and aligned raw half load/extract/store while cleanly keeping transcendentals/mixed-precision/LDS on safe FP32 fallback.
  • When VICTORY_NATIVE_FP16 is unset (0), emitted DXIL matches baseline origin/main byte-for-byte; Cargo.lock untouched.

Verification

  • cargo xtask policy: OK
  • cargo clippy -p victory-shader -p victory-gpu --all-targets --locked -- -D warnings & --features diagnostics: 0 warnings
  • cargo test -p victory-shader --locked -- fp16: 4/4 passed (validated via Windows SDK 10.0.26100.0\x64\dxil.dll); full cargo test -p victory-shader --locked: 347/347 passed
  • VICTORY_D3D12_DEBUG=1 & VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --locked --lib fp16: 4/4 passed on both (hardware/WARP buffer parity against widened baseline)
**@⁠Vladimir-Human** on GitHub · 2026-11-28 15:22 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/420) `Vladimir-Human:perf/optin-native-sm62-fp16` → `main` · +61173 −5593 · 208 files · 660 commits · closed without merging Implements an opt-in, hardware-capability-gated SM 6.2 native `half` foundation for item #1 from #401 (`VICTORY_NATIVE_FP16=1`, default OFF = `0`). ### Summary (`1be693f`) - **Capability gate & cache isolation (`host.rs`, `shader_cache.rs`, `pipeline/library.rs`):** requires both `VICTORY_NATIVE_FP16=1` and `D3D12_FEATURE_DATA_D3D12_OPTIONS4::Native16BitShaderOpsSupported == true` (falls back cleanly to baseline widened FP32 translation otherwise); keys shader/PSO disk caches separately when active. - **Shader translation (`emit/bitcode.rs`, `bitcode/opt.rs`, `lower.rs`, `mod.rs`, `shader.rs`, `container.rs`):** selects SM 6.2 where compatible (`SFI0` bit 18 `NativeLowPrecision` + DXIL entry metadata bit 23), lowers native binary16 constants, bitcasts, `fadd`/`fsub`/`fmul`/`fmad`, min/max, comparisons, `fpext`/`fptrunc`, and aligned raw half load/extract/store while cleanly keeping transcendentals/mixed-precision/LDS on safe FP32 fallback. - When `VICTORY_NATIVE_FP16` is unset (`0`), emitted DXIL matches baseline `origin/main` byte-for-byte; `Cargo.lock` untouched. ### Verification - `cargo xtask policy`: **OK** - `cargo clippy -p victory-shader -p victory-gpu --all-targets --locked -- -D warnings` & `--features diagnostics`: **0 warnings** - `cargo test -p victory-shader --locked -- fp16`: **4/4 passed** (validated via Windows SDK `10.0.26100.0\x64\dxil.dll`); full `cargo test -p victory-shader --locked`: **347/347 passed** - `VICTORY_D3D12_DEBUG=1` & `VICTORY_D3D12_WARP=1` `cargo test -p victory-gpu --features diagnostics --locked --lib fp16`: **4/4 passed** on both (hardware/WARP buffer parity against widened baseline)
All behavioral changes default OFF (`0`) so baseline execution/DXIL is unchanged
unless explicitly opted in.

Verified: synced=12; policy OK; clippy OK; clippy-diag OK; shader-fp16 OK (4p); shader-all OK (347p); HW OK (4p); WARP OK (4p) (repairs=1)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 15:26:18 +00:00
Author
Owner

@⁠Garu667 on GitHub · 2026-11-28 18:48 UTC · original

Tested on an RTX 3080 10 GB (1be693f, Series S, 5 min runs, 1 warm-up run excluded, 3 pairs). native_fp16=true shows up in the log, so the gate works on this card.

mean fps p10 first 6 samples prep median
off 16.1 / 15.6 / 16.3 9.0 / 7.3 / 11.6 12.3 / 12.7 / 13.1 45.1 / 49.8 / 49.7 ms
VICTORY_NATIVE_FP16=1 10.6 / 10.4 / 13.7 3.2 / 2.8 / 3.2 2.9 / 2.6 / 2.4 56.0 / 55.0 / 50.1 ms

So on Ampere it's a clear regression, mostly at entry (~2.5 fps for the first samples on every on-run, vs ~12.7 off) and the runs reach the same scenes later. The picture renders, though character surfaces in the boat cutscene looked smeared or partly see-through in one on-run capture; I can't rule out TAA/motion blur from a single frame.

**@⁠Garu667** on GitHub · 2026-11-28 18:48 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/420#issuecomment-7244067613) Tested on an RTX 3080 10 GB (`1be693f`, Series S, 5 min runs, 1 warm-up run excluded, 3 pairs). `native_fp16=true` shows up in the log, so the gate works on this card. | | mean fps | p10 | first 6 samples | prep median | |---|---|---|---|---| | off | 16.1 / 15.6 / 16.3 | 9.0 / 7.3 / 11.6 | 12.3 / 12.7 / 13.1 | 45.1 / 49.8 / 49.7 ms | | `VICTORY_NATIVE_FP16=1` | 10.6 / 10.4 / 13.7 | 3.2 / 2.8 / 3.2 | 2.9 / 2.6 / 2.4 | 56.0 / 55.0 / 50.1 ms | So on Ampere it's a clear regression, mostly at entry (~2.5 fps for the first samples on every on-run, vs ~12.7 off) and the runs reach the same scenes later. The picture renders, though character surfaces in the boat cutscene looked smeared or partly see-through in one on-run capture; I can't rule out TAA/motion blur from a single frame.
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-29 11:35 UTC · original

Thanks for the three matched pairs. The substantial Ampere startup regression means this should remain opt-in, even when Native16BitShaderOpsSupported is true. The possible character artifact also needs repeated matched captures before we consider enabling it by default.

**@⁠TaynanGT** on GitHub · 2026-11-29 11:35 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/420#issuecomment-7255217808) Thanks for the three matched pairs. The substantial Ampere startup regression means this should remain opt-in, even when Native16BitShaderOpsSupported is true. The possible character artifact also needs repeated matched captures before we consider enabling it by default.
github-bot closed this pull request 2026-11-30 17:08:47 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-30 17:08 UTC · original

main has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current main and open a new PR; I'll review it there.

**@⁠TaynanGT** on GitHub · 2026-11-30 17:08 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/420#issuecomment-7285770411) `main` has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current `main` and open a new PR; I'll review it there.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.