gpu-parity: FXC/D3D11 check of cultmath snoise and snoise_grad #1

Merged
nibu merged 8 commits from nibu/gpu-snoise-parity into main 2026-11-11 12:10:42 +00:00
Member

Closes follow-up asura:follow_up:gpu-snoise-parity.

tools/gpu-parity/: a console project that compiles CultLib's own CultMath.hlsl (included through fxc /I, not copied) with fxc.exe under default flags and /Gis, runs cultmath_snoise(float2), cultmath_snoise(float3) and cultmath_snoise_grad (xyz = gradient, w = value) as a D3D11 compute shader with structured-buffer readback, and compares with C# math.snoise / snoise_grad. CultLib is pinned to cultmath-unity-v0.5.0 by a runtime check. Dependencies: Vortice.Direct3D11 only; fxc.exe is shelled out.

Run on Starfire (GTX 1070), 163928 points (43928 tie-constructed with 0 to 2 ulp neighbours, 120000 seeded random at scales 4/64/1024). Stated tolerance, absolute, by input magnitude (<=8, <=128, <=1024): value 4.2e-6 / 7.2e-5 / 1.65e-3, gradient 3.3e-5 / 4.2e-4 / 6.8e-3. Default and /Gis have the same maxima, so the error is ulp-of-input scaled GPU/CPU rounding in x0, not FMA contraction. Max measured: value 3.1e-6 / 5.3e-5 / 1.2e-3, gradient 2.4e-5 / 3.1e-4 / 5.0e-3. GPU/CPU simplex-ordering branch differs at 190/35814 float3 and 39 float2 tie points (|p|<=8), all within tolerance; reported, not failed. Details and run instructions in tools/gpu-parity/README.md.

Not covered: other drivers or GPUs; snoise_hessian; the HLSL under Unity's own fxc invocation (flags may differ); the branch probe is a separate expression tree.

🤖 Generated with Claude Code

Closes follow-up `asura:follow_up:gpu-snoise-parity`. `tools/gpu-parity/`: a console project that compiles CultLib's own `CultMath.hlsl` (included through `fxc /I`, not copied) with fxc.exe under default flags and `/Gis`, runs `cultmath_snoise(float2)`, `cultmath_snoise(float3)` and `cultmath_snoise_grad` (xyz = gradient, w = value) as a D3D11 compute shader with structured-buffer readback, and compares with C# `math.snoise` / `snoise_grad`. CultLib is pinned to `cultmath-unity-v0.5.0` by a runtime check. Dependencies: Vortice.Direct3D11 only; fxc.exe is shelled out. Run on Starfire (GTX 1070), 163928 points (43928 tie-constructed with 0 to 2 ulp neighbours, 120000 seeded random at scales 4/64/1024). Stated tolerance, absolute, by input magnitude (<=8, <=128, <=1024): value 4.2e-6 / 7.2e-5 / 1.65e-3, gradient 3.3e-5 / 4.2e-4 / 6.8e-3. Default and `/Gis` have the same maxima, so the error is ulp-of-input scaled GPU/CPU rounding in x0, not FMA contraction. Max measured: value 3.1e-6 / 5.3e-5 / 1.2e-3, gradient 2.4e-5 / 3.1e-4 / 5.0e-3. GPU/CPU simplex-ordering branch differs at 190/35814 float3 and 39 float2 tie points (|p|<=8), all within tolerance; reported, not failed. Details and run instructions in `tools/gpu-parity/README.md`. Not covered: other drivers or GPUs; snoise_hessian; the HLSL under Unity's own fxc invocation (flags may differ); the branch probe is a separate expression tree. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
nibu merged commit d94f7ea8e3 into main 2026-11-11 12:10:42 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
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
GameCult/Asura!1
No description provided.