feat(runtime): add fp32 support to ReduceSum kernel - #604
Open
AMDmoore wants to merge 1 commit into
Open
Conversation
AMDmoore
requested review from
amd-mingw,
edelaye,
fhanuman,
qianglin-amd and
wcy123
as code owners
July 31, 2026 03:19
|
Thanks for opening a PR! This project follows LLVM's incremental-development and AI-tool-use Before requesting review, please check that:
Reviewers are assigned through |
L2 Accuracy Results (EP vs CPU)
Threshold: 0.01 | Run: 3495 - Commit: |
MorphiZen EP Performance Results
EPContext Export Performance
EPContext Import Performance
OGA Benchmark Results
OGA Wheel Smoke (Python benchmark_e2e.py)
Run: 3495 - Commit: |
AMDmoore
force-pushed
the
feat/reduce_sum_support_f32
branch
from
July 31, 2026 11:10
d9536a2 to
ccd14d5
Compare
Add a reduce_sum_f32_kernel (float accumulate + float store) and a HIP_DTYPE_FLOAT32 dispatch branch to hip_reduce_sum. Map HIPDNN_EP_DATATYPE_FLOAT -> HIP_DTYPE_FLOAT32 in wrap_reduce_sum, update its unsupported-dtype message, and list FLOAT32 in the header doc. Quantized LLMs (e.g. Nemotron INT4-RTN) upcast to fp32 before a sum for numerical stability (Cast(fp16->fp32) -> ... -> ReduceSum), which hit the runtime error 'wrap_reduce_sum: unsupported data_type=f32'. This mirrors the existing reduce_mean_f32_kernel added for the same fp32-upcast pattern. AI assistance: Cursor assisted with implementing the fp32 kernel path following the existing ReduceMean fp32 precedent; the change was reviewed for correctness. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
reduce_sum_f32_kernel(float accumulate + float store) and aHIP_DTYPE_FLOAT32dispatch branch tohip_reduce_sum.HIPDNN_EP_DATATYPE_FLOAT -> HIP_DTYPE_FLOAT32inwrap_reduce_sumand update its unsupported-dtype message.hip_reduce_sumheader doc to list FLOAT32.Why
Quantized LLMs (e.g. Nemotron INT4-RTN) upcast to fp32 before a sum for numerical stability (
Cast(fp16->fp32) -> ... -> ReduceSum), which triggered the runtime error[REAL] wrap_reduce_sum: unsupported data_type=f32(0)and blocked the model. This mirrors the existingreduce_mean_f32_kerneladded for the same fp32-upcast pattern, so ReduceSum and ReduceMean now have matching dtype coverage.Test plan
unsupported data_type=f32error is gone.AI assistance
Cursor (Claude) assisted with implementing the fp32 kernel path following the existing ReduceMean fp32 precedent; the change was reviewed for correctness.
Made with Cursor