[Mlir-commits] [mlir] [MLIR][Python] fix class name of powf and negf in linalg (PR #97696)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Jul 4 01:54:58 PDT 2024
https://github.com/xurui1995 updated https://github.com/llvm/llvm-project/pull/97696
>From 65ef897202ebd1e78838d505e2be20247a544870 Mon Sep 17 00:00:00 2001
From: "Xu, Rui" <rui.xu at intel.com>
Date: Thu, 4 Jul 2024 01:22:22 -0700
Subject: [PATCH 1/3] [MLIR][linalg] fix the class name of negf and powf
---
.../mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml | 2 +-
mlir/python/mlir/dialects/linalg/opdsl/ops/core_named_ops.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml b/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml
index fad234a9dcae9..a344add6a4e54 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml
@@ -271,7 +271,7 @@ structured_op: !LinalgStructuredOpConfig
--- !LinalgOpConfig
metadata: !LinalgOpMetadata
name: negf
- cpp_class_name: NegfOp
+ cpp_class_name: NegFOp
doc: |-
Applies negf(x) elementwise.
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 43410aaa6af1b..cbb2d1cec103c 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
@@ -96,7 +96,7 @@ def floor(
O[None] = UnaryFn.floor(I[None])
- at linalg_structured_op
+ at linalg_structured_op(op_class_name="NegFOp")
def negf(
I=TensorDef(T1),
O=TensorDef(T1, output=True),
@@ -330,7 +330,7 @@ def min(
O[None] = BinaryFn.min_signed(lhs[None], rhs[None])
- at linalg_structured_op
+ at linalg_structured_op(op_class_name="PowFOp")
def powf(
lhs=TensorDef(T1),
rhs=TensorDef(T1),
>From 2a0849c8ab09a1eef0bd867e163cc73b7d0b637b Mon Sep 17 00:00:00 2001
From: "Xu, Rui" <rui.xu at intel.com>
Date: Thu, 4 Jul 2024 01:49:48 -0700
Subject: [PATCH 2/3] add test
---
mlir/test/python/dialects/linalg/opdsl/test_core_named_ops.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mlir/test/python/dialects/linalg/opdsl/test_core_named_ops.py b/mlir/test/python/dialects/linalg/opdsl/test_core_named_ops.py
index 0dceba9c13a46..0a068bff7715f 100644
--- a/mlir/test/python/dialects/linalg/opdsl/test_core_named_ops.py
+++ b/mlir/test/python/dialects/linalg/opdsl/test_core_named_ops.py
@@ -2,3 +2,7 @@
# Just verify that at least one known op is generated.
# CHECK: name: matmul
+
+# verify some special cases: negf->NegFOp, powf->PowFOp
+# CHECK cpp_class_name: NegFOp
+# CHECK cpp_class_name: PowFOp
\ No newline at end of file
>From 18ac17263cd9ec03e611e42ee7e7181a1b16141e Mon Sep 17 00:00:00 2001
From: "Xu, Rui" <rui.xu at intel.com>
Date: Thu, 4 Jul 2024 01:54:42 -0700
Subject: [PATCH 3/3] add a empty line
---
mlir/test/python/dialects/linalg/opdsl/test_core_named_ops.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mlir/test/python/dialects/linalg/opdsl/test_core_named_ops.py b/mlir/test/python/dialects/linalg/opdsl/test_core_named_ops.py
index 0a068bff7715f..ee76b6d25cae1 100644
--- a/mlir/test/python/dialects/linalg/opdsl/test_core_named_ops.py
+++ b/mlir/test/python/dialects/linalg/opdsl/test_core_named_ops.py
@@ -5,4 +5,4 @@
# verify some special cases: negf->NegFOp, powf->PowFOp
# CHECK cpp_class_name: NegFOp
-# CHECK cpp_class_name: PowFOp
\ No newline at end of file
+# CHECK cpp_class_name: PowFOp
More information about the Mlir-commits
mailing list