[Mlir-commits] [mlir] [MLIR][Linalg] Fix named structured ops yaml file (PR #98865)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Jul 15 00:26:05 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Renato Golin (rengolin)
<details>
<summary>Changes</summary>
Added missing reciprocal to Python file and fixed ErfOp name in yaml file. Now running the bash script yields the same output.
---
Full diff: https://github.com/llvm/llvm-project/pull/98865.diff
3 Files Affected:
- (modified) mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml (+1-1)
- (modified) mlir/python/mlir/dialects/linalg/opdsl/lang/comprehension.py (+1)
- (modified) mlir/python/mlir/dialects/linalg/opdsl/ops/core_named_ops.py (+12)
``````````diff
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml b/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml
index c31b7c4f6c108..46b3ec0f60ebf 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml
@@ -516,7 +516,7 @@ structured_op: !LinalgStructuredOpConfig
--- !LinalgOpConfig
metadata: !LinalgOpMetadata
name: erf
- cpp_class_name: erfOp
+ cpp_class_name: ErfOp
doc: |-
Applies erf(x) elementwise.
diff --git a/mlir/python/mlir/dialects/linalg/opdsl/lang/comprehension.py b/mlir/python/mlir/dialects/linalg/opdsl/lang/comprehension.py
index 1a198fc5ec6f9..4f81a3874650d 100644
--- a/mlir/python/mlir/dialects/linalg/opdsl/lang/comprehension.py
+++ b/mlir/python/mlir/dialects/linalg/opdsl/lang/comprehension.py
@@ -292,6 +292,7 @@ class UnaryFn:
ceil = UnaryFnType("ceil")
floor = UnaryFnType("floor")
negf = UnaryFnType("negf")
+ reciprocal = UnaryFnType("reciprocal")
round = UnaryFnType("round")
sqrt = UnaryFnType("sqrt")
rsqrt = UnaryFnType("rsqrt")
diff --git a/mlir/python/mlir/dialects/linalg/opdsl/ops/core_named_ops.py b/mlir/python/mlir/dialects/linalg/opdsl/ops/core_named_ops.py
index 3ceee8e370445..67bde8f736ef4 100644
--- a/mlir/python/mlir/dialects/linalg/opdsl/ops/core_named_ops.py
+++ b/mlir/python/mlir/dialects/linalg/opdsl/ops/core_named_ops.py
@@ -108,6 +108,18 @@ def negf(
O[None] = UnaryFn.negf(I[None])
+ at linalg_structured_op(op_class_name="ReciprocalOp")
+def reciprocal(
+ I=TensorDef(T1),
+ O=TensorDef(T1, output=True),
+):
+ """Applies reciprocal(x) elementwise.
+
+ No numeric casting is performed on the input operand.
+ """
+ O[None] = UnaryFn.reciprocal(I[None])
+
+
@linalg_structured_op
def round(
I=TensorDef(T1),
``````````
</details>
https://github.com/llvm/llvm-project/pull/98865
More information about the Mlir-commits
mailing list