Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Commit 02063ef

Browse files
authored
[MLIR][Linalg] Remove elemwise_unary and elemwise_binary (#147082)
RFC: https://discourse.llvm.org/t/rfc-deprecate-linalg-elemwise-unary-and-elemwise-binary/87144 Remove the two operations and fix the tests by: * Cleaning simple operation tests of the old ops * Changing `linalg.elemwise_{u|bi}nary` with `linalg.{exp|add}` on transform tests * Changing some of the tests with `linalg.elementwise` instead, to broaden test coverage * Surgically removing the `elemwise_*` part in the Python tests * Update MLIR transform examples (text and tests) with `linalg.elementwise` instead Nothing else changed.
1 parent bdbf563 commit 02063ef

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

mlir/python/mlir/dialects/linalg/opdsl/ops/core_named_ops.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,6 @@ def copy(
2121
O[None] = cast(U, I[None])
2222

2323

24-
@linalg_structured_op
25-
def elemwise_unary(
26-
I=TensorDef(T1),
27-
O=TensorDef(U, output=True),
28-
fun=UnaryFnAttrDef(default=UnaryFn.exp),
29-
cast=TypeFnAttrDef(default=TypeFn.cast_signed),
30-
):
31-
"""Applies the unary function fun elementwise.
32-
33-
Numeric casting is performed on the input operand, promoting it to the same
34-
data type as the accumulator/output.
35-
"""
36-
O[None] = fun(cast(U, I[None]))
37-
38-
3924
@linalg_structured_op
4025
def exp(
4126
I=TensorDef(T1),
@@ -192,22 +177,6 @@ def erf(
192177
O[None] = UnaryFn.erf(I[None])
193178

194179

195-
@linalg_structured_op
196-
def elemwise_binary(
197-
lhs=TensorDef(T1),
198-
rhs=TensorDef(T2),
199-
O=TensorDef(U, output=True),
200-
fun=BinaryFnAttrDef(default=BinaryFn.add),
201-
cast=TypeFnAttrDef(default=TypeFn.cast_signed),
202-
):
203-
"""Applies the binary function fun elementwise.
204-
205-
Numeric casting is performed on the input operand, promoting it to the same
206-
data type as the accumulator/output.
207-
"""
208-
O[None] = fun(cast(U, lhs[None]), cast(U, rhs[None]))
209-
210-
211180
@linalg_structured_op
212181
def add(
213182
lhs=TensorDef(T1),

0 commit comments

Comments
 (0)