C-API#

Device Info#

Device Info Functions#

tinytc_ze_core_info_create#

tinytc_status_t tinytc_ze_core_info_create(tinytc_core_info_t *info, ze_device_handle_t device)#

Query core info from level zero runtime.

Parameters:
  • info – [out] pointer to the core_info object created

  • device – [in] device handle

Returns:

tinytc_status_success on success and error otherwise

tinytc_ze_get_support_level#

tinytc_status_t tinytc_ze_get_support_level(ze_device_handle_t device, tinytc_support_level_t *level)#

Get support level of Level Zero device.

Parameters:
  • device – [in] Device handle

  • level – [out] Pointer to support level

Returns:

tinytc_status_success on success and error otherwise

Kernel#

Kernel Functions#

tinytc_ze_get_group_size#

tinytc_status_t tinytc_ze_get_group_size(ze_kernel_handle_t kernel, uint32_t *x, uint32_t *y, uint32_t *z)#

Get work group size for kernel.

Parameters:
  • kernel – [in] kernel handle

  • x – [out] pointer to group size in x dimension

  • y – [out] pointer to group size in y dimension

  • z – [out] pointer to group size in z dimension

Returns:

tinytc_status_success on success and error otherwise

tinytc_ze_kernel_create#

tinytc_status_t tinytc_ze_kernel_create(ze_kernel_handle_t *krnl, ze_module_handle_t mod, char const *name)#

Create a kernel and set group size.

Parameters:
  • krnl – [out] pointer to the kernel object created

  • mod – [in] module handle

  • name – [in] kernel name

Returns:

tinytc_status_success on success and error otherwise

tinytc_ze_kernel_bundle_create_with_binary#

tinytc_status_t tinytc_ze_kernel_bundle_create_with_binary(ze_module_handle_t *bundle, ze_context_handle_t context, ze_device_handle_t device, const_tinytc_binary_t bin)#

Create an OpenCL program from a tinytc binary.

Parameters:
  • bundle – [out] pointer to the kernel bundle (ze_module_handle_t) object created

  • context – [in] context handle

  • device – [in] device handle

  • bin – [in] binary object

Returns:

tinytc_status_success on success and error otherwise

tinytc_ze_kernel_bundle_create_with_program#

tinytc_status_t tinytc_ze_kernel_bundle_create_with_program(ze_module_handle_t *bundle, ze_context_handle_t context, ze_device_handle_t device, tinytc_prog_t prg, tinytc_core_feature_flags_t core_features)#

Compile tensor program.

Parameters:
  • bundle – [out] pointer to the kernel bundle (ze_module_handle_t) object created

  • context – [in] context handle

  • device – [in] device handle

  • prg – [inout] tensor program; modified as compiler passes are run

  • core_features – [in][optional] requested core features; must be 0 (default) or a combination of tinytc_core_feature_flag_t

Returns:

tinytc_status_success on success and error otherwise

Recipe#

Recipe Functions#

tinytc_ze_recipe_handler_create#

tinytc_status_t tinytc_ze_recipe_handler_create(tinytc_recipe_handler_t *handler, ze_context_handle_t context, ze_device_handle_t device, tinytc_recipe_t recipe)#

Create kernel object for recipe.

Parameters:
  • handler – [out] pointer to recipe handler object

  • context – [in] context handle

  • device – [in] device handle

  • recipe – [in] recipe object

Returns:

tinytc_status_success on success and error otherwise

tinytc_ze_recipe_handler_submit#

tinytc_status_t tinytc_ze_recipe_handler_submit(tinytc_recipe_handler_t handler, ze_command_list_handle_t list, ze_event_handle_t signal_event, uint32_t num_wait_events, ze_event_handle_t *wait_events)#

Submit recipe to device.

Parameters:
  • handler – [in] recipe handler object

  • list – [in] command list handle

  • signal_event – [inout][optional] event to be signalled on completion; can be nullptr

  • num_wait_events – [in][optional] number of events the kernel depends on

  • wait_events – [in][optional][range(0,num_wait_events)] array of events to wait on; can be nullptr if num_wait_events is 0

Returns:

tinytc_status_success on success and error otherwise