Skip to content

Commit cf05668

Browse files
author
gysit
committed
[mlir][OpDSL] Rename PrimFn to ArithFn.
The revision renames `PrimFn` to `ArithFn`. The name resembles the newly introduced arith dialect that implements most of the arithmetic functions. An exception are log/exp that are part of the math dialect. Depends On D115239 Reviewed By: stellaraccident Differential Revision: https://reviews.llvm.org/D115240
1 parent 15757ea commit cf05668

File tree

11 files changed

+208
-186
lines changed

11 files changed

+208
-186
lines changed

mlir/docs/Dialects/Linalg/OpDSL.md

+15-7
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,20 @@ TODO: Introduce a directive to fix the dimension bindings.
177177
Reduction dimensions are inferred to be any dimensions on the RHS that are not
178178
on the LHS.
179179

180-
A number of arithmetic primitive functions are supported:
180+
A number of arithmetic functions are supported:
181+
182+
* `ArithFn.add(a, b)` (also via overloading the binary `+` operator)
183+
* `ArithFn.exp(a)`
184+
* `ArithFn.log(a)`
185+
* `ArithFn.mul(a, b)` (also via overloading the binary `*` operator)
186+
* `ArithFn.max(a, b)`
187+
* `ArithFn.min(a, b)`
188+
* `ArithFn.sub(a, b)` (also via overloading the binary `-` operator)
189+
* `ArithFn.max_unsigned(a, b)`
190+
* `ArithFn.min_unsigned(a, b)`
181191

182-
* `PrimFn.add(a, b)` (also via overloading the binary `+` operator)
183-
* `PrimFn.exp(a)`
184-
* `PrimFn.log(a)`
185-
* `PrimFn.mul(a, b)` (also via overloading the binary `*` operator)
186-
* `PrimFn.max(a, b)`
187-
* `PrimFn.sub(a, b)` (also via overloading the binary `-` operator)
192+
As the integer types are signless, signedness is implement by different
193+
functions that treat integers as signed or unsigned values.
188194

189195
Reduction functions can appear as the outer-most function on the RHS:
190196

@@ -233,6 +239,8 @@ The following examples illustrate the lowering of signed and unsigned functions:
233239
* cast(F32 -> I32) -> `arith.FPToSIOp`
234240
* cast_unsigned(I32 -> I64) -> `arith.ExtUIOp`
235241
* cast_unsigned(F32 -> I32) -> `arith.FPToUIOp`
242+
* max -> `arith.MaxSIOp`
243+
* max_unsinged -> `arith.MaxUIOp`
236244

237245
Not all functions are applicable for all numeric types, and on mismatch, op
238246
verification will fail.

0 commit comments

Comments
 (0)