mlir.dialects._cf_ops_gen

Attributes

Classes

_Dialect

AssertOp

Assert operation at runtime with single boolean operand and an error

BranchOp

The cf.br operation represents a direct branch operation to a given

CondBranchOp

The cf.cond_br terminator operation represents a conditional branch on a

SwitchOp

The cf.switch terminator operation represents a switch on a signless integer

Functions

assert_(→ AssertOp)

br(→ BranchOp)

cond_br(→ CondBranchOp)

switch(→ SwitchOp)

Module Contents

mlir.dialects._cf_ops_gen._ods_ir
class mlir.dialects._cf_ops_gen._Dialect(descriptor: object)

Bases: _ods_ir

DIALECT_NAMESPACE = 'cf'
class mlir.dialects._cf_ops_gen.AssertOp(arg, msg, *, loc=None, ip=None)

Bases: _ods_ir

Assert operation at runtime with single boolean operand and an error message attribute. If the argument is true this operation has no effect. Otherwise, the program execution will abort. The provided error message may be used by a runtime to propagate the error to the user.

Example:

cf.assert %b, "Expected ... to be true"
OPERATION_NAME = 'cf.assert'
_ODS_REGIONS = (0, True)
arg() _ods_ir
msg() _ods_ir
mlir.dialects._cf_ops_gen.assert_(arg, msg, *, loc=None, ip=None) AssertOp
class mlir.dialects._cf_ops_gen.BranchOp(destOperands, dest, *, loc=None, ip=None)

Bases: _ods_ir

The cf.br operation represents a direct branch operation to a given block. The operands of this operation are forwarded to the successor block, and the number and type of the operands must match the arguments of the target block.

Example:

^bb2:
  %2 = call @someFn()
  cf.br ^bb3(%2 : tensor<*xf32>)
^bb3(%3: tensor<*xf32>):
OPERATION_NAME = 'cf.br'
_ODS_REGIONS = (0, True)
destOperands() _ods_ir
mlir.dialects._cf_ops_gen.br(dest_operands, dest, *, loc=None, ip=None) BranchOp
class mlir.dialects._cf_ops_gen.CondBranchOp(condition, trueDestOperands, falseDestOperands, trueDest, falseDest, *, branch_weights=None, loc=None, ip=None)

Bases: _ods_ir

The cf.cond_br terminator operation represents a conditional branch on a boolean (1-bit integer) value. If the bit is set, then the first destination is jumped to; if it is false, the second destination is chosen. The count and types of operands must align with the arguments in the corresponding target blocks.

The MLIR conditional branch operation is not allowed to target the entry block for a region. The two destinations of the conditional branch operation are allowed to be the same.

The following example illustrates a function with a conditional branch operation that targets the same block.

Example:

func.func @select(%a: i32, %b: i32, %flag: i1) -> i32 {
  // Both targets are the same, operands differ
  cf.cond_br %flag, ^bb1(%a : i32), ^bb1(%b : i32)

^bb1(%x : i32) :
  return %x : i32
}
OPERATION_NAME = 'cf.cond_br'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (0, True)
condition() _ods_ir
trueDestOperands() _ods_ir
falseDestOperands() _ods_ir
branch_weights() _ods_ir | None
mlir.dialects._cf_ops_gen.cond_br(condition, true_dest_operands, false_dest_operands, true_dest, false_dest, *, branch_weights=None, loc=None, ip=None) CondBranchOp
class mlir.dialects._cf_ops_gen.SwitchOp(flag, defaultOperands, caseOperands, case_operand_segments, defaultDestination, caseDestinations, *, case_values=None, loc=None, ip=None)

Bases: _ods_ir

The cf.switch terminator operation represents a switch on a signless integer value. If the flag matches one of the specified cases, then the corresponding destination is jumped to. If the flag does not match any of the cases, the default destination is jumped to. The count and types of operands must align with the arguments in the corresponding target blocks.

Example:

cf.switch %flag : i32, [
  default: ^bb1(%a : i32),
  42: ^bb1(%b : i32),
  43: ^bb3(%c : i32)
]
OPERATION_NAME = 'cf.switch'
_ODS_OPERAND_SEGMENTS
_ODS_REGIONS = (0, True)
flag() _ods_ir
defaultOperands() _ods_ir
caseOperands() _ods_ir
case_values() _ods_ir | None
case_operand_segments() _ods_ir
mlir.dialects._cf_ops_gen.switch(flag, default_operands, case_operands, case_operand_segments, default_destination, case_destinations, *, case_values=None, loc=None, ip=None) SwitchOp