Offer: GPU-verified FidelityFX CAS golden model for shader validation (ffx-kit) #713

Open
opened 2026-11-26 04:13:52 +00:00 by github-bot · 3 comments
Owner

@⁠Cobrall on GitHub · 2026-11-24 07:33 UTC · original

Hi VIctory team,

Following Halfect's work in #712 on DXIL validation for compute shaders (25,889 matched program labels, 1693/1693 validation), I'd like to offer a complementary tool that may help with the FidelityFX CAS portion of the shader pipeline.

What ffx-kit does:

  • Compiles official AMD FidelityFX-CAS sources (MIT) with DXC to SPIR-V/DXIL
  • Runs them on a real GPU (Vulkan/D3D12) and verifies output against a CPU golden model
  • The CPU model exactly mirrors AMD's fast-math approximations: APrxLoRcpF1 / APrxMedRcpF1 / APrxLoSqrtF1 bit tricks, green-channel weight path, D3D saturate(NaN)=0 semantics

Why this matters for VIctory:
A naive "mathematically exact" CPU reference disagrees with AMD's intended fast-math paths by up to ~8.5% of signal. When validating translated CAS shaders against exact math, this produces false failures. ffx-kit provides the correct reference to validate against.

Results (RTX 4070 Ti, DXC 1.9.2609.5):

  • 8/8 fp32 variants (BETTER_DIAGONALS × GO_SLOWER × SLOW): PASS, worst max diff 4.77e-07
  • 4K (3840×2160): PASS, max diff 2.98e-07
  • manifest.json with SHA-256 hashes for each compiled variant

