Merged
Conversation
tetsuo-cpp
commented
Feb 21, 2026
Owner
Author
tetsuo-cpp
left a comment
There was a problem hiding this comment.
Code Review
Clean, well-structured PR that follows established patterns closely. LGTM overall.
Strengths
- Good template factoring —
UnaryFloatOpConversionmirrors the existingBinaryArithOpConversionnicely - MaxF/MinF correctly reuse the binary template instead of duplicating code
- Test coverage across all three layers (translation, conversion, pipeline)
- Pipeline ordering is correct:
math-to-llvmaftergpu-to-nvvmbut beforenvvm-to-llvm
One bug: duplicate stage number
Passes.cpp:53 — comment says "Stage 8" for gpu.binary compilation, but the preceding reconcile-unrealized-casts is also labeled "Stage 8". Should be "Stage 9".
Nit
arith::MaximumFOp / arith::MinimumFOp follow IEEE 754-2019 semantics (NaN-propagating). This is probably the right default for GPU math, but worth noting — if FMAX NaN 1.0 should return 1.0 (like CUDA's fmax), you'd want arith::MaxNumFOp instead. The current choice matches standard IEEE behavior though, so fine as-is.
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
FEXP,FSQRT,FLOG,FABS,FNEG(unary) andFMAX,FMIN(binary)math.exp/math.sqrt/math.log/math.absf/arith.negfwith i64↔f64 bitcast patternarith.maximumf/arith.minimumfreusing existingBinaryArithOpConversiontemplateconvert-math-to-llvmpass in pipeline for GPU loweringTest plan
forth.*opsgpu.binary