mlir.dialects._ml_program_ops_gen

Attributes

Classes

_Dialect

FuncOp

This simple function container represents callables in an ML program where

GlobalLoadConstOp

Loads a constant (immutable) value from a global directly by symbol.

GlobalLoadGraphOp

Performs a non-atomic, non-volatile, non-synchronized load from a global

GlobalLoadOp

Performs a non-atomic, non-volatile, non-synchronized load from a global

GlobalOp

Declares a named global variable (or constant).

GlobalStoreGraphOp

Performs a non-atomic, non-volatile, non-synchronized store to a mutable

GlobalStoreOp

Performs a non-atomic, non-volatile, non-synchronized store to a mutable

OutputOp

The output operation terminates a subgraph by yielding values

ReturnOp

The return operation terminates a func function by yielding values

SubgraphOp

This simple function container represents callables in an ML program where

TokenOp

Token values are used to chain side effecting ops in a graph so as to

Functions

func(→ FuncOp)

global_load_const(→ _ods_ir)

global_load_graph(→ _ods_ir)

global_load(→ _ods_ir)

global_(→ GlobalOp)

global_store_graph(→ _ods_ir)

global_store(→ GlobalStoreOp)

output(→ OutputOp)

return_(→ ReturnOp)

subgraph(→ SubgraphOp)

token(→ _ods_ir)

Module Contents

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

Bases: _ods_ir

DIALECT_NAMESPACE = 'ml_program'
class mlir.dialects._ml_program_ops_gen.FuncOp(sym_name, function_type, *, arg_attrs=None, res_attrs=None, sym_visibility=None, loc=None, ip=None)

Bases: _ods_ir

This simple function container represents callables in an ML program where the body is an SSACFG region. It must be terminated by a return op which yields values with the same arity and types as the FunctionType results of the containing func.

This op is a Symbol but does not introduce a new SymbolTable. As such, it cannot represent nested symbols.

Example:

ml_program.func private @some_extern(i32) -> i32
ml_program.func @compute(%arg0 : i32) -> i32 {
  ml_program.return %arg0 : i32
}
OPERATION_NAME = 'ml_program.func'
_ODS_REGIONS = (1, True)
sym_name() _ods_ir
function_type() _ods_ir
arg_attrs() _ods_ir | None
res_attrs() _ods_ir | None
sym_visibility() _ods_ir | None
body() _ods_ir
mlir.dialects._ml_program_ops_gen.func(sym_name, function_type, *, arg_attrs=None, res_attrs=None, sym_visibility=None, loc=None, ip=None) FuncOp
class mlir.dialects._ml_program_ops_gen.GlobalLoadConstOp(result, global_, *, loc=None, ip=None)

Bases: _ods_ir

Loads a constant (immutable) value from a global directly by symbol.

This op is only legal for globals that are not mutable and exists because such a load can be considered to have no side effects.

Example:

%0 = ml_program.global_load_const @foobar : tensor<?xi32>
OPERATION_NAME = 'ml_program.global_load_const'
_ODS_REGIONS = (0, True)
global_() _ods_ir
result() _ods_ir

Shortcut to get an op result if it has only one (throws an error otherwise).

mlir.dialects._ml_program_ops_gen.global_load_const(result, global_, *, loc=None, ip=None) _ods_ir
class mlir.dialects._ml_program_ops_gen.GlobalLoadGraphOp(result, produceToken, global_, consumeTokens, *, loc=None, ip=None)

Bases: _ods_ir

Performs a non-atomic, non-volatile, non-synchronized load from a global that may be mutable.

It is fully expected that these constraints are not suitable for all situations, and alternative ops should be defined and used for more advanced cases.

This op is side effecting and may not be valid to use in graph regions without additional consideration to evaluation order constraints.

Example:

%0, %cstr = ml_program.global_load_graph @foobar
  ordering (%token -> !ml_program.token) : tensor<?xi32>
OPERATION_NAME = 'ml_program.global_load_graph'
_ODS_REGIONS = (0, True)
consumeTokens() _ods_ir
global_() _ods_ir
result() _ods_ir

Shortcut to get an op result if it has only one (throws an error otherwise).

produceToken() _ods_ir
mlir.dialects._ml_program_ops_gen.global_load_graph(result, produce_token, global_, consume_tokens, *, loc=None, ip=None) _ods_ir
class mlir.dialects._ml_program_ops_gen.GlobalLoadOp(result, global_, *, loc=None, ip=None)

Bases: _ods_ir

Performs a non-atomic, non-volatile, non-synchronized load from a global that may be mutable.

It is fully expected that these constraints are not suitable for all situations, and alternative ops should be defined and used for more advanced cases.

This op is side effecting and may not be valid to use in graph regions without additional consideration to evaluation order constraints. See global_load_graph for op which allows for explicit ordering constraints.

Example:

%0 = ml_program.global_load @foobar : tensor<?xi32>
OPERATION_NAME = 'ml_program.global_load'
_ODS_REGIONS = (0, True)
global_() _ods_ir
result() _ods_ir

Shortcut to get an op result if it has only one (throws an error otherwise).

mlir.dialects._ml_program_ops_gen.global_load(result, global_, *, loc=None, ip=None) _ods_ir
class mlir.dialects._ml_program_ops_gen.GlobalOp(sym_name, type_, *, is_mutable=None, value=None, sym_visibility=None, loc=None, ip=None)

Bases: _ods_ir

Declares a named global variable (or constant).