How it could integrate:

  • Use the provided .spv/DXIL files as ground-truth references for your CAS shader translator
  • Port the Python golden model (cas_golden.py) to Rust for CI integration
  • The fp16 packed variant (CasFilterH) is ready for native runtime integration (Python harness limited by wgpu's RelaxedPrecision handling on Windows)

Repo: https://github.com/Cobrall/ffx-kit

No game files, console binaries, or keys involved — only official open-source AMD FidelityFX headers.

Happy to adapt the harness to VIctory's CI, answer questions about the bit-exact golden model, or provide the Rust port of the CPU reference if useful.

cc @⁠Halfect — this may complement your DXIL validation work on compute shaders.

now also includes a zero-dep Rust reference implementation

Update: the repo now includes a zero-dep Rust reference implementation at rust/cas_golden.rs (std only, verified via cargo check). This means VIctory's CI can drop it directly into a test crate without any external dependencies — no need to port the Python golden model by hand.

Update: The repository now includes a zero-dependency Rust reference implementation at rust/cas_golden.rs.

It has been verified via cargo check and tested against the Python reference, mirroring AMD's fast-math approximations (APrxLoRcpF1, APrxMedRcpF1, APrxLoSqrtF1) and D3D saturate(NaN)=0 semantics exactly.

This can be dropped directly into a Rust or C++ test harness to validate translated CAS shaders against the intended AMD output, bypassing the need for the Python harness or naive "mathematically exact" references (which disagree by up to ~8.5% of signal).

Happy to help adapt this further if it fits into VIctory's CI pipeline!

**@⁠Cobrall** on GitHub · 2026-11-24 07:33 UTC · [original](https://github.com/Marvisak/VIctory/issues/713) Hi VIctory team, Following Halfect's work in #712 on DXIL validation for compute shaders (25,889 matched program labels, 1693/1693 validation), I'd like to offer a complementary tool that may help with the FidelityFX CAS portion of the shader pipeline. **What ffx-kit does:** - Compiles official AMD FidelityFX-CAS sources (MIT) with DXC to SPIR-V/DXIL - Runs them on a real GPU (Vulkan/D3D12) and verifies output against a CPU golden model - The CPU model exactly mirrors AMD's fast-math approximations: `APrxLoRcpF1` / `APrxMedRcpF1` / `APrxLoSqrtF1` bit tricks, green-channel weight path, D3D `saturate(NaN)=0` semantics **Why this matters for VIctory:** A naive "mathematically exact" CPU reference disagrees with AMD's intended fast-math paths by up to ~8.5% of signal. When validating translated CAS shaders against exact math, this produces false failures. ffx-kit provides the *correct* reference to validate against. **Results (RTX 4070 Ti, DXC 1.9.2609.5):** - 8/8 fp32 variants (BETTER_DIAGONALS × GO_SLOWER × SLOW): **PASS**, worst max diff 4.77e-07 - 4K (3840×2160): PASS, max diff 2.98e-07 - `manifest.json` with SHA-256 hashes for each compiled variant **How it could integrate:** - Use the provided `.spv`/DXIL files as ground-truth references for your CAS shader translator - Port the Python golden model (`cas_golden.py`) to Rust for CI integration - The fp16 packed variant (`CasFilterH`) is ready for native runtime integration (Python harness limited by wgpu's `RelaxedPrecision` handling on Windows) **Repo:** https://github.com/Cobrall/ffx-kit No game files, console binaries, or keys involved — only official open-source AMD FidelityFX headers. Happy to adapt the harness to VIctory's CI, answer questions about the bit-exact golden model, or provide the Rust port of the CPU reference if useful. cc @⁠Halfect — this may complement your DXIL validation work on compute shaders. now also includes a zero-dep Rust reference implementation Update: the repo now includes a zero-dep Rust reference implementation at `rust/cas_golden.rs` (std only, verified via `cargo check`). This means VIctory's CI can drop it directly into a test crate without any external dependencies — no need to port the Python golden model by hand. **Update:** The repository now includes a zero-dependency Rust reference implementation at [`rust/cas_golden.rs`](https://github.com/Cobrall/ffx-kit/blob/main/rust/cas_golden.rs). It has been verified via `cargo check` and tested against the Python reference, mirroring AMD's fast-math approximations (`APrxLoRcpF1`, `APrxMedRcpF1`, `APrxLoSqrtF1`) and D3D `saturate(NaN)=0` semantics exactly. This can be dropped directly into a Rust or C++ test harness to validate translated CAS shaders against the *intended* AMD output, bypassing the need for the Python harness or naive "mathematically exact" references (which disagree by up to ~8.5% of signal). Happy to help adapt this further if it fits into VIctory's CI pipeline!
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:13:52 +00:00
Author
Owner

@⁠cj5k9dnkfd-afk on GitHub · 2026-11-24 07:37 UTC · original

Hi anyone have the files game

**@⁠cj5k9dnkfd-afk** on GitHub · 2026-11-24 07:37 UTC · [original](https://github.com/Marvisak/VIctory/issues/713#issuecomment-7125197690) Hi anyone have the files game
Author
Owner

@⁠Cobrall on GitHub · 2026-11-24 07:58 UTC · original

Update: The repository now includes a zero-dependency Rust reference implementation at rust/cas_golden.rs.

It has been verified via cargo check and tested against the Python reference, mirroring AMD's fast-math approximations (APrxLoRcpF1, APrxMedRcpF1, APrxLoSqrtF1) and D3D saturate(NaN)=0 semantics exactly.

This can be dropped directly into a Rust or C++ test harness to validate translated CAS shaders against the intended AMD output, bypassing the need for the Python harness or naive "mathematically exact" references (which disagree by up to ~8.5% of signal).

Happy to help adapt this further if it fits into VIctory's CI pipeline!

**@⁠Cobrall** on GitHub · 2026-11-24 07:58 UTC · [original](https://github.com/Marvisak/VIctory/issues/713#issuecomment-7125587362) **Update:** The repository now includes a zero-dependency Rust reference implementation at [`rust/cas_golden.rs`](https://github.com/Cobrall/ffx-kit/blob/main/rust/cas_golden.rs). It has been verified via `cargo check` and tested against the Python reference, mirroring AMD's fast-math approximations (`APrxLoRcpF1`, `APrxMedRcpF1`, `APrxLoSqrtF1`) and D3D `saturate(NaN)=0` semantics exactly. This can be dropped directly into a Rust or C++ test harness to validate translated CAS shaders against the *intended* AMD output, bypassing the need for the Python harness or naive "mathematically exact" references (which disagree by up to ~8.5% of signal). Happy to help adapt this further if it fits into VIctory's CI pipeline!
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:46 UTC · original

Automated triage for the maintainers.

This is an offer of an external tool (a CAS reference model hosted in another repository), not a report about VIctory's code. VIctory checks its translated shaders by translating the title's own GFX10 programs and validating/running the emitted DXIL (victory-shader), so it has no step that would consume a separately compiled FidelityFX reference. Offers of outside tools fall under what this tracker treats as out of scope.

If you want a specific check in VIctory's own test suite, pull requests are open to everyone: a self-contained test under crates/victory-shader with synthetic inputs is the way to propose it.

Separately, to the commenter asking for the game: game files must not be requested or shared here.

This issue will be closed in 48 hours unless the reporter replies or a maintainer removes the triage: proposed close label.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:46 UTC · [original](https://github.com/Marvisak/VIctory/issues/713#issuecomment-7149940632) <!-- victory-issue-triage v1 verdict=proposed-close seen=2026-11-24T07:58:55Z at=2026-11-25T01:46:30Z --> Automated triage for the maintainers. This is an offer of an external tool (a CAS reference model hosted in another repository), not a report about VIctory's code. VIctory checks its translated shaders by translating the title's own GFX10 programs and validating/running the emitted DXIL (`victory-shader`), so it has no step that would consume a separately compiled FidelityFX reference. Offers of outside tools fall under what this tracker treats as out of scope. If you want a specific check in VIctory's own test suite, pull requests are open to everyone: a self-contained test under `crates/victory-shader` with synthetic inputs is the way to propose it. Separately, to the commenter asking for the game: game files must not be requested or shared here. This issue will be closed in 48 hours unless the reporter replies or a maintainer removes the `triage: proposed close` label. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
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#713
No description provided.