Skip to content

Commit 9f57050

Browse files
Regenerate MLIR Bindings (#1936)
Co-authored-by: enzyme-ci-bot[bot] <78882869+enzyme-ci-bot[bot]@users.noreply.github.com>
1 parent d0cace0 commit 9f57050

File tree

5 files changed

+980
-389
lines changed

5 files changed

+980
-389
lines changed

src/mlir/Dialects/Arith.jl

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -548,12 +548,18 @@ is undefined behavior. When applied to `vector` and `tensor` values, the
548548
behavior is undefined if _any_ of its elements are divided by zero or has a
549549
signed division overflow.
550550
551+
If the `exact` attribute is present, the result value is poison if `lhs` is
552+
not a multiple of `rhs`.
553+
551554
# Example
552555
553556
```mlir
554557
// Scalar signed integer division.
555558
%a = arith.divsi %b, %c : i64
556559
560+
// Scalar signed integer division where %b is known to be a multiple of %c.
561+
%a = arith.divsi %b, %c exact : i64
562+
557563
// SIMD vector element-wise division.
558564
%f = arith.divsi %g, %h : vector<4xi32>
559565
@@ -562,14 +568,19 @@ signed division overflow.
562568
```
563569
"""
564570
function divsi(
565-
lhs::Value, rhs::Value; result=nothing::Union{Nothing,IR.Type}, location=Location()
571+
lhs::Value,
572+
rhs::Value;
573+
result=nothing::Union{Nothing,IR.Type},
574+
isExact=nothing,
575+
location=Location(),
566576
)
567577
op_ty_results = IR.Type[]
568578
operands = Value[lhs, rhs]
569579
owned_regions = Region[]
570580
successors = Block[]
571581
attributes = NamedAttribute[]
572582
!isnothing(result) && push!(op_ty_results, result)
583+
!isnothing(isExact) && push!(attributes, namedattribute("isExact", isExact))
573584

574585
return create_operation(
575586
"arith.divsi",
@@ -594,12 +605,18 @@ Division by zero is undefined behavior. When applied to `vector` and
594605
`tensor` values, the behavior is undefined if _any_ elements are divided by
595606
zero.
596607
608+
If the `exact` attribute is present, the result value is poison if `lhs` is
609+
not a multiple of `rhs`.
610+
597611
# Example
598612
599613
```mlir
600614
// Scalar unsigned integer division.
601615
%a = arith.divui %b, %c : i64
602616
617+
// Scalar unsigned integer division where %b is known to be a multiple of %c.
618+
%a = arith.divui %b, %c exact : i64
619+
603620
// SIMD vector element-wise division.
604621
%f = arith.divui %g, %h : vector<4xi32>
605622
@@ -608,14 +625,19 @@ zero.
608625
```
609626
"""
610627
function divui(
611-
lhs::Value, rhs::Value; result=nothing::Union{Nothing,IR.Type}, location=Location()
628+
lhs::Value,
629+
rhs::Value;
630+
result=nothing::Union{Nothing,IR.Type},
631+
isExact=nothing,
632+
location=Location(),
612633
)
613634
op_ty_results = IR.Type[]
614635
operands = Value[lhs, rhs]
615636
owned_regions = Region[]
616637
successors = Block[]
617638
attributes = NamedAttribute[]
618639
!isnothing(result) && push!(op_ty_results, result)
640+
!isnothing(isExact) && push!(attributes, namedattribute("isExact", isExact))
619641

620642
return create_operation(
621643
"arith.divui",
@@ -1789,25 +1811,33 @@ output are filled with copies of the most-significant bit of the shifted value
17891811
operand is greater or equal than bitwidth of the first operand, then the operation
17901812
returns poison.
17911813
1814+
If the `exact` attribute is present, the result value of shrsi is a poison
1815+
value if any of the bits shifted out are non-zero.
1816+
17921817
# Example
17931818
17941819
```mlir
1795-
%1 = arith.constant 160 : i8 // %1 is 0b10100000
1820+
%1 = arith.constant 160 : i8 // %1 is 0b10100000
17961821
%2 = arith.constant 3 : i8
1797-
%3 = arith.shrsi %1, %2 : (i8, i8) -> i8 // %3 is 0b11110100
1798-
%4 = arith.constant 96 : i8 // %4 is 0b01100000
1799-
%5 = arith.shrsi %4, %2 : (i8, i8) -> i8 // %5 is 0b00001100
1822+
%3 = arith.shrsi %1, %2 exact : i8 // %3 is 0b11110100
1823+
%4 = arith.constant 98 : i8 // %4 is 0b01100010
1824+
%5 = arith.shrsi %4, %2 : i8 // %5 is 0b00001100
18001825
```
18011826
"""
18021827
function shrsi(
1803-
lhs::Value, rhs::Value; result=nothing::Union{Nothing,IR.Type}, location=Location()
1828+
lhs::Value,
1829+
rhs::Value;
1830+
result=nothing::Union{Nothing,IR.Type},
1831+
isExact=nothing,
1832+
location=Location(),
18041833
)
18051834
op_ty_results = IR.Type[]
18061835
operands = Value[lhs, rhs]
18071836
owned_regions = Region[]
18081837
successors = Block[]
18091838
attributes = NamedAttribute[]
18101839
!isnothing(result) && push!(op_ty_results, result)
1840+
!isnothing(isExact) && push!(attributes, namedattribute("isExact", isExact))
18111841

18121842
return create_operation(
18131843
"arith.shrsi",
@@ -1830,23 +1860,33 @@ and the second operand is interpreted as unsigned. The high order bits are alway
18301860
filled with zeros. If the value of the second operand is greater or equal than the
18311861
bitwidth of the first operand, then the operation returns poison.
18321862
1863+
If the `exact` attribute is present, the result value of shrui is a poison
1864+
value if any of the bits shifted out are non-zero.
1865+
18331866
# Example
18341867
18351868
```mlir
1836-
%1 = arith.constant 160 : i8 // %1 is 0b10100000
1869+
%1 = arith.constant 160 : i8 // %1 is 0b10100000
18371870
%2 = arith.constant 3 : i8
1838-
%3 = arith.shrui %1, %2 : (i8, i8) -> i8 // %3 is 0b00010100
1871+
%3 = arith.constant 6 : i8
1872+
%4 = arith.shrui %1, %2 exact : i8 // %4 is 0b00010100
1873+
%5 = arith.shrui %1, %3 : i8 // %3 is 0b00000010
18391874
```
18401875
"""
18411876
function shrui(
1842-
lhs::Value, rhs::Value; result=nothing::Union{Nothing,IR.Type}, location=Location()
1877+
lhs::Value,
1878+
rhs::Value;
1879+
result=nothing::Union{Nothing,IR.Type},
1880+
isExact=nothing,
1881+
location=Location(),
18431882
)
18441883
op_ty_results = IR.Type[]
18451884
operands = Value[lhs, rhs]
18461885
owned_regions = Region[]
18471886
successors = Block[]
18481887
attributes = NamedAttribute[]
18491888
!isnothing(result) && push!(op_ty_results, result)
1889+
!isnothing(isExact) && push!(attributes, namedattribute("isExact", isExact))
18501890

18511891
return create_operation(
18521892
"arith.shrui",

src/mlir/Dialects/MosaicGPU.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ does not.
215215
216216
The `predicate` allows scheduling the transfer conditionally. The async copy
217217
is always scheduled by at most a single lane in the warpgroup.
218+
219+
The `reduction_op` attribute can be provided to perform a reduction when
220+
storing to GMEM. For example, using `add` will add the SMEM values to
221+
existing values in GMEM.
218222
"""
219223
function async_store(
220224
source::Value,
@@ -223,6 +227,7 @@ function async_store(
223227
predicate=nothing::Union{Nothing,Value};
224228
slice_lengths,
225229
commit_group=nothing,
230+
reduction_op=nothing,
226231
location=Location(),
227232
)
228233
op_ty_results = IR.Type[]
@@ -237,6 +242,8 @@ function async_store(
237242
)
238243
!isnothing(commit_group) &&
239244
push!(attributes, namedattribute("commit_group", commit_group))
245+
!isnothing(reduction_op) &&
246+
push!(attributes, namedattribute("reduction_op", reduction_op))
240247

241248
return create_operation(
242249
"mosaic_gpu.async_store",
@@ -639,7 +646,7 @@ The `smem_ptr` is a pointer in SMEM where a pointer to the allocated
639646
TMEM will be stored. The op returns a memref to the allocated TMEM. The
640647
result must have a shape with dimensions [rows, logical_columns]. If
641648
`packing` is 1, then the number of logical (unpacked) columns is equal to
642-
the number of allocated columns in TMEM. Otherwise, these equations
649+
the number of allocated columns in TMEM. Otherwise, these constraints
643650
must hold:
644651
645652
packing = 32 / bitwidth(element type of result)

0 commit comments

Comments
 (0)