Skip to content

fix(kernels): remove global --use_fast_math; selective per-kernel intrinsics only (T3.1) - #143

Merged
dndungu merged 2 commits into
mainfrom
fix/remove-global-fast-math-linear
Jun 12, 2026
Merged

fix(kernels): remove global --use_fast_math; selective per-kernel intrinsics only (T3.1)#143
dndungu merged 2 commits into
mainfrom
fix/remove-global-fast-math-linear

Conversation

@dndungu

@dndungu dndungu commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Linear re-roll of #142 (same content; #142 grew a merge commit resolving the T2.4 devlog conflict, which GitHub's rebase-merge refuses to replay). All GB10 evidence lives on #142:

Implements zerfoo plan-gpu-training-hardening T3.1 + S3.1.1 (verifies UC-GH-5).

dndungu added 2 commits June 12, 2026 13:50
…max only (T3.1)

Drop --use_fast_math from NVCC_FLAGS: the flag swapped every
expf/tanhf/logf/division for unsafe approximations library-wide; the
non-saturating fast tanhf caused the GELU blowup behind the GPU f32
CrossAsset cliff (ztensor#125). Per the torch numerics convention
(zerfoo plan-gpu-training-hardening T3.1) fast intrinsics are now
re-enabled selectively in kernel source, only where the PyTorch-oracle
gate proves equivalence within tolerance:

- kernel_softmax keeps __expf AFTER max-subtraction (argument <= 0,
  result in (0,1], ~2^-21 relative error -- inside the Softmax
  tolerance atol 1e-6 / rtol 1e-4).
- Everything else gets the accurate libdevice functions.
- The tanh saturation clamp (ztensor#125) is RETAINED as
  defense-in-depth.

Gate plumbing: oracle-gen grows -engine gpu (GenerateAllWith records
compute.GPUEngine bundles through the same format -- the GPU-side
oracle gate the scripts/oracle README reserved for T3.x), and
compute/gpu_kernel_bench_test.go adds per-kernel GPU micro-benchmarks
for the ops whose codegen changed, for the before/after perf delta.

Verifies zerfoo UC-GH-5.
@dndungu
dndungu merged commit b596563 into main Jun 12, 2026
1 check passed
@dndungu
dndungu deleted the fix/remove-global-fast-math-linear branch June 12, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant