[Mlir-commits] [mlir] [MLIR][NVVM] Add sqrt Ops (PR #197422)
Durgadoss R
llvmlistbot at llvm.org
Wed May 13 06:03:20 PDT 2026
================
@@ -3535,6 +3545,57 @@ RsqrtOp::getIntrinsicIDAndArgs(Operation &op, LLVM::ModuleTranslation &mt,
return {id, {mt.lookupValue(thisOp.getSrc())}};
}
+mlir::NVVM::IDArgPair
+SqrtOp::getIntrinsicIDAndArgs(Operation &op, LLVM::ModuleTranslation &mt,
+ llvm::IRBuilderBase &builder) {
+ auto thisOp = cast<NVVM::SqrtOp>(op);
+ Type t = thisOp.getRes().getType();
+ NVVM::FPRoundingMode rndMode = thisOp.getRnd();
+ bool isFtz = thisOp.getFtz();
+
+ // f32: 5 RM slots (NONE→RN, RN, RM, RP, RZ) × 2 ftz states.
+ static constexpr llvm::Intrinsic::ID f32IDs[] = {
+ llvm::Intrinsic::nvvm_sqrt_rn_f, // NONE → default RN (verifier rejects
+ // NONE anyway)
----------------
durga4github wrote:
I feel this is harder to read.
We can compute the rnd-mode-based-index as a standalone variable, with a -1 offset and use it everywhere.
That way, we don't need to duplicate rn-entries in the array.
https://github.com/llvm/llvm-project/pull/197422
More information about the Mlir-commits
mailing list