Intercept table for runtime libraries

Intercept table for runtime libraries#

Rocprofiler SDK Developer API: Intercept table for runtime libraries
Rocprofiler SDK Developer API 0.4.0
ROCm Profiling API and tools
Intercept table for runtime libraries

Enable tools to wrap the runtime API function calls of HIP, HSA, and ROCTx before and after the "real" implementation is called. More...

Typedefs

typedef void(* rocprofiler_intercept_library_cb_t) (rocprofiler_intercept_table_t type, uint64_t lib_version, uint64_t lib_instance, void **tables, uint64_t num_tables, void *user_data)
 Callback type when a new runtime library is loaded.
 

Functions

rocprofiler_status_t rocprofiler_at_intercept_table_registration (rocprofiler_intercept_library_cb_t callback, int libs, void *data)
 

Detailed Description

Enable tools to wrap the runtime API function calls of HIP, HSA, and ROCTx before and after the "real" implementation is called.

When an application invokes the public function from the HIP, HSA, and ROCTx libraries, these functions invoke a function pointer which, when properly chained, allow tools to wrap these function calls to collect information. When this capability is used alongside the rocprofiler API tracing, tools will wrap the rocprofiler wrappers of the API function, e.g. if the tool installs a wrapper around the hsa_init function called tool_hsa_init, and rocprofiler installs a wrapper around the hsa_init function called rocp_hsa_init, and within the HSA runtime library, the "real" implementation of the hsa_init invokes a function called real_hsa_init, the invocation chain (starting from within the user application) will be: <application> -> hsa_init -> tool_hsa_init -> rocp_hsa_init -> real_hsa_init. The return sequence will be the inverse of invocation chain: real_hsa_init -> rocp_hsa_init -> tool_hsa_init -> <application>. Thus, it is important for tools that use this feature to (A) call the next function in the chain and (B) properly handle the return value.

Typedef Documentation

◆ rocprofiler_intercept_library_cb_t

typedef void(* rocprofiler_intercept_library_cb_t) (rocprofiler_intercept_table_t type, uint64_t lib_version, uint64_t lib_instance, void **tables, uint64_t num_tables, void *user_data)

Callback type when a new runtime library is loaded.

See also
rocprofiler_at_intercept_table_registration
Parameters
[in]typeType of API table
[in]lib_versionMajor, minor, and patch version of library encoded into single number similar to ROCPROFILER_VERSION
[in]lib_instanceThe number of times this runtime library has been registered previously
[in]tablesAn array of pointers to the API tables
[in]num_tablesThe size of the array of pointers to the API tables
[in]user_dataThe pointer to the data provided to rocprofiler_at_intercept_table_registration

Definition at line 63 of file intercept_table.h.

Function Documentation

◆ rocprofiler_at_intercept_table_registration()

rocprofiler_status_t rocprofiler_at_intercept_table_registration ( rocprofiler_intercept_library_cb_t  callback,
int  libs,
void *  data 
)