Skip to content

Instantly share code, notes, and snippets.

@stellaraccident
Created January 10, 2021 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stellaraccident/ec8a46159bd665d859eb51443aab6d10 to your computer and use it in GitHub Desktop.
Save stellaraccident/ec8a46159bd665d859eb51443aab6d10 to your computer and use it in GitHub Desktop.
MLIR Python Dialect Bindings
# Autogenerated by mlir-tblgen; don't manually edit.
import array as _ods_array
from . import _cext as _ods_cext
from . import _segmented_accessor as _ods_segmented_accessor, _equally_sized_accessor as _ods_equally_sized_accessor, _get_default_loc_context as _ods_get_default_loc_context
_ods_ir = _ods_cext.ir
@_ods_cext.register_dialect
class _Dialect(_ods_ir.Dialect):
DIALECT_NAMESPACE = "linalg"
pass
@_ods_cext.register_operation(_Dialect)
class BatchMatmulOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.batch_matmul"
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class ConvDHWOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.conv_3d"
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class ConvHWOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.conv_2d"
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class ConvNCDHWOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.conv_3d_ncdhw"
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class ConvNCHWOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.conv_2d_nchw"
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class ConvNCWOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.conv_1d_ncw"
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class ConvNDHWCOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.conv_3d_ndhwc"
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class ConvNHWCOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.conv_2d_nhwc"
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class ConvNWCOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.conv_1d_nwc"
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class ConvOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.conv"
def __init__(self, filter, input, output, strides, dilations, padding, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands.append(filter)
operands.append(input)
operands.append(output)
if strides is not None: attributes["strides"] = strides
if dilations is not None: attributes["dilations"] = dilations
if padding is not None: attributes["padding"] = padding
super().__init__(_ods_ir.Operation.create(
"linalg.conv", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def filter(self):
return self.operation.operands[0]
@property
def input(self):
return self.operation.operands[1]
@property
def output(self):
return self.operation.operands[2]
@property
def padding(self):
if "padding" not in self.operation.attributes:
return None
return _ods_ir.DenseIntElementsAttr(self.operation.attributes["padding"])
@padding.setter
def padding(self, value):
if value is not None:
self.operation.attributes["padding"] = value
elif "padding" in self.operation.attributes:
del self.operation.attributes["padding"]
@padding.deleter
def padding(self):
del self.operation.attributes["padding"]
@_ods_cext.register_operation(_Dialect)
class ConvWOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.conv_1d"
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class CopyOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.copy"
def __init__(self, input, output, inputPermutation, outputPermutation, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands.append(input)
operands.append(output)
if inputPermutation is not None: attributes["inputPermutation"] = inputPermutation
if outputPermutation is not None: attributes["outputPermutation"] = outputPermutation
super().__init__(_ods_ir.Operation.create(
"linalg.copy", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def input(self):
return self.operation.operands[0]
@property
def output(self):
return self.operation.operands[1]
@_ods_cext.register_operation(_Dialect)
class DotOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.dot"
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class FillOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.fill"
def __init__(self, output, value, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands.append(output)
operands.append(value)
super().__init__(_ods_ir.Operation.create(
"linalg.fill", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def output(self):
return self.operation.operands[0]
@property
def value(self):
return self.operation.operands[1]
@_ods_cext.register_operation(_Dialect)
class GenericOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.generic"
def __init__(self, result_tensors, inputs, outputs, indexing_maps, iterator_types, doc, library_call, sparse, loc=None, ip=None):
operands = []
results = []
attributes = {}
results += [*result_tensors]
operand_segment_sizes_ods = _ods_array.array('L')
operands += [*inputs]
operand_segment_sizes_ods.append(len(inputs))
operands += [*outputs]
operand_segment_sizes_ods.append(len(outputs))
attributes["operand_segment_sizes"] = _ods_ir.DenseElementsAttr.get(operand_segment_sizes_ods,
context=_ods_get_default_loc_context(loc))
attributes["indexing_maps"] = indexing_maps
attributes["iterator_types"] = iterator_types
if doc is not None: attributes["doc"] = doc
if library_call is not None: attributes["library_call"] = library_call
if sparse is not None: attributes["sparse"] = sparse
super().__init__(_ods_ir.Operation.create(
"linalg.generic", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def doc(self):
if "doc" not in self.operation.attributes:
return None
return _ods_ir.StringAttr(self.operation.attributes["doc"])
@doc.setter
def doc(self, value):
if value is not None:
self.operation.attributes["doc"] = value
elif "doc" in self.operation.attributes:
del self.operation.attributes["doc"]
@doc.deleter
def doc(self):
del self.operation.attributes["doc"]
@property
def library_call(self):
if "library_call" not in self.operation.attributes:
return None
return _ods_ir.StringAttr(self.operation.attributes["library_call"])
@library_call.setter
def library_call(self, value):
if value is not None:
self.operation.attributes["library_call"] = value
elif "library_call" in self.operation.attributes:
del self.operation.attributes["library_call"]
@library_call.deleter
def library_call(self):
del self.operation.attributes["library_call"]
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class IndexedGenericOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.indexed_generic"
def __init__(self, result_tensors, inputs, outputs, indexing_maps, iterator_types, doc, library_call, sparse, loc=None, ip=None):
operands = []
results = []
attributes = {}
results += [*result_tensors]
operand_segment_sizes_ods = _ods_array.array('L')
operands += [*inputs]
operand_segment_sizes_ods.append(len(inputs))
operands += [*outputs]
operand_segment_sizes_ods.append(len(outputs))
attributes["operand_segment_sizes"] = _ods_ir.DenseElementsAttr.get(operand_segment_sizes_ods,
context=_ods_get_default_loc_context(loc))
attributes["indexing_maps"] = indexing_maps
attributes["iterator_types"] = iterator_types
if doc is not None: attributes["doc"] = doc
if library_call is not None: attributes["library_call"] = library_call
if sparse is not None: attributes["sparse"] = sparse
super().__init__(_ods_ir.Operation.create(
"linalg.indexed_generic", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def doc(self):
if "doc" not in self.operation.attributes:
return None
return _ods_ir.StringAttr(self.operation.attributes["doc"])
@doc.setter
def doc(self, value):
if value is not None:
self.operation.attributes["doc"] = value
elif "doc" in self.operation.attributes:
del self.operation.attributes["doc"]
@doc.deleter
def doc(self):
del self.operation.attributes["doc"]
@property
def library_call(self):
if "library_call" not in self.operation.attributes:
return None
return _ods_ir.StringAttr(self.operation.attributes["library_call"])
@library_call.setter
def library_call(self, value):
if value is not None:
self.operation.attributes["library_call"] = value
elif "library_call" in self.operation.attributes:
del self.operation.attributes["library_call"]
@library_call.deleter
def library_call(self):
del self.operation.attributes["library_call"]
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class InitTensorOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.init_tensor"
def __init__(self, result_, sizes, static_sizes, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands += [*sizes]
attributes["static_sizes"] = static_sizes
super().__init__(_ods_ir.Operation.create(
"linalg.init_tensor", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def sizes(self):
_ods_variadic_group_length = len(self.operation.operands) - 1 + 1
return self.operation.operands[0:0 + _ods_variadic_group_length]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class RangeOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.range"
def __init__(self, _gen_res_0, min, max, step, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(min)
operands.append(max)
operands.append(step)
super().__init__(_ods_ir.Operation.create(
"linalg.range", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def min(self):
return self.operation.operands[0]
@property
def max(self):
return self.operation.operands[1]
@property
def step(self):
return self.operation.operands[2]
@_ods_cext.register_operation(_Dialect)
class ReshapeOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.reshape"
def __init__(self, result_, src, reassociation, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(src)
attributes["reassociation"] = reassociation
super().__init__(_ods_ir.Operation.create(
"linalg.reshape", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def src(self):
return self.operation.operands[0]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class SliceOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.slice"
def __init__(self, _gen_res_0, view, indexings, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(view)
operands += [*indexings]
super().__init__(_ods_ir.Operation.create(
"linalg.slice", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def view(self):
return self.operation.operands[0]
@property
def indexings(self):
_ods_variadic_group_length = len(self.operation.operands) - 2 + 1
return self.operation.operands[1:1 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class TensorReshapeOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.tensor_reshape"
def __init__(self, result_, src, reassociation, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(src)
attributes["reassociation"] = reassociation
super().__init__(_ods_ir.Operation.create(
"linalg.tensor_reshape", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def src(self):
return self.operation.operands[0]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class YieldOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.yield"
def __init__(self, values, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands += [*values]
super().__init__(_ods_ir.Operation.create(
"linalg.yield", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def values(self):
_ods_variadic_group_length = len(self.operation.operands) - 1 + 1
return self.operation.operands[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class MatmulOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.matmul"
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class MatvecOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.matvec"
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class PoolingMaxOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.pooling_max"
def __init__(self, input, windowDims, output, strides, dilations, padding, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands.append(input)
operands.append(windowDims)
operands.append(output)
if strides is not None: attributes["strides"] = strides
if dilations is not None: attributes["dilations"] = dilations
if padding is not None: attributes["padding"] = padding
super().__init__(_ods_ir.Operation.create(
"linalg.pooling_max", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def input(self):
return self.operation.operands[0]
@property
def windowDims(self):
return self.operation.operands[1]
@property
def output(self):
return self.operation.operands[2]
@property
def padding(self):
if "padding" not in self.operation.attributes:
return None
return _ods_ir.DenseIntElementsAttr(self.operation.attributes["padding"])
@padding.setter
def padding(self, value):
if value is not None:
self.operation.attributes["padding"] = value
elif "padding" in self.operation.attributes:
del self.operation.attributes["padding"]
@padding.deleter
def padding(self):
del self.operation.attributes["padding"]
@_ods_cext.register_operation(_Dialect)
class PoolingMinOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.pooling_min"
def __init__(self, input, windowDims, output, strides, dilations, padding, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands.append(input)
operands.append(windowDims)
operands.append(output)
if strides is not None: attributes["strides"] = strides
if dilations is not None: attributes["dilations"] = dilations
if padding is not None: attributes["padding"] = padding
super().__init__(_ods_ir.Operation.create(
"linalg.pooling_min", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def input(self):
return self.operation.operands[0]
@property
def windowDims(self):
return self.operation.operands[1]
@property
def output(self):
return self.operation.operands[2]
@property
def padding(self):
if "padding" not in self.operation.attributes:
return None
return _ods_ir.DenseIntElementsAttr(self.operation.attributes["padding"])
@padding.setter
def padding(self, value):
if value is not None:
self.operation.attributes["padding"] = value
elif "padding" in self.operation.attributes:
del self.operation.attributes["padding"]
@padding.deleter
def padding(self):
del self.operation.attributes["padding"]
@_ods_cext.register_operation(_Dialect)
class PoolingSumOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.pooling_sum"
def __init__(self, input, windowDims, output, strides, dilations, padding, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands.append(input)
operands.append(windowDims)
operands.append(output)
if strides is not None: attributes["strides"] = strides
if dilations is not None: attributes["dilations"] = dilations
if padding is not None: attributes["padding"] = padding
super().__init__(_ods_ir.Operation.create(
"linalg.pooling_sum", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def input(self):
return self.operation.operands[0]
@property
def windowDims(self):
return self.operation.operands[1]
@property
def output(self):
return self.operation.operands[2]
@property
def padding(self):
if "padding" not in self.operation.attributes:
return None
return _ods_ir.DenseIntElementsAttr(self.operation.attributes["padding"])
@padding.setter
def padding(self, value):
if value is not None:
self.operation.attributes["padding"] = value
elif "padding" in self.operation.attributes:
del self.operation.attributes["padding"]
@padding.deleter
def padding(self):
del self.operation.attributes["padding"]
@_ods_cext.register_operation(_Dialect)
class VecmatOp(_ods_ir.OpView):
OPERATION_NAME = "linalg.vecmat"
@property
def inputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def outputs(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def result_tensors(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
# Autogenerated by mlir-tblgen; don't manually edit.
import array as _ods_array
from . import _cext as _ods_cext
from . import _segmented_accessor as _ods_segmented_accessor, _equally_sized_accessor as _ods_equally_sized_accessor, _get_default_loc_context as _ods_get_default_loc_context
_ods_ir = _ods_cext.ir
@_ods_cext.register_dialect
class _Dialect(_ods_ir.Dialect):
DIALECT_NAMESPACE = "shape"
pass
@_ods_cext.register_operation(_Dialect)
class ShapeFunctionLibraryTerminatorOp(_ods_ir.OpView):
OPERATION_NAME = "shape.fn_lib_terminator"
def __init__(self, loc=None, ip=None):
operands = []
results = []
attributes = {}
super().__init__(_ods_ir.Operation.create(
"shape.fn_lib_terminator", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@_ods_cext.register_operation(_Dialect)
class AddOp(_ods_ir.OpView):
OPERATION_NAME = "shape.add"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"shape.add", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class AnyOp(_ods_ir.OpView):
OPERATION_NAME = "shape.any"
def __init__(self, result_, inputs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands += [*inputs]
super().__init__(_ods_ir.Operation.create(
"shape.any", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def inputs(self):
_ods_variadic_group_length = len(self.operation.operands) - 1 + 1
return self.operation.operands[0:0 + _ods_variadic_group_length]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class AssumingAllOp(_ods_ir.OpView):
OPERATION_NAME = "shape.assuming_all"
def __init__(self, result_, inputs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands += [*inputs]
super().__init__(_ods_ir.Operation.create(
"shape.assuming_all", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def inputs(self):
_ods_variadic_group_length = len(self.operation.operands) - 1 + 1
return self.operation.operands[0:0 + _ods_variadic_group_length]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class AssumingOp(_ods_ir.OpView):
OPERATION_NAME = "shape.assuming"
def __init__(self, results_, witness, loc=None, ip=None):
operands = []
results = []
attributes = {}
results += [*results_]
operands.append(witness)
super().__init__(_ods_ir.Operation.create(
"shape.assuming", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def witness(self):
return self.operation.operands[0]
@property
def results_(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class AssumingYieldOp(_ods_ir.OpView):
OPERATION_NAME = "shape.assuming_yield"
def __init__(self, operands_, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands += [*operands_]
super().__init__(_ods_ir.Operation.create(
"shape.assuming_yield", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operands_(self):
_ods_variadic_group_length = len(self.operation.operands) - 1 + 1
return self.operation.operands[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class BroadcastOp(_ods_ir.OpView):
OPERATION_NAME = "shape.broadcast"
def __init__(self, result_, lhs, rhs, error, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
if error is not None: attributes["error"] = error
super().__init__(_ods_ir.Operation.create(
"shape.broadcast", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def error(self):
if "error" not in self.operation.attributes:
return None
return _ods_ir.StringAttr(self.operation.attributes["error"])
@error.setter
def error(self, value):
if value is not None:
self.operation.attributes["error"] = value
elif "error" in self.operation.attributes:
del self.operation.attributes["error"]
@error.deleter
def error(self):
del self.operation.attributes["error"]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class ConcatOp(_ods_ir.OpView):
OPERATION_NAME = "shape.concat"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"shape.concat", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class ConstShapeOp(_ods_ir.OpView):
OPERATION_NAME = "shape.const_shape"
def __init__(self, result_, shape, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
attributes["shape"] = shape
super().__init__(_ods_ir.Operation.create(
"shape.const_shape", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def shape(self):
return _ods_ir.DenseIntElementsAttr(self.operation.attributes["shape"])
@shape.setter
def shape(self, value):
if value is None:
raise ValueError("'None' not allowed as value for mandatory attributes")
self.operation.attributes["shape"] = value
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class ConstSizeOp(_ods_ir.OpView):
OPERATION_NAME = "shape.const_size"
def __init__(self, result_, value, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
attributes["value"] = value
super().__init__(_ods_ir.Operation.create(
"shape.const_size", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def value(self):
return _ods_ir.IntegerAttr(self.operation.attributes["value"])
@value.setter
def value(self, value):
if value is None:
raise ValueError("'None' not allowed as value for mandatory attributes")
self.operation.attributes["value"] = value
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class ConstWitnessOp(_ods_ir.OpView):
OPERATION_NAME = "shape.const_witness"
def __init__(self, result_, passing, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
attributes["passing"] = passing
super().__init__(_ods_ir.Operation.create(
"shape.const_witness", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def passing(self):
return _ods_ir.BoolAttr(self.operation.attributes["passing"])
@passing.setter
def passing(self, value):
if value is None:
raise ValueError("'None' not allowed as value for mandatory attributes")
self.operation.attributes["passing"] = value
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class CstrBroadcastableOp(_ods_ir.OpView):
OPERATION_NAME = "shape.cstr_broadcastable"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"shape.cstr_broadcastable", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class CstrEqOp(_ods_ir.OpView):
OPERATION_NAME = "shape.cstr_eq"
def __init__(self, result_, inputs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands += [*inputs]
super().__init__(_ods_ir.Operation.create(
"shape.cstr_eq", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def inputs(self):
_ods_variadic_group_length = len(self.operation.operands) - 1 + 1
return self.operation.operands[0:0 + _ods_variadic_group_length]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class CstrRequireOp(_ods_ir.OpView):
OPERATION_NAME = "shape.cstr_require"
def __init__(self, result_, pred, msg, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(pred)
attributes["msg"] = msg
super().__init__(_ods_ir.Operation.create(
"shape.cstr_require", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def pred(self):
return self.operation.operands[0]
@property
def msg(self):
return _ods_ir.StringAttr(self.operation.attributes["msg"])
@msg.setter
def msg(self, value):
if value is None:
raise ValueError("'None' not allowed as value for mandatory attributes")
self.operation.attributes["msg"] = value
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class DebugPrintOp(_ods_ir.OpView):
OPERATION_NAME = "shape.debug_print"
def __init__(self, output, input, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(output)
operands.append(input)
super().__init__(_ods_ir.Operation.create(
"shape.debug_print", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def input(self):
return self.operation.operands[0]
@property
def output(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class FromExtentTensorOp(_ods_ir.OpView):
OPERATION_NAME = "shape.from_extent_tensor"
def __init__(self, result_, input, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(input)
super().__init__(_ods_ir.Operation.create(
"shape.from_extent_tensor", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def input(self):
return self.operation.operands[0]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class FromExtentsOp(_ods_ir.OpView):
OPERATION_NAME = "shape.from_extents"
def __init__(self, shape, extents, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(shape)
operands += [*extents]
super().__init__(_ods_ir.Operation.create(
"shape.from_extents", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def extents(self):
_ods_variadic_group_length = len(self.operation.operands) - 1 + 1
return self.operation.operands[0:0 + _ods_variadic_group_length]
@property
def shape(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class FunctionLibraryOp(_ods_ir.OpView):
OPERATION_NAME = "shape.function_library"
@_ods_cext.register_operation(_Dialect)
class GetExtentOp(_ods_ir.OpView):
OPERATION_NAME = "shape.get_extent"
def __init__(self, extent, shape, dim, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(extent)
operands.append(shape)
operands.append(dim)
super().__init__(_ods_ir.Operation.create(
"shape.get_extent", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def shape(self):
return self.operation.operands[0]
@property
def dim(self):
return self.operation.operands[1]
@property
def extent(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class IndexToSizeOp(_ods_ir.OpView):
OPERATION_NAME = "shape.index_to_size"
def __init__(self, result_, arg, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(arg)
super().__init__(_ods_ir.Operation.create(
"shape.index_to_size", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def arg(self):
return self.operation.operands[0]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class IsBroadcastableOp(_ods_ir.OpView):
OPERATION_NAME = "shape.is_broadcastable"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"shape.is_broadcastable", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class JoinOp(_ods_ir.OpView):
OPERATION_NAME = "shape.join"
def __init__(self, result_, arg0, arg1, error, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(arg0)
operands.append(arg1)
if error is not None: attributes["error"] = error
super().__init__(_ods_ir.Operation.create(
"shape.join", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def arg0(self):
return self.operation.operands[0]
@property
def arg1(self):
return self.operation.operands[1]
@property
def error(self):
if "error" not in self.operation.attributes:
return None
return _ods_ir.StringAttr(self.operation.attributes["error"])
@error.setter
def error(self, value):
if value is not None:
self.operation.attributes["error"] = value
elif "error" in self.operation.attributes:
del self.operation.attributes["error"]
@error.deleter
def error(self):
del self.operation.attributes["error"]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class MulOp(_ods_ir.OpView):
OPERATION_NAME = "shape.mul"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"shape.mul", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class NumElementsOp(_ods_ir.OpView):
OPERATION_NAME = "shape.num_elements"
def __init__(self, result_, shape, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(shape)
super().__init__(_ods_ir.Operation.create(
"shape.num_elements", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def shape(self):
return self.operation.operands[0]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class RankOp(_ods_ir.OpView):
OPERATION_NAME = "shape.rank"
def __init__(self, rank, shape, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(rank)
operands.append(shape)
super().__init__(_ods_ir.Operation.create(
"shape.rank", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def shape(self):
return self.operation.operands[0]
@property
def rank(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class ReduceOp(_ods_ir.OpView):
OPERATION_NAME = "shape.reduce"
def __init__(self, result_, shape, initVals, loc=None, ip=None):
operands = []
results = []
attributes = {}
results += [*result_]
operands.append(shape)
operands += [*initVals]
super().__init__(_ods_ir.Operation.create(
"shape.reduce", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def shape(self):
return self.operation.operands[0]
@property
def initVals(self):
_ods_variadic_group_length = len(self.operation.operands) - 2 + 1
return self.operation.operands[1:1 + _ods_variadic_group_length]
@property
def result_(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class ShapeEqOp(_ods_ir.OpView):
OPERATION_NAME = "shape.shape_eq"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"shape.shape_eq", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class ShapeOfOp(_ods_ir.OpView):
OPERATION_NAME = "shape.shape_of"
def __init__(self, result_, arg, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(arg)
super().__init__(_ods_ir.Operation.create(
"shape.shape_of", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def arg(self):
return self.operation.operands[0]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class SizeToIndexOp(_ods_ir.OpView):
OPERATION_NAME = "shape.size_to_index"
def __init__(self, result_, arg, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(arg)
super().__init__(_ods_ir.Operation.create(
"shape.size_to_index", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def arg(self):
return self.operation.operands[0]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class SplitAtOp(_ods_ir.OpView):
OPERATION_NAME = "shape.split_at"
def __init__(self, head, tail, operand, index, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(head)
results.append(tail)
operands.append(operand)
operands.append(index)
super().__init__(_ods_ir.Operation.create(
"shape.split_at", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@property
def index(self):
return self.operation.operands[1]
@property
def head(self):
return self.operation.results[0]
@property
def tail(self):
return self.operation.results[1]
@_ods_cext.register_operation(_Dialect)
class ToExtentTensorOp(_ods_ir.OpView):
OPERATION_NAME = "shape.to_extent_tensor"
def __init__(self, result_, input, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(input)
super().__init__(_ods_ir.Operation.create(
"shape.to_extent_tensor", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def input(self):
return self.operation.operands[0]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class WithOp(_ods_ir.OpView):
OPERATION_NAME = "shape.with_shape"
def __init__(self, result_, operand, shape, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(operand)
operands.append(shape)
super().__init__(_ods_ir.Operation.create(
"shape.with_shape", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@property
def shape(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class YieldOp(_ods_ir.OpView):
OPERATION_NAME = "shape.yield"
def __init__(self, operands_, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands += [*operands_]
super().__init__(_ods_ir.Operation.create(
"shape.yield", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operands_(self):
_ods_variadic_group_length = len(self.operation.operands) - 1 + 1
return self.operation.operands[0:0 + _ods_variadic_group_length]
# Autogenerated by mlir-tblgen; don't manually edit.
import array as _ods_array
from . import _cext as _ods_cext
from . import _segmented_accessor as _ods_segmented_accessor, _equally_sized_accessor as _ods_equally_sized_accessor, _get_default_loc_context as _ods_get_default_loc_context
_ods_ir = _ods_cext.ir
@_ods_cext.register_dialect
class _Dialect(_ods_ir.Dialect):
DIALECT_NAMESPACE = "std"
pass
@_ods_cext.register_operation(_Dialect)
class AbsFOp(_ods_ir.OpView):
OPERATION_NAME = "std.absf"
def __init__(self, _gen_res_0, operand, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(operand)
super().__init__(_ods_ir.Operation.create(
"std.absf", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class AddCFOp(_ods_ir.OpView):
OPERATION_NAME = "std.addcf"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.addcf", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class AddFOp(_ods_ir.OpView):
OPERATION_NAME = "std.addf"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.addf", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class AddIOp(_ods_ir.OpView):
OPERATION_NAME = "std.addi"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.addi", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class AllocOp(_ods_ir.OpView):
OPERATION_NAME = "std.alloc"
def __init__(self, memref, dynamicSizes, symbolOperands, alignment, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(memref)
operand_segment_sizes_ods = _ods_array.array('L')
operands += [*dynamicSizes]
operand_segment_sizes_ods.append(len(dynamicSizes))
operands += [*symbolOperands]
operand_segment_sizes_ods.append(len(symbolOperands))
attributes["operand_segment_sizes"] = _ods_ir.DenseElementsAttr.get(operand_segment_sizes_ods,
context=_ods_get_default_loc_context(loc))
if alignment is not None: attributes["alignment"] = alignment
super().__init__(_ods_ir.Operation.create(
"std.alloc", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def dynamicSizes(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def symbolOperands(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def alignment(self):
if "alignment" not in self.operation.attributes:
return None
return _ods_ir.IntegerAttr(self.operation.attributes["alignment"])
@alignment.setter
def alignment(self, value):
if value is not None:
self.operation.attributes["alignment"] = value
elif "alignment" in self.operation.attributes:
del self.operation.attributes["alignment"]
@alignment.deleter
def alignment(self):
del self.operation.attributes["alignment"]
@property
def memref(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class AllocaOp(_ods_ir.OpView):
OPERATION_NAME = "std.alloca"
def __init__(self, memref, dynamicSizes, symbolOperands, alignment, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(memref)
operand_segment_sizes_ods = _ods_array.array('L')
operands += [*dynamicSizes]
operand_segment_sizes_ods.append(len(dynamicSizes))
operands += [*symbolOperands]
operand_segment_sizes_ods.append(len(symbolOperands))
attributes["operand_segment_sizes"] = _ods_ir.DenseElementsAttr.get(operand_segment_sizes_ods,
context=_ods_get_default_loc_context(loc))
if alignment is not None: attributes["alignment"] = alignment
super().__init__(_ods_ir.Operation.create(
"std.alloca", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def dynamicSizes(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range
@property
def symbolOperands(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def alignment(self):
if "alignment" not in self.operation.attributes:
return None
return _ods_ir.IntegerAttr(self.operation.attributes["alignment"])
@alignment.setter
def alignment(self, value):
if value is not None:
self.operation.attributes["alignment"] = value
elif "alignment" in self.operation.attributes:
del self.operation.attributes["alignment"]
@alignment.deleter
def alignment(self):
del self.operation.attributes["alignment"]
@property
def memref(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class AndOp(_ods_ir.OpView):
OPERATION_NAME = "std.and"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.and", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class AssertOp(_ods_ir.OpView):
OPERATION_NAME = "std.assert"
def __init__(self, arg, msg, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands.append(arg)
attributes["msg"] = msg
super().__init__(_ods_ir.Operation.create(
"std.assert", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def arg(self):
return self.operation.operands[0]
@property
def msg(self):
return _ods_ir.StringAttr(self.operation.attributes["msg"])
@msg.setter
def msg(self, value):
if value is None:
raise ValueError("'None' not allowed as value for mandatory attributes")
self.operation.attributes["msg"] = value
@_ods_cext.register_operation(_Dialect)
class AssumeAlignmentOp(_ods_ir.OpView):
OPERATION_NAME = "std.assume_alignment"
def __init__(self, memref, alignment, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands.append(memref)
attributes["alignment"] = alignment
super().__init__(_ods_ir.Operation.create(
"std.assume_alignment", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def memref(self):
return self.operation.operands[0]
@property
def alignment(self):
return _ods_ir.IntegerAttr(self.operation.attributes["alignment"])
@alignment.setter
def alignment(self, value):
if value is None:
raise ValueError("'None' not allowed as value for mandatory attributes")
self.operation.attributes["alignment"] = value
@_ods_cext.register_operation(_Dialect)
class Atan2Op(_ods_ir.OpView):
OPERATION_NAME = "std.atan2"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.atan2", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class AtanOp(_ods_ir.OpView):
OPERATION_NAME = "std.atan"
def __init__(self, _gen_res_0, operand, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(operand)
super().__init__(_ods_ir.Operation.create(
"std.atan", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class AtomicRMWOp(_ods_ir.OpView):
OPERATION_NAME = "std.atomic_rmw"
def __init__(self, result_, kind, value, memref, indices, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(value)
operands.append(memref)
operands += [*indices]
attributes["kind"] = kind
super().__init__(_ods_ir.Operation.create(
"std.atomic_rmw", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def value(self):
return self.operation.operands[0]
@property
def memref(self):
return self.operation.operands[1]
@property
def indices(self):
_ods_variadic_group_length = len(self.operation.operands) - 3 + 1
return self.operation.operands[2:2 + _ods_variadic_group_length]
@property
def kind(self):
return _ods_ir.IntegerAttr(self.operation.attributes["kind"])
@kind.setter
def kind(self, value):
if value is None:
raise ValueError("'None' not allowed as value for mandatory attributes")
self.operation.attributes["kind"] = value
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class AtomicYieldOp(_ods_ir.OpView):
OPERATION_NAME = "std.atomic_yield"
def __init__(self, result_, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands.append(result_)
super().__init__(_ods_ir.Operation.create(
"std.atomic_yield", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def result_(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class BranchOp(_ods_ir.OpView):
OPERATION_NAME = "std.br"
def __init__(self, destOperands, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands += [*destOperands]
super().__init__(_ods_ir.Operation.create(
"std.br", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def destOperands(self):
_ods_variadic_group_length = len(self.operation.operands) - 1 + 1
return self.operation.operands[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class CallIndirectOp(_ods_ir.OpView):
OPERATION_NAME = "std.call_indirect"
def __init__(self, results_, callee, operands_, loc=None, ip=None):
operands = []
results = []
attributes = {}
results += [*results_]
operands.append(callee)
operands += [*operands_]
super().__init__(_ods_ir.Operation.create(
"std.call_indirect", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def callee(self):
return self.operation.operands[0]
@property
def operands_(self):
_ods_variadic_group_length = len(self.operation.operands) - 2 + 1
return self.operation.operands[1:1 + _ods_variadic_group_length]
@property
def results_(self):
_ods_variadic_group_length = len(self.operation.results) - 1 + 1
return self.operation.results[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class CallOp(_ods_ir.OpView):
OPERATION_NAME = "std.call"
def __init__(self, _gen_res_0, callee, operands_, loc=None, ip=None):
operands = []
results = []
attributes = {}
results += [*_gen_res_0]
operands += [*operands_]
attributes["callee"] = callee
super().__init__(_ods_ir.Operation.create(
"std.call", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operands_(self):
_ods_variadic_group_length = len(self.operation.operands) - 1 + 1
return self.operation.operands[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class CeilFOp(_ods_ir.OpView):
OPERATION_NAME = "std.ceilf"
def __init__(self, _gen_res_0, operand, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(operand)
super().__init__(_ods_ir.Operation.create(
"std.ceilf", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class CmpFOp(_ods_ir.OpView):
OPERATION_NAME = "std.cmpf"
def __init__(self, result_, predicate, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
attributes["predicate"] = predicate
super().__init__(_ods_ir.Operation.create(
"std.cmpf", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def predicate(self):
return _ods_ir.IntegerAttr(self.operation.attributes["predicate"])
@predicate.setter
def predicate(self, value):
if value is None:
raise ValueError("'None' not allowed as value for mandatory attributes")
self.operation.attributes["predicate"] = value
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class CmpIOp(_ods_ir.OpView):
OPERATION_NAME = "std.cmpi"
def __init__(self, result_, predicate, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
attributes["predicate"] = predicate
super().__init__(_ods_ir.Operation.create(
"std.cmpi", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def predicate(self):
return _ods_ir.IntegerAttr(self.operation.attributes["predicate"])
@predicate.setter
def predicate(self, value):
if value is None:
raise ValueError("'None' not allowed as value for mandatory attributes")
self.operation.attributes["predicate"] = value
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class CondBranchOp(_ods_ir.OpView):
OPERATION_NAME = "std.cond_br"
def __init__(self, condition, trueDestOperands, falseDestOperands, loc=None, ip=None):
operands = []
results = []
attributes = {}
operand_segment_sizes_ods = _ods_array.array('L')
operands.append(condition)
operand_segment_sizes_ods.append(1) # condition
operands += [*trueDestOperands]
operand_segment_sizes_ods.append(len(trueDestOperands))
operands += [*falseDestOperands]
operand_segment_sizes_ods.append(len(falseDestOperands))
attributes["operand_segment_sizes"] = _ods_ir.DenseElementsAttr.get(operand_segment_sizes_ods,
context=_ods_get_default_loc_context(loc))
super().__init__(_ods_ir.Operation.create(
"std.cond_br", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def condition(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range[0]
@property
def trueDestOperands(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def falseDestOperands(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 2)
return operand_range
@_ods_cext.register_operation(_Dialect)
class ConstantOp(_ods_ir.OpView):
OPERATION_NAME = "std.constant"
def __init__(self, _gen_res_0, value, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
attributes["value"] = value
super().__init__(_ods_ir.Operation.create(
"std.constant", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def value(self):
return _ods_ir.Attribute(self.operation.attributes["value"])
@value.setter
def value(self, value):
if value is None:
raise ValueError("'None' not allowed as value for mandatory attributes")
self.operation.attributes["value"] = value
@_ods_cext.register_operation(_Dialect)
class CopySignOp(_ods_ir.OpView):
OPERATION_NAME = "std.copysign"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.copysign", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class CosOp(_ods_ir.OpView):
OPERATION_NAME = "std.cos"
def __init__(self, _gen_res_0, operand, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(operand)
super().__init__(_ods_ir.Operation.create(
"std.cos", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class CreateComplexOp(_ods_ir.OpView):
OPERATION_NAME = "std.create_complex"
def __init__(self, complex, real, imaginary, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(complex)
operands.append(real)
operands.append(imaginary)
super().__init__(_ods_ir.Operation.create(
"std.create_complex", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def real(self):
return self.operation.operands[0]
@property
def imaginary(self):
return self.operation.operands[1]
@property
def complex(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class DeallocOp(_ods_ir.OpView):
OPERATION_NAME = "std.dealloc"
def __init__(self, memref, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands.append(memref)
super().__init__(_ods_ir.Operation.create(
"std.dealloc", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def memref(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class DimOp(_ods_ir.OpView):
OPERATION_NAME = "std.dim"
def __init__(self, result_, memrefOrTensor, index, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(memrefOrTensor)
operands.append(index)
super().__init__(_ods_ir.Operation.create(
"std.dim", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def memrefOrTensor(self):
return self.operation.operands[0]
@property
def index(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class DivFOp(_ods_ir.OpView):
OPERATION_NAME = "std.divf"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.divf", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class DynamicTensorFromElementsOp(_ods_ir.OpView):
OPERATION_NAME = "std.dynamic_tensor_from_elements"
def __init__(self, result_, dynamicExtents, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands += [*dynamicExtents]
super().__init__(_ods_ir.Operation.create(
"std.dynamic_tensor_from_elements", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def dynamicExtents(self):
_ods_variadic_group_length = len(self.operation.operands) - 1 + 1
return self.operation.operands[0:0 + _ods_variadic_group_length]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class Exp2Op(_ods_ir.OpView):
OPERATION_NAME = "std.exp2"
def __init__(self, _gen_res_0, operand, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(operand)
super().__init__(_ods_ir.Operation.create(
"std.exp2", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class ExpOp(_ods_ir.OpView):
OPERATION_NAME = "std.exp"
def __init__(self, _gen_res_0, operand, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(operand)
super().__init__(_ods_ir.Operation.create(
"std.exp", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class FPExtOp(_ods_ir.OpView):
OPERATION_NAME = "std.fpext"
def __init__(self, _gen_res_0, in_, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(in_)
super().__init__(_ods_ir.Operation.create(
"std.fpext", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def in_(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class FPToSIOp(_ods_ir.OpView):
OPERATION_NAME = "std.fptosi"
def __init__(self, _gen_res_0, in_, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(in_)
super().__init__(_ods_ir.Operation.create(
"std.fptosi", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def in_(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class FPToUIOp(_ods_ir.OpView):
OPERATION_NAME = "std.fptoui"
def __init__(self, _gen_res_0, in_, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(in_)
super().__init__(_ods_ir.Operation.create(
"std.fptoui", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def in_(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class FPTruncOp(_ods_ir.OpView):
OPERATION_NAME = "std.fptrunc"
def __init__(self, _gen_res_0, in_, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(in_)
super().__init__(_ods_ir.Operation.create(
"std.fptrunc", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def in_(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class FloorFOp(_ods_ir.OpView):
OPERATION_NAME = "std.floorf"
def __init__(self, _gen_res_0, operand, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(operand)
super().__init__(_ods_ir.Operation.create(
"std.floorf", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class GenericAtomicRMWOp(_ods_ir.OpView):
OPERATION_NAME = "std.generic_atomic_rmw"
@property
def memref(self):
return self.operation.operands[0]
@property
def indices(self):
_ods_variadic_group_length = len(self.operation.operands) - 2 + 1
return self.operation.operands[1:1 + _ods_variadic_group_length]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class GetGlobalMemrefOp(_ods_ir.OpView):
OPERATION_NAME = "std.get_global_memref"
def __init__(self, result_, name, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
attributes["name"] = name
super().__init__(_ods_ir.Operation.create(
"std.get_global_memref", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class GlobalMemrefOp(_ods_ir.OpView):
OPERATION_NAME = "std.global_memref"
def __init__(self, sym_name, sym_visibility, type, initial_value, constant, loc=None, ip=None):
operands = []
results = []
attributes = {}
attributes["sym_name"] = sym_name
if sym_visibility is not None: attributes["sym_visibility"] = sym_visibility
attributes["type"] = type
if initial_value is not None: attributes["initial_value"] = initial_value
if bool(constant): attributes["constant"] = _ods_ir.UnitAttr.get(
_ods_get_default_loc_context(loc))
super().__init__(_ods_ir.Operation.create(
"std.global_memref", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def sym_name(self):
return _ods_ir.StringAttr(self.operation.attributes["sym_name"])
@sym_name.setter
def sym_name(self, value):
if value is None:
raise ValueError("'None' not allowed as value for mandatory attributes")
self.operation.attributes["sym_name"] = value
@property
def sym_visibility(self):
if "sym_visibility" not in self.operation.attributes:
return None
return _ods_ir.StringAttr(self.operation.attributes["sym_visibility"])
@sym_visibility.setter
def sym_visibility(self, value):
if value is not None:
self.operation.attributes["sym_visibility"] = value
elif "sym_visibility" in self.operation.attributes:
del self.operation.attributes["sym_visibility"]
@sym_visibility.deleter
def sym_visibility(self):
del self.operation.attributes["sym_visibility"]
@property
def initial_value(self):
if "initial_value" not in self.operation.attributes:
return None
return _ods_ir.Attribute(self.operation.attributes["initial_value"])
@initial_value.setter
def initial_value(self, value):
if value is not None:
self.operation.attributes["initial_value"] = value
elif "initial_value" in self.operation.attributes:
del self.operation.attributes["initial_value"]
@initial_value.deleter
def initial_value(self):
del self.operation.attributes["initial_value"]
@property
def constant(self):
return "constant" in self.operation.attributes
@constant.setter
def constant(self, value):
if bool(value):
self.operation.attributes["constant"] = _ods_ir.UnitAttr.get()
elif "constant" in self.operation.attributes:
del self.operation.attributes["constant"]
@constant.deleter
def constant(self):
del self.operation.attributes["constant"]
@_ods_cext.register_operation(_Dialect)
class ImOp(_ods_ir.OpView):
OPERATION_NAME = "std.im"
def __init__(self, imaginary, complex, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(imaginary)
operands.append(complex)
super().__init__(_ods_ir.Operation.create(
"std.im", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def complex(self):
return self.operation.operands[0]
@property
def imaginary(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class IndexCastOp(_ods_ir.OpView):
OPERATION_NAME = "std.index_cast"
def __init__(self, _gen_res_0, in_, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(in_)
super().__init__(_ods_ir.Operation.create(
"std.index_cast", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def in_(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class LoadOp(_ods_ir.OpView):
OPERATION_NAME = "std.load"
def __init__(self, result_, memref, indices, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(memref)
operands += [*indices]
super().__init__(_ods_ir.Operation.create(
"std.load", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def memref(self):
return self.operation.operands[0]
@property
def indices(self):
_ods_variadic_group_length = len(self.operation.operands) - 2 + 1
return self.operation.operands[1:1 + _ods_variadic_group_length]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class Log10Op(_ods_ir.OpView):
OPERATION_NAME = "std.log10"
def __init__(self, _gen_res_0, operand, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(operand)
super().__init__(_ods_ir.Operation.create(
"std.log10", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class Log2Op(_ods_ir.OpView):
OPERATION_NAME = "std.log2"
def __init__(self, _gen_res_0, operand, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(operand)
super().__init__(_ods_ir.Operation.create(
"std.log2", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class LogOp(_ods_ir.OpView):
OPERATION_NAME = "std.log"
def __init__(self, _gen_res_0, operand, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(operand)
super().__init__(_ods_ir.Operation.create(
"std.log", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class MemRefCastOp(_ods_ir.OpView):
OPERATION_NAME = "std.memref_cast"
def __init__(self, _gen_res_0, source, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(source)
super().__init__(_ods_ir.Operation.create(
"std.memref_cast", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def source(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class MemRefReinterpretCastOp(_ods_ir.OpView):
OPERATION_NAME = "std.memref_reinterpret_cast"
def __init__(self, result_, source, offsets, sizes, strides, static_offsets, static_sizes, static_strides, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operand_segment_sizes_ods = _ods_array.array('L')
operands.append(source)
operand_segment_sizes_ods.append(1) # source
operands += [*offsets]
operand_segment_sizes_ods.append(len(offsets))
operands += [*sizes]
operand_segment_sizes_ods.append(len(sizes))
operands += [*strides]
operand_segment_sizes_ods.append(len(strides))
attributes["operand_segment_sizes"] = _ods_ir.DenseElementsAttr.get(operand_segment_sizes_ods,
context=_ods_get_default_loc_context(loc))
attributes["static_offsets"] = static_offsets
attributes["static_sizes"] = static_sizes
attributes["static_strides"] = static_strides
super().__init__(_ods_ir.Operation.create(
"std.memref_reinterpret_cast", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def source(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range[0]
@property
def offsets(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def sizes(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 2)
return operand_range
@property
def strides(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 3)
return operand_range
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class MemRefReshapeOp(_ods_ir.OpView):
OPERATION_NAME = "std.memref_reshape"
def __init__(self, result_, source, shape, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(source)
operands.append(shape)
super().__init__(_ods_ir.Operation.create(
"std.memref_reshape", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def source(self):
return self.operation.operands[0]
@property
def shape(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class MulFOp(_ods_ir.OpView):
OPERATION_NAME = "std.mulf"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.mulf", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class MulIOp(_ods_ir.OpView):
OPERATION_NAME = "std.muli"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.muli", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class NegFOp(_ods_ir.OpView):
OPERATION_NAME = "std.negf"
def __init__(self, _gen_res_0, operand, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(operand)
super().__init__(_ods_ir.Operation.create(
"std.negf", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class OrOp(_ods_ir.OpView):
OPERATION_NAME = "std.or"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.or", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class PowFOp(_ods_ir.OpView):
OPERATION_NAME = "std.powf"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.powf", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class PrefetchOp(_ods_ir.OpView):
OPERATION_NAME = "std.prefetch"
def __init__(self, memref, indices, isWrite, localityHint, isDataCache, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands.append(memref)
operands += [*indices]
attributes["isWrite"] = isWrite
attributes["localityHint"] = localityHint
attributes["isDataCache"] = isDataCache
super().__init__(_ods_ir.Operation.create(
"std.prefetch", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def memref(self):
return self.operation.operands[0]
@property
def indices(self):
_ods_variadic_group_length = len(self.operation.operands) - 2 + 1
return self.operation.operands[1:1 + _ods_variadic_group_length]
@property
def isWrite(self):
return _ods_ir.BoolAttr(self.operation.attributes["isWrite"])
@isWrite.setter
def isWrite(self, value):
if value is None:
raise ValueError("'None' not allowed as value for mandatory attributes")
self.operation.attributes["isWrite"] = value
@property
def localityHint(self):
return _ods_ir.IntegerAttr(self.operation.attributes["localityHint"])
@localityHint.setter
def localityHint(self, value):
if value is None:
raise ValueError("'None' not allowed as value for mandatory attributes")
self.operation.attributes["localityHint"] = value
@property
def isDataCache(self):
return _ods_ir.BoolAttr(self.operation.attributes["isDataCache"])
@isDataCache.setter
def isDataCache(self, value):
if value is None:
raise ValueError("'None' not allowed as value for mandatory attributes")
self.operation.attributes["isDataCache"] = value
@_ods_cext.register_operation(_Dialect)
class RankOp(_ods_ir.OpView):
OPERATION_NAME = "std.rank"
def __init__(self, _gen_res_0, memrefOrTensor, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(memrefOrTensor)
super().__init__(_ods_ir.Operation.create(
"std.rank", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def memrefOrTensor(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class ReOp(_ods_ir.OpView):
OPERATION_NAME = "std.re"
def __init__(self, real, complex, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(real)
operands.append(complex)
super().__init__(_ods_ir.Operation.create(
"std.re", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def complex(self):
return self.operation.operands[0]
@property
def real(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class RemFOp(_ods_ir.OpView):
OPERATION_NAME = "std.remf"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.remf", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class ReturnOp(_ods_ir.OpView):
OPERATION_NAME = "std.return"
def __init__(self, operands_, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands += [*operands_]
super().__init__(_ods_ir.Operation.create(
"std.return", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operands_(self):
_ods_variadic_group_length = len(self.operation.operands) - 1 + 1
return self.operation.operands[0:0 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class RsqrtOp(_ods_ir.OpView):
OPERATION_NAME = "std.rsqrt"
def __init__(self, _gen_res_0, operand, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(operand)
super().__init__(_ods_ir.Operation.create(
"std.rsqrt", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class SIToFPOp(_ods_ir.OpView):
OPERATION_NAME = "std.sitofp"
def __init__(self, _gen_res_0, in_, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(in_)
super().__init__(_ods_ir.Operation.create(
"std.sitofp", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def in_(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class SelectOp(_ods_ir.OpView):
OPERATION_NAME = "std.select"
def __init__(self, result_, condition, true_value, false_value, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(condition)
operands.append(true_value)
operands.append(false_value)
super().__init__(_ods_ir.Operation.create(
"std.select", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def condition(self):
return self.operation.operands[0]
@property
def true_value(self):
return self.operation.operands[1]
@property
def false_value(self):
return self.operation.operands[2]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class ShiftLeftOp(_ods_ir.OpView):
OPERATION_NAME = "std.shift_left"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.shift_left", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class SignExtendIOp(_ods_ir.OpView):
OPERATION_NAME = "std.sexti"
def __init__(self, _gen_res_0, value, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(value)
super().__init__(_ods_ir.Operation.create(
"std.sexti", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def value(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class SignedCeilDivIOp(_ods_ir.OpView):
OPERATION_NAME = "std.ceildivi_signed"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.ceildivi_signed", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class SignedDivIOp(_ods_ir.OpView):
OPERATION_NAME = "std.divi_signed"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.divi_signed", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class SignedFloorDivIOp(_ods_ir.OpView):
OPERATION_NAME = "std.floordivi_signed"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.floordivi_signed", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class SignedRemIOp(_ods_ir.OpView):
OPERATION_NAME = "std.remi_signed"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.remi_signed", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class SignedShiftRightOp(_ods_ir.OpView):
OPERATION_NAME = "std.shift_right_signed"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.shift_right_signed", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class SinOp(_ods_ir.OpView):
OPERATION_NAME = "std.sin"
def __init__(self, _gen_res_0, operand, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(operand)
super().__init__(_ods_ir.Operation.create(
"std.sin", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class SplatOp(_ods_ir.OpView):
OPERATION_NAME = "std.splat"
def __init__(self, aggregate, input, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(aggregate)
operands.append(input)
super().__init__(_ods_ir.Operation.create(
"std.splat", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def input(self):
return self.operation.operands[0]
@property
def aggregate(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class SqrtOp(_ods_ir.OpView):
OPERATION_NAME = "std.sqrt"
def __init__(self, _gen_res_0, operand, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(operand)
super().__init__(_ods_ir.Operation.create(
"std.sqrt", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class StoreOp(_ods_ir.OpView):
OPERATION_NAME = "std.store"
def __init__(self, value, memref, indices, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands.append(value)
operands.append(memref)
operands += [*indices]
super().__init__(_ods_ir.Operation.create(
"std.store", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def value(self):
return self.operation.operands[0]
@property
def memref(self):
return self.operation.operands[1]
@property
def indices(self):
_ods_variadic_group_length = len(self.operation.operands) - 3 + 1
return self.operation.operands[2:2 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class SubCFOp(_ods_ir.OpView):
OPERATION_NAME = "std.subcf"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.subcf", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class SubFOp(_ods_ir.OpView):
OPERATION_NAME = "std.subf"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.subf", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class SubIOp(_ods_ir.OpView):
OPERATION_NAME = "std.subi"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.subi", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class SubTensorInsertOp(_ods_ir.OpView):
OPERATION_NAME = "std.subtensor_insert"
def __init__(self, result_, source, dest, offsets, sizes, strides, static_offsets, static_sizes, static_strides, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operand_segment_sizes_ods = _ods_array.array('L')
operands.append(source)
operand_segment_sizes_ods.append(1) # source
operands.append(dest)
operand_segment_sizes_ods.append(1) # dest
operands += [*offsets]
operand_segment_sizes_ods.append(len(offsets))
operands += [*sizes]
operand_segment_sizes_ods.append(len(sizes))
operands += [*strides]
operand_segment_sizes_ods.append(len(strides))
attributes["operand_segment_sizes"] = _ods_ir.DenseElementsAttr.get(operand_segment_sizes_ods,
context=_ods_get_default_loc_context(loc))
attributes["static_offsets"] = static_offsets
attributes["static_sizes"] = static_sizes
attributes["static_strides"] = static_strides
super().__init__(_ods_ir.Operation.create(
"std.subtensor_insert", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def source(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range[0]
@property
def dest(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range[0]
@property
def offsets(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 2)
return operand_range
@property
def sizes(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 3)
return operand_range
@property
def strides(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 4)
return operand_range
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class SubTensorOp(_ods_ir.OpView):
OPERATION_NAME = "std.subtensor"
def __init__(self, result_, source, offsets, sizes, strides, static_offsets, static_sizes, static_strides, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operand_segment_sizes_ods = _ods_array.array('L')
operands.append(source)
operand_segment_sizes_ods.append(1) # source
operands += [*offsets]
operand_segment_sizes_ods.append(len(offsets))
operands += [*sizes]
operand_segment_sizes_ods.append(len(sizes))
operands += [*strides]
operand_segment_sizes_ods.append(len(strides))
attributes["operand_segment_sizes"] = _ods_ir.DenseElementsAttr.get(operand_segment_sizes_ods,
context=_ods_get_default_loc_context(loc))
attributes["static_offsets"] = static_offsets
attributes["static_sizes"] = static_sizes
attributes["static_strides"] = static_strides
super().__init__(_ods_ir.Operation.create(
"std.subtensor", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def source(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range[0]
@property
def offsets(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def sizes(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 2)
return operand_range
@property
def strides(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 3)
return operand_range
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class SubViewOp(_ods_ir.OpView):
OPERATION_NAME = "std.subview"
def __init__(self, result_, source, offsets, sizes, strides, static_offsets, static_sizes, static_strides, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operand_segment_sizes_ods = _ods_array.array('L')
operands.append(source)
operand_segment_sizes_ods.append(1) # source
operands += [*offsets]
operand_segment_sizes_ods.append(len(offsets))
operands += [*sizes]
operand_segment_sizes_ods.append(len(sizes))
operands += [*strides]
operand_segment_sizes_ods.append(len(strides))
attributes["operand_segment_sizes"] = _ods_ir.DenseElementsAttr.get(operand_segment_sizes_ods,
context=_ods_get_default_loc_context(loc))
attributes["static_offsets"] = static_offsets
attributes["static_sizes"] = static_sizes
attributes["static_strides"] = static_strides
super().__init__(_ods_ir.Operation.create(
"std.subview", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def source(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 0)
return operand_range[0]
@property
def offsets(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 1)
return operand_range
@property
def sizes(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 2)
return operand_range
@property
def strides(self):
operand_range = _ods_segmented_accessor(
self.operation.operands,
self.operation.attributes["operand_segment_sizes"], 3)
return operand_range
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class TanhOp(_ods_ir.OpView):
OPERATION_NAME = "std.tanh"
def __init__(self, _gen_res_0, operand, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(operand)
super().__init__(_ods_ir.Operation.create(
"std.tanh", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def operand(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class TensorFromElementsOp(_ods_ir.OpView):
OPERATION_NAME = "std.tensor_from_elements"
@property
def elements(self):
_ods_variadic_group_length = len(self.operation.operands) - 1 + 1
return self.operation.operands[0:0 + _ods_variadic_group_length]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class TensorLoadOp(_ods_ir.OpView):
OPERATION_NAME = "std.tensor_load"
def __init__(self, result_, memref, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(memref)
super().__init__(_ods_ir.Operation.create(
"std.tensor_load", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def memref(self):
return self.operation.operands[0]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class TensorStoreOp(_ods_ir.OpView):
OPERATION_NAME = "std.tensor_store"
def __init__(self, tensor, memref, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands.append(tensor)
operands.append(memref)
super().__init__(_ods_ir.Operation.create(
"std.tensor_store", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def tensor(self):
return self.operation.operands[0]
@property
def memref(self):
return self.operation.operands[1]
@_ods_cext.register_operation(_Dialect)
class TensorToMemrefOp(_ods_ir.OpView):
OPERATION_NAME = "std.tensor_to_memref"
def __init__(self, memref, tensor, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(memref)
operands.append(tensor)
super().__init__(_ods_ir.Operation.create(
"std.tensor_to_memref", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def tensor(self):
return self.operation.operands[0]
@property
def memref(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class TransposeOp(_ods_ir.OpView):
OPERATION_NAME = "std.transpose"
def __init__(self, _gen_res_0, in_, permutation, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(in_)
attributes["permutation"] = permutation
super().__init__(_ods_ir.Operation.create(
"std.transpose", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def in_(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class TruncateIOp(_ods_ir.OpView):
OPERATION_NAME = "std.trunci"
def __init__(self, _gen_res_0, value, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(value)
super().__init__(_ods_ir.Operation.create(
"std.trunci", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def value(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class UIToFPOp(_ods_ir.OpView):
OPERATION_NAME = "std.uitofp"
def __init__(self, _gen_res_0, in_, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(in_)
super().__init__(_ods_ir.Operation.create(
"std.uitofp", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def in_(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class UnsignedDivIOp(_ods_ir.OpView):
OPERATION_NAME = "std.divi_unsigned"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.divi_unsigned", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class UnsignedRemIOp(_ods_ir.OpView):
OPERATION_NAME = "std.remi_unsigned"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.remi_unsigned", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class UnsignedShiftRightOp(_ods_ir.OpView):
OPERATION_NAME = "std.shift_right_unsigned"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.shift_right_unsigned", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class ViewOp(_ods_ir.OpView):
OPERATION_NAME = "std.view"
def __init__(self, _gen_res_0, source, byte_shift, sizes, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(source)
operands.append(byte_shift)
operands += [*sizes]
super().__init__(_ods_ir.Operation.create(
"std.view", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def source(self):
return self.operation.operands[0]
@property
def byte_shift(self):
return self.operation.operands[1]
@property
def sizes(self):
_ods_variadic_group_length = len(self.operation.operands) - 3 + 1
return self.operation.operands[2:2 + _ods_variadic_group_length]
@_ods_cext.register_operation(_Dialect)
class XOrOp(_ods_ir.OpView):
OPERATION_NAME = "std.xor"
def __init__(self, result_, lhs, rhs, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(lhs)
operands.append(rhs)
super().__init__(_ods_ir.Operation.create(
"std.xor", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def lhs(self):
return self.operation.operands[0]
@property
def rhs(self):
return self.operation.operands[1]
@property
def result_(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class YieldOp(_ods_ir.OpView):
OPERATION_NAME = "std.yield"
def __init__(self, value, loc=None, ip=None):
operands = []
results = []
attributes = {}
operands.append(value)
super().__init__(_ods_ir.Operation.create(
"std.yield", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def value(self):
return self.operation.operands[0]
@_ods_cext.register_operation(_Dialect)
class ZeroExtendIOp(_ods_ir.OpView):
OPERATION_NAME = "std.zexti"
def __init__(self, _gen_res_0, value, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(_gen_res_0)
operands.append(value)
super().__init__(_ods_ir.Operation.create(
"std.zexti", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def value(self):
return self.operation.operands[0]
# Autogenerated by mlir-tblgen; don't manually edit.
import array as _ods_array
from . import _cext as _ods_cext
from . import _segmented_accessor as _ods_segmented_accessor, _equally_sized_accessor as _ods_equally_sized_accessor, _get_default_loc_context as _ods_get_default_loc_context
_ods_ir = _ods_cext.ir
@_ods_cext.register_dialect
class _Dialect(_ods_ir.Dialect):
DIALECT_NAMESPACE = "tensor"
pass
@_ods_cext.register_operation(_Dialect)
class CastOp(_ods_ir.OpView):
OPERATION_NAME = "tensor.cast"
def __init__(self, dest, source, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(dest)
operands.append(source)
super().__init__(_ods_ir.Operation.create(
"tensor.cast", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def source(self):
return self.operation.operands[0]
@property
def dest(self):
return self.operation.results[0]
@_ods_cext.register_operation(_Dialect)
class ExtractOp(_ods_ir.OpView):
OPERATION_NAME = "tensor.extract"
def __init__(self, result_, tensor, indices, loc=None, ip=None):
operands = []
results = []
attributes = {}
results.append(result_)
operands.append(tensor)
operands += [*indices]
super().__init__(_ods_ir.Operation.create(
"tensor.extract", attributes=attributes, operands=operands, results=results,
loc=loc, ip=ip))
@property
def tensor(self):
return self.operation.operands[0]
@property
def indices(self):
_ods_variadic_group_length = len(self.operation.operands) - 2 + 1
return self.operation.operands[1:1 + _ods_variadic_group_length]
@property
def result_(self):
return self.operation.results[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment