Builder C-API

Contents

Builder C-API#

Common#

Common Enumerations#

tinytc_arithmetic_t#

enum tinytc_arithmetic_t#

Arithmetic operations.

Values:

enumerator tinytc_arithmetic_add = 0#

add

enumerator tinytc_arithmetic_sub = 1#

subtract

enumerator tinytc_arithmetic_mul = 2#

multiply

enumerator tinytc_arithmetic_div = 3#

divide

enumerator tinytc_arithmetic_rem = 4#

division remainder

enumerator tinytc_arithmetic_shl = 5#

left shift

enumerator tinytc_arithmetic_shr = 6#

arithmetic right shift

enumerator tinytc_arithmetic_and = 7#

bitwise and

enumerator tinytc_arithmetic_or = 8#

bitwise or

enumerator tinytc_arithmetic_xor = 9#

bitwise xor

tinytc_arithmetic_unary_t#

enum tinytc_arithmetic_unary_t#

Arithmetic operations (unary)

Values:

enumerator tinytc_arithmetic_unary_neg = 0#

negation

enumerator tinytc_arithmetic_unary_not = 1#

bitwise not

tinytc_cmp_condition_t#

enum tinytc_cmp_condition_t#

Compare operation.

Values:

enumerator tinytc_cmp_condition_eq = 0#

equals

enumerator tinytc_cmp_condition_ne = 1#

not equal

enumerator tinytc_cmp_condition_gt = 2#

greater than

enumerator tinytc_cmp_condition_ge = 3#

greather or equal than

enumerator tinytc_cmp_condition_lt = 4#

less than

enumerator tinytc_cmp_condition_le = 5#

less or equal than

tinytc_scalar_type_t#

enum tinytc_scalar_type_t#

Scalar types.

Values:

enumerator tinytc_scalar_type_i1 = 0#

Signed 1 bit integer (boolean)

enumerator tinytc_scalar_type_i8 = 1#

Signed 8 bit integer.

enumerator tinytc_scalar_type_i16 = 2#

Signed 16 bit integer.

enumerator tinytc_scalar_type_i32 = 3#

Signed 32 bit integer.

enumerator tinytc_scalar_type_i64 = 4#

Signed 64 bit integer.

enumerator tinytc_scalar_type_index = 5#

Integer type for indices.

enumerator tinytc_scalar_type_f32 = 6#

Single precision floating point (32 bit)

enumerator tinytc_scalar_type_f64 = 7#

Double precision floating point (64 bit)

tinytc_transpose_t#

enum tinytc_transpose_t#

Transpose.

Values:

enumerator tinytc_transpose_N = 0#

No transpose.

enumerator tinytc_transpose_T = 1#

Transpose.

Common Definitions#

TINYTC_DYNAMIC#

TINYTC_DYNAMIC INT64_MIN#

Common Functions#

tinytc_arithmetic_to_string#

char const *tinytc_arithmetic_to_string(tinytc_arithmetic_t op)#

Convert arithmetic operation type to string.

tinytc_arithmetic_unary_to_string#

char const *tinytc_arithmetic_unary_to_string(tinytc_arithmetic_unary_t op)#

Convert arithmetic operation type to string (unary)

tinytc_cmp_condition_to_string#

char const *tinytc_cmp_condition_to_string(tinytc_cmp_condition_t cond)#

Convert cmp condition to string.

tinytc_scalar_type_size#

size_t tinytc_scalar_type_size(tinytc_scalar_type_t ty)#

Size of scalar type in bytes.

tinytc_scalar_type_to_string#

char const *tinytc_scalar_type_to_string(tinytc_scalar_type_t ty)#

Convert scalar type to string.

tinytc_transpose_to_string#

char const *tinytc_transpose_to_string(tinytc_transpose_t t)#

Convert transpose to string.

Common Structures#

tinytc_position#

struct tinytc_position#

Source code position.

Public Members

int32_t source_id#

Source file identifier; 0 is “unknown source”.

int32_t line#

Line number; counting starts at 1.

int32_t column#

Column number; counting start at 1.

tinytc_location#

struct tinytc_location#

Source code location.

Public Members

tinytc_position_t begin#

Starting position.

tinytc_position_t end#

End position.

Common Typedefs#

tinytc_data_type_t#

typedef struct tinytc_data_type *tinytc_data_type_t#

