C-API#
Common#
Functions
Common Functions#
tinytc_cl_convert_status#
-
tinytc_status_t tinytc_cl_convert_status(cl_int status)#
Device Info#
Device Info Functions#
tinytc_cl_core_info_create#
-
tinytc_status_t tinytc_cl_core_info_create(tinytc_core_info_t *info, cl_device_id device)#
Query core info from OpenCL 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_cl_get_support_level#
-
tinytc_status_t tinytc_cl_get_support_level(cl_device_id device, tinytc_support_level_t *level)#
Get support level of OpenCL device.
- Parameters:
device – [in] Device handle
level – [out] Pointer to support level
- Returns:
tinytc_status_success on success and error otherwise
Kernel#
Functions
Kernel Functions#
tinytc_cl_get_global_size#
-
void tinytc_cl_get_global_size(int64_t howmany, const size_t *local_size, size_t *global_size)#
Convert group size to opencl global range.
- Parameters:
howmany – group size
local_size – [in][range(0,3)] pointer to local size array of size >= 3
global_size – [out][range(0,3)] pointer to global size array of size >= 3
tinytc_cl_get_group_size#
-
tinytc_status_t tinytc_cl_get_group_size(cl_kernel kernel, size_t *local_size)#
Get work group size for kernel.
- Parameters:
kernel – [in] kernel handle
local_size – [out][range(0,3)] pointer to local size array of size >= 3 entries
- Returns:
tinytc_status_success on success and error otherwise
tinytc_cl_kernel_bundle_create_with_source#
-
tinytc_status_t tinytc_cl_kernel_bundle_create_with_source(cl_program *bundle, cl_context context, cl_device_id device, const_tinytc_source_t src, tinytc_source_context_t source_ctx)#
Compile OpenCL-C source to device binary.
- Parameters:
bundle – [out] pointer to the kernel bundle (cl_program) object created
context – [in] context handle
device – [in] device handle
src – [in] source text and extensions
source_ctx – [inout][optional] source context object to save extended error messages that are enhanced with source code context; can be nullptr
- Returns:
tinytc_status_success on success and error otherwise
tinytc_cl_kernel_bundle_create_with_program#
-
tinytc_status_t tinytc_cl_kernel_bundle_create_with_program(cl_program *bundle, cl_context context, cl_device_id device, tinytc_prog_t prg, tinytc_core_feature_flags_t core_features, tinytc_source_context_t source_ctx)#
Compile tensor program.
- Parameters:
bundle – [out] pointer to the kernel bundle (cl_program) 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
source_ctx – [inout][optional] source context object to save extended error messages that are enhanced with source code context; can be nullptr
- Returns:
tinytc_status_success on success and error otherwise
tinytc_cl_kernel_bundle_create_with_binary#
-
tinytc_status_t tinytc_cl_kernel_bundle_create_with_binary(cl_program *bundle, cl_context context, cl_device_id device, const_tinytc_binary_t bin, tinytc_source_context_t source_ctx)#
Create an OpenCL program from a tinytc binary.
- Parameters:
bundle – [out] pointer to the kernel bundle (cl_program) object created
context – [in] context handle
device – [in] device handle
bin – [in] binary object
source_ctx – [inout][optional] source context object to save extended error messages that are enhanced with source code context; can be nullptr
- Returns:
tinytc_status_success on success and error otherwise
Recipe#
Recipe Functions#
tinytc_cl_recipe_handler_create#
-
tinytc_status_t tinytc_cl_recipe_handler_create(tinytc_recipe_handler_t *handler, cl_context context, cl_device_id device, tinytc_recipe_t recipe, tinytc_source_context_t source_ctx)#
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
source_ctx – [inout][optional] source context object to save extended error messages that are enhanced with source code context; can be nullptr
- Returns:
tinytc_status_success on success and error otherwise
tinytc_cl_recipe_handler_submit#
-
tinytc_status_t tinytc_cl_recipe_handler_submit(tinytc_recipe_handler_t handler, cl_command_queue queue, cl_uint num_wait_events, const cl_event *wait_events, cl_event *event)#
Submit recipe to device.
- Parameters:
handler – [in] recipe handler object
queue – [in] command queue handle
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
event – [out][optional] pointer to event object created; can be nullptr
- Returns:
tinytc_status_success on success and error otherwise