/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocal/checkouts/develop/rocAL/include/api/rocal_api.h File Reference

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocal/checkouts/develop/rocAL/include/api/rocal_api.h File Reference#

rocAL: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocal/checkouts/develop/rocAL/include/api/rocal_api.h File Reference
rocal_api.h File Reference

The AMD rocAL Library. More...

Go to the source code of this file.

Macros

#define ROCAL_INVALID_CONTEXT_EXCEPTION(p_context)
 
#define ROCAL_INVALID_CONTEXT_ERR(p_context, output)
 
#define ROCAL_INVALID_INPUT_ERR(input, output)
 
#define ROCAL_PRINT_EXCEPTION(context, e)
 
#define ROCAL_HANDLE_EXCEPTION(context, e, output)
 

Functions

RocalContext ROCAL_API_CALL rocalCreate (size_t batch_size, RocalProcessMode affinity, int gpu_id=0, size_t cpu_thread_count=1, size_t prefetch_queue_depth=3, RocalTensorOutputType output_tensor_data_type=RocalTensorOutputType::ROCAL_FP32, bool enable_checkpointing=false)
 rocalCreate creates the context for a new augmentation pipeline. Initializes all the required internals for the pipeline More...
 
RocalStatus ROCAL_API_CALL rocalVerify (RocalContext context)
 rocalVerify function to verify the graph for all the inputs and outputs More...
 
RocalStatus ROCAL_API_CALL rocalRun (RocalContext context)
 rocalRun function to process and run the built and verified graph. More...
 
RocalStatus ROCAL_API_CALL rocalRelease (RocalContext rocal_context)
 rocalRelease function to free all the resources allocated during the graph creation process. More...
 
RocalStatus ROCAL_API_CALL rocalSerialize (RocalContext rocal_context, size_t *serialized_string_size)
 Serialize the current pipeline into an opaque binary string. More...
 
RocalStatus ROCAL_API_CALL rocalGetSerializedString (RocalContext rocal_context, char *serialized_string)
 Copy the last serialized pipeline string into a user buffer. More...
 
RocalContext ROCAL_API_CALL rocalDeserialize (const char *serialized_pipeline, size_t serialized_string_size, RocalPipelineParams *pipe_params)
 Deserialize a pipeline from a serialized binary string. More...
 
RocalStatus ROCAL_API_CALL rocalCheckpoint (RocalContext rocal_context, size_t *serialized_ckpt_string_size)
 Serialize the current pipeline state into an opaque checkpoint blob. More...
 
RocalStatus ROCAL_API_CALL rocalGetSerializedCheckpointString (RocalContext rocal_context, char *serialized_ckpt_string)
 Copy the last serialized checkpoint blob into a user buffer. More...
 
RocalStatus ROCAL_API_CALL rocalRestoreFromSerializedCheckpoint (RocalContext rocal_context, const char *serialized_ckpt_string, size_t serialized_ckpt_size)
 Restore pipeline state from a serialized checkpoint blob. More...
 

Detailed Description

The AMD rocAL Library.

Macro Definition Documentation

◆ ROCAL_HANDLE_EXCEPTION

#define ROCAL_HANDLE_EXCEPTION (   context,
  e,
  output 
)
Value:
do { \
ROCAL_PRINT_EXCEPTION(context, e); \
context->master_graph->discard_tensor(output); \
output = {}; \
} while (0)

An entry point that fails must also discard the output tensor it had already created: these are extern "C" and cannot let the exception escape, so callers - the Python bindings among them - read a null return as "this call failed" and take the reason from rocalGetErrorMessage(). Returning the tensor of an operator that never joined the graph builds a pipeline that runs but produces nothing, and dropping it without discarding it leaks the tensor, or worse leaves it in the master graph's output lists as an output no node produces. discard_tensor() is the inverse of whichever create_tensor() overload made it. output must be a Tensor*; rocalNonSilentRegionDetection returns a struct of two tensors and so unwinds them itself.

◆ ROCAL_INVALID_CONTEXT_ERR

#define ROCAL_INVALID_CONTEXT_ERR (   p_context,
  output 
)
Value:
do { \
if (p_context == nullptr) { \
ERR("Invalid rocal context") \
return output; \
} \
} while (0)

◆ ROCAL_INVALID_CONTEXT_EXCEPTION

#define ROCAL_INVALID_CONTEXT_EXCEPTION (   p_context)
Value:
do { \
if (p_context == nullptr) \
THROW("Invalid rocal context") \
} while (0)

◆ ROCAL_INVALID_INPUT_ERR

#define ROCAL_INVALID_INPUT_ERR (   input,
  output 
)
Value:
do { \
if (input == nullptr) { \
ERR("Invalid input image") \
return output; \
} \
} while (0)

◆ ROCAL_PRINT_EXCEPTION

#define ROCAL_PRINT_EXCEPTION (   context,
  e 
)
Value:
do { \
context->capture_error(e.what()); \
std::cerr << e.what() << '\n'; \
} while (0)