data_type handle

tinytc_func_t#

typedef struct tinytc_func *tinytc_func_t#

func handle

tinytc_location_t#

typedef struct tinytc_location tinytc_location_t#

Source code location.

tinytc_position_t#

typedef struct tinytc_position tinytc_position_t#

Source code position.

tinytc_prog_t#

typedef struct tinytc_prog *tinytc_prog_t#

prog handle

tinytc_inst_t#

typedef struct tinytc_inst *tinytc_inst_t#

inst handle

tinytc_region_t#

typedef struct tinytc_region *tinytc_region_t#

region handle

tinytc_value_t#

typedef struct tinytc_value *tinytc_value_t#

value handle

const_tinytc_data_type_t#

typedef const struct tinytc_data_type *const_tinytc_data_type_t#

const data_type handle

const_tinytc_func_t#

typedef const struct tinytc_func *const_tinytc_func_t#

const func handle

const_tinytc_inst_t#

typedef const struct tinytc_inst *const_tinytc_inst_t#

const inst handle

const_tinytc_prog_t#

typedef const struct tinytc_prog *const_tinytc_prog_t#

const prog handle

const_tinytc_region_t#

typedef const struct tinytc_region *const_tinytc_region_t#

const region handle

Data Type#

Data Type Functions#

tinytc_group_type_create#

tinytc_status_t tinytc_group_type_create(tinytc_data_type_t *dt, tinytc_data_type_t memref_ty, int64_t offset, const tinytc_location_t *loc)#

Create group data type.

Parameters:
  • dt – [out] pointer to the data type object created

  • memref_ty – [in] memref data type object

  • offset – [in][optional] offset parameter; pass 0 for default

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_memref_type_create#

tinytc_status_t tinytc_memref_type_create(tinytc_data_type_t *dt, tinytc_scalar_type_t scalar_ty, uint32_t shape_size, const int64_t *shape, uint32_t stride_size, const int64_t *stride, const tinytc_location_t *loc)#

Create memref data type.

Parameters:
  • dt – [out] pointer to the data type object created

  • scalar_ty – [in] element type

  • shape_size – [in] tensor order; number of elements in shape array, must be 0 if shape == nullptr

  • shape – [in][range(0, shape_size)] array of mode sizes

  • stride_size – [in][optional] number of elements in stride array; must be either 0 for automatic stride calculation or must match shape_size; must be 0 if stride == nullptr

  • stride – [in][optional][range(0, stride_size)] stride array

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_scalar_type_create#

tinytc_status_t tinytc_scalar_type_create(tinytc_data_type_t *dt, tinytc_scalar_type_t type, const tinytc_location_t *loc)#

Create scalar data type.

Parameters:
  • dt – [out] pointer to the data type object created

  • type – [in] scalar type

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_data_type_release#

tinytc_status_t tinytc_data_type_release(tinytc_data_type_t dt)#

Release data type object.

Decreases reference count by 1, free memory if reference count is 0.

Parameters:
  • dt – [inout] data type object

Returns:

tinytc_status_success on success and error otherwise

tinytc_data_type_retain#

tinytc_status_t tinytc_data_type_retain(tinytc_data_type_t dt)#

Increase reference count of data type object by 1.

Parameters:
  • dt – [inout] data type object

Returns:

tinytc_status_success on success and error otherwise

Function#

Function Functions#

tinytc_function_create#

tinytc_status_t tinytc_function_create(tinytc_func_t *fun, tinytc_func_t prototype, tinytc_region_t body, const tinytc_location_t *loc)#

Create function.

Parameters:
  • fun – [out] pointer to the func object created

  • prototype – [in] function prototype

  • body – [in] function body

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_function_prototype_create#

tinytc_status_t tinytc_function_prototype_create(tinytc_func_t *fun, char const *name, uint32_t arg_list_size, tinytc_value_t *arg_list, const tinytc_location_t *loc)#

Create function prototype.

Parameters:
  • fun – [out] pointer to the func object created

  • name – [in] function name

  • arg_list_size – [in] length of argument array

  • arg_list – [in][range(0, arg_list_size)] argument array; can be nullptr if arg_list_size is 0

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_function_set_subgroup_size#

tinytc_status_t tinytc_function_set_subgroup_size(tinytc_func_t fun, int32_t sgs)#

