[Mlir-commits] [mlir] [MLIR][NVVM] Add sqrt Ops (PR #197422)
Guray Ozen
llvmlistbot at llvm.org
Mon May 18 00:59:56 PDT 2026
================
@@ -6544,6 +6544,41 @@ def NVVM_FmaOp : NVVM_Op<"fma", [Pure, SameOperandsAndResultType]> {
}];
}
+//===----------------------------------------------------------------------===//
+// NVVM sqrt op definitions
+//===----------------------------------------------------------------------===//
+
+def NVVM_SqrtOp
+ : NVVM_SingleResultIntrinsicOp<"sqrt", [Pure, SameOperandsAndResultType]> {
+ let summary = "Take the square root of a value";
+ let description = [{
+ Compute sqrt(src) and store the result in res.
+
+ For more information, see PTX ISA:
+ [sqrt](https://docs.nvidia.com/cuda/parallel-thread-execution/#floating-point-instructions-sqrt)
+ }];
+ let arguments = (ins AnyTypeOf<[F32, F64]>:$src, FPArithRoundingMode:$rnd,
+ DefaultValuedAttr<BoolAttr, "false">:$ftz);
+ let results = (outs AnyTypeOf<[F32, F64]>:$res);
+ let assemblyFormat = "$src attr-dict `:` type($src)";
+ let hasVerifier = 1;
+}
+
+def NVVM_SqrtApproxOp : NVVM_F32UnaryApproxOp<"sqrt.approx"> {
----------------
grypp wrote:
Do we really need extra OP for `approx`?
@durga4github @schwarzschild-radius @varadk27
https://github.com/llvm/llvm-project/pull/197422
More information about the Mlir-commits
mailing list