mlir.dialects._bufferization_transform_ops_gen

Attributes

Classes

BufferLoopHoistingOp

Hoist buffer allocations ("memref.alloc" and "memref.alloca") from loops

EliminateEmptyTensorsOp

Try to eliminate all tensor.empty ops within the targeted op by replacing

EmptyTensorToAllocTensorOp

Replace a tensor.empty with a bufferization.tensor_alloc.

OneShotBufferizeOp

Indicates that the given target op should be bufferized with One-Shot

Functions

Module Contents

mlir.dialects._bufferization_transform_ops_gen._ods_ir
class mlir.dialects._bufferization_transform_ops_gen.BufferLoopHoistingOp(target, *, loc=None, ip=None)

Bases: _ods_ir

Hoist buffer allocations (“memref.alloc” and “memref.alloca”) from loops within the targeted op. This transform assumes that there are no buffer deallocation ops in the IR.

This transform reads the target handle and modifies the payload.

OPERATION_NAME = 'transform.bufferization.buffer_loop_hoisting'
_ODS_REGIONS = (0, True)
target() _ods_ir
mlir.dialects._bufferization_transform_ops_gen.bufferization_buffer_loop_hoisting(target, *, loc=None, ip=None) BufferLoopHoistingOp
class mlir.dialects._bufferization_transform_ops_gen.EliminateEmptyTensorsOp(target, *, loc=None, ip=None)

Bases: _ods_ir

Try to eliminate all tensor.empty ops within the targeted op by replacing them with another destination tensor.

“tensor.empty” ops cannot be bufferized. They can either be converted to “bufferization.alloc_tensor” or replaced with another tensor (via this transform). “tensor.empty” does not specify the contents of the returned tensor so their results can be replaced with arbitrary tensor values as long as the dimensions match.

This transformation looks for subset ops that insert a tensor that originates from a “tensor.empty” (as per the reverse use-def chain). Such “tensor.empty” ops are replaced with the destination subset.

Example:

%0 = tensor.empty() : tensor<5xf32>
%1 = linalg.fill ... outs(%0)
%2 = tensor.insert_slice %1 into %t[1][5][1]

Is rewritten with:

%0 = tensor.extract_slice %t[1][5][1]
%1 = linalg.fill ... outs(%0)
%2 = tensor.insert_slice %1 into %t[1][5][1]

In the above example, the subset op is “tensor.insert_slice”. When tracing back the reverse use-def chain of a the source, we end up at a “tensor.empty” op.

The above example can bufferize without an allocation (in the absence of other conflicts) because there is no longer a tensor.empty op.

See -eliminate-empty-tensors for more details.

Return modes

This transform reads the target handle and modifies the payload. It does not produce any handle.

OPERATION_NAME = 'transform.bufferization.eliminate_empty_tensors'
_ODS_REGIONS = (0, True)
target() _ods_ir
mlir.dialects._bufferization_transform_ops_gen.bufferization_eliminate_empty_tensors(target, *, loc=None, ip=None) EliminateEmptyTensorsOp
class mlir.dialects._bufferization_transform_ops_gen.EmptyTensorToAllocTensorOp(transformed, target, *, loc=None, ip=None)

Bases: _ods_ir

Replace a tensor.empty with a bufferization.tensor_alloc.

Return modes

This operation consumes the target handle and produces the transformed handle. target is expected to be a tensor.empty operation. The transform always succeeds.

OPERATION_NAME = 'transform.bufferization.empty_tensor_to_alloc_tensor'
_ODS_REGIONS = (0, True)
target() _ods_ir
transformed() _ods_ir
mlir.dialects._bufferization_transform_ops_gen.bufferization_empty_tensor_to_alloc_tensor(transformed, target, *, loc=None, ip=None) _ods_ir
class mlir.dialects._bufferization_transform_ops_gen.OneShotBufferizeOp(transformed, target, *, function_boundary_type_conversion=None, allow_return_allocs_from_loops=None, allow_unknown_ops=None, bufferize_function_boundaries=None, dump_alias_sets=None, test_analysis_only=None, print_conflicts=None, check_parallel_regions=None, memcpy_op=None, loc=None, ip=None)

Bases: _ods_ir

Indicates that the given target op should be bufferized with One-Shot Bufferize. The bufferization can be configured with various attributes that corresponding to options in BufferizationOptions and the one-shot-bufferize pass. More information can be found in the pass documentation.

The targeted ops must be modules or functions. This is because there is always a single, bufferized replacement op for such targets.

Note: Only ops that implement BufferizableOpInterface are bufferized. All other ops are ignored if allow_unknown_ops. If allow_unknown_ops is unset, this transform fails when an unknown/non-bufferizable op is found. Many ops implement BufferizableOpInterface via an external model. These external models must be registered when applying this transform op; otherwise, said ops would be considered non-bufferizable.

Return modes

This operation consumes the target handle and produces the transformed handle.

OPERATION_NAME = 'transform.bufferization.one_shot_bufferize'
_ODS_REGIONS = (0, True)
target() _ods_ir
function_boundary_type_conversion() _ods_ir | None
allow_return_allocs_from_loops() _ods_ir
allow_unknown_ops() _ods_ir
bufferize_function_boundaries() _ods_ir
dump_alias_sets() _ods_ir
test_analysis_only() _ods_ir
print_conflicts() _ods_ir
check_parallel_regions() _ods_ir
memcpy_op() _ods_ir
transformed() _ods_ir
mlir.dialects._bufferization_transform_ops_gen.bufferization_one_shot_bufferize(transformed, target, *, function_boundary_type_conversion=None, allow_return_allocs_from_loops=None, allow_unknown_ops=None, bufferize_function_boundaries=None, dump_alias_sets=None, test_analysis_only=None, print_conflicts=None, check_parallel_regions=None, memcpy_op=None, loc=None, ip=None) _ods_ir