Set subgroup size.

Parameters:
  • fun – [out] func object (must be the function definition, not the function prototype)

  • sgs – [in] subgroup size; the supported values need to be queried from the compute device

Returns:

tinytc_status_success on success and error otherwise

tinytc_function_set_work_group_size#

tinytc_status_t tinytc_function_set_work_group_size(tinytc_func_t fun, int32_t x, int32_t y)#

Set work-group size.

Parameters:
  • fun – [out] func object (must be the function definition, not the function prototype)

  • x – [in] number of rows in parallel grid; must be a multiple of the subgroup size

  • y – [in] number of columns in parallel grid

Returns:

tinytc_status_success on success and error otherwise

tinytc_func_release#

tinytc_status_t tinytc_func_release(tinytc_func_t fun)#

Release function object.

Decreases reference count by 1, free memory if reference count is 0.

Parameters:
  • fun – [inout] function object

Returns:

tinytc_status_success on success and error otherwise

tinytc_func_retain#

tinytc_status_t tinytc_func_retain(tinytc_func_t fun)#

Increase reference count of function object by 1.

Parameters:
  • fun – [inout] function object

Returns:

tinytc_status_success on success and error otherwise

Instruction#

Instruction Functions#

tinytc_alloca_inst_create#

tinytc_status_t tinytc_alloca_inst_create(tinytc_inst_t *instr, tinytc_data_type_t ty, const tinytc_location_t *loc)#

Create alloca instruction.

%value = alloca -> %ty 
Parameters:
  • instr – [out] pointer to the inst object created

  • ty – [in] type that is allocated

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_axpby_inst_create#

tinytc_status_t tinytc_axpby_inst_create(tinytc_inst_t *instr, tinytc_transpose_t tA, tinytc_bool_t atomic, tinytc_value_t alpha, tinytc_value_t A, tinytc_value_t beta, tinytc_value_t B, const tinytc_location_t *loc)#

Create axpby instruction.

axpby.<tA>.<atomic> %alpha, %A, %beta, %B : type(%alpha), type(%A), type(%beta), type(%B)
Parameters:
  • instr – [out] pointer to the inst object created

  • tA – [in] operation applied on A

  • atomic – [in] true for atomic updates of B

  • alpha – [in] \(\alpha\)

  • A – [in] A

  • beta – [in] \(\beta\)

  • B – [in] B

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_arith_inst_create#

tinytc_status_t tinytc_arith_inst_create(tinytc_inst_t *instr, tinytc_arithmetic_t op, tinytc_value_t a, tinytc_value_t b, const tinytc_location_t *loc)#

Create arithmetic instruction (binary)

%value = arith.<op> %a, %b : type(%a) ; type(%a) == type(%b) 
Parameters:
  • instr – [out] pointer to the inst object created

  • op – [in] arithmetic operation type

  • a – [in] left-hand operand

  • b – [in] right-hand operand

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_arith_unary_inst_create#

tinytc_status_t tinytc_arith_unary_inst_create(tinytc_inst_t *instr, tinytc_arithmetic_unary_t op, tinytc_value_t a, const tinytc_location_t *loc)#

Create arithmetic instruction (unary)

%value = arith.<op> %a : type(%a) 
Parameters:
  • instr – [out] pointer to the inst object created

  • op – [in] unary arithmetic operation type

  • a – [in] operand

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_cast_inst_create#

tinytc_status_t tinytc_cast_inst_create(tinytc_inst_t *instr, tinytc_value_t a, tinytc_scalar_type_t to_ty, const tinytc_location_t *loc)#

Create cast instruction.

%value = cast %a, %b : type(%a) -> %to_ty 
Parameters:
  • instr – [out] pointer to the inst object created

  • a – [in] operand

  • to_ty – [in] target type

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_cmp_inst_create#

tinytc_status_t tinytc_cmp_inst_create(tinytc_inst_t *instr, tinytc_cmp_condition_t cond, tinytc_value_t a, tinytc_value_t b, const tinytc_location_t *loc)#

Create binary op instruction.

%value = cmp.<cond> %a, %b : type(%a) ; type(%a) == type(%b) 
Parameters:
  • instr – [out] pointer to the inst object created

  • cond – [in] compare type

  • a – [in] left-hand operand

  • b – [in] right-hand operand

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_expand_inst_create#