A global contains a value of a specified type which can be accessed at runtime via appropriate load/store operations. It can be mutable or constant, optionally taking an initial value or declared as extern (in which case, the initial value is found in external storage by symbol name).

Generally, the type of the global and the type of the initial value will be the same. However, for type hierarchies which can have a more generalized bounding type that can be assigned from a narrow type, this is allowed (but not verified).

Examples:

// Constant global.
ml_program.global @foobar(dense<4> : tensor<4xi32>) : tensor<?xi32>

// Constant with external linkage.
ml_program.global mutable @foobar(#ml_program.extern<tensor<4xi32>>)
  : tensor<?xi32>

// Mutable global with an undefined initial value.
ml_program.global mutable @foobar : tensor<?xi32>
OPERATION_NAME = 'ml_program.global'
_ODS_REGIONS = (0, True)
sym_name() _ods_ir
type_() _ods_ir
is_mutable() bool
value() _ods_ir | None
sym_visibility() _ods_ir | None
mlir.dialects._ml_program_ops_gen.global_(sym_name, type_, *, is_mutable=None, value=None, sym_visibility=None, loc=None, ip=None) GlobalOp
class mlir.dialects._ml_program_ops_gen.GlobalStoreGraphOp(produceToken, global_, value, consumeTokens, *, loc=None, ip=None)

Bases: _ods_ir

Performs a non-atomic, non-volatile, non-synchronized store to a mutable global.

It is fully expected that these constraints are not suitable for all situations, and alternative ops should be defined and used for more advanced cases.

This op is side effecting and may not be valid to use in graph regions without additional consideration to evaluation order constraints.

Example:

%token = ml_program.global_store @foobar = %0 : tensor<?xi32>
  ordering (%in_token -> !ml_program.token) : tensor<?xi32>
OPERATION_NAME = 'ml_program.global_store_graph'
_ODS_REGIONS = (0, True)
value() _ods_ir
consumeTokens() _ods_ir
global_() _ods_ir
produceToken() _ods_ir
mlir.dialects._ml_program_ops_gen.global_store_graph(produce_token, global_, value, consume_tokens, *, loc=None, ip=None) _ods_ir
class mlir.dialects._ml_program_ops_gen.GlobalStoreOp(global_, value, *, loc=None, ip=None)

Bases: _ods_ir

Performs a non-atomic, non-volatile, non-synchronized store to a mutable global.

It is fully expected that these constraints are not suitable for all situations, and alternative ops should be defined and used for more advanced cases.

This op is side effecting and may not be valid to use in graph regions without additional consideration to evaluation order constraints. See global_store_graph for op which allows for explicit ordering constraints.

Example:

ml_program.global_store @foobar = %0 : tensor<?xi32>
OPERATION_NAME = 'ml_program.global_store'
_ODS_REGIONS = (0, True)
value() _ods_ir
global_() _ods_ir
mlir.dialects._ml_program_ops_gen.global_store(global_, value, *, loc=None, ip=None) GlobalStoreOp
class mlir.dialects._ml_program_ops_gen.OutputOp(operands_, *, loc=None, ip=None)

Bases: _ods_ir

The output operation terminates a subgraph by yielding values to the caller. The operation takes variable number of operands and produces no results. The operand number and types must match the signature of the function that contains the operation.

OPERATION_NAME = 'ml_program.output'
_ODS_REGIONS = (0, True)
operands_() _ods_ir
mlir.dialects._ml_program_ops_gen.output(operands_, *, loc=None, ip=None) OutputOp
class mlir.dialects._ml_program_ops_gen.ReturnOp(operands_, *, loc=None, ip=None)

Bases: _ods_ir

The return operation terminates a func function by yielding values to the caller. The operation takes variable number of operands and produces no results. The operand number and types must match the signature of the function that contains the operation.

OPERATION_NAME = 'ml_program.return'
_ODS_REGIONS = (0, True)
operands_() _ods_ir
mlir.dialects._ml_program_ops_gen.return_(operands_, *, loc=None, ip=None) ReturnOp
class mlir.dialects._ml_program_ops_gen.SubgraphOp(sym_name, function_type, *, arg_attrs=None, res_attrs=None, sym_visibility=None, loc=None, ip=None)

Bases: _ods_ir

This simple function container represents callables in an ML program where the body is a Graph region containing a single block. It must be terminated by an output op which yields values with the same arity and types as the FunctionType results of the containing subgraph.

This op is a Symbol but does not introduce a new SymbolTable. As such, it cannot represented nested symbols.

Example:

ml_program.subgraph private @some_extern(i32) -> i32
ml_program.subgraph @compute(%arg0 : i32) -> i32 {
  ml_program.output %arg0 : i32
}
OPERATION_NAME = 'ml_program.subgraph'
_ODS_REGIONS = (1, True)
sym_name() _ods_ir
function_type() _ods_ir
arg_attrs() _ods_ir | None
res_attrs() _ods_ir | None
sym_visibility() _ods_ir | None
body() _ods_ir
mlir.dialects._ml_program_ops_gen.subgraph(sym_name, function_type, *, arg_attrs=None, res_attrs=None, sym_visibility=None, loc=None, ip=None) SubgraphOp
class mlir.dialects._ml_program_ops_gen.TokenOp(token, *, loc=None, ip=None)

Bases: _ods_ir

Token values are used to chain side effecting ops in a graph so as to establish an execution order. This op produces a token.

OPERATION_NAME = 'ml_program.token'
_ODS_REGIONS = (0, True)
token() _ods_ir
mlir.dialects._ml_program_ops_gen.token(token, *, loc=None, ip=None) _ods_ir