nvidia-cutlass-dsl-libs-base 4.9.0.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/_mlir_libs/__init__.py +324 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/_mlir_libs/_cutlass_ir/_mlir/py.typed +0 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/_mlir_libs/_cutlass_ir/_mlirExecutionEngine.pyi +19 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_arith_enum_gen.py +293 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_arith_ops_gen.py +4031 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_builtin_ops_gen.py +199 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_cf_ops_gen.py +400 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_core_enum_gen.py +567 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_core_ops_gen.py +6378 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_cuda_enum_gen.py +900 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_cuda_ops_gen.py +16207 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_cute_enum_gen.py +143 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_cute_nvgpu_enum_gen.py +1536 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_cute_nvgpu_ops_gen.py +6865 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_cute_ops_gen.py +8755 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_func_ops_gen.py +600 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_gpu_enum_gen.py +440 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_gpu_ops_gen.py +7183 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_iket_enum_gen.py +8 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_iket_ops_gen.py +454 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_lir_enum_gen.py +96 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_lir_ops_gen.py +6817 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_llvm_enum_gen.py +1098 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_llvm_ops_gen.py +21996 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_math_ops_gen.py +3115 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_nvgpu_enum_gen.py +257 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_nvgpu_ops_gen.py +2914 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_nvvm_enum_gen.py +2828 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_nvvm_ops_gen.py +25559 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_ods_common.py +274 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_pyir_ops_gen.py +174 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_scf_ops_gen.py +1404 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_ts_enum_gen.py +257 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_ts_ops_gen.py +1650 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_ub_ops_gen.py +123 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_vector_enum_gen.py +119 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/_vector_ops_gen.py +4221 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/arith.py +88 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/builtin.py +46 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/cf.py +6 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/core.py +35 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/cuda.py +276 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/cute.py +16 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/cute_nvgpu.py +15 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/ext.py +961 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/func.py +321 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/gpu/__init__.py +337 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/gpu/passes/__init__.py +5 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/iket.py +13 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/lir.py +14 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/llvm.py +26 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/math.py +6 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/nvgpu.py +8 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/nvvm.py +7 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/pyir.py +17 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/scf.py +324 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/ts.py +64 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/ub.py +6 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/dialects/vector.py +7 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/execution_engine.py +41 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/extras/meta.py +81 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/extras/types.py +170 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/ir.py +386 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/passmanager.py +5 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/rewrite.py +5 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/runtime/__init__.py +1 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir/runtime/np_to_memref.py +181 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir_helpers/__init__.py +29 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir_helpers/arith.py +1221 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir_helpers/cuda.py +99 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir_helpers/dialect_proxy.py +121 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir_helpers/dominance.py +75 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir_helpers/gpu.py +63 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir_helpers/lru_cache_ir.py +79 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir_helpers/math.py +2514 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir_helpers/nanobind_compat.py +71 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir_helpers/op.py +810 -0
- nvidia_cutlass_dsl/dsl_packages/cutlass/_mlir_helpers/vector.py +1470 -0
- nvidia_cutlass_dsl_libs_base-4.9.0.dev1.dist-info/METADATA +46 -0
- nvidia_cutlass_dsl_libs_base-4.9.0.dev1.dist-info/RECORD +83 -0
- nvidia_cutlass_dsl_libs_base-4.9.0.dev1.dist-info/WHEEL +5 -0
- nvidia_cutlass_dsl_libs_base-4.9.0.dev1.dist-info/licenses/LICENSE +188 -0
- nvidia_cutlass_dsl_libs_base-4.9.0.dev1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,4031 @@
|
|
|
1
|
+
|
|
2
|
+
# Autogenerated by mlir-tblgen; don't manually edit.
|
|
3
|
+
|
|
4
|
+
from ._ods_common import _cext as _ods_cext
|
|
5
|
+
from ._ods_common import (
|
|
6
|
+
equally_sized_accessor as _ods_equally_sized_accessor,
|
|
7
|
+
get_default_loc_context as _ods_get_default_loc_context,
|
|
8
|
+
get_op_results_or_values as _get_op_results_or_values,
|
|
9
|
+
segmented_accessor as _ods_segmented_accessor,
|
|
10
|
+
)
|
|
11
|
+
_ods_ir = _ods_cext.ir
|
|
12
|
+
_ods_cext.globals.register_traceback_file_exclusion(__file__)
|
|
13
|
+
|
|
14
|
+
import builtins
|
|
15
|
+
from typing import Any as _Any, Sequence as _Sequence, Union as _Union, Optional as _Optional
|
|
16
|
+
import sys as _sys
|
|
17
|
+
if _sys.version_info >= (3, 12):
|
|
18
|
+
from collections.abc import Buffer as _Buffer # pytype: disable=not-supported-yet
|
|
19
|
+
else:
|
|
20
|
+
try:
|
|
21
|
+
from typing_extensions import Buffer as _Buffer
|
|
22
|
+
except ImportError:
|
|
23
|
+
_Buffer = _Any
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@_ods_cext.register_dialect
|
|
27
|
+
class _Dialect(_ods_ir.Dialect):
|
|
28
|
+
DIALECT_NAMESPACE = "arith"
|
|
29
|
+
|
|
30
|
+
@_ods_cext.register_operation(_Dialect)
|
|
31
|
+
class AddFOp(_ods_ir.OpView):
|
|
32
|
+
r"""
|
|
33
|
+
The `addf` operation takes two operands and returns one result, each of
|
|
34
|
+
these is required to be the same type. This type may be a floating point
|
|
35
|
+
scalar type, a vector whose element type is a floating point type, or a
|
|
36
|
+
floating point tensor.
|
|
37
|
+
|
|
38
|
+
Example:
|
|
39
|
+
|
|
40
|
+
```mlir
|
|
41
|
+
// Scalar addition.
|
|
42
|
+
%a = arith.addf %b, %c : f64
|
|
43
|
+
|
|
44
|
+
// SIMD vector addition, e.g. for Intel SSE.
|
|
45
|
+
%f = arith.addf %g, %h : vector<4xf32>
|
|
46
|
+
|
|
47
|
+
// Tensor addition.
|
|
48
|
+
%x = arith.addf %y, %z : tensor<4x?xbf16>
|
|
49
|
+
|
|
50
|
+
// Scalar addition with rounding mode.
|
|
51
|
+
%a = arith.addf %b, %c to_nearest_even : f64
|
|
52
|
+
```
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
OPERATION_NAME = "arith.addf"
|
|
56
|
+
|
|
57
|
+
_ODS_REGIONS = (0, True)
|
|
58
|
+
|
|
59
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, roundingmode: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
60
|
+
operands = []
|
|
61
|
+
attributes = {}
|
|
62
|
+
regions = None
|
|
63
|
+
operands.append(lhs)
|
|
64
|
+
operands.append(rhs)
|
|
65
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
66
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
67
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
68
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
69
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
70
|
+
if roundingmode is not None: attributes["roundingmode"] = (roundingmode if (
|
|
71
|
+
isinstance(roundingmode, _ods_ir.Attribute) or
|
|
72
|
+
not _ods_ir.AttrBuilder.contains('Arith_RoundingModeAttr')) else
|
|
73
|
+
_ods_ir.AttrBuilder.get('Arith_RoundingModeAttr')(roundingmode, context=_ods_context))
|
|
74
|
+
if results is None: results = [operands[0].type] * 1
|
|
75
|
+
_ods_successors = None
|
|
76
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
77
|
+
|
|
78
|
+
@builtins.property
|
|
79
|
+
def lhs(self) -> _ods_ir.Value:
|
|
80
|
+
return self.operation.operands[0]
|
|
81
|
+
|
|
82
|
+
@builtins.property
|
|
83
|
+
def rhs(self) -> _ods_ir.Value:
|
|
84
|
+
return self.operation.operands[1]
|
|
85
|
+
|
|
86
|
+
@builtins.property
|
|
87
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
88
|
+
return self.operation.attributes["fastmath"]
|
|
89
|
+
|
|
90
|
+
@fastmath.setter
|
|
91
|
+
def fastmath(self, value: _ods_ir.Attribute):
|
|
92
|
+
if value is None:
|
|
93
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
94
|
+
self.operation.attributes["fastmath"] = value
|
|
95
|
+
|
|
96
|
+
@builtins.property
|
|
97
|
+
def roundingmode(self) -> _Optional[_ods_ir.Attribute]:
|
|
98
|
+
if "roundingmode" not in self.operation.attributes:
|
|
99
|
+
return None
|
|
100
|
+
return self.operation.attributes["roundingmode"]
|
|
101
|
+
|
|
102
|
+
@roundingmode.setter
|
|
103
|
+
def roundingmode(self, value: _Optional[_ods_ir.Attribute]):
|
|
104
|
+
if value is not None:
|
|
105
|
+
self.operation.attributes["roundingmode"] = value
|
|
106
|
+
elif "roundingmode" in self.operation.attributes:
|
|
107
|
+
del self.operation.attributes["roundingmode"]
|
|
108
|
+
|
|
109
|
+
@roundingmode.deleter
|
|
110
|
+
def roundingmode(self):
|
|
111
|
+
del self.operation.attributes["roundingmode"]
|
|
112
|
+
|
|
113
|
+
@builtins.property
|
|
114
|
+
def result(self) -> _ods_ir.OpResult:
|
|
115
|
+
return self.operation.results[0]
|
|
116
|
+
|
|
117
|
+
@_ods_cext.register_op_adaptor(AddFOp)
|
|
118
|
+
class AddFOpAdaptor(_ods_ir.OpAdaptor):
|
|
119
|
+
OPERATION_NAME = "arith.addf"
|
|
120
|
+
|
|
121
|
+
@builtins.property
|
|
122
|
+
def lhs(self) -> _ods_ir.Value:
|
|
123
|
+
return self.operands[0]
|
|
124
|
+
|
|
125
|
+
@builtins.property
|
|
126
|
+
def rhs(self) -> _ods_ir.Value:
|
|
127
|
+
return self.operands[1]
|
|
128
|
+
|
|
129
|
+
@builtins.property
|
|
130
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
131
|
+
return self.attributes["fastmath"]
|
|
132
|
+
|
|
133
|
+
@builtins.property
|
|
134
|
+
def roundingmode(self) -> _Optional[_ods_ir.Attribute]:
|
|
135
|
+
if "roundingmode" not in self.attributes:
|
|
136
|
+
return None
|
|
137
|
+
return self.attributes["roundingmode"]
|
|
138
|
+
|
|
139
|
+
def addf(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, roundingmode: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
140
|
+
return AddFOp(lhs=lhs, rhs=rhs, fastmath=fastmath, roundingmode=roundingmode, results=results, loc=loc, ip=ip).result
|
|
141
|
+
|
|
142
|
+
@_ods_cext.register_operation(_Dialect)
|
|
143
|
+
class AddIOp(_ods_ir.OpView):
|
|
144
|
+
r"""
|
|
145
|
+
Performs N-bit addition on the operands. The operands are interpreted as
|
|
146
|
+
unsigned bitvectors. The result is represented by a bitvector containing the
|
|
147
|
+
mathematical value of the addition modulo 2^n, where `n` is the bitwidth.
|
|
148
|
+
Because `arith` integers use a two's complement representation, this operation
|
|
149
|
+
is applicable on both signed and unsigned integer operands.
|
|
150
|
+
|
|
151
|
+
The `addi` operation takes two operands and returns one result, each of
|
|
152
|
+
these is required to be the same type. This type may be an integer scalar type,
|
|
153
|
+
a vector whose element type is integer, or a tensor of integers.
|
|
154
|
+
|
|
155
|
+
This op supports `nuw`/`nsw` overflow flags which stands for
|
|
156
|
+
"No Unsigned Wrap" and "No Signed Wrap", respectively. If the `nuw` and/or
|
|
157
|
+
`nsw` flags are present, and an unsigned/signed overflow occurs
|
|
158
|
+
(respectively), the result is poison.
|
|
159
|
+
|
|
160
|
+
Example:
|
|
161
|
+
|
|
162
|
+
```mlir
|
|
163
|
+
// Scalar addition.
|
|
164
|
+
%a = arith.addi %b, %c : i64
|
|
165
|
+
|
|
166
|
+
// Scalar addition with overflow flags.
|
|
167
|
+
%a = arith.addi %b, %c overflow<nsw, nuw> : i64
|
|
168
|
+
|
|
169
|
+
// SIMD vector element-wise addition.
|
|
170
|
+
%f = arith.addi %g, %h : vector<4xi32>
|
|
171
|
+
|
|
172
|
+
// Tensor element-wise addition.
|
|
173
|
+
%x = arith.addi %y, %z : tensor<4x?xi8>
|
|
174
|
+
```
|
|
175
|
+
"""
|
|
176
|
+
|
|
177
|
+
OPERATION_NAME = "arith.addi"
|
|
178
|
+
|
|
179
|
+
_ODS_REGIONS = (0, True)
|
|
180
|
+
|
|
181
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, overflowFlags: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
182
|
+
operands = []
|
|
183
|
+
attributes = {}
|
|
184
|
+
regions = None
|
|
185
|
+
operands.append(lhs)
|
|
186
|
+
operands.append(rhs)
|
|
187
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
188
|
+
if overflowFlags is not None: attributes["overflowFlags"] = (overflowFlags if (
|
|
189
|
+
isinstance(overflowFlags, _ods_ir.Attribute) or
|
|
190
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_IntegerOverflowAttr')) else
|
|
191
|
+
_ods_ir.AttrBuilder.get('arith.Arith_IntegerOverflowAttr')(overflowFlags, context=_ods_context))
|
|
192
|
+
if results is None: results = [operands[0].type] * 1
|
|
193
|
+
_ods_successors = None
|
|
194
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
195
|
+
|
|
196
|
+
@builtins.property
|
|
197
|
+
def lhs(self) -> _ods_ir.Value:
|
|
198
|
+
return self.operation.operands[0]
|
|
199
|
+
|
|
200
|
+
@builtins.property
|
|
201
|
+
def rhs(self) -> _ods_ir.Value:
|
|
202
|
+
return self.operation.operands[1]
|
|
203
|
+
|
|
204
|
+
@builtins.property
|
|
205
|
+
def overflowFlags(self) -> _ods_ir.Attribute:
|
|
206
|
+
return self.operation.attributes["overflowFlags"]
|
|
207
|
+
|
|
208
|
+
@overflowFlags.setter
|
|
209
|
+
def overflowFlags(self, value: _ods_ir.Attribute):
|
|
210
|
+
if value is None:
|
|
211
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
212
|
+
self.operation.attributes["overflowFlags"] = value
|
|
213
|
+
|
|
214
|
+
@builtins.property
|
|
215
|
+
def result(self) -> _ods_ir.OpResult:
|
|
216
|
+
return self.operation.results[0]
|
|
217
|
+
|
|
218
|
+
@_ods_cext.register_op_adaptor(AddIOp)
|
|
219
|
+
class AddIOpAdaptor(_ods_ir.OpAdaptor):
|
|
220
|
+
OPERATION_NAME = "arith.addi"
|
|
221
|
+
|
|
222
|
+
@builtins.property
|
|
223
|
+
def lhs(self) -> _ods_ir.Value:
|
|
224
|
+
return self.operands[0]
|
|
225
|
+
|
|
226
|
+
@builtins.property
|
|
227
|
+
def rhs(self) -> _ods_ir.Value:
|
|
228
|
+
return self.operands[1]
|
|
229
|
+
|
|
230
|
+
@builtins.property
|
|
231
|
+
def overflowFlags(self) -> _ods_ir.Attribute:
|
|
232
|
+
return self.attributes["overflowFlags"]
|
|
233
|
+
|
|
234
|
+
def addi(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, overflow_flags: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
235
|
+
return AddIOp(lhs=lhs, rhs=rhs, overflowFlags=overflow_flags, results=results, loc=loc, ip=ip).result
|
|
236
|
+
|
|
237
|
+
@_ods_cext.register_operation(_Dialect)
|
|
238
|
+
class AddUIExtendedOp(_ods_ir.OpView):
|
|
239
|
+
r"""
|
|
240
|
+
Performs (N+1)-bit addition on zero-extended operands. Returns two results:
|
|
241
|
+
the N-bit sum (same type as both operands), and the overflow bit
|
|
242
|
+
(boolean-like), where `1` indicates unsigned addition overflow, while `0`
|
|
243
|
+
indicates no overflow.
|
|
244
|
+
|
|
245
|
+
Example:
|
|
246
|
+
|
|
247
|
+
```mlir
|
|
248
|
+
// Scalar addition.
|
|
249
|
+
%sum, %overflow = arith.addui_extended %b, %c : i64, i1
|
|
250
|
+
|
|
251
|
+
// Vector element-wise addition.
|
|
252
|
+
%d:2 = arith.addui_extended %e, %f : vector<4xi32>, vector<4xi1>
|
|
253
|
+
|
|
254
|
+
// Tensor element-wise addition.
|
|
255
|
+
%x:2 = arith.addui_extended %y, %z : tensor<4x?xi8>, tensor<4x?xi1>
|
|
256
|
+
```
|
|
257
|
+
"""
|
|
258
|
+
|
|
259
|
+
OPERATION_NAME = "arith.addui_extended"
|
|
260
|
+
|
|
261
|
+
_ODS_REGIONS = (0, True)
|
|
262
|
+
|
|
263
|
+
def __init__(self, sum: _ods_ir.Type, overflow: _ods_ir.Type, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
264
|
+
operands = []
|
|
265
|
+
attributes = {}
|
|
266
|
+
regions = None
|
|
267
|
+
operands.append(lhs)
|
|
268
|
+
operands.append(rhs)
|
|
269
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
270
|
+
results = []
|
|
271
|
+
results.append(sum)
|
|
272
|
+
results.append(overflow)
|
|
273
|
+
_ods_successors = None
|
|
274
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
275
|
+
|
|
276
|
+
@builtins.property
|
|
277
|
+
def lhs(self) -> _ods_ir.Value:
|
|
278
|
+
return self.operation.operands[0]
|
|
279
|
+
|
|
280
|
+
@builtins.property
|
|
281
|
+
def rhs(self) -> _ods_ir.Value:
|
|
282
|
+
return self.operation.operands[1]
|
|
283
|
+
|
|
284
|
+
@builtins.property
|
|
285
|
+
def sum(self) -> _ods_ir.OpResult:
|
|
286
|
+
return self.operation.results[0]
|
|
287
|
+
|
|
288
|
+
@builtins.property
|
|
289
|
+
def overflow(self) -> _ods_ir.OpResult:
|
|
290
|
+
return self.operation.results[1]
|
|
291
|
+
|
|
292
|
+
@_ods_cext.register_op_adaptor(AddUIExtendedOp)
|
|
293
|
+
class AddUIExtendedOpAdaptor(_ods_ir.OpAdaptor):
|
|
294
|
+
OPERATION_NAME = "arith.addui_extended"
|
|
295
|
+
|
|
296
|
+
@builtins.property
|
|
297
|
+
def lhs(self) -> _ods_ir.Value:
|
|
298
|
+
return self.operands[0]
|
|
299
|
+
|
|
300
|
+
@builtins.property
|
|
301
|
+
def rhs(self) -> _ods_ir.Value:
|
|
302
|
+
return self.operands[1]
|
|
303
|
+
|
|
304
|
+
def addui_extended(sum: _ods_ir.Type, overflow: _ods_ir.Type, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResultList:
|
|
305
|
+
return AddUIExtendedOp(sum=sum, overflow=overflow, lhs=lhs, rhs=rhs, loc=loc, ip=ip).results
|
|
306
|
+
|
|
307
|
+
@_ods_cext.register_operation(_Dialect)
|
|
308
|
+
class AndIOp(_ods_ir.OpView):
|
|
309
|
+
r"""
|
|
310
|
+
The `andi` operation takes two operands and returns one result, each of
|
|
311
|
+
these is required to be the same type. This type may be an integer scalar
|
|
312
|
+
type, a vector whose element type is integer, or a tensor of integers. It
|
|
313
|
+
has no standard attributes.
|
|
314
|
+
|
|
315
|
+
Example:
|
|
316
|
+
|
|
317
|
+
```mlir
|
|
318
|
+
// Scalar integer bitwise and.
|
|
319
|
+
%a = arith.andi %b, %c : i64
|
|
320
|
+
|
|
321
|
+
// SIMD vector element-wise bitwise integer and.
|
|
322
|
+
%f = arith.andi %g, %h : vector<4xi32>
|
|
323
|
+
|
|
324
|
+
// Tensor element-wise bitwise integer and.
|
|
325
|
+
%x = arith.andi %y, %z : tensor<4x?xi8>
|
|
326
|
+
```
|
|
327
|
+
"""
|
|
328
|
+
|
|
329
|
+
OPERATION_NAME = "arith.andi"
|
|
330
|
+
|
|
331
|
+
_ODS_REGIONS = (0, True)
|
|
332
|
+
|
|
333
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
334
|
+
operands = []
|
|
335
|
+
attributes = {}
|
|
336
|
+
regions = None
|
|
337
|
+
operands.append(lhs)
|
|
338
|
+
operands.append(rhs)
|
|
339
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
340
|
+
if results is None: results = [operands[0].type] * 1
|
|
341
|
+
_ods_successors = None
|
|
342
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
343
|
+
|
|
344
|
+
@builtins.property
|
|
345
|
+
def lhs(self) -> _ods_ir.Value:
|
|
346
|
+
return self.operation.operands[0]
|
|
347
|
+
|
|
348
|
+
@builtins.property
|
|
349
|
+
def rhs(self) -> _ods_ir.Value:
|
|
350
|
+
return self.operation.operands[1]
|
|
351
|
+
|
|
352
|
+
@builtins.property
|
|
353
|
+
def result(self) -> _ods_ir.OpResult:
|
|
354
|
+
return self.operation.results[0]
|
|
355
|
+
|
|
356
|
+
@_ods_cext.register_op_adaptor(AndIOp)
|
|
357
|
+
class AndIOpAdaptor(_ods_ir.OpAdaptor):
|
|
358
|
+
OPERATION_NAME = "arith.andi"
|
|
359
|
+
|
|
360
|
+
@builtins.property
|
|
361
|
+
def lhs(self) -> _ods_ir.Value:
|
|
362
|
+
return self.operands[0]
|
|
363
|
+
|
|
364
|
+
@builtins.property
|
|
365
|
+
def rhs(self) -> _ods_ir.Value:
|
|
366
|
+
return self.operands[1]
|
|
367
|
+
|
|
368
|
+
def andi(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
369
|
+
return AndIOp(lhs=lhs, rhs=rhs, results=results, loc=loc, ip=ip).result
|
|
370
|
+
|
|
371
|
+
@_ods_cext.register_operation(_Dialect)
|
|
372
|
+
class BitcastOp(_ods_ir.OpView):
|
|
373
|
+
r"""
|
|
374
|
+
Bitcast an integer or floating point value to an integer or floating point
|
|
375
|
+
value of equal bit width. When operating on vectors, casts elementwise.
|
|
376
|
+
|
|
377
|
+
Note that this implements a logical bitcast independent of target
|
|
378
|
+
endianness. This allows constant folding without target information and is
|
|
379
|
+
consitent with the bitcast constant folders in LLVM (see
|
|
380
|
+
https://github.com/llvm/llvm-project/blob/18c19414eb/llvm/lib/IR/ConstantFold.cpp#L168)
|
|
381
|
+
For targets where the source and target type have the same endianness (which
|
|
382
|
+
is the standard), this cast will also change no bits at runtime, but it may
|
|
383
|
+
still require an operation, for example if the machine has different
|
|
384
|
+
floating point and integer register files. For targets that have a different
|
|
385
|
+
endianness for the source and target types (e.g. float is big-endian and
|
|
386
|
+
integer is little-endian) a proper lowering would add operations to swap the
|
|
387
|
+
order of words in addition to the bitcast.
|
|
388
|
+
"""
|
|
389
|
+
|
|
390
|
+
OPERATION_NAME = "arith.bitcast"
|
|
391
|
+
|
|
392
|
+
_ODS_REGIONS = (0, True)
|
|
393
|
+
|
|
394
|
+
def __init__(self, out: _ods_ir.Type, in_: _ods_ir.Value, *, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
395
|
+
operands = []
|
|
396
|
+
attributes = {}
|
|
397
|
+
regions = None
|
|
398
|
+
operands.append(in_)
|
|
399
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
400
|
+
results = []
|
|
401
|
+
results.append(out)
|
|
402
|
+
_ods_successors = None
|
|
403
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
404
|
+
|
|
405
|
+
@builtins.property
|
|
406
|
+
def in_(self) -> _ods_ir.Value:
|
|
407
|
+
return self.operation.operands[0]
|
|
408
|
+
|
|
409
|
+
@builtins.property
|
|
410
|
+
def out(self) -> _ods_ir.OpResult:
|
|
411
|
+
return self.operation.results[0]
|
|
412
|
+
|
|
413
|
+
@_ods_cext.register_op_adaptor(BitcastOp)
|
|
414
|
+
class BitcastOpAdaptor(_ods_ir.OpAdaptor):
|
|
415
|
+
OPERATION_NAME = "arith.bitcast"
|
|
416
|
+
|
|
417
|
+
@builtins.property
|
|
418
|
+
def in_(self) -> _ods_ir.Value:
|
|
419
|
+
return self.operands[0]
|
|
420
|
+
|
|
421
|
+
def bitcast(out: _ods_ir.Type, in_: _ods_ir.Value, *, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
422
|
+
return BitcastOp(out=out, in_=in_, loc=loc, ip=ip).result
|
|
423
|
+
|
|
424
|
+
@_ods_cext.register_operation(_Dialect)
|
|
425
|
+
class CeilDivSIOp(_ods_ir.OpView):
|
|
426
|
+
r"""
|
|
427
|
+
Signed integer division. Rounds towards positive infinity, i.e. `7 / -2 = -3`.
|
|
428
|
+
|
|
429
|
+
Divison by zero, or signed division overflow (minimum value divided by -1)
|
|
430
|
+
is undefined behavior. When applied to `vector` and `tensor` values, the
|
|
431
|
+
behavior is undefined if _any_ of its elements are divided by zero or has a
|
|
432
|
+
signed division overflow.
|
|
433
|
+
|
|
434
|
+
Example:
|
|
435
|
+
|
|
436
|
+
```mlir
|
|
437
|
+
// Scalar signed integer division.
|
|
438
|
+
%a = arith.ceildivsi %b, %c : i64
|
|
439
|
+
```
|
|
440
|
+
"""
|
|
441
|
+
|
|
442
|
+
OPERATION_NAME = "arith.ceildivsi"
|
|
443
|
+
|
|
444
|
+
_ODS_REGIONS = (0, True)
|
|
445
|
+
|
|
446
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
447
|
+
operands = []
|
|
448
|
+
attributes = {}
|
|
449
|
+
regions = None
|
|
450
|
+
operands.append(lhs)
|
|
451
|
+
operands.append(rhs)
|
|
452
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
453
|
+
if results is None: results = [operands[0].type] * 1
|
|
454
|
+
_ods_successors = None
|
|
455
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
456
|
+
|
|
457
|
+
@builtins.property
|
|
458
|
+
def lhs(self) -> _ods_ir.Value:
|
|
459
|
+
return self.operation.operands[0]
|
|
460
|
+
|
|
461
|
+
@builtins.property
|
|
462
|
+
def rhs(self) -> _ods_ir.Value:
|
|
463
|
+
return self.operation.operands[1]
|
|
464
|
+
|
|
465
|
+
@builtins.property
|
|
466
|
+
def result(self) -> _ods_ir.OpResult:
|
|
467
|
+
return self.operation.results[0]
|
|
468
|
+
|
|
469
|
+
@_ods_cext.register_op_adaptor(CeilDivSIOp)
|
|
470
|
+
class CeilDivSIOpAdaptor(_ods_ir.OpAdaptor):
|
|
471
|
+
OPERATION_NAME = "arith.ceildivsi"
|
|
472
|
+
|
|
473
|
+
@builtins.property
|
|
474
|
+
def lhs(self) -> _ods_ir.Value:
|
|
475
|
+
return self.operands[0]
|
|
476
|
+
|
|
477
|
+
@builtins.property
|
|
478
|
+
def rhs(self) -> _ods_ir.Value:
|
|
479
|
+
return self.operands[1]
|
|
480
|
+
|
|
481
|
+
def ceildivsi(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
482
|
+
return CeilDivSIOp(lhs=lhs, rhs=rhs, results=results, loc=loc, ip=ip).result
|
|
483
|
+
|
|
484
|
+
@_ods_cext.register_operation(_Dialect)
|
|
485
|
+
class CeilDivUIOp(_ods_ir.OpView):
|
|
486
|
+
r"""
|
|
487
|
+
Unsigned integer division. Rounds towards positive infinity. Treats the
|
|
488
|
+
leading bit as the most significant, i.e. for `i16` given two's complement
|
|
489
|
+
representation, `6 / -2 = 6 / (2^16 - 2) = 1`.
|
|
490
|
+
|
|
491
|
+
Division by zero is undefined behavior. When applied to `vector` and
|
|
492
|
+
`tensor` values, the behavior is undefined if _any_ elements are divided by
|
|
493
|
+
zero.
|
|
494
|
+
|
|
495
|
+
Example:
|
|
496
|
+
|
|
497
|
+
```mlir
|
|
498
|
+
// Scalar unsigned integer division.
|
|
499
|
+
%a = arith.ceildivui %b, %c : i64
|
|
500
|
+
```
|
|
501
|
+
"""
|
|
502
|
+
|
|
503
|
+
OPERATION_NAME = "arith.ceildivui"
|
|
504
|
+
|
|
505
|
+
_ODS_REGIONS = (0, True)
|
|
506
|
+
|
|
507
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
508
|
+
operands = []
|
|
509
|
+
attributes = {}
|
|
510
|
+
regions = None
|
|
511
|
+
operands.append(lhs)
|
|
512
|
+
operands.append(rhs)
|
|
513
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
514
|
+
if results is None: results = [operands[0].type] * 1
|
|
515
|
+
_ods_successors = None
|
|
516
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
517
|
+
|
|
518
|
+
@builtins.property
|
|
519
|
+
def lhs(self) -> _ods_ir.Value:
|
|
520
|
+
return self.operation.operands[0]
|
|
521
|
+
|
|
522
|
+
@builtins.property
|
|
523
|
+
def rhs(self) -> _ods_ir.Value:
|
|
524
|
+
return self.operation.operands[1]
|
|
525
|
+
|
|
526
|
+
@builtins.property
|
|
527
|
+
def result(self) -> _ods_ir.OpResult:
|
|
528
|
+
return self.operation.results[0]
|
|
529
|
+
|
|
530
|
+
@_ods_cext.register_op_adaptor(CeilDivUIOp)
|
|
531
|
+
class CeilDivUIOpAdaptor(_ods_ir.OpAdaptor):
|
|
532
|
+
OPERATION_NAME = "arith.ceildivui"
|
|
533
|
+
|
|
534
|
+
@builtins.property
|
|
535
|
+
def lhs(self) -> _ods_ir.Value:
|
|
536
|
+
return self.operands[0]
|
|
537
|
+
|
|
538
|
+
@builtins.property
|
|
539
|
+
def rhs(self) -> _ods_ir.Value:
|
|
540
|
+
return self.operands[1]
|
|
541
|
+
|
|
542
|
+
def ceildivui(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
543
|
+
return CeilDivUIOp(lhs=lhs, rhs=rhs, results=results, loc=loc, ip=ip).result
|
|
544
|
+
|
|
545
|
+
@_ods_cext.register_operation(_Dialect)
|
|
546
|
+
class CmpFOp(_ods_ir.OpView):
|
|
547
|
+
r"""
|
|
548
|
+
The `cmpf` operation compares its two operands according to the float
|
|
549
|
+
comparison rules and the predicate specified by the respective attribute.
|
|
550
|
+
The predicate defines the type of comparison: (un)orderedness, (in)equality
|
|
551
|
+
and signed less/greater than (or equal to) as well as predicates that are
|
|
552
|
+
always true or false. The operands must have the same type, and this type
|
|
553
|
+
must be a float type, or a vector or tensor thereof. The result is an i1,
|
|
554
|
+
or a vector/tensor thereof having the same shape as the inputs. Unlike cmpi,
|
|
555
|
+
the operands are always treated as signed. The u prefix indicates
|
|
556
|
+
*unordered* comparison, not unsigned comparison, so "une" means unordered or
|
|
557
|
+
not equal. For the sake of readability by humans, custom assembly form for
|
|
558
|
+
the operation uses a string-typed attribute for the predicate. The value of
|
|
559
|
+
this attribute corresponds to lower-cased name of the predicate constant,
|
|
560
|
+
e.g., "one" means "ordered not equal". The string representation of the
|
|
561
|
+
attribute is merely a syntactic sugar and is converted to an integer
|
|
562
|
+
attribute by the parser.
|
|
563
|
+
|
|
564
|
+
Example:
|
|
565
|
+
|
|
566
|
+
```mlir
|
|
567
|
+
%r1 = arith.cmpf oeq, %0, %1 : f32
|
|
568
|
+
%r2 = arith.cmpf ult, %0, %1 : tensor<42x42xf64>
|
|
569
|
+
%r3 = "arith.cmpf"(%0, %1) {predicate: 0} : (f8, f8) -> i1
|
|
570
|
+
```
|
|
571
|
+
"""
|
|
572
|
+
|
|
573
|
+
OPERATION_NAME = "arith.cmpf"
|
|
574
|
+
|
|
575
|
+
_ODS_REGIONS = (0, True)
|
|
576
|
+
|
|
577
|
+
def __init__(self, predicate: _Union[_Any, _ods_ir.Attribute], lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
578
|
+
operands = []
|
|
579
|
+
attributes = {}
|
|
580
|
+
regions = None
|
|
581
|
+
operands.append(lhs)
|
|
582
|
+
operands.append(rhs)
|
|
583
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
584
|
+
attributes["predicate"] = (predicate if (
|
|
585
|
+
isinstance(predicate, _ods_ir.Attribute) or
|
|
586
|
+
not _ods_ir.AttrBuilder.contains('Arith_CmpFPredicateAttr')) else
|
|
587
|
+
_ods_ir.AttrBuilder.get('Arith_CmpFPredicateAttr')(predicate, context=_ods_context))
|
|
588
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
589
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
590
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
591
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
592
|
+
_ods_successors = None
|
|
593
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
594
|
+
|
|
595
|
+
@builtins.property
|
|
596
|
+
def lhs(self) -> _ods_ir.Value:
|
|
597
|
+
return self.operation.operands[0]
|
|
598
|
+
|
|
599
|
+
@builtins.property
|
|
600
|
+
def rhs(self) -> _ods_ir.Value:
|
|
601
|
+
return self.operation.operands[1]
|
|
602
|
+
|
|
603
|
+
@builtins.property
|
|
604
|
+
def predicate(self) -> _ods_ir.Attribute:
|
|
605
|
+
return self.operation.attributes["predicate"]
|
|
606
|
+
|
|
607
|
+
@predicate.setter
|
|
608
|
+
def predicate(self, value: _ods_ir.Attribute):
|
|
609
|
+
if value is None:
|
|
610
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
611
|
+
self.operation.attributes["predicate"] = value
|
|
612
|
+
|
|
613
|
+
@builtins.property
|
|
614
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
615
|
+
return self.operation.attributes["fastmath"]
|
|
616
|
+
|
|
617
|
+
@fastmath.setter
|
|
618
|
+
def fastmath(self, value: _ods_ir.Attribute):
|
|
619
|
+
if value is None:
|
|
620
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
621
|
+
self.operation.attributes["fastmath"] = value
|
|
622
|
+
|
|
623
|
+
@builtins.property
|
|
624
|
+
def result(self) -> _ods_ir.OpResult:
|
|
625
|
+
return self.operation.results[0]
|
|
626
|
+
|
|
627
|
+
@_ods_cext.register_op_adaptor(CmpFOp)
|
|
628
|
+
class CmpFOpAdaptor(_ods_ir.OpAdaptor):
|
|
629
|
+
OPERATION_NAME = "arith.cmpf"
|
|
630
|
+
|
|
631
|
+
@builtins.property
|
|
632
|
+
def lhs(self) -> _ods_ir.Value:
|
|
633
|
+
return self.operands[0]
|
|
634
|
+
|
|
635
|
+
@builtins.property
|
|
636
|
+
def rhs(self) -> _ods_ir.Value:
|
|
637
|
+
return self.operands[1]
|
|
638
|
+
|
|
639
|
+
@builtins.property
|
|
640
|
+
def predicate(self) -> _ods_ir.Attribute:
|
|
641
|
+
return self.attributes["predicate"]
|
|
642
|
+
|
|
643
|
+
@builtins.property
|
|
644
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
645
|
+
return self.attributes["fastmath"]
|
|
646
|
+
|
|
647
|
+
def cmpf(predicate: _Union[_Any, _ods_ir.Attribute], lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
648
|
+
return CmpFOp(predicate=predicate, lhs=lhs, rhs=rhs, fastmath=fastmath, results=results, loc=loc, ip=ip).result
|
|
649
|
+
|
|
650
|
+
@_ods_cext.register_operation(_Dialect)
|
|
651
|
+
class CmpIOp(_ods_ir.OpView):
|
|
652
|
+
r"""
|
|
653
|
+
The `cmpi` operation is a generic comparison for integer-like types. Its two
|
|
654
|
+
arguments can be integers, vectors or tensors thereof as long as their types
|
|
655
|
+
match. The operation produces an i1 for the former case, a vector or a
|
|
656
|
+
tensor of i1 with the same shape as inputs in the other cases.
|
|
657
|
+
|
|
658
|
+
Its first argument is an attribute that defines which type of comparison is
|
|
659
|
+
performed. The following comparisons are supported:
|
|
660
|
+
|
|
661
|
+
- equal (mnemonic: `"eq"`; integer value: `0`)
|
|
662
|
+
- not equal (mnemonic: `"ne"`; integer value: `1`)
|
|
663
|
+
- signed less than (mnemonic: `"slt"`; integer value: `2`)
|
|
664
|
+
- signed less than or equal (mnemonic: `"sle"`; integer value: `3`)
|
|
665
|
+
- signed greater than (mnemonic: `"sgt"`; integer value: `4`)
|
|
666
|
+
- signed greater than or equal (mnemonic: `"sge"`; integer value: `5`)
|
|
667
|
+
- unsigned less than (mnemonic: `"ult"`; integer value: `6`)
|
|
668
|
+
- unsigned less than or equal (mnemonic: `"ule"`; integer value: `7`)
|
|
669
|
+
- unsigned greater than (mnemonic: `"ugt"`; integer value: `8`)
|
|
670
|
+
- unsigned greater than or equal (mnemonic: `"uge"`; integer value: `9`)
|
|
671
|
+
|
|
672
|
+
The result is `1` if the comparison is true and `0` otherwise. For vector or
|
|
673
|
+
tensor operands, the comparison is performed elementwise and the element of
|
|
674
|
+
the result indicates whether the comparison is true for the operand elements
|
|
675
|
+
with the same indices as those of the result.
|
|
676
|
+
|
|
677
|
+
Note: while the custom assembly form uses strings, the actual underlying
|
|
678
|
+
attribute has integer type (or rather enum class in C++ code) as seen from
|
|
679
|
+
the generic assembly form. String literals are used to improve readability
|
|
680
|
+
of the IR by humans.
|
|
681
|
+
|
|
682
|
+
This operation only applies to integer-like operands, but not floats. The
|
|
683
|
+
main reason being that comparison operations have diverging sets of
|
|
684
|
+
attributes: integers require sign specification while floats require various
|
|
685
|
+
floating point-related particularities, e.g., `-ffast-math` behavior,
|
|
686
|
+
IEEE754 compliance, etc
|
|
687
|
+
([rationale](../Rationale/Rationale.md#splitting-floating-point-vs-integer-operations)).
|
|
688
|
+
The type of comparison is specified as attribute to avoid introducing ten
|
|
689
|
+
similar operations, taking into account that they are often implemented
|
|
690
|
+
using the same operation downstream
|
|
691
|
+
([rationale](../Rationale/Rationale.md#specifying-comparison-kind-as-attribute)). The
|
|
692
|
+
separation between signed and unsigned order comparisons is necessary
|
|
693
|
+
because of integers being signless. The comparison operation must know how
|
|
694
|
+
to interpret values with the foremost bit being set: negatives in two's
|
|
695
|
+
complement or large positives
|
|
696
|
+
([rationale](../Rationale/Rationale.md#specifying-sign-in-integer-comparison-operations)).
|
|
697
|
+
|
|
698
|
+
Example:
|
|
699
|
+
|
|
700
|
+
```mlir
|
|
701
|
+
// Custom form of scalar "signed less than" comparison.
|
|
702
|
+
%x = arith.cmpi slt, %lhs, %rhs : i32
|
|
703
|
+
|
|
704
|
+
// Generic form of the same operation.
|
|
705
|
+
%x = "arith.cmpi"(%lhs, %rhs) {predicate = 2 : i64} : (i32, i32) -> i1
|
|
706
|
+
|
|
707
|
+
// Custom form of vector equality comparison.
|
|
708
|
+
%x = arith.cmpi eq, %lhs, %rhs : vector<4xi64>
|
|
709
|
+
|
|
710
|
+
// Generic form of the same operation.
|
|
711
|
+
%x = "arith.cmpi"(%lhs, %rhs) {predicate = 0 : i64}
|
|
712
|
+
: (vector<4xi64>, vector<4xi64>) -> vector<4xi1>
|
|
713
|
+
```
|
|
714
|
+
"""
|
|
715
|
+
|
|
716
|
+
OPERATION_NAME = "arith.cmpi"
|
|
717
|
+
|
|
718
|
+
_ODS_REGIONS = (0, True)
|
|
719
|
+
|
|
720
|
+
def __init__(self, predicate: _Union[_Any, _ods_ir.Attribute], lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
721
|
+
operands = []
|
|
722
|
+
attributes = {}
|
|
723
|
+
regions = None
|
|
724
|
+
operands.append(lhs)
|
|
725
|
+
operands.append(rhs)
|
|
726
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
727
|
+
attributes["predicate"] = (predicate if (
|
|
728
|
+
isinstance(predicate, _ods_ir.Attribute) or
|
|
729
|
+
not _ods_ir.AttrBuilder.contains('Arith_CmpIPredicateAttr')) else
|
|
730
|
+
_ods_ir.AttrBuilder.get('Arith_CmpIPredicateAttr')(predicate, context=_ods_context))
|
|
731
|
+
_ods_successors = None
|
|
732
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
733
|
+
|
|
734
|
+
@builtins.property
|
|
735
|
+
def lhs(self) -> _ods_ir.Value:
|
|
736
|
+
return self.operation.operands[0]
|
|
737
|
+
|
|
738
|
+
@builtins.property
|
|
739
|
+
def rhs(self) -> _ods_ir.Value:
|
|
740
|
+
return self.operation.operands[1]
|
|
741
|
+
|
|
742
|
+
@builtins.property
|
|
743
|
+
def predicate(self) -> _ods_ir.Attribute:
|
|
744
|
+
return self.operation.attributes["predicate"]
|
|
745
|
+
|
|
746
|
+
@predicate.setter
|
|
747
|
+
def predicate(self, value: _ods_ir.Attribute):
|
|
748
|
+
if value is None:
|
|
749
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
750
|
+
self.operation.attributes["predicate"] = value
|
|
751
|
+
|
|
752
|
+
@builtins.property
|
|
753
|
+
def result(self) -> _ods_ir.OpResult:
|
|
754
|
+
return self.operation.results[0]
|
|
755
|
+
|
|
756
|
+
@_ods_cext.register_op_adaptor(CmpIOp)
|
|
757
|
+
class CmpIOpAdaptor(_ods_ir.OpAdaptor):
|
|
758
|
+
OPERATION_NAME = "arith.cmpi"
|
|
759
|
+
|
|
760
|
+
@builtins.property
|
|
761
|
+
def lhs(self) -> _ods_ir.Value:
|
|
762
|
+
return self.operands[0]
|
|
763
|
+
|
|
764
|
+
@builtins.property
|
|
765
|
+
def rhs(self) -> _ods_ir.Value:
|
|
766
|
+
return self.operands[1]
|
|
767
|
+
|
|
768
|
+
@builtins.property
|
|
769
|
+
def predicate(self) -> _ods_ir.Attribute:
|
|
770
|
+
return self.attributes["predicate"]
|
|
771
|
+
|
|
772
|
+
def cmpi(predicate: _Union[_Any, _ods_ir.Attribute], lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
773
|
+
return CmpIOp(predicate=predicate, lhs=lhs, rhs=rhs, results=results, loc=loc, ip=ip).result
|
|
774
|
+
|
|
775
|
+
@_ods_cext.register_operation(_Dialect)
|
|
776
|
+
class ConstantOp(_ods_ir.OpView):
|
|
777
|
+
r"""
|
|
778
|
+
The `constant` operation produces an SSA value equal to some integer or
|
|
779
|
+
floating-point constant specified by an attribute. This is the way MLIR
|
|
780
|
+
forms simple integer and floating point constants.
|
|
781
|
+
|
|
782
|
+
Example:
|
|
783
|
+
|
|
784
|
+
```
|
|
785
|
+
// Integer constant
|
|
786
|
+
%1 = arith.constant 42 : i32
|
|
787
|
+
|
|
788
|
+
// Equivalent generic form
|
|
789
|
+
%1 = "arith.constant"() {value = 42 : i32} : () -> i32
|
|
790
|
+
```
|
|
791
|
+
"""
|
|
792
|
+
|
|
793
|
+
OPERATION_NAME = "arith.constant"
|
|
794
|
+
|
|
795
|
+
_ODS_REGIONS = (0, True)
|
|
796
|
+
|
|
797
|
+
def __init__(self, value: _Union[_Any, _ods_ir.Attribute], *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
798
|
+
operands = []
|
|
799
|
+
attributes = {}
|
|
800
|
+
regions = None
|
|
801
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
802
|
+
attributes["value"] = (value if (
|
|
803
|
+
isinstance(value, _ods_ir.Attribute) or
|
|
804
|
+
not _ods_ir.AttrBuilder.contains('TypedAttrInterface')) else
|
|
805
|
+
_ods_ir.AttrBuilder.get('TypedAttrInterface')(value, context=_ods_context))
|
|
806
|
+
_ods_successors = None
|
|
807
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
808
|
+
|
|
809
|
+
@builtins.property
|
|
810
|
+
def value(self) -> _ods_ir.Attribute:
|
|
811
|
+
return self.operation.attributes["value"]
|
|
812
|
+
|
|
813
|
+
@value.setter
|
|
814
|
+
def value(self, value: _ods_ir.Attribute):
|
|
815
|
+
if value is None:
|
|
816
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
817
|
+
self.operation.attributes["value"] = value
|
|
818
|
+
|
|
819
|
+
@builtins.property
|
|
820
|
+
def result(self) -> _ods_ir.OpResult:
|
|
821
|
+
return self.operation.results[0]
|
|
822
|
+
|
|
823
|
+
@_ods_cext.register_op_adaptor(ConstantOp)
|
|
824
|
+
class ConstantOpAdaptor(_ods_ir.OpAdaptor):
|
|
825
|
+
OPERATION_NAME = "arith.constant"
|
|
826
|
+
|
|
827
|
+
@builtins.property
|
|
828
|
+
def value(self) -> _ods_ir.Attribute:
|
|
829
|
+
return self.attributes["value"]
|
|
830
|
+
|
|
831
|
+
def constant(value: _Union[_Any, _ods_ir.Attribute], *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
832
|
+
return ConstantOp(value=value, results=results, loc=loc, ip=ip).result
|
|
833
|
+
|
|
834
|
+
@_ods_cext.register_operation(_Dialect)
|
|
835
|
+
class ConvertFOp(_ods_ir.OpView):
|
|
836
|
+
r"""
|
|
837
|
+
Cast a floating-point value to a different floating-point type of the same
|
|
838
|
+
bitwidth. This operation handles conversions between types that have the
|
|
839
|
+
same bitwidth but different semantics (e.g., f16 to bf16), which cannot
|
|
840
|
+
be represented by `arith.extf` or `arith.truncf`.
|
|
841
|
+
|
|
842
|
+
The source and destination element types must be different and must have
|
|
843
|
+
the same bitwidth. When operating on vectors, casts elementwise.
|
|
844
|
+
"""
|
|
845
|
+
|
|
846
|
+
OPERATION_NAME = "arith.convertf"
|
|
847
|
+
|
|
848
|
+
_ODS_REGIONS = (0, True)
|
|
849
|
+
|
|
850
|
+
def __init__(self, out: _ods_ir.Type, in_: _ods_ir.Value, *, roundingmode: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
851
|
+
operands = []
|
|
852
|
+
attributes = {}
|
|
853
|
+
regions = None
|
|
854
|
+
operands.append(in_)
|
|
855
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
856
|
+
if roundingmode is not None: attributes["roundingmode"] = (roundingmode if (
|
|
857
|
+
isinstance(roundingmode, _ods_ir.Attribute) or
|
|
858
|
+
not _ods_ir.AttrBuilder.contains('Arith_RoundingModeAttr')) else
|
|
859
|
+
_ods_ir.AttrBuilder.get('Arith_RoundingModeAttr')(roundingmode, context=_ods_context))
|
|
860
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
861
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
862
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
863
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
864
|
+
results = []
|
|
865
|
+
results.append(out)
|
|
866
|
+
_ods_successors = None
|
|
867
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
868
|
+
|
|
869
|
+
@builtins.property
|
|
870
|
+
def in_(self) -> _ods_ir.Value:
|
|
871
|
+
return self.operation.operands[0]
|
|
872
|
+
|
|
873
|
+
@builtins.property
|
|
874
|
+
def roundingmode(self) -> _Optional[_ods_ir.Attribute]:
|
|
875
|
+
if "roundingmode" not in self.operation.attributes:
|
|
876
|
+
return None
|
|
877
|
+
return self.operation.attributes["roundingmode"]
|
|
878
|
+
|
|
879
|
+
@roundingmode.setter
|
|
880
|
+
def roundingmode(self, value: _Optional[_ods_ir.Attribute]):
|
|
881
|
+
if value is not None:
|
|
882
|
+
self.operation.attributes["roundingmode"] = value
|
|
883
|
+
elif "roundingmode" in self.operation.attributes:
|
|
884
|
+
del self.operation.attributes["roundingmode"]
|
|
885
|
+
|
|
886
|
+
@roundingmode.deleter
|
|
887
|
+
def roundingmode(self):
|
|
888
|
+
del self.operation.attributes["roundingmode"]
|
|
889
|
+
|
|
890
|
+
@builtins.property
|
|
891
|
+
def fastmath(self) -> _Optional[_ods_ir.Attribute]:
|
|
892
|
+
if "fastmath" not in self.operation.attributes:
|
|
893
|
+
return None
|
|
894
|
+
return self.operation.attributes["fastmath"]
|
|
895
|
+
|
|
896
|
+
@fastmath.setter
|
|
897
|
+
def fastmath(self, value: _Optional[_ods_ir.Attribute]):
|
|
898
|
+
if value is not None:
|
|
899
|
+
self.operation.attributes["fastmath"] = value
|
|
900
|
+
elif "fastmath" in self.operation.attributes:
|
|
901
|
+
del self.operation.attributes["fastmath"]
|
|
902
|
+
|
|
903
|
+
@fastmath.deleter
|
|
904
|
+
def fastmath(self):
|
|
905
|
+
del self.operation.attributes["fastmath"]
|
|
906
|
+
|
|
907
|
+
@builtins.property
|
|
908
|
+
def out(self) -> _ods_ir.OpResult:
|
|
909
|
+
return self.operation.results[0]
|
|
910
|
+
|
|
911
|
+
@_ods_cext.register_op_adaptor(ConvertFOp)
|
|
912
|
+
class ConvertFOpAdaptor(_ods_ir.OpAdaptor):
|
|
913
|
+
OPERATION_NAME = "arith.convertf"
|
|
914
|
+
|
|
915
|
+
@builtins.property
|
|
916
|
+
def in_(self) -> _ods_ir.Value:
|
|
917
|
+
return self.operands[0]
|
|
918
|
+
|
|
919
|
+
@builtins.property
|
|
920
|
+
def roundingmode(self) -> _Optional[_ods_ir.Attribute]:
|
|
921
|
+
if "roundingmode" not in self.attributes:
|
|
922
|
+
return None
|
|
923
|
+
return self.attributes["roundingmode"]
|
|
924
|
+
|
|
925
|
+
@builtins.property
|
|
926
|
+
def fastmath(self) -> _Optional[_ods_ir.Attribute]:
|
|
927
|
+
if "fastmath" not in self.attributes:
|
|
928
|
+
return None
|
|
929
|
+
return self.attributes["fastmath"]
|
|
930
|
+
|
|
931
|
+
def convertf(out: _ods_ir.Type, in_: _ods_ir.Value, *, roundingmode: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
932
|
+
return ConvertFOp(out=out, in_=in_, roundingmode=roundingmode, fastmath=fastmath, loc=loc, ip=ip).result
|
|
933
|
+
|
|
934
|
+
@_ods_cext.register_operation(_Dialect)
|
|
935
|
+
class DivFOp(_ods_ir.OpView):
|
|
936
|
+
r"""
|
|
937
|
+
The `divf` operation takes two operands and returns one result, each of
|
|
938
|
+
these is required to be the same type. This type may be a floating point
|
|
939
|
+
scalar type, a vector whose element type is a floating point type, or a
|
|
940
|
+
floating point tensor.
|
|
941
|
+
|
|
942
|
+
Example:
|
|
943
|
+
|
|
944
|
+
```mlir
|
|
945
|
+
// Scalar division.
|
|
946
|
+
%a = arith.divf %b, %c : f64
|
|
947
|
+
|
|
948
|
+
// Scalar division with rounding mode.
|
|
949
|
+
%a = arith.divf %b, %c toward_zero : f64
|
|
950
|
+
```
|
|
951
|
+
"""
|
|
952
|
+
|
|
953
|
+
OPERATION_NAME = "arith.divf"
|
|
954
|
+
|
|
955
|
+
_ODS_REGIONS = (0, True)
|
|
956
|
+
|
|
957
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, roundingmode: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
958
|
+
operands = []
|
|
959
|
+
attributes = {}
|
|
960
|
+
regions = None
|
|
961
|
+
operands.append(lhs)
|
|
962
|
+
operands.append(rhs)
|
|
963
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
964
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
965
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
966
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
967
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
968
|
+
if roundingmode is not None: attributes["roundingmode"] = (roundingmode if (
|
|
969
|
+
isinstance(roundingmode, _ods_ir.Attribute) or
|
|
970
|
+
not _ods_ir.AttrBuilder.contains('Arith_RoundingModeAttr')) else
|
|
971
|
+
_ods_ir.AttrBuilder.get('Arith_RoundingModeAttr')(roundingmode, context=_ods_context))
|
|
972
|
+
if results is None: results = [operands[0].type] * 1
|
|
973
|
+
_ods_successors = None
|
|
974
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
975
|
+
|
|
976
|
+
@builtins.property
|
|
977
|
+
def lhs(self) -> _ods_ir.Value:
|
|
978
|
+
return self.operation.operands[0]
|
|
979
|
+
|
|
980
|
+
@builtins.property
|
|
981
|
+
def rhs(self) -> _ods_ir.Value:
|
|
982
|
+
return self.operation.operands[1]
|
|
983
|
+
|
|
984
|
+
@builtins.property
|
|
985
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
986
|
+
return self.operation.attributes["fastmath"]
|
|
987
|
+
|
|
988
|
+
@fastmath.setter
|
|
989
|
+
def fastmath(self, value: _ods_ir.Attribute):
|
|
990
|
+
if value is None:
|
|
991
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
992
|
+
self.operation.attributes["fastmath"] = value
|
|
993
|
+
|
|
994
|
+
@builtins.property
|
|
995
|
+
def roundingmode(self) -> _Optional[_ods_ir.Attribute]:
|
|
996
|
+
if "roundingmode" not in self.operation.attributes:
|
|
997
|
+
return None
|
|
998
|
+
return self.operation.attributes["roundingmode"]
|
|
999
|
+
|
|
1000
|
+
@roundingmode.setter
|
|
1001
|
+
def roundingmode(self, value: _Optional[_ods_ir.Attribute]):
|
|
1002
|
+
if value is not None:
|
|
1003
|
+
self.operation.attributes["roundingmode"] = value
|
|
1004
|
+
elif "roundingmode" in self.operation.attributes:
|
|
1005
|
+
del self.operation.attributes["roundingmode"]
|
|
1006
|
+
|
|
1007
|
+
@roundingmode.deleter
|
|
1008
|
+
def roundingmode(self):
|
|
1009
|
+
del self.operation.attributes["roundingmode"]
|
|
1010
|
+
|
|
1011
|
+
@builtins.property
|
|
1012
|
+
def result(self) -> _ods_ir.OpResult:
|
|
1013
|
+
return self.operation.results[0]
|
|
1014
|
+
|
|
1015
|
+
@_ods_cext.register_op_adaptor(DivFOp)
|
|
1016
|
+
class DivFOpAdaptor(_ods_ir.OpAdaptor):
|
|
1017
|
+
OPERATION_NAME = "arith.divf"
|
|
1018
|
+
|
|
1019
|
+
@builtins.property
|
|
1020
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1021
|
+
return self.operands[0]
|
|
1022
|
+
|
|
1023
|
+
@builtins.property
|
|
1024
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1025
|
+
return self.operands[1]
|
|
1026
|
+
|
|
1027
|
+
@builtins.property
|
|
1028
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
1029
|
+
return self.attributes["fastmath"]
|
|
1030
|
+
|
|
1031
|
+
@builtins.property
|
|
1032
|
+
def roundingmode(self) -> _Optional[_ods_ir.Attribute]:
|
|
1033
|
+
if "roundingmode" not in self.attributes:
|
|
1034
|
+
return None
|
|
1035
|
+
return self.attributes["roundingmode"]
|
|
1036
|
+
|
|
1037
|
+
def divf(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, roundingmode: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
1038
|
+
return DivFOp(lhs=lhs, rhs=rhs, fastmath=fastmath, roundingmode=roundingmode, results=results, loc=loc, ip=ip).result
|
|
1039
|
+
|
|
1040
|
+
@_ods_cext.register_operation(_Dialect)
|
|
1041
|
+
class DivSIOp(_ods_ir.OpView):
|
|
1042
|
+
r"""
|
|
1043
|
+
Signed integer division. Rounds towards zero. Treats the leading bit as
|
|
1044
|
+
sign, i.e. `6 / -2 = -3`.
|
|
1045
|
+
|
|
1046
|
+
Divison by zero, or signed division overflow (minimum value divided by -1)
|
|
1047
|
+
is undefined behavior. When applied to `vector` and `tensor` values, the
|
|
1048
|
+
behavior is undefined if _any_ of its elements are divided by zero or has a
|
|
1049
|
+
signed division overflow.
|
|
1050
|
+
|
|
1051
|
+
If the `exact` attribute is present, the result value is poison if `lhs` is
|
|
1052
|
+
not a multiple of `rhs`.
|
|
1053
|
+
|
|
1054
|
+
Example:
|
|
1055
|
+
|
|
1056
|
+
```mlir
|
|
1057
|
+
// Scalar signed integer division.
|
|
1058
|
+
%a = arith.divsi %b, %c : i64
|
|
1059
|
+
|
|
1060
|
+
// Scalar signed integer division where %b is known to be a multiple of %c.
|
|
1061
|
+
%a = arith.divsi %b, %c exact : i64
|
|
1062
|
+
|
|
1063
|
+
// SIMD vector element-wise division.
|
|
1064
|
+
%f = arith.divsi %g, %h : vector<4xi32>
|
|
1065
|
+
|
|
1066
|
+
// Tensor element-wise integer division.
|
|
1067
|
+
%x = arith.divsi %y, %z : tensor<4x?xi8>
|
|
1068
|
+
```
|
|
1069
|
+
"""
|
|
1070
|
+
|
|
1071
|
+
OPERATION_NAME = "arith.divsi"
|
|
1072
|
+
|
|
1073
|
+
_ODS_REGIONS = (0, True)
|
|
1074
|
+
|
|
1075
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, isExact: _Optional[bool] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
1076
|
+
operands = []
|
|
1077
|
+
attributes = {}
|
|
1078
|
+
regions = None
|
|
1079
|
+
operands.append(lhs)
|
|
1080
|
+
operands.append(rhs)
|
|
1081
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
1082
|
+
if bool(isExact): attributes["isExact"] = _ods_ir.UnitAttr.get(
|
|
1083
|
+
_ods_get_default_loc_context(loc))
|
|
1084
|
+
if results is None: results = [operands[0].type] * 1
|
|
1085
|
+
_ods_successors = None
|
|
1086
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
1087
|
+
|
|
1088
|
+
@builtins.property
|
|
1089
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1090
|
+
return self.operation.operands[0]
|
|
1091
|
+
|
|
1092
|
+
@builtins.property
|
|
1093
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1094
|
+
return self.operation.operands[1]
|
|
1095
|
+
|
|
1096
|
+
@builtins.property
|
|
1097
|
+
def isExact(self) -> bool:
|
|
1098
|
+
return "isExact" in self.operation.attributes
|
|
1099
|
+
|
|
1100
|
+
@isExact.setter
|
|
1101
|
+
def isExact(self, value):
|
|
1102
|
+
if bool(value):
|
|
1103
|
+
self.operation.attributes["isExact"] = _ods_ir.UnitAttr.get()
|
|
1104
|
+
elif "isExact" in self.operation.attributes:
|
|
1105
|
+
del self.operation.attributes["isExact"]
|
|
1106
|
+
|
|
1107
|
+
@isExact.deleter
|
|
1108
|
+
def isExact(self):
|
|
1109
|
+
del self.operation.attributes["isExact"]
|
|
1110
|
+
|
|
1111
|
+
@builtins.property
|
|
1112
|
+
def result(self) -> _ods_ir.OpResult:
|
|
1113
|
+
return self.operation.results[0]
|
|
1114
|
+
|
|
1115
|
+
@_ods_cext.register_op_adaptor(DivSIOp)
|
|
1116
|
+
class DivSIOpAdaptor(_ods_ir.OpAdaptor):
|
|
1117
|
+
OPERATION_NAME = "arith.divsi"
|
|
1118
|
+
|
|
1119
|
+
@builtins.property
|
|
1120
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1121
|
+
return self.operands[0]
|
|
1122
|
+
|
|
1123
|
+
@builtins.property
|
|
1124
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1125
|
+
return self.operands[1]
|
|
1126
|
+
|
|
1127
|
+
@builtins.property
|
|
1128
|
+
def isExact(self) -> bool:
|
|
1129
|
+
return "isExact" in self.attributes
|
|
1130
|
+
|
|
1131
|
+
def divsi(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, is_exact: _Optional[bool] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
1132
|
+
return DivSIOp(lhs=lhs, rhs=rhs, isExact=is_exact, results=results, loc=loc, ip=ip).result
|
|
1133
|
+
|
|
1134
|
+
@_ods_cext.register_operation(_Dialect)
|
|
1135
|
+
class DivUIOp(_ods_ir.OpView):
|
|
1136
|
+
r"""
|
|
1137
|
+
Unsigned integer division. Rounds towards zero. Treats the leading bit as
|
|
1138
|
+
the most significant, i.e. for `i16` given two's complement representation,
|
|
1139
|
+
`6 / -2 = 6 / (2^16 - 2) = 0`.
|
|
1140
|
+
|
|
1141
|
+
Division by zero is undefined behavior. When applied to `vector` and
|
|
1142
|
+
`tensor` values, the behavior is undefined if _any_ elements are divided by
|
|
1143
|
+
zero.
|
|
1144
|
+
|
|
1145
|
+
If the `exact` attribute is present, the result value is poison if `lhs` is
|
|
1146
|
+
not a multiple of `rhs`.
|
|
1147
|
+
|
|
1148
|
+
Example:
|
|
1149
|
+
|
|
1150
|
+
```mlir
|
|
1151
|
+
// Scalar unsigned integer division.
|
|
1152
|
+
%a = arith.divui %b, %c : i64
|
|
1153
|
+
|
|
1154
|
+
// Scalar unsigned integer division where %b is known to be a multiple of %c.
|
|
1155
|
+
%a = arith.divui %b, %c exact : i64
|
|
1156
|
+
|
|
1157
|
+
// SIMD vector element-wise division.
|
|
1158
|
+
%f = arith.divui %g, %h : vector<4xi32>
|
|
1159
|
+
|
|
1160
|
+
// Tensor element-wise integer division.
|
|
1161
|
+
%x = arith.divui %y, %z : tensor<4x?xi8>
|
|
1162
|
+
```
|
|
1163
|
+
"""
|
|
1164
|
+
|
|
1165
|
+
OPERATION_NAME = "arith.divui"
|
|
1166
|
+
|
|
1167
|
+
_ODS_REGIONS = (0, True)
|
|
1168
|
+
|
|
1169
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, isExact: _Optional[bool] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
1170
|
+
operands = []
|
|
1171
|
+
attributes = {}
|
|
1172
|
+
regions = None
|
|
1173
|
+
operands.append(lhs)
|
|
1174
|
+
operands.append(rhs)
|
|
1175
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
1176
|
+
if bool(isExact): attributes["isExact"] = _ods_ir.UnitAttr.get(
|
|
1177
|
+
_ods_get_default_loc_context(loc))
|
|
1178
|
+
if results is None: results = [operands[0].type] * 1
|
|
1179
|
+
_ods_successors = None
|
|
1180
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
1181
|
+
|
|
1182
|
+
@builtins.property
|
|
1183
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1184
|
+
return self.operation.operands[0]
|
|
1185
|
+
|
|
1186
|
+
@builtins.property
|
|
1187
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1188
|
+
return self.operation.operands[1]
|
|
1189
|
+
|
|
1190
|
+
@builtins.property
|
|
1191
|
+
def isExact(self) -> bool:
|
|
1192
|
+
return "isExact" in self.operation.attributes
|
|
1193
|
+
|
|
1194
|
+
@isExact.setter
|
|
1195
|
+
def isExact(self, value):
|
|
1196
|
+
if bool(value):
|
|
1197
|
+
self.operation.attributes["isExact"] = _ods_ir.UnitAttr.get()
|
|
1198
|
+
elif "isExact" in self.operation.attributes:
|
|
1199
|
+
del self.operation.attributes["isExact"]
|
|
1200
|
+
|
|
1201
|
+
@isExact.deleter
|
|
1202
|
+
def isExact(self):
|
|
1203
|
+
del self.operation.attributes["isExact"]
|
|
1204
|
+
|
|
1205
|
+
@builtins.property
|
|
1206
|
+
def result(self) -> _ods_ir.OpResult:
|
|
1207
|
+
return self.operation.results[0]
|
|
1208
|
+
|
|
1209
|
+
@_ods_cext.register_op_adaptor(DivUIOp)
|
|
1210
|
+
class DivUIOpAdaptor(_ods_ir.OpAdaptor):
|
|
1211
|
+
OPERATION_NAME = "arith.divui"
|
|
1212
|
+
|
|
1213
|
+
@builtins.property
|
|
1214
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1215
|
+
return self.operands[0]
|
|
1216
|
+
|
|
1217
|
+
@builtins.property
|
|
1218
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1219
|
+
return self.operands[1]
|
|
1220
|
+
|
|
1221
|
+
@builtins.property
|
|
1222
|
+
def isExact(self) -> bool:
|
|
1223
|
+
return "isExact" in self.attributes
|
|
1224
|
+
|
|
1225
|
+
def divui(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, is_exact: _Optional[bool] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
1226
|
+
return DivUIOp(lhs=lhs, rhs=rhs, isExact=is_exact, results=results, loc=loc, ip=ip).result
|
|
1227
|
+
|
|
1228
|
+
@_ods_cext.register_operation(_Dialect)
|
|
1229
|
+
class ExtFOp(_ods_ir.OpView):
|
|
1230
|
+
r"""
|
|
1231
|
+
Cast a floating-point value to a larger floating-point-typed value.
|
|
1232
|
+
The destination type must to be strictly wider than the source type.
|
|
1233
|
+
When operating on vectors, casts elementwise.
|
|
1234
|
+
"""
|
|
1235
|
+
|
|
1236
|
+
OPERATION_NAME = "arith.extf"
|
|
1237
|
+
|
|
1238
|
+
_ODS_REGIONS = (0, True)
|
|
1239
|
+
|
|
1240
|
+
def __init__(self, out: _ods_ir.Type, in_: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
1241
|
+
operands = []
|
|
1242
|
+
attributes = {}
|
|
1243
|
+
regions = None
|
|
1244
|
+
operands.append(in_)
|
|
1245
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
1246
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
1247
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
1248
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
1249
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
1250
|
+
results = []
|
|
1251
|
+
results.append(out)
|
|
1252
|
+
_ods_successors = None
|
|
1253
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
1254
|
+
|
|
1255
|
+
@builtins.property
|
|
1256
|
+
def in_(self) -> _ods_ir.Value:
|
|
1257
|
+
return self.operation.operands[0]
|
|
1258
|
+
|
|
1259
|
+
@builtins.property
|
|
1260
|
+
def fastmath(self) -> _Optional[_ods_ir.Attribute]:
|
|
1261
|
+
if "fastmath" not in self.operation.attributes:
|
|
1262
|
+
return None
|
|
1263
|
+
return self.operation.attributes["fastmath"]
|
|
1264
|
+
|
|
1265
|
+
@fastmath.setter
|
|
1266
|
+
def fastmath(self, value: _Optional[_ods_ir.Attribute]):
|
|
1267
|
+
if value is not None:
|
|
1268
|
+
self.operation.attributes["fastmath"] = value
|
|
1269
|
+
elif "fastmath" in self.operation.attributes:
|
|
1270
|
+
del self.operation.attributes["fastmath"]
|
|
1271
|
+
|
|
1272
|
+
@fastmath.deleter
|
|
1273
|
+
def fastmath(self):
|
|
1274
|
+
del self.operation.attributes["fastmath"]
|
|
1275
|
+
|
|
1276
|
+
@builtins.property
|
|
1277
|
+
def out(self) -> _ods_ir.OpResult:
|
|
1278
|
+
return self.operation.results[0]
|
|
1279
|
+
|
|
1280
|
+
@_ods_cext.register_op_adaptor(ExtFOp)
|
|
1281
|
+
class ExtFOpAdaptor(_ods_ir.OpAdaptor):
|
|
1282
|
+
OPERATION_NAME = "arith.extf"
|
|
1283
|
+
|
|
1284
|
+
@builtins.property
|
|
1285
|
+
def in_(self) -> _ods_ir.Value:
|
|
1286
|
+
return self.operands[0]
|
|
1287
|
+
|
|
1288
|
+
@builtins.property
|
|
1289
|
+
def fastmath(self) -> _Optional[_ods_ir.Attribute]:
|
|
1290
|
+
if "fastmath" not in self.attributes:
|
|
1291
|
+
return None
|
|
1292
|
+
return self.attributes["fastmath"]
|
|
1293
|
+
|
|
1294
|
+
def extf(out: _ods_ir.Type, in_: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
1295
|
+
return ExtFOp(out=out, in_=in_, fastmath=fastmath, loc=loc, ip=ip).result
|
|
1296
|
+
|
|
1297
|
+
@_ods_cext.register_operation(_Dialect)
|
|
1298
|
+
class ExtSIOp(_ods_ir.OpView):
|
|
1299
|
+
r"""
|
|
1300
|
+
The integer sign extension operation takes an integer input of
|
|
1301
|
+
width M and an integer destination type of width N. The destination
|
|
1302
|
+
bit-width must be larger than the input bit-width (N > M).
|
|
1303
|
+
The top-most (N - M) bits of the output are filled with copies
|
|
1304
|
+
of the most-significant bit of the input.
|
|
1305
|
+
|
|
1306
|
+
Example:
|
|
1307
|
+
|
|
1308
|
+
```mlir
|
|
1309
|
+
%1 = arith.constant 5 : i3 // %1 is 0b101
|
|
1310
|
+
%2 = arith.extsi %1 : i3 to i6 // %2 is 0b111101
|
|
1311
|
+
%3 = arith.constant 2 : i3 // %3 is 0b010
|
|
1312
|
+
%4 = arith.extsi %3 : i3 to i6 // %4 is 0b000010
|
|
1313
|
+
|
|
1314
|
+
%5 = arith.extsi %0 : vector<2 x i32> to vector<2 x i64>
|
|
1315
|
+
```
|
|
1316
|
+
"""
|
|
1317
|
+
|
|
1318
|
+
OPERATION_NAME = "arith.extsi"
|
|
1319
|
+
|
|
1320
|
+
_ODS_REGIONS = (0, True)
|
|
1321
|
+
|
|
1322
|
+
def __init__(self, out: _ods_ir.Type, in_: _ods_ir.Value, *, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
1323
|
+
operands = []
|
|
1324
|
+
attributes = {}
|
|
1325
|
+
regions = None
|
|
1326
|
+
operands.append(in_)
|
|
1327
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
1328
|
+
results = []
|
|
1329
|
+
results.append(out)
|
|
1330
|
+
_ods_successors = None
|
|
1331
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
1332
|
+
|
|
1333
|
+
@builtins.property
|
|
1334
|
+
def in_(self) -> _ods_ir.Value:
|
|
1335
|
+
return self.operation.operands[0]
|
|
1336
|
+
|
|
1337
|
+
@builtins.property
|
|
1338
|
+
def out(self) -> _ods_ir.OpResult:
|
|
1339
|
+
return self.operation.results[0]
|
|
1340
|
+
|
|
1341
|
+
@_ods_cext.register_op_adaptor(ExtSIOp)
|
|
1342
|
+
class ExtSIOpAdaptor(_ods_ir.OpAdaptor):
|
|
1343
|
+
OPERATION_NAME = "arith.extsi"
|
|
1344
|
+
|
|
1345
|
+
@builtins.property
|
|
1346
|
+
def in_(self) -> _ods_ir.Value:
|
|
1347
|
+
return self.operands[0]
|
|
1348
|
+
|
|
1349
|
+
def extsi(out: _ods_ir.Type, in_: _ods_ir.Value, *, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
1350
|
+
return ExtSIOp(out=out, in_=in_, loc=loc, ip=ip).result
|
|
1351
|
+
|
|
1352
|
+
@_ods_cext.register_operation(_Dialect)
|
|
1353
|
+
class ExtUIOp(_ods_ir.OpView):
|
|
1354
|
+
r"""
|
|
1355
|
+
The integer zero extension operation takes an integer input of
|
|
1356
|
+
width M and an integer destination type of width N. The destination
|
|
1357
|
+
bit-width must be larger than the input bit-width (N > M).
|
|
1358
|
+
The top-most (N - M) bits of the output are filled with zeros.
|
|
1359
|
+
|
|
1360
|
+
When the `nneg` flag is present, the operand is assumed to have
|
|
1361
|
+
the most significant bit set to 0. In this case, zero extension is
|
|
1362
|
+
equivalent to sign extension. When this assumption is violated, the
|
|
1363
|
+
result is poison.
|
|
1364
|
+
|
|
1365
|
+
Example:
|
|
1366
|
+
|
|
1367
|
+
```mlir
|
|
1368
|
+
%1 = arith.constant 5 : i3 // %1 is 0b101
|
|
1369
|
+
%2 = arith.extui %1 : i3 to i6 // %2 is 0b000101
|
|
1370
|
+
%3 = arith.constant 2 : i3 // %3 is 0b010
|
|
1371
|
+
%4 = arith.extui %3 : i3 to i6 // %4 is 0b000010
|
|
1372
|
+
|
|
1373
|
+
%5 = arith.extui %0 : vector<2 x i32> to vector<2 x i64>
|
|
1374
|
+
|
|
1375
|
+
// Zero extension with nneg flag.
|
|
1376
|
+
%6 = arith.extui %3 nneg : i3 to i6
|
|
1377
|
+
```
|
|
1378
|
+
"""
|
|
1379
|
+
|
|
1380
|
+
OPERATION_NAME = "arith.extui"
|
|
1381
|
+
|
|
1382
|
+
_ODS_REGIONS = (0, True)
|
|
1383
|
+
|
|
1384
|
+
def __init__(self, out: _ods_ir.Type, in_: _ods_ir.Value, *, nonNeg: _Optional[bool] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
1385
|
+
operands = []
|
|
1386
|
+
attributes = {}
|
|
1387
|
+
regions = None
|
|
1388
|
+
operands.append(in_)
|
|
1389
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
1390
|
+
if bool(nonNeg): attributes["nonNeg"] = _ods_ir.UnitAttr.get(
|
|
1391
|
+
_ods_get_default_loc_context(loc))
|
|
1392
|
+
results = []
|
|
1393
|
+
results.append(out)
|
|
1394
|
+
_ods_successors = None
|
|
1395
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
1396
|
+
|
|
1397
|
+
@builtins.property
|
|
1398
|
+
def in_(self) -> _ods_ir.Value:
|
|
1399
|
+
return self.operation.operands[0]
|
|
1400
|
+
|
|
1401
|
+
@builtins.property
|
|
1402
|
+
def nonNeg(self) -> bool:
|
|
1403
|
+
return "nonNeg" in self.operation.attributes
|
|
1404
|
+
|
|
1405
|
+
@nonNeg.setter
|
|
1406
|
+
def nonNeg(self, value):
|
|
1407
|
+
if bool(value):
|
|
1408
|
+
self.operation.attributes["nonNeg"] = _ods_ir.UnitAttr.get()
|
|
1409
|
+
elif "nonNeg" in self.operation.attributes:
|
|
1410
|
+
del self.operation.attributes["nonNeg"]
|
|
1411
|
+
|
|
1412
|
+
@nonNeg.deleter
|
|
1413
|
+
def nonNeg(self):
|
|
1414
|
+
del self.operation.attributes["nonNeg"]
|
|
1415
|
+
|
|
1416
|
+
@builtins.property
|
|
1417
|
+
def out(self) -> _ods_ir.OpResult:
|
|
1418
|
+
return self.operation.results[0]
|
|
1419
|
+
|
|
1420
|
+
@_ods_cext.register_op_adaptor(ExtUIOp)
|
|
1421
|
+
class ExtUIOpAdaptor(_ods_ir.OpAdaptor):
|
|
1422
|
+
OPERATION_NAME = "arith.extui"
|
|
1423
|
+
|
|
1424
|
+
@builtins.property
|
|
1425
|
+
def in_(self) -> _ods_ir.Value:
|
|
1426
|
+
return self.operands[0]
|
|
1427
|
+
|
|
1428
|
+
@builtins.property
|
|
1429
|
+
def nonNeg(self) -> bool:
|
|
1430
|
+
return "nonNeg" in self.attributes
|
|
1431
|
+
|
|
1432
|
+
def extui(out: _ods_ir.Type, in_: _ods_ir.Value, *, non_neg: _Optional[bool] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
1433
|
+
return ExtUIOp(out=out, in_=in_, nonNeg=non_neg, loc=loc, ip=ip).result
|
|
1434
|
+
|
|
1435
|
+
@_ods_cext.register_operation(_Dialect)
|
|
1436
|
+
class FPToSIOp(_ods_ir.OpView):
|
|
1437
|
+
r"""
|
|
1438
|
+
Cast from a value interpreted as floating-point to the nearest (rounding
|
|
1439
|
+
towards zero) signed integer value. When operating on vectors, casts
|
|
1440
|
+
elementwise.
|
|
1441
|
+
"""
|
|
1442
|
+
|
|
1443
|
+
OPERATION_NAME = "arith.fptosi"
|
|
1444
|
+
|
|
1445
|
+
_ODS_REGIONS = (0, True)
|
|
1446
|
+
|
|
1447
|
+
def __init__(self, out: _ods_ir.Type, in_: _ods_ir.Value, *, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
1448
|
+
operands = []
|
|
1449
|
+
attributes = {}
|
|
1450
|
+
regions = None
|
|
1451
|
+
operands.append(in_)
|
|
1452
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
1453
|
+
results = []
|
|
1454
|
+
results.append(out)
|
|
1455
|
+
_ods_successors = None
|
|
1456
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
1457
|
+
|
|
1458
|
+
@builtins.property
|
|
1459
|
+
def in_(self) -> _ods_ir.Value:
|
|
1460
|
+
return self.operation.operands[0]
|
|
1461
|
+
|
|
1462
|
+
@builtins.property
|
|
1463
|
+
def out(self) -> _ods_ir.OpResult:
|
|
1464
|
+
return self.operation.results[0]
|
|
1465
|
+
|
|
1466
|
+
@_ods_cext.register_op_adaptor(FPToSIOp)
|
|
1467
|
+
class FPToSIOpAdaptor(_ods_ir.OpAdaptor):
|
|
1468
|
+
OPERATION_NAME = "arith.fptosi"
|
|
1469
|
+
|
|
1470
|
+
@builtins.property
|
|
1471
|
+
def in_(self) -> _ods_ir.Value:
|
|
1472
|
+
return self.operands[0]
|
|
1473
|
+
|
|
1474
|
+
def fptosi(out: _ods_ir.Type, in_: _ods_ir.Value, *, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
1475
|
+
return FPToSIOp(out=out, in_=in_, loc=loc, ip=ip).result
|
|
1476
|
+
|
|
1477
|
+
@_ods_cext.register_operation(_Dialect)
|
|
1478
|
+
class FPToUIOp(_ods_ir.OpView):
|
|
1479
|
+
r"""
|
|
1480
|
+
Cast from a value interpreted as floating-point to the nearest (rounding
|
|
1481
|
+
towards zero) unsigned integer value. When operating on vectors, casts
|
|
1482
|
+
elementwise.
|
|
1483
|
+
"""
|
|
1484
|
+
|
|
1485
|
+
OPERATION_NAME = "arith.fptoui"
|
|
1486
|
+
|
|
1487
|
+
_ODS_REGIONS = (0, True)
|
|
1488
|
+
|
|
1489
|
+
def __init__(self, out: _ods_ir.Type, in_: _ods_ir.Value, *, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
1490
|
+
operands = []
|
|
1491
|
+
attributes = {}
|
|
1492
|
+
regions = None
|
|
1493
|
+
operands.append(in_)
|
|
1494
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
1495
|
+
results = []
|
|
1496
|
+
results.append(out)
|
|
1497
|
+
_ods_successors = None
|
|
1498
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
1499
|
+
|
|
1500
|
+
@builtins.property
|
|
1501
|
+
def in_(self) -> _ods_ir.Value:
|
|
1502
|
+
return self.operation.operands[0]
|
|
1503
|
+
|
|
1504
|
+
@builtins.property
|
|
1505
|
+
def out(self) -> _ods_ir.OpResult:
|
|
1506
|
+
return self.operation.results[0]
|
|
1507
|
+
|
|
1508
|
+
@_ods_cext.register_op_adaptor(FPToUIOp)
|
|
1509
|
+
class FPToUIOpAdaptor(_ods_ir.OpAdaptor):
|
|
1510
|
+
OPERATION_NAME = "arith.fptoui"
|
|
1511
|
+
|
|
1512
|
+
@builtins.property
|
|
1513
|
+
def in_(self) -> _ods_ir.Value:
|
|
1514
|
+
return self.operands[0]
|
|
1515
|
+
|
|
1516
|
+
def fptoui(out: _ods_ir.Type, in_: _ods_ir.Value, *, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
1517
|
+
return FPToUIOp(out=out, in_=in_, loc=loc, ip=ip).result
|
|
1518
|
+
|
|
1519
|
+
@_ods_cext.register_operation(_Dialect)
|
|
1520
|
+
class FloorDivSIOp(_ods_ir.OpView):
|
|
1521
|
+
r"""
|
|
1522
|
+
Signed integer division. Rounds towards negative infinity, i.e. `5 / -2 = -3`.
|
|
1523
|
+
|
|
1524
|
+
Divison by zero, or signed division overflow (minimum value divided by -1)
|
|
1525
|
+
is undefined behavior. When applied to `vector` and `tensor` values, the
|
|
1526
|
+
behavior is undefined if _any_ of its elements are divided by zero or has a
|
|
1527
|
+
signed division overflow.
|
|
1528
|
+
|
|
1529
|
+
Example:
|
|
1530
|
+
|
|
1531
|
+
```mlir
|
|
1532
|
+
// Scalar signed integer division.
|
|
1533
|
+
%a = arith.floordivsi %b, %c : i64
|
|
1534
|
+
|
|
1535
|
+
```
|
|
1536
|
+
"""
|
|
1537
|
+
|
|
1538
|
+
OPERATION_NAME = "arith.floordivsi"
|
|
1539
|
+
|
|
1540
|
+
_ODS_REGIONS = (0, True)
|
|
1541
|
+
|
|
1542
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
1543
|
+
operands = []
|
|
1544
|
+
attributes = {}
|
|
1545
|
+
regions = None
|
|
1546
|
+
operands.append(lhs)
|
|
1547
|
+
operands.append(rhs)
|
|
1548
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
1549
|
+
if results is None: results = [operands[0].type] * 1
|
|
1550
|
+
_ods_successors = None
|
|
1551
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
1552
|
+
|
|
1553
|
+
@builtins.property
|
|
1554
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1555
|
+
return self.operation.operands[0]
|
|
1556
|
+
|
|
1557
|
+
@builtins.property
|
|
1558
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1559
|
+
return self.operation.operands[1]
|
|
1560
|
+
|
|
1561
|
+
@builtins.property
|
|
1562
|
+
def result(self) -> _ods_ir.OpResult:
|
|
1563
|
+
return self.operation.results[0]
|
|
1564
|
+
|
|
1565
|
+
@_ods_cext.register_op_adaptor(FloorDivSIOp)
|
|
1566
|
+
class FloorDivSIOpAdaptor(_ods_ir.OpAdaptor):
|
|
1567
|
+
OPERATION_NAME = "arith.floordivsi"
|
|
1568
|
+
|
|
1569
|
+
@builtins.property
|
|
1570
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1571
|
+
return self.operands[0]
|
|
1572
|
+
|
|
1573
|
+
@builtins.property
|
|
1574
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1575
|
+
return self.operands[1]
|
|
1576
|
+
|
|
1577
|
+
def floordivsi(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
1578
|
+
return FloorDivSIOp(lhs=lhs, rhs=rhs, results=results, loc=loc, ip=ip).result
|
|
1579
|
+
|
|
1580
|
+
@_ods_cext.register_operation(_Dialect)
|
|
1581
|
+
class IndexCastOp(_ods_ir.OpView):
|
|
1582
|
+
r"""
|
|
1583
|
+
Casts between scalar or vector integers and corresponding 'index' scalar or
|
|
1584
|
+
vectors. Index is an integer of platform-specific bit width. If casting to
|
|
1585
|
+
a wider integer, the value is sign-extended. If casting to a narrower
|
|
1586
|
+
integer, the value is truncated.
|
|
1587
|
+
"""
|
|
1588
|
+
|
|
1589
|
+
OPERATION_NAME = "arith.index_cast"
|
|
1590
|
+
|
|
1591
|
+
_ODS_REGIONS = (0, True)
|
|
1592
|
+
|
|
1593
|
+
def __init__(self, out: _ods_ir.Type, in_: _ods_ir.Value, *, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
1594
|
+
operands = []
|
|
1595
|
+
attributes = {}
|
|
1596
|
+
regions = None
|
|
1597
|
+
operands.append(in_)
|
|
1598
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
1599
|
+
results = []
|
|
1600
|
+
results.append(out)
|
|
1601
|
+
_ods_successors = None
|
|
1602
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
1603
|
+
|
|
1604
|
+
@builtins.property
|
|
1605
|
+
def in_(self) -> _ods_ir.Value:
|
|
1606
|
+
return self.operation.operands[0]
|
|
1607
|
+
|
|
1608
|
+
@builtins.property
|
|
1609
|
+
def out(self) -> _ods_ir.OpResult:
|
|
1610
|
+
return self.operation.results[0]
|
|
1611
|
+
|
|
1612
|
+
@_ods_cext.register_op_adaptor(IndexCastOp)
|
|
1613
|
+
class IndexCastOpAdaptor(_ods_ir.OpAdaptor):
|
|
1614
|
+
OPERATION_NAME = "arith.index_cast"
|
|
1615
|
+
|
|
1616
|
+
@builtins.property
|
|
1617
|
+
def in_(self) -> _ods_ir.Value:
|
|
1618
|
+
return self.operands[0]
|
|
1619
|
+
|
|
1620
|
+
def index_cast(out: _ods_ir.Type, in_: _ods_ir.Value, *, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
1621
|
+
return IndexCastOp(out=out, in_=in_, loc=loc, ip=ip).result
|
|
1622
|
+
|
|
1623
|
+
@_ods_cext.register_operation(_Dialect)
|
|
1624
|
+
class IndexCastUIOp(_ods_ir.OpView):
|
|
1625
|
+
r"""
|
|
1626
|
+
Casts between scalar or vector integers and corresponding 'index' scalar or
|
|
1627
|
+
vectors. Index is an integer of platform-specific bit width. If casting to
|
|
1628
|
+
a wider integer, the value is zero-extended. If casting to a narrower
|
|
1629
|
+
integer, the value is truncated.
|
|
1630
|
+
|
|
1631
|
+
When the `nneg` flag is present, the operand is assumed to have
|
|
1632
|
+
the most significant bit set to 0. In this case, zero extension
|
|
1633
|
+
is equivalent to sign extension. When this assumption is violated,
|
|
1634
|
+
the result is poison.
|
|
1635
|
+
|
|
1636
|
+
Example:
|
|
1637
|
+
|
|
1638
|
+
```mlir
|
|
1639
|
+
%0 = arith.index_castui %a : i32 to index
|
|
1640
|
+
%1 = arith.index_castui %a nneg : i32 to index
|
|
1641
|
+
%2 = arith.index_castui %b nneg : index to i64
|
|
1642
|
+
```
|
|
1643
|
+
"""
|
|
1644
|
+
|
|
1645
|
+
OPERATION_NAME = "arith.index_castui"
|
|
1646
|
+
|
|
1647
|
+
_ODS_REGIONS = (0, True)
|
|
1648
|
+
|
|
1649
|
+
def __init__(self, out: _ods_ir.Type, in_: _ods_ir.Value, *, nonNeg: _Optional[bool] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
1650
|
+
operands = []
|
|
1651
|
+
attributes = {}
|
|
1652
|
+
regions = None
|
|
1653
|
+
operands.append(in_)
|
|
1654
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
1655
|
+
if bool(nonNeg): attributes["nonNeg"] = _ods_ir.UnitAttr.get(
|
|
1656
|
+
_ods_get_default_loc_context(loc))
|
|
1657
|
+
results = []
|
|
1658
|
+
results.append(out)
|
|
1659
|
+
_ods_successors = None
|
|
1660
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
1661
|
+
|
|
1662
|
+
@builtins.property
|
|
1663
|
+
def in_(self) -> _ods_ir.Value:
|
|
1664
|
+
return self.operation.operands[0]
|
|
1665
|
+
|
|
1666
|
+
@builtins.property
|
|
1667
|
+
def nonNeg(self) -> bool:
|
|
1668
|
+
return "nonNeg" in self.operation.attributes
|
|
1669
|
+
|
|
1670
|
+
@nonNeg.setter
|
|
1671
|
+
def nonNeg(self, value):
|
|
1672
|
+
if bool(value):
|
|
1673
|
+
self.operation.attributes["nonNeg"] = _ods_ir.UnitAttr.get()
|
|
1674
|
+
elif "nonNeg" in self.operation.attributes:
|
|
1675
|
+
del self.operation.attributes["nonNeg"]
|
|
1676
|
+
|
|
1677
|
+
@nonNeg.deleter
|
|
1678
|
+
def nonNeg(self):
|
|
1679
|
+
del self.operation.attributes["nonNeg"]
|
|
1680
|
+
|
|
1681
|
+
@builtins.property
|
|
1682
|
+
def out(self) -> _ods_ir.OpResult:
|
|
1683
|
+
return self.operation.results[0]
|
|
1684
|
+
|
|
1685
|
+
@_ods_cext.register_op_adaptor(IndexCastUIOp)
|
|
1686
|
+
class IndexCastUIOpAdaptor(_ods_ir.OpAdaptor):
|
|
1687
|
+
OPERATION_NAME = "arith.index_castui"
|
|
1688
|
+
|
|
1689
|
+
@builtins.property
|
|
1690
|
+
def in_(self) -> _ods_ir.Value:
|
|
1691
|
+
return self.operands[0]
|
|
1692
|
+
|
|
1693
|
+
@builtins.property
|
|
1694
|
+
def nonNeg(self) -> bool:
|
|
1695
|
+
return "nonNeg" in self.attributes
|
|
1696
|
+
|
|
1697
|
+
def index_castui(out: _ods_ir.Type, in_: _ods_ir.Value, *, non_neg: _Optional[bool] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
1698
|
+
return IndexCastUIOp(out=out, in_=in_, nonNeg=non_neg, loc=loc, ip=ip).result
|
|
1699
|
+
|
|
1700
|
+
@_ods_cext.register_operation(_Dialect)
|
|
1701
|
+
class MaxNumFOp(_ods_ir.OpView):
|
|
1702
|
+
r"""
|
|
1703
|
+
Returns the maximum of the two arguments.
|
|
1704
|
+
If the arguments are -0.0 and +0.0, then the result is either of them.
|
|
1705
|
+
If one of the arguments is NaN, then the result is the other argument.
|
|
1706
|
+
|
|
1707
|
+
Example:
|
|
1708
|
+
|
|
1709
|
+
```mlir
|
|
1710
|
+
// Scalar floating-point maximum.
|
|
1711
|
+
%a = arith.maxnumf %b, %c : f64
|
|
1712
|
+
```
|
|
1713
|
+
"""
|
|
1714
|
+
|
|
1715
|
+
OPERATION_NAME = "arith.maxnumf"
|
|
1716
|
+
|
|
1717
|
+
_ODS_REGIONS = (0, True)
|
|
1718
|
+
|
|
1719
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
1720
|
+
operands = []
|
|
1721
|
+
attributes = {}
|
|
1722
|
+
regions = None
|
|
1723
|
+
operands.append(lhs)
|
|
1724
|
+
operands.append(rhs)
|
|
1725
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
1726
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
1727
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
1728
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
1729
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
1730
|
+
if results is None: results = [operands[0].type] * 1
|
|
1731
|
+
_ods_successors = None
|
|
1732
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
1733
|
+
|
|
1734
|
+
@builtins.property
|
|
1735
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1736
|
+
return self.operation.operands[0]
|
|
1737
|
+
|
|
1738
|
+
@builtins.property
|
|
1739
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1740
|
+
return self.operation.operands[1]
|
|
1741
|
+
|
|
1742
|
+
@builtins.property
|
|
1743
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
1744
|
+
return self.operation.attributes["fastmath"]
|
|
1745
|
+
|
|
1746
|
+
@fastmath.setter
|
|
1747
|
+
def fastmath(self, value: _ods_ir.Attribute):
|
|
1748
|
+
if value is None:
|
|
1749
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
1750
|
+
self.operation.attributes["fastmath"] = value
|
|
1751
|
+
|
|
1752
|
+
@builtins.property
|
|
1753
|
+
def result(self) -> _ods_ir.OpResult:
|
|
1754
|
+
return self.operation.results[0]
|
|
1755
|
+
|
|
1756
|
+
@_ods_cext.register_op_adaptor(MaxNumFOp)
|
|
1757
|
+
class MaxNumFOpAdaptor(_ods_ir.OpAdaptor):
|
|
1758
|
+
OPERATION_NAME = "arith.maxnumf"
|
|
1759
|
+
|
|
1760
|
+
@builtins.property
|
|
1761
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1762
|
+
return self.operands[0]
|
|
1763
|
+
|
|
1764
|
+
@builtins.property
|
|
1765
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1766
|
+
return self.operands[1]
|
|
1767
|
+
|
|
1768
|
+
@builtins.property
|
|
1769
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
1770
|
+
return self.attributes["fastmath"]
|
|
1771
|
+
|
|
1772
|
+
def maxnumf(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
1773
|
+
return MaxNumFOp(lhs=lhs, rhs=rhs, fastmath=fastmath, results=results, loc=loc, ip=ip).result
|
|
1774
|
+
|
|
1775
|
+
@_ods_cext.register_operation(_Dialect)
|
|
1776
|
+
class MaxSIOp(_ods_ir.OpView):
|
|
1777
|
+
OPERATION_NAME = "arith.maxsi"
|
|
1778
|
+
|
|
1779
|
+
_ODS_REGIONS = (0, True)
|
|
1780
|
+
|
|
1781
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
1782
|
+
operands = []
|
|
1783
|
+
attributes = {}
|
|
1784
|
+
regions = None
|
|
1785
|
+
operands.append(lhs)
|
|
1786
|
+
operands.append(rhs)
|
|
1787
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
1788
|
+
if results is None: results = [operands[0].type] * 1
|
|
1789
|
+
_ods_successors = None
|
|
1790
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
1791
|
+
|
|
1792
|
+
@builtins.property
|
|
1793
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1794
|
+
return self.operation.operands[0]
|
|
1795
|
+
|
|
1796
|
+
@builtins.property
|
|
1797
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1798
|
+
return self.operation.operands[1]
|
|
1799
|
+
|
|
1800
|
+
@builtins.property
|
|
1801
|
+
def result(self) -> _ods_ir.OpResult:
|
|
1802
|
+
return self.operation.results[0]
|
|
1803
|
+
|
|
1804
|
+
@_ods_cext.register_op_adaptor(MaxSIOp)
|
|
1805
|
+
class MaxSIOpAdaptor(_ods_ir.OpAdaptor):
|
|
1806
|
+
OPERATION_NAME = "arith.maxsi"
|
|
1807
|
+
|
|
1808
|
+
@builtins.property
|
|
1809
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1810
|
+
return self.operands[0]
|
|
1811
|
+
|
|
1812
|
+
@builtins.property
|
|
1813
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1814
|
+
return self.operands[1]
|
|
1815
|
+
|
|
1816
|
+
def maxsi(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
1817
|
+
return MaxSIOp(lhs=lhs, rhs=rhs, results=results, loc=loc, ip=ip).result
|
|
1818
|
+
|
|
1819
|
+
@_ods_cext.register_operation(_Dialect)
|
|
1820
|
+
class MaxUIOp(_ods_ir.OpView):
|
|
1821
|
+
OPERATION_NAME = "arith.maxui"
|
|
1822
|
+
|
|
1823
|
+
_ODS_REGIONS = (0, True)
|
|
1824
|
+
|
|
1825
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
1826
|
+
operands = []
|
|
1827
|
+
attributes = {}
|
|
1828
|
+
regions = None
|
|
1829
|
+
operands.append(lhs)
|
|
1830
|
+
operands.append(rhs)
|
|
1831
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
1832
|
+
if results is None: results = [operands[0].type] * 1
|
|
1833
|
+
_ods_successors = None
|
|
1834
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
1835
|
+
|
|
1836
|
+
@builtins.property
|
|
1837
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1838
|
+
return self.operation.operands[0]
|
|
1839
|
+
|
|
1840
|
+
@builtins.property
|
|
1841
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1842
|
+
return self.operation.operands[1]
|
|
1843
|
+
|
|
1844
|
+
@builtins.property
|
|
1845
|
+
def result(self) -> _ods_ir.OpResult:
|
|
1846
|
+
return self.operation.results[0]
|
|
1847
|
+
|
|
1848
|
+
@_ods_cext.register_op_adaptor(MaxUIOp)
|
|
1849
|
+
class MaxUIOpAdaptor(_ods_ir.OpAdaptor):
|
|
1850
|
+
OPERATION_NAME = "arith.maxui"
|
|
1851
|
+
|
|
1852
|
+
@builtins.property
|
|
1853
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1854
|
+
return self.operands[0]
|
|
1855
|
+
|
|
1856
|
+
@builtins.property
|
|
1857
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1858
|
+
return self.operands[1]
|
|
1859
|
+
|
|
1860
|
+
def maxui(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
1861
|
+
return MaxUIOp(lhs=lhs, rhs=rhs, results=results, loc=loc, ip=ip).result
|
|
1862
|
+
|
|
1863
|
+
@_ods_cext.register_operation(_Dialect)
|
|
1864
|
+
class MaximumFOp(_ods_ir.OpView):
|
|
1865
|
+
r"""
|
|
1866
|
+
Returns the maximum of the two arguments, treating -0.0 as less than +0.0.
|
|
1867
|
+
If one of the arguments is NaN, then the result is also NaN.
|
|
1868
|
+
|
|
1869
|
+
Example:
|
|
1870
|
+
|
|
1871
|
+
```mlir
|
|
1872
|
+
// Scalar floating-point maximum.
|
|
1873
|
+
%a = arith.maximumf %b, %c : f64
|
|
1874
|
+
```
|
|
1875
|
+
"""
|
|
1876
|
+
|
|
1877
|
+
OPERATION_NAME = "arith.maximumf"
|
|
1878
|
+
|
|
1879
|
+
_ODS_REGIONS = (0, True)
|
|
1880
|
+
|
|
1881
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
1882
|
+
operands = []
|
|
1883
|
+
attributes = {}
|
|
1884
|
+
regions = None
|
|
1885
|
+
operands.append(lhs)
|
|
1886
|
+
operands.append(rhs)
|
|
1887
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
1888
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
1889
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
1890
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
1891
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
1892
|
+
if results is None: results = [operands[0].type] * 1
|
|
1893
|
+
_ods_successors = None
|
|
1894
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
1895
|
+
|
|
1896
|
+
@builtins.property
|
|
1897
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1898
|
+
return self.operation.operands[0]
|
|
1899
|
+
|
|
1900
|
+
@builtins.property
|
|
1901
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1902
|
+
return self.operation.operands[1]
|
|
1903
|
+
|
|
1904
|
+
@builtins.property
|
|
1905
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
1906
|
+
return self.operation.attributes["fastmath"]
|
|
1907
|
+
|
|
1908
|
+
@fastmath.setter
|
|
1909
|
+
def fastmath(self, value: _ods_ir.Attribute):
|
|
1910
|
+
if value is None:
|
|
1911
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
1912
|
+
self.operation.attributes["fastmath"] = value
|
|
1913
|
+
|
|
1914
|
+
@builtins.property
|
|
1915
|
+
def result(self) -> _ods_ir.OpResult:
|
|
1916
|
+
return self.operation.results[0]
|
|
1917
|
+
|
|
1918
|
+
@_ods_cext.register_op_adaptor(MaximumFOp)
|
|
1919
|
+
class MaximumFOpAdaptor(_ods_ir.OpAdaptor):
|
|
1920
|
+
OPERATION_NAME = "arith.maximumf"
|
|
1921
|
+
|
|
1922
|
+
@builtins.property
|
|
1923
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1924
|
+
return self.operands[0]
|
|
1925
|
+
|
|
1926
|
+
@builtins.property
|
|
1927
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1928
|
+
return self.operands[1]
|
|
1929
|
+
|
|
1930
|
+
@builtins.property
|
|
1931
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
1932
|
+
return self.attributes["fastmath"]
|
|
1933
|
+
|
|
1934
|
+
def maximumf(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
1935
|
+
return MaximumFOp(lhs=lhs, rhs=rhs, fastmath=fastmath, results=results, loc=loc, ip=ip).result
|
|
1936
|
+
|
|
1937
|
+
@_ods_cext.register_operation(_Dialect)
|
|
1938
|
+
class MinNumFOp(_ods_ir.OpView):
|
|
1939
|
+
r"""
|
|
1940
|
+
Returns the minimum of the two arguments.
|
|
1941
|
+
If the arguments are -0.0 and +0.0, then the result is either of them.
|
|
1942
|
+
If one of the arguments is NaN, then the result is the other argument.
|
|
1943
|
+
|
|
1944
|
+
Example:
|
|
1945
|
+
|
|
1946
|
+
```mlir
|
|
1947
|
+
// Scalar floating-point minimum.
|
|
1948
|
+
%a = arith.minnumf %b, %c : f64
|
|
1949
|
+
```
|
|
1950
|
+
"""
|
|
1951
|
+
|
|
1952
|
+
OPERATION_NAME = "arith.minnumf"
|
|
1953
|
+
|
|
1954
|
+
_ODS_REGIONS = (0, True)
|
|
1955
|
+
|
|
1956
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
1957
|
+
operands = []
|
|
1958
|
+
attributes = {}
|
|
1959
|
+
regions = None
|
|
1960
|
+
operands.append(lhs)
|
|
1961
|
+
operands.append(rhs)
|
|
1962
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
1963
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
1964
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
1965
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
1966
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
1967
|
+
if results is None: results = [operands[0].type] * 1
|
|
1968
|
+
_ods_successors = None
|
|
1969
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
1970
|
+
|
|
1971
|
+
@builtins.property
|
|
1972
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1973
|
+
return self.operation.operands[0]
|
|
1974
|
+
|
|
1975
|
+
@builtins.property
|
|
1976
|
+
def rhs(self) -> _ods_ir.Value:
|
|
1977
|
+
return self.operation.operands[1]
|
|
1978
|
+
|
|
1979
|
+
@builtins.property
|
|
1980
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
1981
|
+
return self.operation.attributes["fastmath"]
|
|
1982
|
+
|
|
1983
|
+
@fastmath.setter
|
|
1984
|
+
def fastmath(self, value: _ods_ir.Attribute):
|
|
1985
|
+
if value is None:
|
|
1986
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
1987
|
+
self.operation.attributes["fastmath"] = value
|
|
1988
|
+
|
|
1989
|
+
@builtins.property
|
|
1990
|
+
def result(self) -> _ods_ir.OpResult:
|
|
1991
|
+
return self.operation.results[0]
|
|
1992
|
+
|
|
1993
|
+
@_ods_cext.register_op_adaptor(MinNumFOp)
|
|
1994
|
+
class MinNumFOpAdaptor(_ods_ir.OpAdaptor):
|
|
1995
|
+
OPERATION_NAME = "arith.minnumf"
|
|
1996
|
+
|
|
1997
|
+
@builtins.property
|
|
1998
|
+
def lhs(self) -> _ods_ir.Value:
|
|
1999
|
+
return self.operands[0]
|
|
2000
|
+
|
|
2001
|
+
@builtins.property
|
|
2002
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2003
|
+
return self.operands[1]
|
|
2004
|
+
|
|
2005
|
+
@builtins.property
|
|
2006
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
2007
|
+
return self.attributes["fastmath"]
|
|
2008
|
+
|
|
2009
|
+
def minnumf(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
2010
|
+
return MinNumFOp(lhs=lhs, rhs=rhs, fastmath=fastmath, results=results, loc=loc, ip=ip).result
|
|
2011
|
+
|
|
2012
|
+
@_ods_cext.register_operation(_Dialect)
|
|
2013
|
+
class MinSIOp(_ods_ir.OpView):
|
|
2014
|
+
OPERATION_NAME = "arith.minsi"
|
|
2015
|
+
|
|
2016
|
+
_ODS_REGIONS = (0, True)
|
|
2017
|
+
|
|
2018
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
2019
|
+
operands = []
|
|
2020
|
+
attributes = {}
|
|
2021
|
+
regions = None
|
|
2022
|
+
operands.append(lhs)
|
|
2023
|
+
operands.append(rhs)
|
|
2024
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
2025
|
+
if results is None: results = [operands[0].type] * 1
|
|
2026
|
+
_ods_successors = None
|
|
2027
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
2028
|
+
|
|
2029
|
+
@builtins.property
|
|
2030
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2031
|
+
return self.operation.operands[0]
|
|
2032
|
+
|
|
2033
|
+
@builtins.property
|
|
2034
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2035
|
+
return self.operation.operands[1]
|
|
2036
|
+
|
|
2037
|
+
@builtins.property
|
|
2038
|
+
def result(self) -> _ods_ir.OpResult:
|
|
2039
|
+
return self.operation.results[0]
|
|
2040
|
+
|
|
2041
|
+
@_ods_cext.register_op_adaptor(MinSIOp)
|
|
2042
|
+
class MinSIOpAdaptor(_ods_ir.OpAdaptor):
|
|
2043
|
+
OPERATION_NAME = "arith.minsi"
|
|
2044
|
+
|
|
2045
|
+
@builtins.property
|
|
2046
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2047
|
+
return self.operands[0]
|
|
2048
|
+
|
|
2049
|
+
@builtins.property
|
|
2050
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2051
|
+
return self.operands[1]
|
|
2052
|
+
|
|
2053
|
+
def minsi(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
2054
|
+
return MinSIOp(lhs=lhs, rhs=rhs, results=results, loc=loc, ip=ip).result
|
|
2055
|
+
|
|
2056
|
+
@_ods_cext.register_operation(_Dialect)
|
|
2057
|
+
class MinUIOp(_ods_ir.OpView):
|
|
2058
|
+
OPERATION_NAME = "arith.minui"
|
|
2059
|
+
|
|
2060
|
+
_ODS_REGIONS = (0, True)
|
|
2061
|
+
|
|
2062
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
2063
|
+
operands = []
|
|
2064
|
+
attributes = {}
|
|
2065
|
+
regions = None
|
|
2066
|
+
operands.append(lhs)
|
|
2067
|
+
operands.append(rhs)
|
|
2068
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
2069
|
+
if results is None: results = [operands[0].type] * 1
|
|
2070
|
+
_ods_successors = None
|
|
2071
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
2072
|
+
|
|
2073
|
+
@builtins.property
|
|
2074
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2075
|
+
return self.operation.operands[0]
|
|
2076
|
+
|
|
2077
|
+
@builtins.property
|
|
2078
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2079
|
+
return self.operation.operands[1]
|
|
2080
|
+
|
|
2081
|
+
@builtins.property
|
|
2082
|
+
def result(self) -> _ods_ir.OpResult:
|
|
2083
|
+
return self.operation.results[0]
|
|
2084
|
+
|
|
2085
|
+
@_ods_cext.register_op_adaptor(MinUIOp)
|
|
2086
|
+
class MinUIOpAdaptor(_ods_ir.OpAdaptor):
|
|
2087
|
+
OPERATION_NAME = "arith.minui"
|
|
2088
|
+
|
|
2089
|
+
@builtins.property
|
|
2090
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2091
|
+
return self.operands[0]
|
|
2092
|
+
|
|
2093
|
+
@builtins.property
|
|
2094
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2095
|
+
return self.operands[1]
|
|
2096
|
+
|
|
2097
|
+
def minui(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
2098
|
+
return MinUIOp(lhs=lhs, rhs=rhs, results=results, loc=loc, ip=ip).result
|
|
2099
|
+
|
|
2100
|
+
@_ods_cext.register_operation(_Dialect)
|
|
2101
|
+
class MinimumFOp(_ods_ir.OpView):
|
|
2102
|
+
r"""
|
|
2103
|
+
Returns the minimum of the two arguments, treating -0.0 as less than +0.0.
|
|
2104
|
+
If one of the arguments is NaN, then the result is also NaN.
|
|
2105
|
+
|
|
2106
|
+
Example:
|
|
2107
|
+
|
|
2108
|
+
```mlir
|
|
2109
|
+
// Scalar floating-point minimum.
|
|
2110
|
+
%a = arith.minimumf %b, %c : f64
|
|
2111
|
+
```
|
|
2112
|
+
"""
|
|
2113
|
+
|
|
2114
|
+
OPERATION_NAME = "arith.minimumf"
|
|
2115
|
+
|
|
2116
|
+
_ODS_REGIONS = (0, True)
|
|
2117
|
+
|
|
2118
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
2119
|
+
operands = []
|
|
2120
|
+
attributes = {}
|
|
2121
|
+
regions = None
|
|
2122
|
+
operands.append(lhs)
|
|
2123
|
+
operands.append(rhs)
|
|
2124
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
2125
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
2126
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
2127
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
2128
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
2129
|
+
if results is None: results = [operands[0].type] * 1
|
|
2130
|
+
_ods_successors = None
|
|
2131
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
2132
|
+
|
|
2133
|
+
@builtins.property
|
|
2134
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2135
|
+
return self.operation.operands[0]
|
|
2136
|
+
|
|
2137
|
+
@builtins.property
|
|
2138
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2139
|
+
return self.operation.operands[1]
|
|
2140
|
+
|
|
2141
|
+
@builtins.property
|
|
2142
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
2143
|
+
return self.operation.attributes["fastmath"]
|
|
2144
|
+
|
|
2145
|
+
@fastmath.setter
|
|
2146
|
+
def fastmath(self, value: _ods_ir.Attribute):
|
|
2147
|
+
if value is None:
|
|
2148
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
2149
|
+
self.operation.attributes["fastmath"] = value
|
|
2150
|
+
|
|
2151
|
+
@builtins.property
|
|
2152
|
+
def result(self) -> _ods_ir.OpResult:
|
|
2153
|
+
return self.operation.results[0]
|
|
2154
|
+
|
|
2155
|
+
@_ods_cext.register_op_adaptor(MinimumFOp)
|
|
2156
|
+
class MinimumFOpAdaptor(_ods_ir.OpAdaptor):
|
|
2157
|
+
OPERATION_NAME = "arith.minimumf"
|
|
2158
|
+
|
|
2159
|
+
@builtins.property
|
|
2160
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2161
|
+
return self.operands[0]
|
|
2162
|
+
|
|
2163
|
+
@builtins.property
|
|
2164
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2165
|
+
return self.operands[1]
|
|
2166
|
+
|
|
2167
|
+
@builtins.property
|
|
2168
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
2169
|
+
return self.attributes["fastmath"]
|
|
2170
|
+
|
|
2171
|
+
def minimumf(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
2172
|
+
return MinimumFOp(lhs=lhs, rhs=rhs, fastmath=fastmath, results=results, loc=loc, ip=ip).result
|
|
2173
|
+
|
|
2174
|
+
@_ods_cext.register_operation(_Dialect)
|
|
2175
|
+
class MulFOp(_ods_ir.OpView):
|
|
2176
|
+
r"""
|
|
2177
|
+
The `mulf` operation takes two operands and returns one result, each of
|
|
2178
|
+
these is required to be the same type. This type may be a floating point
|
|
2179
|
+
scalar type, a vector whose element type is a floating point type, or a
|
|
2180
|
+
floating point tensor.
|
|
2181
|
+
|
|
2182
|
+
Example:
|
|
2183
|
+
|
|
2184
|
+
```mlir
|
|
2185
|
+
// Scalar multiplication.
|
|
2186
|
+
%a = arith.mulf %b, %c : f64
|
|
2187
|
+
|
|
2188
|
+
// SIMD pointwise vector multiplication, e.g. for Intel SSE.
|
|
2189
|
+
%f = arith.mulf %g, %h : vector<4xf32>
|
|
2190
|
+
|
|
2191
|
+
// Tensor pointwise multiplication.
|
|
2192
|
+
%x = arith.mulf %y, %z : tensor<4x?xbf16>
|
|
2193
|
+
|
|
2194
|
+
// Scalar multiplication with rounding mode.
|
|
2195
|
+
%a = arith.mulf %b, %c upward : f64
|
|
2196
|
+
```
|
|
2197
|
+
"""
|
|
2198
|
+
|
|
2199
|
+
OPERATION_NAME = "arith.mulf"
|
|
2200
|
+
|
|
2201
|
+
_ODS_REGIONS = (0, True)
|
|
2202
|
+
|
|
2203
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, roundingmode: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
2204
|
+
operands = []
|
|
2205
|
+
attributes = {}
|
|
2206
|
+
regions = None
|
|
2207
|
+
operands.append(lhs)
|
|
2208
|
+
operands.append(rhs)
|
|
2209
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
2210
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
2211
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
2212
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
2213
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
2214
|
+
if roundingmode is not None: attributes["roundingmode"] = (roundingmode if (
|
|
2215
|
+
isinstance(roundingmode, _ods_ir.Attribute) or
|
|
2216
|
+
not _ods_ir.AttrBuilder.contains('Arith_RoundingModeAttr')) else
|
|
2217
|
+
_ods_ir.AttrBuilder.get('Arith_RoundingModeAttr')(roundingmode, context=_ods_context))
|
|
2218
|
+
if results is None: results = [operands[0].type] * 1
|
|
2219
|
+
_ods_successors = None
|
|
2220
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
2221
|
+
|
|
2222
|
+
@builtins.property
|
|
2223
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2224
|
+
return self.operation.operands[0]
|
|
2225
|
+
|
|
2226
|
+
@builtins.property
|
|
2227
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2228
|
+
return self.operation.operands[1]
|
|
2229
|
+
|
|
2230
|
+
@builtins.property
|
|
2231
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
2232
|
+
return self.operation.attributes["fastmath"]
|
|
2233
|
+
|
|
2234
|
+
@fastmath.setter
|
|
2235
|
+
def fastmath(self, value: _ods_ir.Attribute):
|
|
2236
|
+
if value is None:
|
|
2237
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
2238
|
+
self.operation.attributes["fastmath"] = value
|
|
2239
|
+
|
|
2240
|
+
@builtins.property
|
|
2241
|
+
def roundingmode(self) -> _Optional[_ods_ir.Attribute]:
|
|
2242
|
+
if "roundingmode" not in self.operation.attributes:
|
|
2243
|
+
return None
|
|
2244
|
+
return self.operation.attributes["roundingmode"]
|
|
2245
|
+
|
|
2246
|
+
@roundingmode.setter
|
|
2247
|
+
def roundingmode(self, value: _Optional[_ods_ir.Attribute]):
|
|
2248
|
+
if value is not None:
|
|
2249
|
+
self.operation.attributes["roundingmode"] = value
|
|
2250
|
+
elif "roundingmode" in self.operation.attributes:
|
|
2251
|
+
del self.operation.attributes["roundingmode"]
|
|
2252
|
+
|
|
2253
|
+
@roundingmode.deleter
|
|
2254
|
+
def roundingmode(self):
|
|
2255
|
+
del self.operation.attributes["roundingmode"]
|
|
2256
|
+
|
|
2257
|
+
@builtins.property
|
|
2258
|
+
def result(self) -> _ods_ir.OpResult:
|
|
2259
|
+
return self.operation.results[0]
|
|
2260
|
+
|
|
2261
|
+
@_ods_cext.register_op_adaptor(MulFOp)
|
|
2262
|
+
class MulFOpAdaptor(_ods_ir.OpAdaptor):
|
|
2263
|
+
OPERATION_NAME = "arith.mulf"
|
|
2264
|
+
|
|
2265
|
+
@builtins.property
|
|
2266
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2267
|
+
return self.operands[0]
|
|
2268
|
+
|
|
2269
|
+
@builtins.property
|
|
2270
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2271
|
+
return self.operands[1]
|
|
2272
|
+
|
|
2273
|
+
@builtins.property
|
|
2274
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
2275
|
+
return self.attributes["fastmath"]
|
|
2276
|
+
|
|
2277
|
+
@builtins.property
|
|
2278
|
+
def roundingmode(self) -> _Optional[_ods_ir.Attribute]:
|
|
2279
|
+
if "roundingmode" not in self.attributes:
|
|
2280
|
+
return None
|
|
2281
|
+
return self.attributes["roundingmode"]
|
|
2282
|
+
|
|
2283
|
+
def mulf(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, roundingmode: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
2284
|
+
return MulFOp(lhs=lhs, rhs=rhs, fastmath=fastmath, roundingmode=roundingmode, results=results, loc=loc, ip=ip).result
|
|
2285
|
+
|
|
2286
|
+
@_ods_cext.register_operation(_Dialect)
|
|
2287
|
+
class MulIOp(_ods_ir.OpView):
|
|
2288
|
+
r"""
|
|
2289
|
+
Performs N-bit multiplication on the operands. The operands are interpreted as
|
|
2290
|
+
unsigned bitvectors. The result is represented by a bitvector containing the
|
|
2291
|
+
mathematical value of the multiplication modulo 2^n, where `n` is the bitwidth.
|
|
2292
|
+
Because `arith` integers use a two's complement representation, this operation is
|
|
2293
|
+
applicable on both signed and unsigned integer operands.
|
|
2294
|
+
|
|
2295
|
+
The `muli` operation takes two operands and returns one result, each of
|
|
2296
|
+
these is required to be the same type. This type may be an integer scalar type,
|
|
2297
|
+
a vector whose element type is integer, or a tensor of integers.
|
|
2298
|
+
|
|
2299
|
+
This op supports `nuw`/`nsw` overflow flags which stands for
|
|
2300
|
+
"No Unsigned Wrap" and "No Signed Wrap", respectively. If the `nuw` and/or
|
|
2301
|
+
`nsw` flags are present, and an unsigned/signed overflow occurs
|
|
2302
|
+
(respectively), the result is poison.
|
|
2303
|
+
|
|
2304
|
+
Example:
|
|
2305
|
+
|
|
2306
|
+
```mlir
|
|
2307
|
+
// Scalar multiplication.
|
|
2308
|
+
%a = arith.muli %b, %c : i64
|
|
2309
|
+
|
|
2310
|
+
// Scalar multiplication with overflow flags.
|
|
2311
|
+
%a = arith.muli %b, %c overflow<nsw, nuw> : i64
|
|
2312
|
+
|
|
2313
|
+
// SIMD vector element-wise multiplication.
|
|
2314
|
+
%f = arith.muli %g, %h : vector<4xi32>
|
|
2315
|
+
|
|
2316
|
+
// Tensor element-wise multiplication.
|
|
2317
|
+
%x = arith.muli %y, %z : tensor<4x?xi8>
|
|
2318
|
+
```
|
|
2319
|
+
"""
|
|
2320
|
+
|
|
2321
|
+
OPERATION_NAME = "arith.muli"
|
|
2322
|
+
|
|
2323
|
+
_ODS_REGIONS = (0, True)
|
|
2324
|
+
|
|
2325
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, overflowFlags: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
2326
|
+
operands = []
|
|
2327
|
+
attributes = {}
|
|
2328
|
+
regions = None
|
|
2329
|
+
operands.append(lhs)
|
|
2330
|
+
operands.append(rhs)
|
|
2331
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
2332
|
+
if overflowFlags is not None: attributes["overflowFlags"] = (overflowFlags if (
|
|
2333
|
+
isinstance(overflowFlags, _ods_ir.Attribute) or
|
|
2334
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_IntegerOverflowAttr')) else
|
|
2335
|
+
_ods_ir.AttrBuilder.get('arith.Arith_IntegerOverflowAttr')(overflowFlags, context=_ods_context))
|
|
2336
|
+
if results is None: results = [operands[0].type] * 1
|
|
2337
|
+
_ods_successors = None
|
|
2338
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
2339
|
+
|
|
2340
|
+
@builtins.property
|
|
2341
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2342
|
+
return self.operation.operands[0]
|
|
2343
|
+
|
|
2344
|
+
@builtins.property
|
|
2345
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2346
|
+
return self.operation.operands[1]
|
|
2347
|
+
|
|
2348
|
+
@builtins.property
|
|
2349
|
+
def overflowFlags(self) -> _ods_ir.Attribute:
|
|
2350
|
+
return self.operation.attributes["overflowFlags"]
|
|
2351
|
+
|
|
2352
|
+
@overflowFlags.setter
|
|
2353
|
+
def overflowFlags(self, value: _ods_ir.Attribute):
|
|
2354
|
+
if value is None:
|
|
2355
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
2356
|
+
self.operation.attributes["overflowFlags"] = value
|
|
2357
|
+
|
|
2358
|
+
@builtins.property
|
|
2359
|
+
def result(self) -> _ods_ir.OpResult:
|
|
2360
|
+
return self.operation.results[0]
|
|
2361
|
+
|
|
2362
|
+
@_ods_cext.register_op_adaptor(MulIOp)
|
|
2363
|
+
class MulIOpAdaptor(_ods_ir.OpAdaptor):
|
|
2364
|
+
OPERATION_NAME = "arith.muli"
|
|
2365
|
+
|
|
2366
|
+
@builtins.property
|
|
2367
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2368
|
+
return self.operands[0]
|
|
2369
|
+
|
|
2370
|
+
@builtins.property
|
|
2371
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2372
|
+
return self.operands[1]
|
|
2373
|
+
|
|
2374
|
+
@builtins.property
|
|
2375
|
+
def overflowFlags(self) -> _ods_ir.Attribute:
|
|
2376
|
+
return self.attributes["overflowFlags"]
|
|
2377
|
+
|
|
2378
|
+
def muli(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, overflow_flags: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
2379
|
+
return MulIOp(lhs=lhs, rhs=rhs, overflowFlags=overflow_flags, results=results, loc=loc, ip=ip).result
|
|
2380
|
+
|
|
2381
|
+
@_ods_cext.register_operation(_Dialect)
|
|
2382
|
+
class MulSIExtendedOp(_ods_ir.OpView):
|
|
2383
|
+
r"""
|
|
2384
|
+
Performs (2*N)-bit multiplication on sign-extended operands. Returns two
|
|
2385
|
+
N-bit results: the low and the high halves of the product. The low half has
|
|
2386
|
+
the same value as the result of regular multiplication `arith.muli` with
|
|
2387
|
+
the same operands.
|
|
2388
|
+
|
|
2389
|
+
Example:
|
|
2390
|
+
|
|
2391
|
+
```mlir
|
|
2392
|
+
// Scalar multiplication.
|
|
2393
|
+
%low, %high = arith.mulsi_extended %a, %b : i32
|
|
2394
|
+
|
|
2395
|
+
// Vector element-wise multiplication.
|
|
2396
|
+
%c:2 = arith.mulsi_extended %d, %e : vector<4xi32>
|
|
2397
|
+
|
|
2398
|
+
// Tensor element-wise multiplication.
|
|
2399
|
+
%x:2 = arith.mulsi_extended %y, %z : tensor<4x?xi8>
|
|
2400
|
+
```
|
|
2401
|
+
"""
|
|
2402
|
+
|
|
2403
|
+
OPERATION_NAME = "arith.mulsi_extended"
|
|
2404
|
+
|
|
2405
|
+
_ODS_REGIONS = (0, True)
|
|
2406
|
+
|
|
2407
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
2408
|
+
operands = []
|
|
2409
|
+
attributes = {}
|
|
2410
|
+
regions = None
|
|
2411
|
+
operands.append(lhs)
|
|
2412
|
+
operands.append(rhs)
|
|
2413
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
2414
|
+
_ods_successors = None
|
|
2415
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
2416
|
+
|
|
2417
|
+
@builtins.property
|
|
2418
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2419
|
+
return self.operation.operands[0]
|
|
2420
|
+
|
|
2421
|
+
@builtins.property
|
|
2422
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2423
|
+
return self.operation.operands[1]
|
|
2424
|
+
|
|
2425
|
+
@builtins.property
|
|
2426
|
+
def low(self) -> _ods_ir.OpResult:
|
|
2427
|
+
return self.operation.results[0]
|
|
2428
|
+
|
|
2429
|
+
@builtins.property
|
|
2430
|
+
def high(self) -> _ods_ir.OpResult:
|
|
2431
|
+
return self.operation.results[1]
|
|
2432
|
+
|
|
2433
|
+
@_ods_cext.register_op_adaptor(MulSIExtendedOp)
|
|
2434
|
+
class MulSIExtendedOpAdaptor(_ods_ir.OpAdaptor):
|
|
2435
|
+
OPERATION_NAME = "arith.mulsi_extended"
|
|
2436
|
+
|
|
2437
|
+
@builtins.property
|
|
2438
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2439
|
+
return self.operands[0]
|
|
2440
|
+
|
|
2441
|
+
@builtins.property
|
|
2442
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2443
|
+
return self.operands[1]
|
|
2444
|
+
|
|
2445
|
+
def mulsi_extended(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResultList:
|
|
2446
|
+
return MulSIExtendedOp(lhs=lhs, rhs=rhs, results=results, loc=loc, ip=ip).results
|
|
2447
|
+
|
|
2448
|
+
@_ods_cext.register_operation(_Dialect)
|
|
2449
|
+
class MulUIExtendedOp(_ods_ir.OpView):
|
|
2450
|
+
r"""
|
|
2451
|
+
Performs (2*N)-bit multiplication on zero-extended operands. Returns two
|
|
2452
|
+
N-bit results: the low and the high halves of the product. The low half has
|
|
2453
|
+
the same value as the result of regular multiplication `arith.muli` with
|
|
2454
|
+
the same operands.
|
|
2455
|
+
|
|
2456
|
+
Example:
|
|
2457
|
+
|
|
2458
|
+
```mlir
|
|
2459
|
+
// Scalar multiplication.
|
|
2460
|
+
%low, %high = arith.mului_extended %a, %b : i32
|
|
2461
|
+
|
|
2462
|
+
// Vector element-wise multiplication.
|
|
2463
|
+
%c:2 = arith.mului_extended %d, %e : vector<4xi32>
|
|
2464
|
+
|
|
2465
|
+
// Tensor element-wise multiplication.
|
|
2466
|
+
%x:2 = arith.mului_extended %y, %z : tensor<4x?xi8>
|
|
2467
|
+
```
|
|
2468
|
+
"""
|
|
2469
|
+
|
|
2470
|
+
OPERATION_NAME = "arith.mului_extended"
|
|
2471
|
+
|
|
2472
|
+
_ODS_REGIONS = (0, True)
|
|
2473
|
+
|
|
2474
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
2475
|
+
operands = []
|
|
2476
|
+
attributes = {}
|
|
2477
|
+
regions = None
|
|
2478
|
+
operands.append(lhs)
|
|
2479
|
+
operands.append(rhs)
|
|
2480
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
2481
|
+
_ods_successors = None
|
|
2482
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
2483
|
+
|
|
2484
|
+
@builtins.property
|
|
2485
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2486
|
+
return self.operation.operands[0]
|
|
2487
|
+
|
|
2488
|
+
@builtins.property
|
|
2489
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2490
|
+
return self.operation.operands[1]
|
|
2491
|
+
|
|
2492
|
+
@builtins.property
|
|
2493
|
+
def low(self) -> _ods_ir.OpResult:
|
|
2494
|
+
return self.operation.results[0]
|
|
2495
|
+
|
|
2496
|
+
@builtins.property
|
|
2497
|
+
def high(self) -> _ods_ir.OpResult:
|
|
2498
|
+
return self.operation.results[1]
|
|
2499
|
+
|
|
2500
|
+
@_ods_cext.register_op_adaptor(MulUIExtendedOp)
|
|
2501
|
+
class MulUIExtendedOpAdaptor(_ods_ir.OpAdaptor):
|
|
2502
|
+
OPERATION_NAME = "arith.mului_extended"
|
|
2503
|
+
|
|
2504
|
+
@builtins.property
|
|
2505
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2506
|
+
return self.operands[0]
|
|
2507
|
+
|
|
2508
|
+
@builtins.property
|
|
2509
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2510
|
+
return self.operands[1]
|
|
2511
|
+
|
|
2512
|
+
def mului_extended(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResultList:
|
|
2513
|
+
return MulUIExtendedOp(lhs=lhs, rhs=rhs, results=results, loc=loc, ip=ip).results
|
|
2514
|
+
|
|
2515
|
+
@_ods_cext.register_operation(_Dialect)
|
|
2516
|
+
class NegFOp(_ods_ir.OpView):
|
|
2517
|
+
r"""
|
|
2518
|
+
The `negf` operation computes the negation of a given value. It takes one
|
|
2519
|
+
operand and returns one result of the same type. This type may be a float
|
|
2520
|
+
scalar type, a vector whose element type is float, or a tensor of floats.
|
|
2521
|
+
It has no standard attributes.
|
|
2522
|
+
|
|
2523
|
+
Example:
|
|
2524
|
+
|
|
2525
|
+
```mlir
|
|
2526
|
+
// Scalar negation value.
|
|
2527
|
+
%a = arith.negf %b : f64
|
|
2528
|
+
|
|
2529
|
+
// SIMD vector element-wise negation value.
|
|
2530
|
+
%f = arith.negf %g : vector<4xf32>
|
|
2531
|
+
|
|
2532
|
+
// Tensor element-wise negation value.
|
|
2533
|
+
%x = arith.negf %y : tensor<4x?xf8>
|
|
2534
|
+
```
|
|
2535
|
+
"""
|
|
2536
|
+
|
|
2537
|
+
OPERATION_NAME = "arith.negf"
|
|
2538
|
+
|
|
2539
|
+
_ODS_REGIONS = (0, True)
|
|
2540
|
+
|
|
2541
|
+
def __init__(self, operand: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
2542
|
+
operands = []
|
|
2543
|
+
attributes = {}
|
|
2544
|
+
regions = None
|
|
2545
|
+
operands.append(operand)
|
|
2546
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
2547
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
2548
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
2549
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
2550
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
2551
|
+
if results is None: results = [operands[0].type] * 1
|
|
2552
|
+
_ods_successors = None
|
|
2553
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
2554
|
+
|
|
2555
|
+
@builtins.property
|
|
2556
|
+
def operand(self) -> _ods_ir.Value:
|
|
2557
|
+
return self.operation.operands[0]
|
|
2558
|
+
|
|
2559
|
+
@builtins.property
|
|
2560
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
2561
|
+
return self.operation.attributes["fastmath"]
|
|
2562
|
+
|
|
2563
|
+
@fastmath.setter
|
|
2564
|
+
def fastmath(self, value: _ods_ir.Attribute):
|
|
2565
|
+
if value is None:
|
|
2566
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
2567
|
+
self.operation.attributes["fastmath"] = value
|
|
2568
|
+
|
|
2569
|
+
@builtins.property
|
|
2570
|
+
def result(self) -> _ods_ir.OpResult:
|
|
2571
|
+
return self.operation.results[0]
|
|
2572
|
+
|
|
2573
|
+
@_ods_cext.register_op_adaptor(NegFOp)
|
|
2574
|
+
class NegFOpAdaptor(_ods_ir.OpAdaptor):
|
|
2575
|
+
OPERATION_NAME = "arith.negf"
|
|
2576
|
+
|
|
2577
|
+
@builtins.property
|
|
2578
|
+
def operand(self) -> _ods_ir.Value:
|
|
2579
|
+
return self.operands[0]
|
|
2580
|
+
|
|
2581
|
+
@builtins.property
|
|
2582
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
2583
|
+
return self.attributes["fastmath"]
|
|
2584
|
+
|
|
2585
|
+
def negf(operand: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
2586
|
+
return NegFOp(operand=operand, fastmath=fastmath, results=results, loc=loc, ip=ip).result
|
|
2587
|
+
|
|
2588
|
+
@_ods_cext.register_operation(_Dialect)
|
|
2589
|
+
class OrIOp(_ods_ir.OpView):
|
|
2590
|
+
r"""
|
|
2591
|
+
The `ori` operation takes two operands and returns one result, each of these
|
|
2592
|
+
is required to be the same type. This type may be an integer scalar type, a
|
|
2593
|
+
vector whose element type is integer, or a tensor of integers. It has no
|
|
2594
|
+
standard attributes.
|
|
2595
|
+
|
|
2596
|
+
Example:
|
|
2597
|
+
|
|
2598
|
+
```mlir
|
|
2599
|
+
// Scalar integer bitwise or.
|
|
2600
|
+
%a = arith.ori %b, %c : i64
|
|
2601
|
+
|
|
2602
|
+
// SIMD vector element-wise bitwise integer or.
|
|
2603
|
+
%f = arith.ori %g, %h : vector<4xi32>
|
|
2604
|
+
|
|
2605
|
+
// Tensor element-wise bitwise integer or.
|
|
2606
|
+
%x = arith.ori %y, %z : tensor<4x?xi8>
|
|
2607
|
+
```
|
|
2608
|
+
"""
|
|
2609
|
+
|
|
2610
|
+
OPERATION_NAME = "arith.ori"
|
|
2611
|
+
|
|
2612
|
+
_ODS_REGIONS = (0, True)
|
|
2613
|
+
|
|
2614
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
2615
|
+
operands = []
|
|
2616
|
+
attributes = {}
|
|
2617
|
+
regions = None
|
|
2618
|
+
operands.append(lhs)
|
|
2619
|
+
operands.append(rhs)
|
|
2620
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
2621
|
+
if results is None: results = [operands[0].type] * 1
|
|
2622
|
+
_ods_successors = None
|
|
2623
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
2624
|
+
|
|
2625
|
+
@builtins.property
|
|
2626
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2627
|
+
return self.operation.operands[0]
|
|
2628
|
+
|
|
2629
|
+
@builtins.property
|
|
2630
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2631
|
+
return self.operation.operands[1]
|
|
2632
|
+
|
|
2633
|
+
@builtins.property
|
|
2634
|
+
def result(self) -> _ods_ir.OpResult:
|
|
2635
|
+
return self.operation.results[0]
|
|
2636
|
+
|
|
2637
|
+
@_ods_cext.register_op_adaptor(OrIOp)
|
|
2638
|
+
class OrIOpAdaptor(_ods_ir.OpAdaptor):
|
|
2639
|
+
OPERATION_NAME = "arith.ori"
|
|
2640
|
+
|
|
2641
|
+
@builtins.property
|
|
2642
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2643
|
+
return self.operands[0]
|
|
2644
|
+
|
|
2645
|
+
@builtins.property
|
|
2646
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2647
|
+
return self.operands[1]
|
|
2648
|
+
|
|
2649
|
+
def ori(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
2650
|
+
return OrIOp(lhs=lhs, rhs=rhs, results=results, loc=loc, ip=ip).result
|
|
2651
|
+
|
|
2652
|
+
@_ods_cext.register_operation(_Dialect)
|
|
2653
|
+
class RemFOp(_ods_ir.OpView):
|
|
2654
|
+
r"""
|
|
2655
|
+
Returns the floating point division remainder.
|
|
2656
|
+
The remainder has the same sign as the dividend (lhs operand).
|
|
2657
|
+
|
|
2658
|
+
TODO: Add support for rounding modes.
|
|
2659
|
+
"""
|
|
2660
|
+
|
|
2661
|
+
OPERATION_NAME = "arith.remf"
|
|
2662
|
+
|
|
2663
|
+
_ODS_REGIONS = (0, True)
|
|
2664
|
+
|
|
2665
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
2666
|
+
operands = []
|
|
2667
|
+
attributes = {}
|
|
2668
|
+
regions = None
|
|
2669
|
+
operands.append(lhs)
|
|
2670
|
+
operands.append(rhs)
|
|
2671
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
2672
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
2673
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
2674
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
2675
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
2676
|
+
if results is None: results = [operands[0].type] * 1
|
|
2677
|
+
_ods_successors = None
|
|
2678
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
2679
|
+
|
|
2680
|
+
@builtins.property
|
|
2681
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2682
|
+
return self.operation.operands[0]
|
|
2683
|
+
|
|
2684
|
+
@builtins.property
|
|
2685
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2686
|
+
return self.operation.operands[1]
|
|
2687
|
+
|
|
2688
|
+
@builtins.property
|
|
2689
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
2690
|
+
return self.operation.attributes["fastmath"]
|
|
2691
|
+
|
|
2692
|
+
@fastmath.setter
|
|
2693
|
+
def fastmath(self, value: _ods_ir.Attribute):
|
|
2694
|
+
if value is None:
|
|
2695
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
2696
|
+
self.operation.attributes["fastmath"] = value
|
|
2697
|
+
|
|
2698
|
+
@builtins.property
|
|
2699
|
+
def result(self) -> _ods_ir.OpResult:
|
|
2700
|
+
return self.operation.results[0]
|
|
2701
|
+
|
|
2702
|
+
@_ods_cext.register_op_adaptor(RemFOp)
|
|
2703
|
+
class RemFOpAdaptor(_ods_ir.OpAdaptor):
|
|
2704
|
+
OPERATION_NAME = "arith.remf"
|
|
2705
|
+
|
|
2706
|
+
@builtins.property
|
|
2707
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2708
|
+
return self.operands[0]
|
|
2709
|
+
|
|
2710
|
+
@builtins.property
|
|
2711
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2712
|
+
return self.operands[1]
|
|
2713
|
+
|
|
2714
|
+
@builtins.property
|
|
2715
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
2716
|
+
return self.attributes["fastmath"]
|
|
2717
|
+
|
|
2718
|
+
def remf(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
2719
|
+
return RemFOp(lhs=lhs, rhs=rhs, fastmath=fastmath, results=results, loc=loc, ip=ip).result
|
|
2720
|
+
|
|
2721
|
+
@_ods_cext.register_operation(_Dialect)
|
|
2722
|
+
class RemSIOp(_ods_ir.OpView):
|
|
2723
|
+
r"""
|
|
2724
|
+
Signed integer division remainder. Treats the leading bit as sign, i.e. `6 %
|
|
2725
|
+
-2 = 0`.
|
|
2726
|
+
|
|
2727
|
+
Division by zero is undefined behavior. When applied to `vector` and
|
|
2728
|
+
`tensor` values, the behavior is undefined if _any_ elements are divided by
|
|
2729
|
+
zero.
|
|
2730
|
+
|
|
2731
|
+
Example:
|
|
2732
|
+
|
|
2733
|
+
```mlir
|
|
2734
|
+
// Scalar signed integer division remainder.
|
|
2735
|
+
%a = arith.remsi %b, %c : i64
|
|
2736
|
+
|
|
2737
|
+
// SIMD vector element-wise division remainder.
|
|
2738
|
+
%f = arith.remsi %g, %h : vector<4xi32>
|
|
2739
|
+
|
|
2740
|
+
// Tensor element-wise integer division remainder.
|
|
2741
|
+
%x = arith.remsi %y, %z : tensor<4x?xi8>
|
|
2742
|
+
```
|
|
2743
|
+
"""
|
|
2744
|
+
|
|
2745
|
+
OPERATION_NAME = "arith.remsi"
|
|
2746
|
+
|
|
2747
|
+
_ODS_REGIONS = (0, True)
|
|
2748
|
+
|
|
2749
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
2750
|
+
operands = []
|
|
2751
|
+
attributes = {}
|
|
2752
|
+
regions = None
|
|
2753
|
+
operands.append(lhs)
|
|
2754
|
+
operands.append(rhs)
|
|
2755
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
2756
|
+
if results is None: results = [operands[0].type] * 1
|
|
2757
|
+
_ods_successors = None
|
|
2758
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
2759
|
+
|
|
2760
|
+
@builtins.property
|
|
2761
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2762
|
+
return self.operation.operands[0]
|
|
2763
|
+
|
|
2764
|
+
@builtins.property
|
|
2765
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2766
|
+
return self.operation.operands[1]
|
|
2767
|
+
|
|
2768
|
+
@builtins.property
|
|
2769
|
+
def result(self) -> _ods_ir.OpResult:
|
|
2770
|
+
return self.operation.results[0]
|
|
2771
|
+
|
|
2772
|
+
@_ods_cext.register_op_adaptor(RemSIOp)
|
|
2773
|
+
class RemSIOpAdaptor(_ods_ir.OpAdaptor):
|
|
2774
|
+
OPERATION_NAME = "arith.remsi"
|
|
2775
|
+
|
|
2776
|
+
@builtins.property
|
|
2777
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2778
|
+
return self.operands[0]
|
|
2779
|
+
|
|
2780
|
+
@builtins.property
|
|
2781
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2782
|
+
return self.operands[1]
|
|
2783
|
+
|
|
2784
|
+
def remsi(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
2785
|
+
return RemSIOp(lhs=lhs, rhs=rhs, results=results, loc=loc, ip=ip).result
|
|
2786
|
+
|
|
2787
|
+
@_ods_cext.register_operation(_Dialect)
|
|
2788
|
+
class RemUIOp(_ods_ir.OpView):
|
|
2789
|
+
r"""
|
|
2790
|
+
Unsigned integer division remainder. Treats the leading bit as the most
|
|
2791
|
+
significant, i.e. for `i16`, `6 % -2 = 6 % (2^16 - 2) = 6`.
|
|
2792
|
+
|
|
2793
|
+
Division by zero is undefined behavior. When applied to `vector` and
|
|
2794
|
+
`tensor` values, the behavior is undefined if _any_ elements are divided by
|
|
2795
|
+
zero.
|
|
2796
|
+
|
|
2797
|
+
Example:
|
|
2798
|
+
|
|
2799
|
+
```mlir
|
|
2800
|
+
// Scalar unsigned integer division remainder.
|
|
2801
|
+
%a = arith.remui %b, %c : i64
|
|
2802
|
+
|
|
2803
|
+
// SIMD vector element-wise division remainder.
|
|
2804
|
+
%f = arith.remui %g, %h : vector<4xi32>
|
|
2805
|
+
|
|
2806
|
+
// Tensor element-wise integer division remainder.
|
|
2807
|
+
%x = arith.remui %y, %z : tensor<4x?xi8>
|
|
2808
|
+
```
|
|
2809
|
+
"""
|
|
2810
|
+
|
|
2811
|
+
OPERATION_NAME = "arith.remui"
|
|
2812
|
+
|
|
2813
|
+
_ODS_REGIONS = (0, True)
|
|
2814
|
+
|
|
2815
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
2816
|
+
operands = []
|
|
2817
|
+
attributes = {}
|
|
2818
|
+
regions = None
|
|
2819
|
+
operands.append(lhs)
|
|
2820
|
+
operands.append(rhs)
|
|
2821
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
2822
|
+
if results is None: results = [operands[0].type] * 1
|
|
2823
|
+
_ods_successors = None
|
|
2824
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
2825
|
+
|
|
2826
|
+
@builtins.property
|
|
2827
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2828
|
+
return self.operation.operands[0]
|
|
2829
|
+
|
|
2830
|
+
@builtins.property
|
|
2831
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2832
|
+
return self.operation.operands[1]
|
|
2833
|
+
|
|
2834
|
+
@builtins.property
|
|
2835
|
+
def result(self) -> _ods_ir.OpResult:
|
|
2836
|
+
return self.operation.results[0]
|
|
2837
|
+
|
|
2838
|
+
@_ods_cext.register_op_adaptor(RemUIOp)
|
|
2839
|
+
class RemUIOpAdaptor(_ods_ir.OpAdaptor):
|
|
2840
|
+
OPERATION_NAME = "arith.remui"
|
|
2841
|
+
|
|
2842
|
+
@builtins.property
|
|
2843
|
+
def lhs(self) -> _ods_ir.Value:
|
|
2844
|
+
return self.operands[0]
|
|
2845
|
+
|
|
2846
|
+
@builtins.property
|
|
2847
|
+
def rhs(self) -> _ods_ir.Value:
|
|
2848
|
+
return self.operands[1]
|
|
2849
|
+
|
|
2850
|
+
def remui(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
2851
|
+
return RemUIOp(lhs=lhs, rhs=rhs, results=results, loc=loc, ip=ip).result
|
|
2852
|
+
|
|
2853
|
+
@_ods_cext.register_operation(_Dialect)
|
|
2854
|
+
class SIToFPOp(_ods_ir.OpView):
|
|
2855
|
+
r"""
|
|
2856
|
+
Cast from a value interpreted as a signed integer to the corresponding
|
|
2857
|
+
floating-point value. When operating on vectors, casts elementwise.
|
|
2858
|
+
"""
|
|
2859
|
+
|
|
2860
|
+
OPERATION_NAME = "arith.sitofp"
|
|
2861
|
+
|
|
2862
|
+
_ODS_REGIONS = (0, True)
|
|
2863
|
+
|
|
2864
|
+
def __init__(self, out: _ods_ir.Type, in_: _ods_ir.Value, *, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
2865
|
+
operands = []
|
|
2866
|
+
attributes = {}
|
|
2867
|
+
regions = None
|
|
2868
|
+
operands.append(in_)
|
|
2869
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
2870
|
+
results = []
|
|
2871
|
+
results.append(out)
|
|
2872
|
+
_ods_successors = None
|
|
2873
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
2874
|
+
|
|
2875
|
+
@builtins.property
|
|
2876
|
+
def in_(self) -> _ods_ir.Value:
|
|
2877
|
+
return self.operation.operands[0]
|
|
2878
|
+
|
|
2879
|
+
@builtins.property
|
|
2880
|
+
def out(self) -> _ods_ir.OpResult:
|
|
2881
|
+
return self.operation.results[0]
|
|
2882
|
+
|
|
2883
|
+
@_ods_cext.register_op_adaptor(SIToFPOp)
|
|
2884
|
+
class SIToFPOpAdaptor(_ods_ir.OpAdaptor):
|
|
2885
|
+
OPERATION_NAME = "arith.sitofp"
|
|
2886
|
+
|
|
2887
|
+
@builtins.property
|
|
2888
|
+
def in_(self) -> _ods_ir.Value:
|
|
2889
|
+
return self.operands[0]
|
|
2890
|
+
|
|
2891
|
+
def sitofp(out: _ods_ir.Type, in_: _ods_ir.Value, *, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
2892
|
+
return SIToFPOp(out=out, in_=in_, loc=loc, ip=ip).result
|
|
2893
|
+
|
|
2894
|
+
@_ods_cext.register_operation(_Dialect)
|
|
2895
|
+
class ScalingExtFOp(_ods_ir.OpView):
|
|
2896
|
+
r"""
|
|
2897
|
+
This operation upcasts input floating-point values using provided scale
|
|
2898
|
+
values. It expects both scales and the input operand to be of the same shape,
|
|
2899
|
+
making the operation elementwise. Scales are usually calculated per block
|
|
2900
|
+
following the OCP MXFP spec as described in https://arxiv.org/abs/2310.10537.
|
|
2901
|
+
|
|
2902
|
+
If scales are calculated per block where blockSize != 1, then scales may
|
|
2903
|
+
require broadcasting to make this operation elementwise. For example, let's
|
|
2904
|
+
say the input is of shape `<dim1 x dim2 x ... dimN>`. Given blockSize != 1 and
|
|
2905
|
+
assuming quantization happens on the last axis, the input can be reshaped to
|
|
2906
|
+
`<dim1 x dim2 x ... (dimN/blockSize) x blockSize>`. Scales will be calculated
|
|
2907
|
+
per block on the last axis. Therefore, scales will be of shape
|
|
2908
|
+
`<dim1 x dim2 x ... (dimN/blockSize) x 1>`. Scales could also be of some other
|
|
2909
|
+
shape as long as it is broadcast compatible with the input, e.g.,
|
|
2910
|
+
`<1 x 1 x ... (dimN/blockSize) x 1>`.
|
|
2911
|
+
|
|
2912
|
+
In this example, before calling into `arith.scaling_extf`, scales must be
|
|
2913
|
+
broadcasted to `<dim1 x dim2 x dim3 ... (dimN/blockSize) x blockSize>`. Note
|
|
2914
|
+
that there could be multiple quantization axes. Internally,
|
|
2915
|
+
`arith.scaling_extf` would perform the following:
|
|
2916
|
+
|
|
2917
|
+
```mlir
|
|
2918
|
+
// Cast scale to result type.
|
|
2919
|
+
%0 = arith.truncf %1 : f32 to f8E8M0FNU
|
|
2920
|
+
%1 = arith.extf %0 : f8E8M0FNU to f16
|
|
2921
|
+
|
|
2922
|
+
// Cast input to result type.
|
|
2923
|
+
%2 = arith.extf %3 : f4E2M1FN to f16
|
|
2924
|
+
|
|
2925
|
+
// Perform scaling
|
|
2926
|
+
%3 = arith.mulf %2, %1 : f16
|
|
2927
|
+
```
|
|
2928
|
+
It propagates NaN values. Therefore, if either scale or the input element
|
|
2929
|
+
contains NaN, then the output element value will also be a NaN.
|
|
2930
|
+
|
|
2931
|
+
Example:
|
|
2932
|
+
|
|
2933
|
+
```mlir
|
|
2934
|
+
// Upcast from f4E2M1FN to f32.
|
|
2935
|
+
%a = arith.scaling_extf %b, %c : f4E2M1FN, f8E8M0FNU to f32
|
|
2936
|
+
|
|
2937
|
+
// Element-wise upcast with broadcast (blockSize = 32).
|
|
2938
|
+
%f = vector.broadcast %g : vector<1xf8E8M0FNU> to vector<32xf8E8M0FNU>
|
|
2939
|
+
%h = arith.scaling_extf %i, %f : vector<32xf4E2M1FN>, vector<32xf8E8M0FNU> to vector<32xbf16>
|
|
2940
|
+
```
|
|
2941
|
+
"""
|
|
2942
|
+
|
|
2943
|
+
OPERATION_NAME = "arith.scaling_extf"
|
|
2944
|
+
|
|
2945
|
+
_ODS_REGIONS = (0, True)
|
|
2946
|
+
|
|
2947
|
+
def __init__(self, out: _ods_ir.Type, in_: _ods_ir.Value, scale: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
2948
|
+
operands = []
|
|
2949
|
+
attributes = {}
|
|
2950
|
+
regions = None
|
|
2951
|
+
operands.append(in_)
|
|
2952
|
+
operands.append(scale)
|
|
2953
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
2954
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
2955
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
2956
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
2957
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
2958
|
+
results = []
|
|
2959
|
+
results.append(out)
|
|
2960
|
+
_ods_successors = None
|
|
2961
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
2962
|
+
|
|
2963
|
+
@builtins.property
|
|
2964
|
+
def in_(self) -> _ods_ir.Value:
|
|
2965
|
+
return self.operation.operands[0]
|
|
2966
|
+
|
|
2967
|
+
@builtins.property
|
|
2968
|
+
def scale(self) -> _ods_ir.Value:
|
|
2969
|
+
return self.operation.operands[1]
|
|
2970
|
+
|
|
2971
|
+
@builtins.property
|
|
2972
|
+
def fastmath(self) -> _Optional[_ods_ir.Attribute]:
|
|
2973
|
+
if "fastmath" not in self.operation.attributes:
|
|
2974
|
+
return None
|
|
2975
|
+
return self.operation.attributes["fastmath"]
|
|
2976
|
+
|
|
2977
|
+
@fastmath.setter
|
|
2978
|
+
def fastmath(self, value: _Optional[_ods_ir.Attribute]):
|
|
2979
|
+
if value is not None:
|
|
2980
|
+
self.operation.attributes["fastmath"] = value
|
|
2981
|
+
elif "fastmath" in self.operation.attributes:
|
|
2982
|
+
del self.operation.attributes["fastmath"]
|
|
2983
|
+
|
|
2984
|
+
@fastmath.deleter
|
|
2985
|
+
def fastmath(self):
|
|
2986
|
+
del self.operation.attributes["fastmath"]
|
|
2987
|
+
|
|
2988
|
+
@builtins.property
|
|
2989
|
+
def out(self) -> _ods_ir.OpResult:
|
|
2990
|
+
return self.operation.results[0]
|
|
2991
|
+
|
|
2992
|
+
@_ods_cext.register_op_adaptor(ScalingExtFOp)
|
|
2993
|
+
class ScalingExtFOpAdaptor(_ods_ir.OpAdaptor):
|
|
2994
|
+
OPERATION_NAME = "arith.scaling_extf"
|
|
2995
|
+
|
|
2996
|
+
@builtins.property
|
|
2997
|
+
def in_(self) -> _ods_ir.Value:
|
|
2998
|
+
return self.operands[0]
|
|
2999
|
+
|
|
3000
|
+
@builtins.property
|
|
3001
|
+
def scale(self) -> _ods_ir.Value:
|
|
3002
|
+
return self.operands[1]
|
|
3003
|
+
|
|
3004
|
+
@builtins.property
|
|
3005
|
+
def fastmath(self) -> _Optional[_ods_ir.Attribute]:
|
|
3006
|
+
if "fastmath" not in self.attributes:
|
|
3007
|
+
return None
|
|
3008
|
+
return self.attributes["fastmath"]
|
|
3009
|
+
|
|
3010
|
+
def scaling_extf(out: _ods_ir.Type, in_: _ods_ir.Value, scale: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
3011
|
+
return ScalingExtFOp(out=out, in_=in_, scale=scale, fastmath=fastmath, loc=loc, ip=ip).result
|
|
3012
|
+
|
|
3013
|
+
@_ods_cext.register_operation(_Dialect)
|
|
3014
|
+
class ScalingTruncFOp(_ods_ir.OpView):
|
|
3015
|
+
r"""
|
|
3016
|
+
This operation downcasts input using the provided scale values. It expects
|
|
3017
|
+
both scales and the input operand to be of the same shape and, therefore,
|
|
3018
|
+
makes the operation elementwise. Scales are usually calculated per block
|
|
3019
|
+
following the OCP MXFP spec as described in https://arxiv.org/abs/2310.10537.
|
|
3020
|
+
Users are required to normalize and clamp the scales as necessary before calling
|
|
3021
|
+
passing them to this operation. OCP MXFP spec also does the flushing of denorms
|
|
3022
|
+
on the input operand, which should be handled during lowering by passing appropriate
|
|
3023
|
+
fastMath flag to this operation.
|
|
3024
|
+
|
|
3025
|
+
If scales are calculated per block where blockSize != 1, scales may require
|
|
3026
|
+
broadcasting to make this operation elementwise. For example, let's say the
|
|
3027
|
+
input is of shape `<dim1 x dim2 x ... dimN>`. Given blockSize != 1 and
|
|
3028
|
+
assuming quantization happens on the last axis, the input can be reshaped to
|
|
3029
|
+
`<dim1 x dim2 x ... (dimN/blockSize) x blockSize>`. Scales will be calculated
|
|
3030
|
+
per block on the last axis. Therefore, scales will be of shape
|
|
3031
|
+
`<dim1 x dim2 x ... (dimN/blockSize) x 1>`. Scales could also be of some other
|
|
3032
|
+
shape as long as it is broadcast compatible with the input, e.g.,
|
|
3033
|
+
`<1 x 1 x ... (dimN/blockSize) x 1>`.
|
|
3034
|
+
|
|
3035
|
+
In this example, before calling into `arith.scaling_truncf`, scales must be
|
|
3036
|
+
broadcasted to `<dim1 x dim2 x dim3 ... (dimN/blockSize) x blockSize>`. Note
|
|
3037
|
+
that there could be multiple quantization axes. Internally,
|
|
3038
|
+
`arith.scaling_truncf` would perform the following:
|
|
3039
|
+
|
|
3040
|
+
```mlir
|
|
3041
|
+
// Cast scale to input type.
|
|
3042
|
+
%0 = arith.truncf %1 : f32 to f8E8M0FNU
|
|
3043
|
+
%1 = arith.extf %0 : f8E8M0FNU to f16
|
|
3044
|
+
|
|
3045
|
+
// Perform scaling.
|
|
3046
|
+
%3 = arith.divf %2, %1 : f16
|
|
3047
|
+
|
|
3048
|
+
// Cast to result type.
|
|
3049
|
+
%4 = arith.truncf %3 : f16 to f4E2M1FN
|
|
3050
|
+
```
|
|
3051
|
+
|
|
3052
|
+
Example:
|
|
3053
|
+
|
|
3054
|
+
```mlir
|
|
3055
|
+
// Downcast from f32 to f4E2M1FN.
|
|
3056
|
+
%a = arith.scaling_truncf %b, %c : f32, f8E8M0FNU to f4E2M1FN
|
|
3057
|
+
|
|
3058
|
+
// Element-wise downcast with broadcast (blockSize = 32).
|
|
3059
|
+
%f = vector.broadcast %g : vector<1xf8E8M0FNU> to vector<32xf8E8M0FNU>
|
|
3060
|
+
%h = arith.scaling_truncf %i, %f : vector<32xbf16>, vector<32xf8E8M0FNU> to vector<32xf4E2M1FN>
|
|
3061
|
+
```
|
|
3062
|
+
"""
|
|
3063
|
+
|
|
3064
|
+
OPERATION_NAME = "arith.scaling_truncf"
|
|
3065
|
+
|
|
3066
|
+
_ODS_REGIONS = (0, True)
|
|
3067
|
+
|
|
3068
|
+
def __init__(self, out: _ods_ir.Type, in_: _ods_ir.Value, scale: _ods_ir.Value, *, roundingmode: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
3069
|
+
operands = []
|
|
3070
|
+
attributes = {}
|
|
3071
|
+
regions = None
|
|
3072
|
+
operands.append(in_)
|
|
3073
|
+
operands.append(scale)
|
|
3074
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
3075
|
+
if roundingmode is not None: attributes["roundingmode"] = (roundingmode if (
|
|
3076
|
+
isinstance(roundingmode, _ods_ir.Attribute) or
|
|
3077
|
+
not _ods_ir.AttrBuilder.contains('Arith_RoundingModeAttr')) else
|
|
3078
|
+
_ods_ir.AttrBuilder.get('Arith_RoundingModeAttr')(roundingmode, context=_ods_context))
|
|
3079
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
3080
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
3081
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
3082
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
3083
|
+
results = []
|
|
3084
|
+
results.append(out)
|
|
3085
|
+
_ods_successors = None
|
|
3086
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
3087
|
+
|
|
3088
|
+
@builtins.property
|
|
3089
|
+
def in_(self) -> _ods_ir.Value:
|
|
3090
|
+
return self.operation.operands[0]
|
|
3091
|
+
|
|
3092
|
+
@builtins.property
|
|
3093
|
+
def scale(self) -> _ods_ir.Value:
|
|
3094
|
+
return self.operation.operands[1]
|
|
3095
|
+
|
|
3096
|
+
@builtins.property
|
|
3097
|
+
def roundingmode(self) -> _Optional[_ods_ir.Attribute]:
|
|
3098
|
+
if "roundingmode" not in self.operation.attributes:
|
|
3099
|
+
return None
|
|
3100
|
+
return self.operation.attributes["roundingmode"]
|
|
3101
|
+
|
|
3102
|
+
@roundingmode.setter
|
|
3103
|
+
def roundingmode(self, value: _Optional[_ods_ir.Attribute]):
|
|
3104
|
+
if value is not None:
|
|
3105
|
+
self.operation.attributes["roundingmode"] = value
|
|
3106
|
+
elif "roundingmode" in self.operation.attributes:
|
|
3107
|
+
del self.operation.attributes["roundingmode"]
|
|
3108
|
+
|
|
3109
|
+
@roundingmode.deleter
|
|
3110
|
+
def roundingmode(self):
|
|
3111
|
+
del self.operation.attributes["roundingmode"]
|
|
3112
|
+
|
|
3113
|
+
@builtins.property
|
|
3114
|
+
def fastmath(self) -> _Optional[_ods_ir.Attribute]:
|
|
3115
|
+
if "fastmath" not in self.operation.attributes:
|
|
3116
|
+
return None
|
|
3117
|
+
return self.operation.attributes["fastmath"]
|
|
3118
|
+
|
|
3119
|
+
@fastmath.setter
|
|
3120
|
+
def fastmath(self, value: _Optional[_ods_ir.Attribute]):
|
|
3121
|
+
if value is not None:
|
|
3122
|
+
self.operation.attributes["fastmath"] = value
|
|
3123
|
+
elif "fastmath" in self.operation.attributes:
|
|
3124
|
+
del self.operation.attributes["fastmath"]
|
|
3125
|
+
|
|
3126
|
+
@fastmath.deleter
|
|
3127
|
+
def fastmath(self):
|
|
3128
|
+
del self.operation.attributes["fastmath"]
|
|
3129
|
+
|
|
3130
|
+
@builtins.property
|
|
3131
|
+
def out(self) -> _ods_ir.OpResult:
|
|
3132
|
+
return self.operation.results[0]
|
|
3133
|
+
|
|
3134
|
+
@_ods_cext.register_op_adaptor(ScalingTruncFOp)
|
|
3135
|
+
class ScalingTruncFOpAdaptor(_ods_ir.OpAdaptor):
|
|
3136
|
+
OPERATION_NAME = "arith.scaling_truncf"
|
|
3137
|
+
|
|
3138
|
+
@builtins.property
|
|
3139
|
+
def in_(self) -> _ods_ir.Value:
|
|
3140
|
+
return self.operands[0]
|
|
3141
|
+
|
|
3142
|
+
@builtins.property
|
|
3143
|
+
def scale(self) -> _ods_ir.Value:
|
|
3144
|
+
return self.operands[1]
|
|
3145
|
+
|
|
3146
|
+
@builtins.property
|
|
3147
|
+
def roundingmode(self) -> _Optional[_ods_ir.Attribute]:
|
|
3148
|
+
if "roundingmode" not in self.attributes:
|
|
3149
|
+
return None
|
|
3150
|
+
return self.attributes["roundingmode"]
|
|
3151
|
+
|
|
3152
|
+
@builtins.property
|
|
3153
|
+
def fastmath(self) -> _Optional[_ods_ir.Attribute]:
|
|
3154
|
+
if "fastmath" not in self.attributes:
|
|
3155
|
+
return None
|
|
3156
|
+
return self.attributes["fastmath"]
|
|
3157
|
+
|
|
3158
|
+
def scaling_truncf(out: _ods_ir.Type, in_: _ods_ir.Value, scale: _ods_ir.Value, *, roundingmode: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
3159
|
+
return ScalingTruncFOp(out=out, in_=in_, scale=scale, roundingmode=roundingmode, fastmath=fastmath, loc=loc, ip=ip).result
|
|
3160
|
+
|
|
3161
|
+
@_ods_cext.register_operation(_Dialect)
|
|
3162
|
+
class ShLIOp(_ods_ir.OpView):
|
|
3163
|
+
r"""
|
|
3164
|
+
The `shli` operation shifts the integer value of the first operand to the left
|
|
3165
|
+
by the integer value of the second operand. The second operand is interpreted as
|
|
3166
|
+
unsigned. The low order bits are filled with zeros. If the value of the second
|
|
3167
|
+
operand is greater or equal than the bitwidth of the first operand, then the
|
|
3168
|
+
operation returns poison.
|
|
3169
|
+
|
|
3170
|
+
This op supports `nuw`/`nsw` overflow flags which stands for
|
|
3171
|
+
"No Unsigned Wrap" and "No Signed Wrap", respectively. If the `nuw` and/or
|
|
3172
|
+
`nsw` flags are present, and an unsigned/signed overflow occurs
|
|
3173
|
+
(respectively), the result is poison.
|
|
3174
|
+
|
|
3175
|
+
Example:
|
|
3176
|
+
|
|
3177
|
+
```mlir
|
|
3178
|
+
%1 = arith.constant 5 : i8 // %1 is 0b00000101
|
|
3179
|
+
%2 = arith.constant 3 : i8
|
|
3180
|
+
%3 = arith.shli %1, %2 : i8 // %3 is 0b00101000
|
|
3181
|
+
%4 = arith.shli %1, %2 overflow<nsw, nuw> : i8
|
|
3182
|
+
```
|
|
3183
|
+
"""
|
|
3184
|
+
|
|
3185
|
+
OPERATION_NAME = "arith.shli"
|
|
3186
|
+
|
|
3187
|
+
_ODS_REGIONS = (0, True)
|
|
3188
|
+
|
|
3189
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, overflowFlags: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
3190
|
+
operands = []
|
|
3191
|
+
attributes = {}
|
|
3192
|
+
regions = None
|
|
3193
|
+
operands.append(lhs)
|
|
3194
|
+
operands.append(rhs)
|
|
3195
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
3196
|
+
if overflowFlags is not None: attributes["overflowFlags"] = (overflowFlags if (
|
|
3197
|
+
isinstance(overflowFlags, _ods_ir.Attribute) or
|
|
3198
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_IntegerOverflowAttr')) else
|
|
3199
|
+
_ods_ir.AttrBuilder.get('arith.Arith_IntegerOverflowAttr')(overflowFlags, context=_ods_context))
|
|
3200
|
+
if results is None: results = [operands[0].type] * 1
|
|
3201
|
+
_ods_successors = None
|
|
3202
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
3203
|
+
|
|
3204
|
+
@builtins.property
|
|
3205
|
+
def lhs(self) -> _ods_ir.Value:
|
|
3206
|
+
return self.operation.operands[0]
|
|
3207
|
+
|
|
3208
|
+
@builtins.property
|
|
3209
|
+
def rhs(self) -> _ods_ir.Value:
|
|
3210
|
+
return self.operation.operands[1]
|
|
3211
|
+
|
|
3212
|
+
@builtins.property
|
|
3213
|
+
def overflowFlags(self) -> _ods_ir.Attribute:
|
|
3214
|
+
return self.operation.attributes["overflowFlags"]
|
|
3215
|
+
|
|
3216
|
+
@overflowFlags.setter
|
|
3217
|
+
def overflowFlags(self, value: _ods_ir.Attribute):
|
|
3218
|
+
if value is None:
|
|
3219
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
3220
|
+
self.operation.attributes["overflowFlags"] = value
|
|
3221
|
+
|
|
3222
|
+
@builtins.property
|
|
3223
|
+
def result(self) -> _ods_ir.OpResult:
|
|
3224
|
+
return self.operation.results[0]
|
|
3225
|
+
|
|
3226
|
+
@_ods_cext.register_op_adaptor(ShLIOp)
|
|
3227
|
+
class ShLIOpAdaptor(_ods_ir.OpAdaptor):
|
|
3228
|
+
OPERATION_NAME = "arith.shli"
|
|
3229
|
+
|
|
3230
|
+
@builtins.property
|
|
3231
|
+
def lhs(self) -> _ods_ir.Value:
|
|
3232
|
+
return self.operands[0]
|
|
3233
|
+
|
|
3234
|
+
@builtins.property
|
|
3235
|
+
def rhs(self) -> _ods_ir.Value:
|
|
3236
|
+
return self.operands[1]
|
|
3237
|
+
|
|
3238
|
+
@builtins.property
|
|
3239
|
+
def overflowFlags(self) -> _ods_ir.Attribute:
|
|
3240
|
+
return self.attributes["overflowFlags"]
|
|
3241
|
+
|
|
3242
|
+
def shli(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, overflow_flags: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
3243
|
+
return ShLIOp(lhs=lhs, rhs=rhs, overflowFlags=overflow_flags, results=results, loc=loc, ip=ip).result
|
|
3244
|
+
|
|
3245
|
+
@_ods_cext.register_operation(_Dialect)
|
|
3246
|
+
class ShRSIOp(_ods_ir.OpView):
|
|
3247
|
+
r"""
|
|
3248
|
+
The `shrsi` operation shifts an integer value of the first operand to the right
|
|
3249
|
+
by the value of the second operand. The first operand is interpreted as signed,
|
|
3250
|
+
and the second operand is interpreter as unsigned. The high order bits in the
|
|
3251
|
+
output are filled with copies of the most-significant bit of the shifted value
|
|
3252
|
+
(which means that the sign of the value is preserved). If the value of the second
|
|
3253
|
+
operand is greater or equal than bitwidth of the first operand, then the operation
|
|
3254
|
+
returns poison.
|
|
3255
|
+
|
|
3256
|
+
If the `exact` attribute is present, the result value of shrsi is a poison
|
|
3257
|
+
value if any of the bits shifted out are non-zero.
|
|
3258
|
+
|
|
3259
|
+
Example:
|
|
3260
|
+
|
|
3261
|
+
```mlir
|
|
3262
|
+
%1 = arith.constant 160 : i8 // %1 is 0b10100000
|
|
3263
|
+
%2 = arith.constant 3 : i8
|
|
3264
|
+
%3 = arith.shrsi %1, %2 exact : i8 // %3 is 0b11110100
|
|
3265
|
+
%4 = arith.constant 98 : i8 // %4 is 0b01100010
|
|
3266
|
+
%5 = arith.shrsi %4, %2 : i8 // %5 is 0b00001100
|
|
3267
|
+
```
|
|
3268
|
+
"""
|
|
3269
|
+
|
|
3270
|
+
OPERATION_NAME = "arith.shrsi"
|
|
3271
|
+
|
|
3272
|
+
_ODS_REGIONS = (0, True)
|
|
3273
|
+
|
|
3274
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, isExact: _Optional[bool] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
3275
|
+
operands = []
|
|
3276
|
+
attributes = {}
|
|
3277
|
+
regions = None
|
|
3278
|
+
operands.append(lhs)
|
|
3279
|
+
operands.append(rhs)
|
|
3280
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
3281
|
+
if bool(isExact): attributes["isExact"] = _ods_ir.UnitAttr.get(
|
|
3282
|
+
_ods_get_default_loc_context(loc))
|
|
3283
|
+
if results is None: results = [operands[0].type] * 1
|
|
3284
|
+
_ods_successors = None
|
|
3285
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
3286
|
+
|
|
3287
|
+
@builtins.property
|
|
3288
|
+
def lhs(self) -> _ods_ir.Value:
|
|
3289
|
+
return self.operation.operands[0]
|
|
3290
|
+
|
|
3291
|
+
@builtins.property
|
|
3292
|
+
def rhs(self) -> _ods_ir.Value:
|
|
3293
|
+
return self.operation.operands[1]
|
|
3294
|
+
|
|
3295
|
+
@builtins.property
|
|
3296
|
+
def isExact(self) -> bool:
|
|
3297
|
+
return "isExact" in self.operation.attributes
|
|
3298
|
+
|
|
3299
|
+
@isExact.setter
|
|
3300
|
+
def isExact(self, value):
|
|
3301
|
+
if bool(value):
|
|
3302
|
+
self.operation.attributes["isExact"] = _ods_ir.UnitAttr.get()
|
|
3303
|
+
elif "isExact" in self.operation.attributes:
|
|
3304
|
+
del self.operation.attributes["isExact"]
|
|
3305
|
+
|
|
3306
|
+
@isExact.deleter
|
|
3307
|
+
def isExact(self):
|
|
3308
|
+
del self.operation.attributes["isExact"]
|
|
3309
|
+
|
|
3310
|
+
@builtins.property
|
|
3311
|
+
def result(self) -> _ods_ir.OpResult:
|
|
3312
|
+
return self.operation.results[0]
|
|
3313
|
+
|
|
3314
|
+
@_ods_cext.register_op_adaptor(ShRSIOp)
|
|
3315
|
+
class ShRSIOpAdaptor(_ods_ir.OpAdaptor):
|
|
3316
|
+
OPERATION_NAME = "arith.shrsi"
|
|
3317
|
+
|
|
3318
|
+
@builtins.property
|
|
3319
|
+
def lhs(self) -> _ods_ir.Value:
|
|
3320
|
+
return self.operands[0]
|
|
3321
|
+
|
|
3322
|
+
@builtins.property
|
|
3323
|
+
def rhs(self) -> _ods_ir.Value:
|
|
3324
|
+
return self.operands[1]
|
|
3325
|
+
|
|
3326
|
+
@builtins.property
|
|
3327
|
+
def isExact(self) -> bool:
|
|
3328
|
+
return "isExact" in self.attributes
|
|
3329
|
+
|
|
3330
|
+
def shrsi(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, is_exact: _Optional[bool] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
3331
|
+
return ShRSIOp(lhs=lhs, rhs=rhs, isExact=is_exact, results=results, loc=loc, ip=ip).result
|
|
3332
|
+
|
|
3333
|
+
@_ods_cext.register_operation(_Dialect)
|
|
3334
|
+
class ShRUIOp(_ods_ir.OpView):
|
|
3335
|
+
r"""
|
|
3336
|
+
The `shrui` operation shifts an integer value of the first operand to the right
|
|
3337
|
+
by the value of the second operand. The first operand is interpreted as unsigned,
|
|
3338
|
+
and the second operand is interpreted as unsigned. The high order bits are always
|
|
3339
|
+
filled with zeros. If the value of the second operand is greater or equal than the
|
|
3340
|
+
bitwidth of the first operand, then the operation returns poison.
|
|
3341
|
+
|
|
3342
|
+
If the `exact` attribute is present, the result value of shrui is a poison
|
|
3343
|
+
value if any of the bits shifted out are non-zero.
|
|
3344
|
+
|
|
3345
|
+
Example:
|
|
3346
|
+
|
|
3347
|
+
```mlir
|
|
3348
|
+
%1 = arith.constant 160 : i8 // %1 is 0b10100000
|
|
3349
|
+
%2 = arith.constant 3 : i8
|
|
3350
|
+
%3 = arith.constant 6 : i8
|
|
3351
|
+
%4 = arith.shrui %1, %2 exact : i8 // %4 is 0b00010100
|
|
3352
|
+
%5 = arith.shrui %1, %3 : i8 // %3 is 0b00000010
|
|
3353
|
+
```
|
|
3354
|
+
"""
|
|
3355
|
+
|
|
3356
|
+
OPERATION_NAME = "arith.shrui"
|
|
3357
|
+
|
|
3358
|
+
_ODS_REGIONS = (0, True)
|
|
3359
|
+
|
|
3360
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, isExact: _Optional[bool] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
3361
|
+
operands = []
|
|
3362
|
+
attributes = {}
|
|
3363
|
+
regions = None
|
|
3364
|
+
operands.append(lhs)
|
|
3365
|
+
operands.append(rhs)
|
|
3366
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
3367
|
+
if bool(isExact): attributes["isExact"] = _ods_ir.UnitAttr.get(
|
|
3368
|
+
_ods_get_default_loc_context(loc))
|
|
3369
|
+
if results is None: results = [operands[0].type] * 1
|
|
3370
|
+
_ods_successors = None
|
|
3371
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
3372
|
+
|
|
3373
|
+
@builtins.property
|
|
3374
|
+
def lhs(self) -> _ods_ir.Value:
|
|
3375
|
+
return self.operation.operands[0]
|
|
3376
|
+
|
|
3377
|
+
@builtins.property
|
|
3378
|
+
def rhs(self) -> _ods_ir.Value:
|
|
3379
|
+
return self.operation.operands[1]
|
|
3380
|
+
|
|
3381
|
+
@builtins.property
|
|
3382
|
+
def isExact(self) -> bool:
|
|
3383
|
+
return "isExact" in self.operation.attributes
|
|
3384
|
+
|
|
3385
|
+
@isExact.setter
|
|
3386
|
+
def isExact(self, value):
|
|
3387
|
+
if bool(value):
|
|
3388
|
+
self.operation.attributes["isExact"] = _ods_ir.UnitAttr.get()
|
|
3389
|
+
elif "isExact" in self.operation.attributes:
|
|
3390
|
+
del self.operation.attributes["isExact"]
|
|
3391
|
+
|
|
3392
|
+
@isExact.deleter
|
|
3393
|
+
def isExact(self):
|
|
3394
|
+
del self.operation.attributes["isExact"]
|
|
3395
|
+
|
|
3396
|
+
@builtins.property
|
|
3397
|
+
def result(self) -> _ods_ir.OpResult:
|
|
3398
|
+
return self.operation.results[0]
|
|
3399
|
+
|
|
3400
|
+
@_ods_cext.register_op_adaptor(ShRUIOp)
|
|
3401
|
+
class ShRUIOpAdaptor(_ods_ir.OpAdaptor):
|
|
3402
|
+
OPERATION_NAME = "arith.shrui"
|
|
3403
|
+
|
|
3404
|
+
@builtins.property
|
|
3405
|
+
def lhs(self) -> _ods_ir.Value:
|
|
3406
|
+
return self.operands[0]
|
|
3407
|
+
|
|
3408
|
+
@builtins.property
|
|
3409
|
+
def rhs(self) -> _ods_ir.Value:
|
|
3410
|
+
return self.operands[1]
|
|
3411
|
+
|
|
3412
|
+
@builtins.property
|
|
3413
|
+
def isExact(self) -> bool:
|
|
3414
|
+
return "isExact" in self.attributes
|
|
3415
|
+
|
|
3416
|
+
def shrui(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, is_exact: _Optional[bool] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
3417
|
+
return ShRUIOp(lhs=lhs, rhs=rhs, isExact=is_exact, results=results, loc=loc, ip=ip).result
|
|
3418
|
+
|
|
3419
|
+
@_ods_cext.register_operation(_Dialect)
|
|
3420
|
+
class SubFOp(_ods_ir.OpView):
|
|
3421
|
+
r"""
|
|
3422
|
+
The `subf` operation takes two operands and returns one result, each of
|
|
3423
|
+
these is required to be the same type. This type may be a floating point
|
|
3424
|
+
scalar type, a vector whose element type is a floating point type, or a
|
|
3425
|
+
floating point tensor.
|
|
3426
|
+
|
|
3427
|
+
Example:
|
|
3428
|
+
|
|
3429
|
+
```mlir
|
|
3430
|
+
// Scalar subtraction.
|
|
3431
|
+
%a = arith.subf %b, %c : f64
|
|
3432
|
+
|
|
3433
|
+
// SIMD vector subtraction, e.g. for Intel SSE.
|
|
3434
|
+
%f = arith.subf %g, %h : vector<4xf32>
|
|
3435
|
+
|
|
3436
|
+
// Tensor subtraction.
|
|
3437
|
+
%x = arith.subf %y, %z : tensor<4x?xbf16>
|
|
3438
|
+
|
|
3439
|
+
// Scalar subtraction with rounding mode.
|
|
3440
|
+
%a = arith.subf %b, %c downward : f64
|
|
3441
|
+
```
|
|
3442
|
+
"""
|
|
3443
|
+
|
|
3444
|
+
OPERATION_NAME = "arith.subf"
|
|
3445
|
+
|
|
3446
|
+
_ODS_REGIONS = (0, True)
|
|
3447
|
+
|
|
3448
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, roundingmode: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
3449
|
+
operands = []
|
|
3450
|
+
attributes = {}
|
|
3451
|
+
regions = None
|
|
3452
|
+
operands.append(lhs)
|
|
3453
|
+
operands.append(rhs)
|
|
3454
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
3455
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
3456
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
3457
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
3458
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
3459
|
+
if roundingmode is not None: attributes["roundingmode"] = (roundingmode if (
|
|
3460
|
+
isinstance(roundingmode, _ods_ir.Attribute) or
|
|
3461
|
+
not _ods_ir.AttrBuilder.contains('Arith_RoundingModeAttr')) else
|
|
3462
|
+
_ods_ir.AttrBuilder.get('Arith_RoundingModeAttr')(roundingmode, context=_ods_context))
|
|
3463
|
+
if results is None: results = [operands[0].type] * 1
|
|
3464
|
+
_ods_successors = None
|
|
3465
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
3466
|
+
|
|
3467
|
+
@builtins.property
|
|
3468
|
+
def lhs(self) -> _ods_ir.Value:
|
|
3469
|
+
return self.operation.operands[0]
|
|
3470
|
+
|
|
3471
|
+
@builtins.property
|
|
3472
|
+
def rhs(self) -> _ods_ir.Value:
|
|
3473
|
+
return self.operation.operands[1]
|
|
3474
|
+
|
|
3475
|
+
@builtins.property
|
|
3476
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
3477
|
+
return self.operation.attributes["fastmath"]
|
|
3478
|
+
|
|
3479
|
+
@fastmath.setter
|
|
3480
|
+
def fastmath(self, value: _ods_ir.Attribute):
|
|
3481
|
+
if value is None:
|
|
3482
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
3483
|
+
self.operation.attributes["fastmath"] = value
|
|
3484
|
+
|
|
3485
|
+
@builtins.property
|
|
3486
|
+
def roundingmode(self) -> _Optional[_ods_ir.Attribute]:
|
|
3487
|
+
if "roundingmode" not in self.operation.attributes:
|
|
3488
|
+
return None
|
|
3489
|
+
return self.operation.attributes["roundingmode"]
|
|
3490
|
+
|
|
3491
|
+
@roundingmode.setter
|
|
3492
|
+
def roundingmode(self, value: _Optional[_ods_ir.Attribute]):
|
|
3493
|
+
if value is not None:
|
|
3494
|
+
self.operation.attributes["roundingmode"] = value
|
|
3495
|
+
elif "roundingmode" in self.operation.attributes:
|
|
3496
|
+
del self.operation.attributes["roundingmode"]
|
|
3497
|
+
|
|
3498
|
+
@roundingmode.deleter
|
|
3499
|
+
def roundingmode(self):
|
|
3500
|
+
del self.operation.attributes["roundingmode"]
|
|
3501
|
+
|
|
3502
|
+
@builtins.property
|
|
3503
|
+
def result(self) -> _ods_ir.OpResult:
|
|
3504
|
+
return self.operation.results[0]
|
|
3505
|
+
|
|
3506
|
+
@_ods_cext.register_op_adaptor(SubFOp)
|
|
3507
|
+
class SubFOpAdaptor(_ods_ir.OpAdaptor):
|
|
3508
|
+
OPERATION_NAME = "arith.subf"
|
|
3509
|
+
|
|
3510
|
+
@builtins.property
|
|
3511
|
+
def lhs(self) -> _ods_ir.Value:
|
|
3512
|
+
return self.operands[0]
|
|
3513
|
+
|
|
3514
|
+
@builtins.property
|
|
3515
|
+
def rhs(self) -> _ods_ir.Value:
|
|
3516
|
+
return self.operands[1]
|
|
3517
|
+
|
|
3518
|
+
@builtins.property
|
|
3519
|
+
def fastmath(self) -> _ods_ir.Attribute:
|
|
3520
|
+
return self.attributes["fastmath"]
|
|
3521
|
+
|
|
3522
|
+
@builtins.property
|
|
3523
|
+
def roundingmode(self) -> _Optional[_ods_ir.Attribute]:
|
|
3524
|
+
if "roundingmode" not in self.attributes:
|
|
3525
|
+
return None
|
|
3526
|
+
return self.attributes["roundingmode"]
|
|
3527
|
+
|
|
3528
|
+
def subf(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, roundingmode: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
3529
|
+
return SubFOp(lhs=lhs, rhs=rhs, fastmath=fastmath, roundingmode=roundingmode, results=results, loc=loc, ip=ip).result
|
|
3530
|
+
|
|
3531
|
+
@_ods_cext.register_operation(_Dialect)
|
|
3532
|
+
class SubIOp(_ods_ir.OpView):
|
|
3533
|
+
r"""
|
|
3534
|
+
Performs N-bit subtraction on the operands. The operands are interpreted as unsigned
|
|
3535
|
+
bitvectors. The result is represented by a bitvector containing the mathematical
|
|
3536
|
+
value of the subtraction modulo 2^n, where `n` is the bitwidth. Because `arith`
|
|
3537
|
+
integers use a two's complement representation, this operation is applicable on
|
|
3538
|
+
both signed and unsigned integer operands.
|
|
3539
|
+
|
|
3540
|
+
The `subi` operation takes two operands and returns one result, each of
|
|
3541
|
+
these is required to be the same type. This type may be an integer scalar type,
|
|
3542
|
+
a vector whose element type is integer, or a tensor of integers.
|
|
3543
|
+
|
|
3544
|
+
This op supports `nuw`/`nsw` overflow flags which stands for
|
|
3545
|
+
"No Unsigned Wrap" and "No Signed Wrap", respectively. If the `nuw` and/or
|
|
3546
|
+
`nsw` flags are present, and an unsigned/signed overflow occurs
|
|
3547
|
+
(respectively), the result is poison.
|
|
3548
|
+
|
|
3549
|
+
Example:
|
|
3550
|
+
|
|
3551
|
+
```mlir
|
|
3552
|
+
// Scalar subtraction.
|
|
3553
|
+
%a = arith.subi %b, %c : i64
|
|
3554
|
+
|
|
3555
|
+
// Scalar subtraction with overflow flags.
|
|
3556
|
+
%a = arith.subi %b, %c overflow<nsw, nuw> : i64
|
|
3557
|
+
|
|
3558
|
+
// SIMD vector element-wise subtraction.
|
|
3559
|
+
%f = arith.subi %g, %h : vector<4xi32>
|
|
3560
|
+
|
|
3561
|
+
// Tensor element-wise subtraction.
|
|
3562
|
+
%x = arith.subi %y, %z : tensor<4x?xi8>
|
|
3563
|
+
```
|
|
3564
|
+
"""
|
|
3565
|
+
|
|
3566
|
+
OPERATION_NAME = "arith.subi"
|
|
3567
|
+
|
|
3568
|
+
_ODS_REGIONS = (0, True)
|
|
3569
|
+
|
|
3570
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, overflowFlags: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
3571
|
+
operands = []
|
|
3572
|
+
attributes = {}
|
|
3573
|
+
regions = None
|
|
3574
|
+
operands.append(lhs)
|
|
3575
|
+
operands.append(rhs)
|
|
3576
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
3577
|
+
if overflowFlags is not None: attributes["overflowFlags"] = (overflowFlags if (
|
|
3578
|
+
isinstance(overflowFlags, _ods_ir.Attribute) or
|
|
3579
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_IntegerOverflowAttr')) else
|
|
3580
|
+
_ods_ir.AttrBuilder.get('arith.Arith_IntegerOverflowAttr')(overflowFlags, context=_ods_context))
|
|
3581
|
+
if results is None: results = [operands[0].type] * 1
|
|
3582
|
+
_ods_successors = None
|
|
3583
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
3584
|
+
|
|
3585
|
+
@builtins.property
|
|
3586
|
+
def lhs(self) -> _ods_ir.Value:
|
|
3587
|
+
return self.operation.operands[0]
|
|
3588
|
+
|
|
3589
|
+
@builtins.property
|
|
3590
|
+
def rhs(self) -> _ods_ir.Value:
|
|
3591
|
+
return self.operation.operands[1]
|
|
3592
|
+
|
|
3593
|
+
@builtins.property
|
|
3594
|
+
def overflowFlags(self) -> _ods_ir.Attribute:
|
|
3595
|
+
return self.operation.attributes["overflowFlags"]
|
|
3596
|
+
|
|
3597
|
+
@overflowFlags.setter
|
|
3598
|
+
def overflowFlags(self, value: _ods_ir.Attribute):
|
|
3599
|
+
if value is None:
|
|
3600
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
3601
|
+
self.operation.attributes["overflowFlags"] = value
|
|
3602
|
+
|
|
3603
|
+
@builtins.property
|
|
3604
|
+
def result(self) -> _ods_ir.OpResult:
|
|
3605
|
+
return self.operation.results[0]
|
|
3606
|
+
|
|
3607
|
+
@_ods_cext.register_op_adaptor(SubIOp)
|
|
3608
|
+
class SubIOpAdaptor(_ods_ir.OpAdaptor):
|
|
3609
|
+
OPERATION_NAME = "arith.subi"
|
|
3610
|
+
|
|
3611
|
+
@builtins.property
|
|
3612
|
+
def lhs(self) -> _ods_ir.Value:
|
|
3613
|
+
return self.operands[0]
|
|
3614
|
+
|
|
3615
|
+
@builtins.property
|
|
3616
|
+
def rhs(self) -> _ods_ir.Value:
|
|
3617
|
+
return self.operands[1]
|
|
3618
|
+
|
|
3619
|
+
@builtins.property
|
|
3620
|
+
def overflowFlags(self) -> _ods_ir.Attribute:
|
|
3621
|
+
return self.attributes["overflowFlags"]
|
|
3622
|
+
|
|
3623
|
+
def subi(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, overflow_flags: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
3624
|
+
return SubIOp(lhs=lhs, rhs=rhs, overflowFlags=overflow_flags, results=results, loc=loc, ip=ip).result
|
|
3625
|
+
|
|
3626
|
+
@_ods_cext.register_operation(_Dialect)
|
|
3627
|
+
class TruncFOp(_ods_ir.OpView):
|
|
3628
|
+
r"""
|
|
3629
|
+
Truncate a floating-point value to a smaller floating-point-typed value.
|
|
3630
|
+
The destination type must be strictly narrower than the source type.
|
|
3631
|
+
When operating on vectors, casts elementwise.
|
|
3632
|
+
"""
|
|
3633
|
+
|
|
3634
|
+
OPERATION_NAME = "arith.truncf"
|
|
3635
|
+
|
|
3636
|
+
_ODS_REGIONS = (0, True)
|
|
3637
|
+
|
|
3638
|
+
def __init__(self, out: _ods_ir.Type, in_: _ods_ir.Value, *, roundingmode: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
3639
|
+
operands = []
|
|
3640
|
+
attributes = {}
|
|
3641
|
+
regions = None
|
|
3642
|
+
operands.append(in_)
|
|
3643
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
3644
|
+
if roundingmode is not None: attributes["roundingmode"] = (roundingmode if (
|
|
3645
|
+
isinstance(roundingmode, _ods_ir.Attribute) or
|
|
3646
|
+
not _ods_ir.AttrBuilder.contains('Arith_RoundingModeAttr')) else
|
|
3647
|
+
_ods_ir.AttrBuilder.get('Arith_RoundingModeAttr')(roundingmode, context=_ods_context))
|
|
3648
|
+
if fastmath is not None: attributes["fastmath"] = (fastmath if (
|
|
3649
|
+
isinstance(fastmath, _ods_ir.Attribute) or
|
|
3650
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_FastMathAttr')) else
|
|
3651
|
+
_ods_ir.AttrBuilder.get('arith.Arith_FastMathAttr')(fastmath, context=_ods_context))
|
|
3652
|
+
results = []
|
|
3653
|
+
results.append(out)
|
|
3654
|
+
_ods_successors = None
|
|
3655
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
3656
|
+
|
|
3657
|
+
@builtins.property
|
|
3658
|
+
def in_(self) -> _ods_ir.Value:
|
|
3659
|
+
return self.operation.operands[0]
|
|
3660
|
+
|
|
3661
|
+
@builtins.property
|
|
3662
|
+
def roundingmode(self) -> _Optional[_ods_ir.Attribute]:
|
|
3663
|
+
if "roundingmode" not in self.operation.attributes:
|
|
3664
|
+
return None
|
|
3665
|
+
return self.operation.attributes["roundingmode"]
|
|
3666
|
+
|
|
3667
|
+
@roundingmode.setter
|
|
3668
|
+
def roundingmode(self, value: _Optional[_ods_ir.Attribute]):
|
|
3669
|
+
if value is not None:
|
|
3670
|
+
self.operation.attributes["roundingmode"] = value
|
|
3671
|
+
elif "roundingmode" in self.operation.attributes:
|
|
3672
|
+
del self.operation.attributes["roundingmode"]
|
|
3673
|
+
|
|
3674
|
+
@roundingmode.deleter
|
|
3675
|
+
def roundingmode(self):
|
|
3676
|
+
del self.operation.attributes["roundingmode"]
|
|
3677
|
+
|
|
3678
|
+
@builtins.property
|
|
3679
|
+
def fastmath(self) -> _Optional[_ods_ir.Attribute]:
|
|
3680
|
+
if "fastmath" not in self.operation.attributes:
|
|
3681
|
+
return None
|
|
3682
|
+
return self.operation.attributes["fastmath"]
|
|
3683
|
+
|
|
3684
|
+
@fastmath.setter
|
|
3685
|
+
def fastmath(self, value: _Optional[_ods_ir.Attribute]):
|
|
3686
|
+
if value is not None:
|
|
3687
|
+
self.operation.attributes["fastmath"] = value
|
|
3688
|
+
elif "fastmath" in self.operation.attributes:
|
|
3689
|
+
del self.operation.attributes["fastmath"]
|
|
3690
|
+
|
|
3691
|
+
@fastmath.deleter
|
|
3692
|
+
def fastmath(self):
|
|
3693
|
+
del self.operation.attributes["fastmath"]
|
|
3694
|
+
|
|
3695
|
+
@builtins.property
|
|
3696
|
+
def out(self) -> _ods_ir.OpResult:
|
|
3697
|
+
return self.operation.results[0]
|
|
3698
|
+
|
|
3699
|
+
@_ods_cext.register_op_adaptor(TruncFOp)
|
|
3700
|
+
class TruncFOpAdaptor(_ods_ir.OpAdaptor):
|
|
3701
|
+
OPERATION_NAME = "arith.truncf"
|
|
3702
|
+
|
|
3703
|
+
@builtins.property
|
|
3704
|
+
def in_(self) -> _ods_ir.Value:
|
|
3705
|
+
return self.operands[0]
|
|
3706
|
+
|
|
3707
|
+
@builtins.property
|
|
3708
|
+
def roundingmode(self) -> _Optional[_ods_ir.Attribute]:
|
|
3709
|
+
if "roundingmode" not in self.attributes:
|
|
3710
|
+
return None
|
|
3711
|
+
return self.attributes["roundingmode"]
|
|
3712
|
+
|
|
3713
|
+
@builtins.property
|
|
3714
|
+
def fastmath(self) -> _Optional[_ods_ir.Attribute]:
|
|
3715
|
+
if "fastmath" not in self.attributes:
|
|
3716
|
+
return None
|
|
3717
|
+
return self.attributes["fastmath"]
|
|
3718
|
+
|
|
3719
|
+
def truncf(out: _ods_ir.Type, in_: _ods_ir.Value, *, roundingmode: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, fastmath: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
3720
|
+
return TruncFOp(out=out, in_=in_, roundingmode=roundingmode, fastmath=fastmath, loc=loc, ip=ip).result
|
|
3721
|
+
|
|
3722
|
+
@_ods_cext.register_operation(_Dialect)
|
|
3723
|
+
class TruncIOp(_ods_ir.OpView):
|
|
3724
|
+
r"""
|
|
3725
|
+
The integer truncation operation takes an integer input of
|
|
3726
|
+
width M and an integer destination type of width N. The destination
|
|
3727
|
+
bit-width must be smaller than the input bit-width (N < M).
|
|
3728
|
+
The top-most (N - M) bits of the input are discarded.
|
|
3729
|
+
|
|
3730
|
+
This op supports `nuw`/`nsw` overflow flags which stands for "No Unsigned
|
|
3731
|
+
Wrap" and "No Signed Wrap", respectively. If the nuw keyword is present,
|
|
3732
|
+
and any of the truncated bits are non-zero, the result is a poison value.
|
|
3733
|
+
If the nsw keyword is present, and any of the truncated bits are not the
|
|
3734
|
+
same as the top bit of the truncation result, the result is a poison value.
|
|
3735
|
+
|
|
3736
|
+
Example:
|
|
3737
|
+
|
|
3738
|
+
```mlir
|
|
3739
|
+
// Scalar truncation.
|
|
3740
|
+
%1 = arith.constant 21 : i5 // %1 is 0b10101
|
|
3741
|
+
%2 = arith.trunci %1 : i5 to i4 // %2 is 0b0101
|
|
3742
|
+
%3 = arith.trunci %1 : i5 to i3 // %3 is 0b101
|
|
3743
|
+
|
|
3744
|
+
// Vector truncation.
|
|
3745
|
+
%4 = arith.trunci %0 : vector<2 x i32> to vector<2 x i16>
|
|
3746
|
+
|
|
3747
|
+
// Scalar truncation with overflow flags.
|
|
3748
|
+
%5 = arith.trunci %a overflow<nsw, nuw> : i32 to i16
|
|
3749
|
+
```
|
|
3750
|
+
"""
|
|
3751
|
+
|
|
3752
|
+
OPERATION_NAME = "arith.trunci"
|
|
3753
|
+
|
|
3754
|
+
_ODS_REGIONS = (0, True)
|
|
3755
|
+
|
|
3756
|
+
def __init__(self, out: _ods_ir.Type, in_: _ods_ir.Value, *, overflowFlags: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
3757
|
+
operands = []
|
|
3758
|
+
attributes = {}
|
|
3759
|
+
regions = None
|
|
3760
|
+
operands.append(in_)
|
|
3761
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
3762
|
+
if overflowFlags is not None: attributes["overflowFlags"] = (overflowFlags if (
|
|
3763
|
+
isinstance(overflowFlags, _ods_ir.Attribute) or
|
|
3764
|
+
not _ods_ir.AttrBuilder.contains('arith.Arith_IntegerOverflowAttr')) else
|
|
3765
|
+
_ods_ir.AttrBuilder.get('arith.Arith_IntegerOverflowAttr')(overflowFlags, context=_ods_context))
|
|
3766
|
+
results = []
|
|
3767
|
+
results.append(out)
|
|
3768
|
+
_ods_successors = None
|
|
3769
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
3770
|
+
|
|
3771
|
+
@builtins.property
|
|
3772
|
+
def in_(self) -> _ods_ir.Value:
|
|
3773
|
+
return self.operation.operands[0]
|
|
3774
|
+
|
|
3775
|
+
@builtins.property
|
|
3776
|
+
def overflowFlags(self) -> _ods_ir.Attribute:
|
|
3777
|
+
return self.operation.attributes["overflowFlags"]
|
|
3778
|
+
|
|
3779
|
+
@overflowFlags.setter
|
|
3780
|
+
def overflowFlags(self, value: _ods_ir.Attribute):
|
|
3781
|
+
if value is None:
|
|
3782
|
+
raise ValueError("'None' not allowed as value for mandatory attributes")
|
|
3783
|
+
self.operation.attributes["overflowFlags"] = value
|
|
3784
|
+
|
|
3785
|
+
@builtins.property
|
|
3786
|
+
def out(self) -> _ods_ir.OpResult:
|
|
3787
|
+
return self.operation.results[0]
|
|
3788
|
+
|
|
3789
|
+
@_ods_cext.register_op_adaptor(TruncIOp)
|
|
3790
|
+
class TruncIOpAdaptor(_ods_ir.OpAdaptor):
|
|
3791
|
+
OPERATION_NAME = "arith.trunci"
|
|
3792
|
+
|
|
3793
|
+
@builtins.property
|
|
3794
|
+
def in_(self) -> _ods_ir.Value:
|
|
3795
|
+
return self.operands[0]
|
|
3796
|
+
|
|
3797
|
+
@builtins.property
|
|
3798
|
+
def overflowFlags(self) -> _ods_ir.Attribute:
|
|
3799
|
+
return self.attributes["overflowFlags"]
|
|
3800
|
+
|
|
3801
|
+
def trunci(out: _ods_ir.Type, in_: _ods_ir.Value, *, overflow_flags: _Optional[_Union[_Any, _ods_ir.Attribute]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
3802
|
+
return TruncIOp(out=out, in_=in_, overflowFlags=overflow_flags, loc=loc, ip=ip).result
|
|
3803
|
+
|
|
3804
|
+
@_ods_cext.register_operation(_Dialect)
|
|
3805
|
+
class UIToFPOp(_ods_ir.OpView):
|
|
3806
|
+
r"""
|
|
3807
|
+
Cast from a value interpreted as unsigned integer to the corresponding
|
|
3808
|
+
floating-point value. When operating on vectors, casts elementwise.
|
|
3809
|
+
|
|
3810
|
+
When the `nneg` flag is present, the operand is assumed to have
|
|
3811
|
+
the most significant bit set to 0. In this case, zero extension is
|
|
3812
|
+
equivalent to sign extension. When this assumption is violated, the
|
|
3813
|
+
result is poison.
|
|
3814
|
+
|
|
3815
|
+
Example:
|
|
3816
|
+
|
|
3817
|
+
```mlir
|
|
3818
|
+
// Without nneg flag.
|
|
3819
|
+
%0 = arith.uitofp %a : i32 to f64
|
|
3820
|
+
|
|
3821
|
+
// With nneg flag.
|
|
3822
|
+
%1 = arith.uitofp %a nneg : i32 to f64
|
|
3823
|
+
```
|
|
3824
|
+
"""
|
|
3825
|
+
|
|
3826
|
+
OPERATION_NAME = "arith.uitofp"
|
|
3827
|
+
|
|
3828
|
+
_ODS_REGIONS = (0, True)
|
|
3829
|
+
|
|
3830
|
+
def __init__(self, out: _ods_ir.Type, in_: _ods_ir.Value, *, nonNeg: _Optional[bool] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
3831
|
+
operands = []
|
|
3832
|
+
attributes = {}
|
|
3833
|
+
regions = None
|
|
3834
|
+
operands.append(in_)
|
|
3835
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
3836
|
+
if bool(nonNeg): attributes["nonNeg"] = _ods_ir.UnitAttr.get(
|
|
3837
|
+
_ods_get_default_loc_context(loc))
|
|
3838
|
+
results = []
|
|
3839
|
+
results.append(out)
|
|
3840
|
+
_ods_successors = None
|
|
3841
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
3842
|
+
|
|
3843
|
+
@builtins.property
|
|
3844
|
+
def in_(self) -> _ods_ir.Value:
|
|
3845
|
+
return self.operation.operands[0]
|
|
3846
|
+
|
|
3847
|
+
@builtins.property
|
|
3848
|
+
def nonNeg(self) -> bool:
|
|
3849
|
+
return "nonNeg" in self.operation.attributes
|
|
3850
|
+
|
|
3851
|
+
@nonNeg.setter
|
|
3852
|
+
def nonNeg(self, value):
|
|
3853
|
+
if bool(value):
|
|
3854
|
+
self.operation.attributes["nonNeg"] = _ods_ir.UnitAttr.get()
|
|
3855
|
+
elif "nonNeg" in self.operation.attributes:
|
|
3856
|
+
del self.operation.attributes["nonNeg"]
|
|
3857
|
+
|
|
3858
|
+
@nonNeg.deleter
|
|
3859
|
+
def nonNeg(self):
|
|
3860
|
+
del self.operation.attributes["nonNeg"]
|
|
3861
|
+
|
|
3862
|
+
@builtins.property
|
|
3863
|
+
def out(self) -> _ods_ir.OpResult:
|
|
3864
|
+
return self.operation.results[0]
|
|
3865
|
+
|
|
3866
|
+
@_ods_cext.register_op_adaptor(UIToFPOp)
|
|
3867
|
+
class UIToFPOpAdaptor(_ods_ir.OpAdaptor):
|
|
3868
|
+
OPERATION_NAME = "arith.uitofp"
|
|
3869
|
+
|
|
3870
|
+
@builtins.property
|
|
3871
|
+
def in_(self) -> _ods_ir.Value:
|
|
3872
|
+
return self.operands[0]
|
|
3873
|
+
|
|
3874
|
+
@builtins.property
|
|
3875
|
+
def nonNeg(self) -> bool:
|
|
3876
|
+
return "nonNeg" in self.attributes
|
|
3877
|
+
|
|
3878
|
+
def uitofp(out: _ods_ir.Type, in_: _ods_ir.Value, *, non_neg: _Optional[bool] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
3879
|
+
return UIToFPOp(out=out, in_=in_, nonNeg=non_neg, loc=loc, ip=ip).result
|
|
3880
|
+
|
|
3881
|
+
@_ods_cext.register_operation(_Dialect)
|
|
3882
|
+
class XOrIOp(_ods_ir.OpView):
|
|
3883
|
+
r"""
|
|
3884
|
+
The `xori` operation takes two operands and returns one result, each of
|
|
3885
|
+
these is required to be the same type. This type may be an integer scalar
|
|
3886
|
+
type, a vector whose element type is integer, or a tensor of integers. It
|
|
3887
|
+
has no standard attributes.
|
|
3888
|
+
|
|
3889
|
+
Example:
|
|
3890
|
+
|
|
3891
|
+
```mlir
|
|
3892
|
+
// Scalar integer bitwise xor.
|
|
3893
|
+
%a = arith.xori %b, %c : i64
|
|
3894
|
+
|
|
3895
|
+
// SIMD vector element-wise bitwise integer xor.
|
|
3896
|
+
%f = arith.xori %g, %h : vector<4xi32>
|
|
3897
|
+
|
|
3898
|
+
// Tensor element-wise bitwise integer xor.
|
|
3899
|
+
%x = arith.xori %y, %z : tensor<4x?xi8>
|
|
3900
|
+
```
|
|
3901
|
+
"""
|
|
3902
|
+
|
|
3903
|
+
OPERATION_NAME = "arith.xori"
|
|
3904
|
+
|
|
3905
|
+
_ODS_REGIONS = (0, True)
|
|
3906
|
+
|
|
3907
|
+
def __init__(self, lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
3908
|
+
operands = []
|
|
3909
|
+
attributes = {}
|
|
3910
|
+
regions = None
|
|
3911
|
+
operands.append(lhs)
|
|
3912
|
+
operands.append(rhs)
|
|
3913
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
3914
|
+
if results is None: results = [operands[0].type] * 1
|
|
3915
|
+
_ods_successors = None
|
|
3916
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
3917
|
+
|
|
3918
|
+
@builtins.property
|
|
3919
|
+
def lhs(self) -> _ods_ir.Value:
|
|
3920
|
+
return self.operation.operands[0]
|
|
3921
|
+
|
|
3922
|
+
@builtins.property
|
|
3923
|
+
def rhs(self) -> _ods_ir.Value:
|
|
3924
|
+
return self.operation.operands[1]
|
|
3925
|
+
|
|
3926
|
+
@builtins.property
|
|
3927
|
+
def result(self) -> _ods_ir.OpResult:
|
|
3928
|
+
return self.operation.results[0]
|
|
3929
|
+
|
|
3930
|
+
@_ods_cext.register_op_adaptor(XOrIOp)
|
|
3931
|
+
class XOrIOpAdaptor(_ods_ir.OpAdaptor):
|
|
3932
|
+
OPERATION_NAME = "arith.xori"
|
|
3933
|
+
|
|
3934
|
+
@builtins.property
|
|
3935
|
+
def lhs(self) -> _ods_ir.Value:
|
|
3936
|
+
return self.operands[0]
|
|
3937
|
+
|
|
3938
|
+
@builtins.property
|
|
3939
|
+
def rhs(self) -> _ods_ir.Value:
|
|
3940
|
+
return self.operands[1]
|
|
3941
|
+
|
|
3942
|
+
def xori(lhs: _ods_ir.Value, rhs: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
3943
|
+
return XOrIOp(lhs=lhs, rhs=rhs, results=results, loc=loc, ip=ip).result
|
|
3944
|
+
|
|
3945
|
+
@_ods_cext.register_operation(_Dialect)
|
|
3946
|
+
class SelectOp(_ods_ir.OpView):
|
|
3947
|
+
r"""
|
|
3948
|
+
The `arith.select` operation chooses one value based on a binary condition
|
|
3949
|
+
supplied as its first operand.
|
|
3950
|
+
|
|
3951
|
+
If the value of the first operand (the condition) is `1`, then the second
|
|
3952
|
+
operand is returned, and the third operand is ignored, even if it was poison.
|
|
3953
|
+
|
|
3954
|
+
If the value of the first operand (the condition) is `0`, then the third
|
|
3955
|
+
operand is returned, and the second operand is ignored, even if it was poison.
|
|
3956
|
+
|
|
3957
|
+
If the value of the first operand (the condition) is poison, then the
|
|
3958
|
+
operation returns poison.
|
|
3959
|
+
|
|
3960
|
+
The operation applies to vectors and tensors elementwise given the _shape_
|
|
3961
|
+
of all operands is identical. The choice is made for each element
|
|
3962
|
+
individually based on the value at the same position as the element in the
|
|
3963
|
+
condition operand. If an i1 is provided as the condition, the entire vector
|
|
3964
|
+
or tensor is chosen.
|
|
3965
|
+
|
|
3966
|
+
Example:
|
|
3967
|
+
|
|
3968
|
+
```mlir
|
|
3969
|
+
// Custom form of scalar selection.
|
|
3970
|
+
%x = arith.select %cond, %true, %false : i32
|
|
3971
|
+
|
|
3972
|
+
// Generic form of the same operation.
|
|
3973
|
+
%x = "arith.select"(%cond, %true, %false) : (i1, i32, i32) -> i32
|
|
3974
|
+
|
|
3975
|
+
// Element-wise vector selection.
|
|
3976
|
+
%vx = arith.select %vcond, %vtrue, %vfalse : vector<42xi1>, vector<42xf32>
|
|
3977
|
+
|
|
3978
|
+
// Full vector selection.
|
|
3979
|
+
%vx = arith.select %cond, %vtrue, %vfalse : vector<42xf32>
|
|
3980
|
+
```
|
|
3981
|
+
"""
|
|
3982
|
+
|
|
3983
|
+
OPERATION_NAME = "arith.select"
|
|
3984
|
+
|
|
3985
|
+
_ODS_REGIONS = (0, True)
|
|
3986
|
+
|
|
3987
|
+
def __init__(self, condition: _ods_ir.Value, true_value: _ods_ir.Value, false_value: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None):
|
|
3988
|
+
operands = []
|
|
3989
|
+
attributes = {}
|
|
3990
|
+
regions = None
|
|
3991
|
+
operands.append(condition)
|
|
3992
|
+
operands.append(true_value)
|
|
3993
|
+
operands.append(false_value)
|
|
3994
|
+
_ods_context = _ods_get_default_loc_context(loc)
|
|
3995
|
+
_ods_successors = None
|
|
3996
|
+
super().__init__(self.OPERATION_NAME, self._ODS_REGIONS, self._ODS_OPERAND_SEGMENTS, self._ODS_RESULT_SEGMENTS, attributes=attributes, results=results, operands=operands, successors=_ods_successors, regions=regions, loc=loc, ip=ip)
|
|
3997
|
+
|
|
3998
|
+
@builtins.property
|
|
3999
|
+
def condition(self) -> _ods_ir.Value:
|
|
4000
|
+
return self.operation.operands[0]
|
|
4001
|
+
|
|
4002
|
+
@builtins.property
|
|
4003
|
+
def true_value(self) -> _ods_ir.Value:
|
|
4004
|
+
return self.operation.operands[1]
|
|
4005
|
+
|
|
4006
|
+
@builtins.property
|
|
4007
|
+
def false_value(self) -> _ods_ir.Value:
|
|
4008
|
+
return self.operation.operands[2]
|
|
4009
|
+
|
|
4010
|
+
@builtins.property
|
|
4011
|
+
def result(self) -> _ods_ir.OpResult:
|
|
4012
|
+
return self.operation.results[0]
|
|
4013
|
+
|
|
4014
|
+
@_ods_cext.register_op_adaptor(SelectOp)
|
|
4015
|
+
class SelectOpAdaptor(_ods_ir.OpAdaptor):
|
|
4016
|
+
OPERATION_NAME = "arith.select"
|
|
4017
|
+
|
|
4018
|
+
@builtins.property
|
|
4019
|
+
def condition(self) -> _ods_ir.Value:
|
|
4020
|
+
return self.operands[0]
|
|
4021
|
+
|
|
4022
|
+
@builtins.property
|
|
4023
|
+
def true_value(self) -> _ods_ir.Value:
|
|
4024
|
+
return self.operands[1]
|
|
4025
|
+
|
|
4026
|
+
@builtins.property
|
|
4027
|
+
def false_value(self) -> _ods_ir.Value:
|
|
4028
|
+
return self.operands[2]
|
|
4029
|
+
|
|
4030
|
+
def select(condition: _ods_ir.Value, true_value: _ods_ir.Value, false_value: _ods_ir.Value, *, results: _Optional[_Sequence[_ods_ir.Type]] = None, loc: _Optional[_ods_ir.Location] = None, ip: _Optional[_ods_ir.InsertionPoint] = None) -> _ods_ir.OpResult:
|
|
4031
|
+
return SelectOp(condition=condition, true_value=true_value, false_value=false_value, results=results, loc=loc, ip=ip).result
|