tinytc_status_t tinytc_expand_inst_create(tinytc_inst_t *instr, tinytc_value_t a, int64_t mode, uint32_t expand_shape_size, tinytc_value_t *expand_shape, const tinytc_location_t *loc)#

Create expand instruction.

%value = expand %a[%mode -> %expand_shape] : type(%a) 
Parameters:
  • instr – [out] pointer to the inst object created

  • a – [in] operand

  • mode – [in] expanded mode

  • expand_shape_size – [in] dimension of expand shape; must be at least 2

  • expand_shape – [in][range(2, expand_shape_size)] expand shape array

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_for_inst_create#

tinytc_status_t tinytc_for_inst_create(tinytc_inst_t *instr, tinytc_value_t loop_var, tinytc_value_t from, tinytc_value_t to, tinytc_value_t step, tinytc_region_t body, const tinytc_location_t *loc)#

Create for loop.

for %loop_var = %from, %to, %step : type(%loop_var) { %body }
; type(%loop_var) == type(%from)
; type(%loop_var) == type(%to)
; type(%loop_var) == type(%step)
Parameters:
  • instr – [out] pointer to the inst object created

  • loop_var – [in] loop variable

  • from – [in] loop begion

  • to – [in] loop bound

  • step – [in][optional] loop step; can be nullptr

  • body – [in] loop body

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_foreach_inst_create#

tinytc_status_t tinytc_foreach_inst_create(tinytc_inst_t *instr, tinytc_value_t loop_var, tinytc_value_t from, tinytc_value_t to, tinytc_region_t body, const tinytc_location_t *loc)#

Create foreach loop.

foreach %loop_var = %from, %to : type(%loop_var) { %body }
; type(%loop_var) == type(%from)
; type(%loop_var) == type(%to)
Parameters:
  • instr – [out] pointer to the inst object created

  • loop_var – [in] loop variable

  • from – [in] loop begion

  • to – [in] loop bound

  • body – [in] loop body

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_fuse_inst_create#

tinytc_status_t tinytc_fuse_inst_create(tinytc_inst_t *instr, tinytc_value_t a, int64_t from, int64_t to, const tinytc_location_t *loc)#

Create fuse instruction.

%value = fuse %a[%from, %to] : type(%a) 
Parameters:
  • instr – [out] pointer to the inst object created

  • a – [in] operand

  • from – [in] first mode to fuse

  • to – [in] last mode to fuse

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_gemm_inst_create#

tinytc_status_t tinytc_gemm_inst_create(tinytc_inst_t *instr, tinytc_transpose_t tA, tinytc_transpose_t tB, tinytc_bool_t atomic, tinytc_value_t alpha, tinytc_value_t A, tinytc_value_t B, tinytc_value_t beta, tinytc_value_t C, const tinytc_location_t *loc)#

Create GEMM instruction.

gemm.<tA>.<tB>.<atomic> %alpha, %A, %B, %beta, %C
    : type(%alpha), type(%A), type(%B), type(%beta), type(%C)
Parameters:
  • instr – [out] pointer to the inst object created

  • tA – [in] operation applied on A

  • tB – [in] operation applied on B

  • atomic – [in] true for atomic updates of C

  • alpha – [in] \(\alpha\)

  • A – [in] A

  • B – [in] B

  • beta – [in] \(\beta\)

  • C – [in] C

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_gemv_inst_create#

tinytc_status_t tinytc_gemv_inst_create(tinytc_inst_t *instr, tinytc_transpose_t tA, tinytc_bool_t atomic, tinytc_value_t alpha, tinytc_value_t A, tinytc_value_t B, tinytc_value_t beta, tinytc_value_t C, const tinytc_location_t *loc)#

Create GEMV instruction.

gemv.<tA>.<atomic> %alpha, %A, %B, %beta, %C
    : type(%alpha), type(%A), type(%B), type(%beta), type(%C)
Parameters:
  • instr – [out] pointer to the inst object created

  • tA – [in] operation applied on A

  • atomic – [in] true for atomic updates of C

  • alpha – [in] \(\alpha\)

  • A – [in] A

  • B – [in] B

  • beta – [in] \(\beta\)

  • C – [in] C

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_ger_inst_create#

