Repository navigation
fix(cuda-oxide-mlir-export): saturate float to int casts - #1655
Merged
nihalpasham merged 3 commits intoOct 29, 2026
Merged
Conversation
Fixes NVIDIA#1642. Signed-off-by: Rachit2323 <atreyrachit23@gmail.com>
Signed-off-by: nihalpasham <nihalp@nvidia.com>
…int tests Signed-off-by: nihalpasham <nihalp@nvidia.com>
Collaborator
|
Thanks, emitting
At |
Collaborator
|
/ok to test 831bd1f |
nihalpasham
approved these changes
Oct 29, 2026
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.
What This PR Does
Fixes
#1642incuda-oxide-mlir-export(cutlass-mlirbackend) so Rust float-to-integerascasts (MirCastKindAttr::FloatToInt) saturate on out-of-range inputs and mapNaNto0, matching Rust semantics andmir-lower:MirCastKindAttr::FloatToInttollvm.fptosi.sat/llvm.fptoui.satviallvm.call_intrinsicand reject integer destinations wider than 64 bits (cuda-oxide-mlir-export)f16(FP16TypeandMirFP16Type),f32,f64, andi128/u128rejection (cuda-oxide-mlir-export)1. Why
arith.fptosi/arith.fptouiMiscompiled Out-of-Range andNaNCastsPreviously,
CastTranslation::translateincuda-oxide-mlir-export/src/mir/core.rsloweredMirCastKindAttr::FloatToIntto MLIRarith.fptosi/arith.fptoui, which have poison semantics onNaNor out-of-range values:> 64bits (i128/u128) with a clear diagnostic before reachinglibCutlassCompiler.so(which does not support 128-bitfptosi.sat/fptoui.satin libNVVM), matchingmir-lower(#878).Verification
sm_120a)cutlass-mlirGPU Suite: 838 / 838 runtime edge-case checks (NaN,+inf,-inf,2147483648.0f32 as i32,-0.0, out-of-range positive/negative) across(f16, f32, f64) -> (i8, u8, i16, u16, i32, u32, i64, u64, isize, usize)pass under bothcutlass-full-cute-mlir22andcutlass-primitives-mlir22(98 / 838failed onmain).cargo test --all-targets -p cuda-oxide-mlir-export(88unit +70integration tests): PASScargo clippy -p cuda-oxide-mlir-export --all-targets -- -D warnings&cargo oxide fmt --check: PASSscripts/check-*.shrepository guards: PASSCloses #1642