Translate llvm.minimum/maximum with NaN-propagating semantics #4032
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.42) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 338 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.349
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #4032"
general
weight: 0.35
MrSidims
Fixes #3282:
llvm.minimum/llvm.maximumwere translated to OpenCL.stdfmin/fmax, which ignore NaN operands. They also don't order -0.0 before +0.0, whichllvm.minimum/llvm.maximumrequire.OpenCL.std has no NaN-propagating min/max, so
SPIRVRegularizeLLVM(which already expandsbswap,fshl/fshr,umul.with.overflow) now expands the calls intollvm.minnum/llvm.maxnum, translated tofmin/fmaxas before, plus two fix-ups:With both
nnanandnszthe result is a plainfmin, as before. The sign is tested withcopysignrather than an integer bitcast, so noInt16/Int64capability is added, and the result is always one of the operands (combining bit patterns could produce a value that is neither input on devices that flush denormals in comparisons). Everything used is core SPIR-V or OpenCL.std.The writer's direct
minimum/maximum→fmin/fmaxmapping is removed. They stay inisKnownIntrinsic, as otherwise-spirv-allow-unknown-intrinsicsemits a declaration left unused by the expansion as an import. As a side effect,llvm.minimum/maximumonbfloat, previously rejected, now translate likellvm.minnum/maxnumonbfloat.Resulting SPIR-V for
llvm.minimum.f32(vectors are the same, with splat constants):Reverse translation yields the corresponding
_Z4fminff/_Z8copysignffcalls,fcmps andselects.Not addressed, and could reuse the same fix-ups:
minnum/minimumnumwithoutnszstill map to a barefmin, which gets NaNs right but, unlike what LangRef requires, may return either zero (theminnummapping was also questioned in a comment on #3282).vector.reduce.fminimum/fmaximumare lowered toselect(FUnordLessThan(a, b), a, b)pairs (FUnordGreaterThanfor max), which drop a NaN inband don't order signed zeros.Assisted by: Opus 5.5