tinytc_status_t tinytc_ger_inst_create(tinytc_inst_t *instr, tinytc_bool_t atomic, tinytc_value_t alpha, tinytc_value_t A, tinytc_value_t B, tinytc_value_t beta, tinytc_value_t C, const tinytc_location_t *loc)#

Create GER instruction.

ger.<atomic> %alpha, %A, %B, %beta, %C
    : type(%alpha), type(%A), type(%B), type(%beta), type(%C)
Parameters:
  • instr – [out] pointer to the inst object created

  • atomic – [in] true for atomic updates of C

  • alpha – [in] \(\alpha\)

  • A – [in] A

  • B – [in] B

  • beta – [in] \(\beta\)

  • C – [in] C

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_group_id_inst_create#

tinytc_status_t tinytc_group_id_inst_create(tinytc_inst_t *instr, const tinytc_location_t *loc)#

Create group_id instruction.

%value = group_id 
Parameters:
  • instr – [out] pointer to the inst object created

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_group_size_inst_create#

tinytc_status_t tinytc_group_size_inst_create(tinytc_inst_t *instr, const tinytc_location_t *loc)#

Create group_size instruction.

%value = group_size 
Parameters:
  • instr – [out] pointer to the inst object created

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_hadamard_inst_create#

tinytc_status_t tinytc_hadamard_inst_create(tinytc_inst_t *instr, tinytc_bool_t atomic, tinytc_value_t alpha, tinytc_value_t A, tinytc_value_t B, tinytc_value_t beta, tinytc_value_t C, const tinytc_location_t *loc)#

Create Hadamard instruction.

hadamard.<atomic> %alpha, %A, %B, %beta, %C
    : type(%alpha), type(%A), type(%B), type(%beta), type(%C)
Parameters:
  • instr – [out] pointer to the inst object created

  • atomic – [in] true for atomic updates of C

  • alpha – [in] \(\alpha\)

  • A – [in] A

  • B – [in] B

  • beta – [in] \(\beta\)

  • C – [in] C

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_if_inst_create#

tinytc_status_t tinytc_if_inst_create(tinytc_inst_t *instr, tinytc_value_t condition, tinytc_region_t then, tinytc_region_t otherwise, uint32_t return_type_list_size, tinytc_scalar_type_t *return_type_list, const tinytc_location_t *loc)#

Create if condition.

if %condition { %then } else { %otherwise }
Parameters:
  • instr – [out] pointer to the inst object created

  • condition – [in] condition

  • then – [in] region taken if condition is true

  • otherwise – [in][optional] region taken if condition is false; can be nullptr

  • return_type_list_size – [in] length of return type array

  • return_type_list – [in][range(0, return_type_list_size)] return type array; can be nullptr if return_type_list_size is 0

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_load_inst_create#

tinytc_status_t tinytc_load_inst_create(tinytc_inst_t *instr, tinytc_value_t a, uint32_t index_list_size, tinytc_value_t *index_list, const tinytc_location_t *loc)#

Create load instruction.

%value = load %a[%index_list] : type(%a) 
Parameters:
  • instr – [out] pointer to the inst object created

  • a – [in] operand

  • index_list_size – [in] number of indices

  • index_list – [in][range(0, index_list_size)] indices array; may be nullptr if index_list_size is 0

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_size_inst_create#

tinytc_status_t tinytc_size_inst_create(tinytc_inst_t *instr, tinytc_value_t a, int64_t mode, const tinytc_location_t *loc)#

Create size instruction.

%value = size %a[%mode] : type(%a) 
Parameters:
  • instr – [out] pointer to the inst object created

  • a – [in] operand

  • mode – [in] mode for that the size is queried

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_store_inst_create#

tinytc_status_t tinytc_store_inst_create(tinytc_inst_t *instr, tinytc_value_t val, tinytc_value_t a, uint32_t index_list_size, tinytc_value_t *index_list, const tinytc_location_t *loc)#

Create store instruction.

store %val, %a[%index_list] : type(%a) 
Parameters:
  • instr – [out] pointer to the inst object created

  • val – [in] value to store

  • a – [in] operand

  • index_list_size – [in] number of indices

  • index_list – [in][range(0, index_list_size)] indices array; may be nullptr if index_list_size is 0

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_subview_inst_create#

