CoopSync for TBB 0.1.0
Cooperative synchronization primitives for TBB resumable tasks
Loading...
Searching...
No Matches
coopsync_tbb::onnx Namespace Reference

ONNX Runtime integration. More...

Functions

static COOPSYNC_TBB_ONNX_NODISCARDinline ::OrtStatus * wait_for (const ::OrtApi *api, ::OrtSession *session, const ::OrtRunOptions *run_options, const char *const *input_names, const ::OrtValue *const *input_values, std::size_t input_count, const char *const *output_names, std::size_t output_count, ::OrtValue **output_values)
 Suspends the current TBB task until an ORT session RunAsync is complete. Accepts ONXX Runtime C API arguments.
static void wait_for (::Ort::Session &session, const ::Ort::RunOptions &run_options, const char *const *input_names, const ::Ort::Value *input_values, std::size_t input_count, const char *const *output_names, ::Ort::Value *output_values, std::size_t output_count)
 Suspends the current TBB task until an ORT session RunAsync is complete. Accepts ONXX Runtime C++ API arguments.

Detailed Description

ONNX Runtime integration.

Function Documentation

◆ wait_for() [1/2]

void coopsync_tbb::onnx::wait_for ( ::Ort::Session & session,
const ::Ort::RunOptions & run_options,
const char *const * input_names,
const ::Ort::Value * input_values,
std::size_t input_count,
const char *const * output_names,
::Ort::Value * output_values,
std::size_t output_count )
inlinestatic

Suspends the current TBB task until an ORT session RunAsync is complete. Accepts ONXX Runtime C++ API arguments.

Parameters
[in]sessionThe Ort::Session to run.
[in]run_optionsThe Ort::RunOptions to use for the RunAsync call.
[in]input_namesArray of null terminated UTF8 encoded strings of the input names.
[in]input_valuesArray of Ort::Values of the input values.
[in]input_countNumber of elements in the input_names and inputs arrays.
[in]output_namesArray of null terminated UTF8 encoded strings of the output names.
[out]output_valuesArray of provided Values to be filled with outputs. On calling, output_values[i] could either be initialized by a null pointer or a preallocated Ort::Value*. It is caller's duty to finally release output_values and each of its member, regardless of whether the member (Ort::Value) is allocated by onnxruntime or preallocated by the caller.
[in]output_countNumber of elements in the output_names and outputs array.
Exceptions
Ort::Exceptionon error. The exception will contain the status message from the ORT callback.

Calls the session.RunAsync with the provided arguments and a callback that resumes the current TBB task. The task is suspended until the callback is invoked, at which point the status from the callback is checked and an exception is thrown if it indicates an error. The arguments follow the same semantics as the Ort::Session::RunAsync.

Note
In case of error during callback setup, the task is resumed immediately.

◆ wait_for() [2/2]

COOPSYNC_TBB_ONNX_NODISCARDinline ::OrtStatus * coopsync_tbb::onnx::wait_for ( const ::OrtApi * api,
::OrtSession * session,
const ::OrtRunOptions * run_options,
const char *const * input_names,
const ::OrtValue *const * input_values,
std::size_t input_count,
const char *const * output_names,
std::size_t output_count,
::OrtValue ** output_values )
static

Suspends the current TBB task until an ORT session RunAsync is complete. Accepts ONXX Runtime C API arguments.

Parameters
[in]apiThe OrtApi to use for the RunAsync call.
[in]sessionThe OrtSession to run.
[in]run_optionsIf nullptr, will use a default OrtRunOptions.
[in]input_namesArray of null terminated UTF8 encoded strings of the input names.
[in]input_valuesArray of OrtValue of the input values
[in]input_countNumber of elements in the input_names and inputs arrays.
[in]output_namesArray of null terminated UTF8 encoded strings of the output names.
[in]output_countNumber of elements in the output_names and outputs array.
[out]output_valuesOrtValue* array of size output_count. On calling, output_values[i] could either be a null or a pointer to a preallocated OrtValue. It is caller's duty to finally release the output array and each of its member, regardless of whether the member (OrtValue*) is allocated by onnxruntime or preallocated by the caller.
Returns
The OrtStatus* passed by ORT to the callback. On success, this is nullptr. The caller owns the returned status and must release it via OrtApi::ReleaseStatus when non-null.

Calls the api->RunAsync with the provided arguments and a callback that resumes the current TBB task. The task is suspended until the callback is invoked. The arguments follow the same semantics as the OrtApi::RunAsync.

Note
In case of error during callback setup, the task is resumed immediately.