Skip to content

Refactor CPU Softmax dtype dispatch - #4127

Merged
zcbenz merged 1 commit into
ml-explore:mainfrom
PhysicistJohn:dispatch-cpu-softmax
Aug 10, 2026
Merged

zcbenz merged 1 commit into
ml-explore:mainfrom
PhysicistJohn:dispatch-cpu-softmax

Conversation

@PhysicistJohn

Copy link
Copy Markdown
Contributor

Summary

Replace CPU Softmax's explicit dtype switch with dispatch_all_types.
The compile-time branches preserve the existing accumulator policy: float16
and bfloat16 use float accumulation in precise mode and their native types
otherwise, while float32 and float64 keep native accumulation. Other types
retain the existing unsupported-type error.

This removes eight net lines from one function.

Testing

  • Release CPU-only build with C++20 and warnings as errors
  • Baseline/candidate raw-byte parity across float16, bfloat16, float32, and
    float64, with precise mode both enabled and disabled (32 cases; transcripts
    byte-identical)
  • Python operations suite (150/150 tests)
  • Native C++ suite (247/247 cases, 3,326/3,326 assertions)
  • Global object symbols preserved
  • Composition check with the older same-file Add support for x86 SIMD with Highway #3019: both patch orders have
    only the adjacent include insertion to resolve; retaining both includes
    produces identical source in either order, the combined Release library
    builds, and the focused reduction/softmax suite passes
  • clang-format and git diff --check

@zcbenz
zcbenz merged commit 1b312a9 into ml-explore:main Aug 10, 2026
25 of 28 checks passed
@BrewTestBot BrewTestBot mentioned this pull request Aug 18, 2026
1 task done
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