Beaver.MLIR.Dialect.Func (beaver v0.4.7)

This module defines functions for Ops in Func dialect.

Summary

Functions

func.call - call operation

func.call_indirect - indirect call operation

func.constant

func.func

Syntax sugar for Func.func SSA expression. No need to specify result types.

Syntax sugar for Func.func alike SSA expression. No need to specify result types.

func.return - Function return operation

Functions

call(ssa)

func.call - call operation

Attributes

  • callee - Single, FlatSymbolRefAttr, flat symbol reference attribute
  • arg_attrs - Optional, DictArrayAttr, Array of dictionary attributes
  • res_attrs - Optional, DictArrayAttr, Array of dictionary attributes
  • no_inline - Optional, UnitAttr, unit attribute

Operands

  • operands - Variadic, AnyType, variadic of any type

Results

  • anonymous - Variadic, AnyType, variadic of any type

Description

The func.call operation represents a direct call to a function that is within the same symbol scope as the call. The operands and result types of the call must match the specified function type. The callee is encoded as a symbol reference attribute named "callee".

Example:

%2 = func.call @my_add(%0, %1) : (f32, f32) -> f32

call_indirect(ssa)

func.call_indirect - indirect call operation

Attributes

  • arg_attrs - Optional, DictArrayAttr, Array of dictionary attributes
  • res_attrs - Optional, DictArrayAttr, Array of dictionary attributes

Operands

  • callee - Single, FunctionType, function type
  • callee_operands - Variadic, AnyType, variadic of any type

Results

  • results - Variadic, AnyType, variadic of any type

Description

The func.call_indirect operation represents an indirect call to a value of function type. The operands and result types of the call must match the specified function type.

Function values can be created with the func.constant operation.

Example:

%func = func.constant @my_func : (tensor<16xf32>, tensor<16xf32>) -> tensor<16xf32>
%result = func.call_indirect %func(%0, %1) : (tensor<16xf32>, tensor<16xf32>) -> tensor<16xf32>

constant(ssa)

func.constant

entry_block(op)

external?(op)

func(ssa)

func.func

func(call, opts)

(macro)

Syntax sugar for Func.func SSA expression. No need to specify result types.

func_like(call, op, list)

(macro)

Syntax sugar for Func.func alike SSA expression. No need to specify result types.

return(ssa)

func.return - Function return operation

Operands

  • operands - Variadic, AnyType, variadic of any type

Description

The func.return operation represents a return operation within a function. 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.

Example:

func.func @foo() -> (i32, f8) {
  ...
  return %0, %1 : i32, f8
}