[Mlir-commits] [mlir] de3e9d4 - [MLIR][Linalg] Fix named structured ops yaml file (#98865)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Jul 15 01:30:59 PDT 2024
Author: Renato Golin
Date: 2024-07-15T09:30:56+01:00
New Revision: de3e9d4138abeb92428bba5014af2f3d9ac21323
URL: https://github.com/llvm/llvm-project/commit/de3e9d4138abeb92428bba5014af2f3d9ac21323
DIFF: https://github.com/llvm/llvm-project/commit/de3e9d4138abeb92428bba5014af2f3d9ac21323.diff
LOG: [MLIR][Linalg] Fix named structured ops yaml file (#98865)
Added missing reciprocal to Python file and fixed ErfOp name in yaml
file. Now running the bash script yields the same output.
Added:
Modified:
mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml
mlir/python/mlir/dialects/linalg/opdsl/lang/comprehension.py
mlir/python/mlir/dialects/linalg/opdsl/ops/core_named_ops.py
Removed:
################################################################################
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),
More information about the Mlir-commits
mailing list