[MLIR][Python] fix class name of powf and negf in linalg (#97696)
The following logic can lead to a class name mismatch when using
`linalg.powf` in Python. This PR fixed the issue and also renamed
`NegfOp` to `NegFOp` in linalg to adhere to the naming convention, as
exemplified by `arith::NegFOp`.
173514d58e/mlir/python/mlir/dialects/linalg/opdsl/lang/dsl.py (L140-L143)
```
# linalg.powf(arg0, arg1, outs=[init_result.result])
NotImplementedError: Unknown named op_name / op_class_name: powf / PowfOp
```
This commit is contained in:
parent
4762f3bab0
commit
bfa762a5a5
@ -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.
|
||||
|
||||
|
@ -96,7 +96,7 @@ def floor(
|
||||
O[None] = UnaryFn.floor(I[None])
|
||||
|
||||
|
||||
@linalg_structured_op
|
||||
@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])
|
||||
|
||||
|
||||
@linalg_structured_op
|
||||
@linalg_structured_op(op_class_name="PowFOp")
|
||||
def powf(
|
||||
lhs=TensorDef(T1),
|
||||
rhs=TensorDef(T1),
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user