Skip to content

cuda tests: reject non-finite errors before reducing FP64 comparisons - #933

Merged
ashhart merged 1 commit into
ashhart:mainfrom
cwschroeder:fix/cuda-finite-reference-check-20261016
Oct 18, 2026
Merged

ashhart merged 1 commit into
ashhart:mainfrom
cwschroeder:fix/cuda-finite-reference-check-20261016

Conversation

@cwschroeder

@cwschroeder cwschroeder commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Rig.close can accept invalid CUDA output when a NaN occurs before a later finite value. Its maximum-error reduction overwrites the NaN and can also erase a previous tolerance failure. For example, output [2, NaN, 0] against zero with unit tolerances ends with a reported maximum error of zero.

Reject a non-finite normalized error before updating the maximum. Add four CPU regression groups covering FP32/BF16, finite bound controls, quiet/poison NaNs at every position, infinities, and a failure preceding a NaN.

The tests call the actual Rig.close, back and DeviceBuffer.download. Only synchronization and readback use CPU callbacks; no CUDA driver is opened. Both Debug and Fast roots run through test-cuda-host, including ordinary zig build test, and can be selected with zig build test-cuda-reference.

Validation on M5 Max/macOS 26.6.2 (25G83), Zig 0.17.0, upstream 46a08c18608153bfc566703a88acc883bc6140f4:

  • Old comparison: one test group passes and three fail in both Debug and Fast. Fixed comparison: all four pass in both modes.
  • Full zig build test, test-kernel-contract, test-golden and fuzz-cortheon commands pass; zero unexpected frozen-answer differences.
  • Whole-tree zig fmt --check build.zig zig, whitespace and lean checks pass; 517 inherited lean findings, zero new.
  • Astra reviewed the comparison, readback fixture and build registration without a remaining source blocker.

This repairs the numerical test oracle. The validation is CPU-only and does not qualify kernel accuracy or performance on a device.

CI at b1df30323d170aca6b18ed1890a8ef6da2bc9701: all four upstream checks pass. The fork desktop/mobile checks also pass; desktop needed one rerun after the unchanged VM guest fixture returned Operation not permitted. Fifty local bounded-output calls through the embedded guest did not reproduce it. The first failure and the passing rerun are in the fork run.

@ashhart ashhart mentioned this pull request Oct 17, 2026
@ashhart
ashhart merged commit 9ad95fd into ashhart:main Oct 18, 2026
4 checks passed
@ashhart

ashhart commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Thank you, @cwschroeder, for exposing the NaN false pass through the actual readback comparator.

We merged your fix for 1.1.0 in 9ad95fd. Non-finite normalized error fails before it can replace the running maximum, so an earlier failure cannot disappear through NaN followed by zero.

CPU fixtures cover finite boundaries, NaNs and infinities through recorded readback, including the tolerance floor for an exact match. No model kernel changes.

Posted by Ash's AI Assistant Synthena

BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
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.

2 participants