tinytc_status_t tinytc_subview_inst_create(tinytc_inst_t *instr, tinytc_value_t a, uint32_t slice_list_size, tinytc_value_t *offset_list, tinytc_value_t *size_list, const tinytc_location_t *loc)#

Create subview instruction.

%value = subview %a[%offset1:%size1,...,%offsetN:%sizeN] : type(%a) 
Parameters:
  • instr – [out] pointer to the inst object created

  • a – [in] operand

  • slice_list_size – [in] number of slices

  • offset_list – [in][range(0, slice_list_size)] offset array; may be nullptr if slice_list_size is 0

  • size_list – [in][range(0, slice_list_size)] size array; may be nullptr if slice_list_size is 0; size_list[i] may be nullptr if a single offset shall be passed instead of a range for the i-th mode

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_sum_inst_create#

tinytc_status_t tinytc_sum_inst_create(tinytc_inst_t *instr, tinytc_transpose_t tA, tinytc_bool_t atomic, tinytc_value_t alpha, tinytc_value_t A, tinytc_value_t beta, tinytc_value_t B, const tinytc_location_t *loc)#

Create sum instruction.

sum.<tA>.<atomic> %alpha, %A, %beta, %B : type(%alpha), type(%A), type(%beta), type(%B)
Parameters:
  • instr – [out] pointer to the inst object created

  • tA – [in] operation applied on A

  • atomic – [in] true for atomic updates of C

  • alpha – [in] \(\alpha\)

  • A – [in] A

  • beta – [in] \(\beta\)

  • B – [in] B

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_yield_inst_create#

tinytc_status_t tinytc_yield_inst_create(tinytc_inst_t *instr, uint32_t yield_list_size, tinytc_value_t *yield_list, const tinytc_location_t *loc)#

Create yield instruction.

yield %identifier1, ..., %identifierN : type(%identifier1), ..., type(%identifierN)
Parameters:
  • instr – [out] pointer to the inst object created

  • yield_list_size – [in] length of yielded values list; must be at least 1

  • yield_list – [in][range(1, yield_list_size)] yielded values array

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_inst_get_value#

tinytc_status_t tinytc_inst_get_value(const_tinytc_inst_t instr, tinytc_value_t *result)#

Get value produced by instruction.

Parameters:
  • instr – [in] inst object

  • result – [out] result value; may be set to nullptr if instruction does not return a value

Returns:

tinytc_status_success on success and error otherwise

tinytc_inst_get_values#

tinytc_status_t tinytc_inst_get_values(const_tinytc_inst_t instr, uint32_t *result_list_size, tinytc_value_t *result_list)#

Get values produced by instruction.

Function can be called with result_list_size = 0 and result_list = nullptr in order to obtain the number of results

Parameters:
  • instr – [in] inst object

  • result_list_size – [inout] number of results to fetch; is updated with the actual value

  • result_list – [out][range(0, result_list_size)] user-provided memory for storing result handles; at most result_list_size values are written; can be nullptr if result_list_size is 0

Returns:

tinytc_status_success on success and error otherwise

tinytc_inst_release#

tinytc_status_t tinytc_inst_release(tinytc_inst_t instr)#

Release inst object.

Decreases reference count by 1, free memory if reference count is 0.

Parameters:
  • instr – [inout] inst object

Returns:

tinytc_status_success on success and error otherwise

tinytc_inst_retain#

tinytc_status_t tinytc_inst_retain(tinytc_inst_t instr)#

Increase reference count of inst object by 1.

Parameters:
  • instr – [inout] inst object

Returns:

tinytc_status_success on success and error otherwise

Program#

Program Functions#

tinytc_program_create#

tinytc_status_t tinytc_program_create(tinytc_prog_t *prg, uint32_t fun_list_size, tinytc_func_t *fun_list, const tinytc_location_t *loc)#

Create program.

Parameters:
  • prg – [out] pointer to the prog object created

  • fun_list_size – [in] length of func array

  • fun_list – [in][range(0, fun_list_size)] func array; can be nullptr if fun_list_size is 0

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_prog_dump#

tinytc_status_t tinytc_prog_dump(const_tinytc_prog_t prg)#

Dump program to stderr.

Parameters:
  • prg – [in] program object

Returns:

tinytc_status_success on success and error otherwise

tinytc_prog_print_to_file#

tinytc_status_t tinytc_prog_print_to_file(const_tinytc_prog_t prg, char const *filename)#

Print program to file.

Parameters:
  • prg – [in] program object

  • filename – [in] filename

Returns:

tinytc_status_success on success and error otherwise

tinytc_prog_print_to_string#

tinytc_status_t tinytc_prog_print_to_string(const_tinytc_prog_t prg, char **str)#

Print program to string.

The user is responsible to dispose the string with tinytc_string_destroy.

Parameters:
  • prg – [in] program object

  • str – [out] pointer to string

Returns:

tinytc_status_success on success and error otherwise

tinytc_prog_release#

tinytc_status_t tinytc_prog_release(tinytc_prog_t prg)#

Release program object.

Decreases reference count by 1, free memory if reference count is 0.

Parameters:
  • prg – [inout] program object

Returns:

tinytc_status_success on success and error otherwise

tinytc_prog_retain#

tinytc_status_t tinytc_prog_retain(tinytc_prog_t prg)#

Increase reference count of program object by 1.

Parameters:
  • prg – [inout] program object

Returns:

tinytc_status_success on success and error otherwise

Region#

Region Functions#

tinytc_region_create#

tinytc_status_t tinytc_region_create(tinytc_region_t *reg, uint32_t instruction_list_size, tinytc_inst_t *instruction_list, const tinytc_location_t *loc)#

Create region.

Parameters:
  • reg – [out] pointer to the region object created

  • instruction_list_size – [in] length of instruction array

  • instruction_list – [in][range(0, instruction_list_size)] instruction array; can be nullptr if instruction_list_size is 0

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_region_release#

tinytc_status_t tinytc_region_release(tinytc_region_t reg)#

Release region object.

Decreases reference count by 1, free memory if reference count is 0.

Parameters:
  • reg – [inout] region object

Returns:

tinytc_status_success on success and error otherwise

tinytc_region_retain#

tinytc_status_t tinytc_region_retain(tinytc_region_t reg)#

Increase reference count of region object by 1.

Parameters:
  • reg – [inout] region object

Returns:

tinytc_status_success on success and error otherwise

Value#

Value Functions#

tinytc_float_imm_create#

tinytc_status_t tinytc_float_imm_create(tinytc_value_t *vl, double imm, tinytc_scalar_type_t type, const tinytc_location_t *loc)#

Create floating point immediate value.

Parameters:
  • vl – [out] pointer to the value object created

  • imm – [in] immediate value

  • type – [in] type of immediate value

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_int_imm_create#

tinytc_status_t tinytc_int_imm_create(tinytc_value_t *vl, int64_t imm, tinytc_scalar_type_t type, const tinytc_location_t *loc)#

Create integer immediate value.

Parameters:
  • vl – [out] pointer to the value object created

  • imm – [in] immediate value

  • type – [in] type of immediate value

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_value_create#

tinytc_status_t tinytc_value_create(tinytc_value_t *vl, tinytc_data_type_t type, const tinytc_location_t *loc)#

Create value.

Parameters:
  • vl – [out] pointer to the value object created

  • type – [in] data type object

  • loc – [in][optional] Source code location; can be nullptr

Returns:

tinytc_status_success on success and error otherwise

tinytc_value_get_name#

tinytc_status_t tinytc_value_get_name(const_tinytc_value_t vl, char const **name)#

Get name of value.

The returned pointer may be invalidated if the value or any node in the abstract syntax tree referencing the value is modified.

Parameters:
  • vl – [in] value object

  • name – [out] pointer to C string

Returns:

tinytc_status_success on success and error otherwise

tinytc_value_set_name#

tinytc_status_t tinytc_value_set_name(tinytc_value_t vl, char const *name)#

Set name of value.

Parameters:
  • vl – [inout] value object

  • name – [in] name; null-terminated string

Returns:

tinytc_status_success on success and error otherwise

tinytc_value_release#

tinytc_status_t tinytc_value_release(tinytc_value_t vl)#

Release value object.

Decreases reference count by 1, free memory if reference count is 0.

Parameters:
  • vl – [inout] value object

Returns:

tinytc_status_success on success and error otherwise

tinytc_value_retain#

tinytc_status_t tinytc_value_retain(tinytc_value_t vl)#

Increase reference count of value object by 1.

Parameters:
  • vl – [inout] value object

Returns:

tinytc_status_success on success and error otherwise