Session Filters Handling

Session Filters Handling#

rocprofiler: Session Filters Handling

Data Structures

struct  rocprofiler_att_parameter_t
 
struct  rocprofiler_filter_property_t
 Filter Data Type filter data will be used to report required and optional filters for the sessions using ::rocprofiler_session_add_filters. More...
 
struct  rocprofiler_spm_parameter_t
 
struct  rocprofiler_counters_sampler_counter_input_t
 
struct  rocprofiler_counters_sampler_counter_output_t
 
struct  rocprofiler_counters_sampler_parameters_t
 
struct  rocprofiler_record_counters_sampler_t
 
union  rocprofiler_filter_data_t
 Filter Kind Data. More...
 

Typedefs

typedef const char * rocprofiler_hip_function_name_t
 
typedef const char * rocprofiler_hsa_function_name_t
 
typedef void(* rocprofiler_sync_callback_t) (rocprofiler_record_tracer_t record, rocprofiler_session_id_t session_id)
 Synchronous Callback To be only used by rocprofiler_set_api_trace_sync_callback, please refer to rocprofiler_set_api_trace_sync_callback for more details. More...
 

Enumerations

enum  rocprofiler_filter_kind_t {
  ROCPROFILER_DISPATCH_TIMESTAMPS_COLLECTION = 1 , ROCPROFILER_COUNTERS_COLLECTION = 2 , ROCPROFILER_PC_SAMPLING_COLLECTION = 3 , ROCPROFILER_ATT_TRACE_COLLECTION = 4 ,
  ROCPROFILER_SPM_COLLECTION = 5 , ROCPROFILER_API_TRACE = 6 , ROCPROFILER_COUNTERS_SAMPLER = 7
}
 
enum  rocprofiler_filter_property_kind_t {
  ROCPROFILER_FILTER_HSA_TRACER_API_FUNCTIONS = 1 , ROCPROFILER_FILTER_HIP_TRACER_API_FUNCTIONS = 2 , ROCPROFILER_FILTER_GPU_NAME = 3 , ROCPROFILER_FILTER_RANGE = 4 ,
  ROCPROFILER_FILTER_KERNEL_NAMES = 5 , ROCPROFILER_FILTER_DISPATCH_IDS = 6
}
 Data Filter Types to be used by ::rocprofiler_session_set_filter to add filters to a specific session. More...
 
enum  rocprofiler_att_parameter_name_t {
  ROCPROFILER_ATT_COMPUTE_UNIT = 0 , ROCPROFILER_ATT_VMID_MASK = 1 , ROCPROFILER_ATT_SE_MASK = 5 , ROCPROFILER_ATT_SIMD_SELECT = 8 ,
  ROCPROFILER_ATT_OCCUPANCY = 9 , ROCPROFILER_ATT_BUFFER_SIZE = 10 , ROCPROFILER_ATT_CAPTURE_MODE = 11 , ROCPROFILER_ATT_PERF_MASK = 240 ,
  ROCPROFILER_ATT_PERF_CTRL = 241 , ROCPROFILER_ATT_PERFCOUNTER = 242 , ROCPROFILER_ATT_PERFCOUNTER_NAME = 243 , ROCPROFILER_ATT_MAXVALUE ,
  ROCPROFILER_ATT_MASK = 2 , ROCPROFILER_ATT_TOKEN_MASK = 3 , ROCPROFILER_ATT_TOKEN_MASK2 = 4 , ROCPROFILER_ATT_SAMPLE_RATE = 6
}
 ATT parameters to be used by for collection. More...
 
enum  rocprofiler_counters_sampler_counter_type_t { ROCPROFILER_COUNTERS_SAMPLER_PCIE_COUNTERS = 0 , ROCPROFILER_COUNTERS_SAMPLER_XGMI_COUNTERS = 1 }
 

Functions

ROCPROFILER_API rocprofiler_status_t rocprofiler_create_filter (rocprofiler_session_id_t session_id, rocprofiler_filter_kind_t filter_kind, rocprofiler_filter_data_t data, uint64_t data_count, rocprofiler_filter_id_t *filter_id, rocprofiler_filter_property_t property) ROCPROFILER_VERSION_9_0
 Create Session Filter This function will create filter and associate it with a specific session For every kind, one filter only is allowed per session. More...
 
ROCPROFILER_API rocprofiler_status_t rocprofiler_set_filter_buffer (rocprofiler_session_id_t session_id, rocprofiler_filter_id_t filter_id, rocprofiler_buffer_id_t buffer_id) ROCPROFILER_VERSION_9_0
 Set Session Filter Buffer This function will associate buffer to a specific filter. More...
 
ROCPROFILER_API rocprofiler_status_t rocprofiler_set_api_trace_sync_callback (rocprofiler_session_id_t session_id, rocprofiler_filter_id_t filter_id, rocprofiler_sync_callback_t callback) ROCPROFILER_VERSION_9_0
 Set Session API Tracing Filter Synchronous Callback This function will associate buffer to a specific filter. More...
 
ROCPROFILER_API rocprofiler_status_t rocprofiler_destroy_filter (rocprofiler_session_id_t session_id, rocprofiler_filter_id_t filter_id) ROCPROFILER_VERSION_9_0
 Destroy Session Filter This function will destroy a specific filter. More...
 
ROCPROFILER_API rocprofiler_status_t rocprofiler_create_buffer (rocprofiler_session_id_t session_id, rocprofiler_buffer_callback_t buffer_callback, size_t buffer_size, rocprofiler_buffer_id_t *buffer_id) ROCPROFILER_VERSION_9_0
 Create Buffer This function will create a buffer that can be associated with a filter. More...
 
ROCPROFILER_API rocprofiler_status_t rocprofiler_set_buffer_properties (rocprofiler_session_id_t session_id, rocprofiler_buffer_id_t buffer_id, rocprofiler_buffer_property_t *buffer_properties, uint32_t buffer_properties_count) ROCPROFILER_VERSION_9_0
 Setting Buffer Properties This function will set buffer properties. More...
 
ROCPROFILER_API rocprofiler_status_t rocprofiler_destroy_buffer (rocprofiler_session_id_t session_id, rocprofiler_buffer_id_t buffer_id) ROCPROFILER_VERSION_9_0
 Destroy Buffer This function will destroy a buffer given its id and session id. More...
 

Detailed Description

Typedef Documentation

◆ rocprofiler_hip_function_name_t

typedef const char* rocprofiler_hip_function_name_t

◆ rocprofiler_hsa_function_name_t

typedef const char* rocprofiler_hsa_function_name_t

◆ rocprofiler_sync_callback_t

typedef void(* rocprofiler_sync_callback_t) (rocprofiler_record_tracer_t record, rocprofiler_session_id_t session_id)

Synchronous Callback To be only used by rocprofiler_set_api_trace_sync_callback, please refer to rocprofiler_set_api_trace_sync_callback for more details.

Parameters
[in]recordpointer to the record.
[in]session_idThe session id associated with that record

Enumeration Type Documentation

◆ rocprofiler_att_parameter_name_t

ATT parameters to be used by for collection.

Enumerator
ROCPROFILER_ATT_COMPUTE_UNIT 

Select the target compute unit (wgp) for profiling.

ROCPROFILER_ATT_VMID_MASK 

VMID Mask.

ROCPROFILER_ATT_SE_MASK 

Shader engine mask for selection.

ROCPROFILER_ATT_SIMD_SELECT 

Set SIMD Mask (GFX9) or SIMD ID for collection (Navi)

ROCPROFILER_ATT_OCCUPANCY 

Set true for occupancy collection only.

ROCPROFILER_ATT_BUFFER_SIZE 

ATT collection max data size, in MB.

Shared among shader engines.

ROCPROFILER_ATT_CAPTURE_MODE 

Set ISA capture during ATT collection (rocprofiler_codeobj_capture_mode_t)

ROCPROFILER_ATT_PERF_MASK 

Mask of which compute units to generate perfcounters.

GFX9 only.

ROCPROFILER_ATT_PERF_CTRL 

Select collection period for perfcounters.

GFX9 only.

ROCPROFILER_ATT_PERFCOUNTER 

Select perfcounter ID (SQ block) for collection.

GFX9 only.

ROCPROFILER_ATT_PERFCOUNTER_NAME 

Select perfcounter name (SQ block) for collection.

GFX9 only.

ROCPROFILER_ATT_MAXVALUE 
ROCPROFILER_ATT_MASK 
ROCPROFILER_ATT_TOKEN_MASK 

Deprecated.

ROCPROFILER_ATT_TOKEN_MASK2 

Deprecated.

ROCPROFILER_ATT_SAMPLE_RATE 

Deprecated.

◆ rocprofiler_counters_sampler_counter_type_t

Enumerator
ROCPROFILER_COUNTERS_SAMPLER_PCIE_COUNTERS 
ROCPROFILER_COUNTERS_SAMPLER_XGMI_COUNTERS 

◆ rocprofiler_filter_kind_t

Enumerator
ROCPROFILER_DISPATCH_TIMESTAMPS_COLLECTION 

Kernel Dispatch Timestamp collection.

ROCPROFILER_COUNTERS_COLLECTION 

GPU Application counter collection.

ROCPROFILER_PC_SAMPLING_COLLECTION 

PC Sampling collection.

(Not Yet Supported)

ROCPROFILER_ATT_TRACE_COLLECTION 

ATT Tracing.

ROCPROFILER_SPM_COLLECTION 

SPM collection.

(Not Yet Supported)

ROCPROFILER_API_TRACE 

HIP/HSA/ROCTX/SYS Trace.

ROCPROFILER_COUNTERS_SAMPLER 

Sampled Counters.

◆ rocprofiler_filter_property_kind_t

Data Filter Types to be used by ::rocprofiler_session_set_filter to add filters to a specific session.

Enumerator
ROCPROFILER_FILTER_HSA_TRACER_API_FUNCTIONS 

Add HSA API calls that will be only traced (ex.

hsa_amd_memory_async_copy)

ROCPROFILER_FILTER_HIP_TRACER_API_FUNCTIONS 

Add HIP API calls that will be only traced (ex.

hipLaunchKernel)

ROCPROFILER_FILTER_GPU_NAME 

Add GPU names that will be only profiled or traced.

ROCPROFILER_FILTER_RANGE 

Add Range of calls to be traced or kernels to be profiled.

ROCPROFILER_FILTER_KERNEL_NAMES 

Add Kernel names that will be profiled or traced.

ROCPROFILER_FILTER_DISPATCH_IDS 

Add Kernel correlation ids that will be profiled or traced for ATT.

Function Documentation

◆ rocprofiler_create_buffer()

ROCPROFILER_API rocprofiler_status_t rocprofiler_create_buffer ( rocprofiler_session_id_t  session_id,
rocprofiler_buffer_callback_t  buffer_callback,
size_t  buffer_size,
rocprofiler_buffer_id_t buffer_id 
)

Create Buffer This function will create a buffer that can be associated with a filter.

Parameters
[in]session_idSession id where these filters will applied to
[in]buffer_callbackProviding a callback for the buffer specialized for that filters
[in]buffer_sizeProviding size for the buffer that will be created
[in]buffer_propertiesArray of Flush Properties provided by the user
[in]buffer_properties_countThe count of the flush properties in the array
[out]buffer_idBuffer id that was created
Return values
ROCPROFILER_STATUS_SUCCESSThe function has been executed successfully.
ROCPROFILER_STATUS_ERROR_NOT_INITIALIZED,ifrocprofiler_initialize wasn't called before or if rocprofiler_finalize is called
::ROCPROFILER_STATUS_SESSION_NOT_FOUNDCouldn't find session associated with the given session identifier
::ROCPROFILER_STATUS_ERROR_SESSION_PROPERTIES_MISMATCHThe given properties data are mismatching the properties kind
::ROCPROFILER_STATUS_ERROR_PROPERTY_DATA_CORRUPTEDData can't be read or corrupted

◆ rocprofiler_create_filter()

ROCPROFILER_API rocprofiler_status_t rocprofiler_create_filter ( rocprofiler_session_id_t  session_id,
rocprofiler_filter_kind_t  filter_kind,
rocprofiler_filter_data_t  data,
uint64_t  data_count,
rocprofiler_filter_id_t filter_id,
rocprofiler_filter_property_t  property 
)

Create Session Filter This function will create filter and associate it with a specific session For every kind, one filter only is allowed per session.

Parameters
[in]session_idSession id where these filters will applied to
[in]filter_kindFilter kind associated with these filters
[in]dataPointer to the filter data
[in]data_countCount of data in the data array given in ::data
[out]filter_idThe id of the filter created
[in]propertyproperty needed for more filteration requests by the user (Only one property is allowed per filter) (Optional)
Return values
ROCPROFILER_STATUS_SUCCESSThe function has been executed successfully.
ROCPROFILER_STATUS_ERROR_NOT_INITIALIZED,ifrocprofiler_initialize wasn't called before or if rocprofiler_finalize is called
::ROCPROFILER_STATUS_SESSION_NOT_FOUNDCouldn't find session associated with the given session identifier
ROCPROFILER_STATUS_ERROR_SESSION_FILTER_DATA_MISMATCH
The session filter can't accept the given data
ROCPROFILER_STATUS_ERROR_FILTER_DATA_CORRUPTED
Data can't be read or corrupted

◆ rocprofiler_destroy_buffer()

ROCPROFILER_API rocprofiler_status_t rocprofiler_destroy_buffer ( rocprofiler_session_id_t  session_id,
rocprofiler_buffer_id_t  buffer_id 
)

Destroy Buffer This function will destroy a buffer given its id and session id.

Parameters
[in]session_idSession id where these filters will applied to
[in]buffer_idBuffer id that will b e destroyed
Return values
ROCPROFILER_STATUS_SUCCESSThe function has been executed successfully.
ROCPROFILER_STATUS_ERROR_NOT_INITIALIZED,ifrocprofiler_initialize wasn't called before or if rocprofiler_finalize is called
::ROCPROFILER_STATUS_SESSION_NOT_FOUNDCouldn't find session associated with the given session identifier
::ROCPROFILER_STATUS_BUFFER_NOT_FOUNDCouldn't find buffer associated with the given buffer identifier
::ROCPROFILER_STATUS_ERROR_SESSION_PROPERTIES_MISMATCHThe given properties data are mismatching the properties kind
::ROCPROFILER_STATUS_ERROR_PROPERTY_DATA_CORRUPTEDData can't be read or corrupted

◆ rocprofiler_destroy_filter()

ROCPROFILER_API rocprofiler_status_t rocprofiler_destroy_filter ( rocprofiler_session_id_t  session_id,
rocprofiler_filter_id_t  filter_id 
)

Destroy Session Filter This function will destroy a specific filter.

Parameters
[in]session_idSession id where these filters will applied to
[in]filter_idThe id of the filter
Return values
ROCPROFILER_STATUS_SUCCESSThe function has been executed successfully.
ROCPROFILER_STATUS_ERROR_NOT_INITIALIZED,ifrocprofiler_initialize wasn't called before or if rocprofiler_finalize is called
::ROCPROFILER_STATUS_SESSION_NOT_FOUNDCouldn't find session associated with the given session identifier
::ROCPROFILER_STATUS_FILTER_NOT_FOUNDCouldn't find session filter

◆ rocprofiler_set_api_trace_sync_callback()

ROCPROFILER_API rocprofiler_status_t rocprofiler_set_api_trace_sync_callback ( rocprofiler_session_id_t  session_id,
rocprofiler_filter_id_t  filter_id,
rocprofiler_sync_callback_t  callback 
)

Set Session API Tracing Filter Synchronous Callback This function will associate buffer to a specific filter.

Currently Synchronous callbacks are only available to API Tracing filters for the api calls tracing and not available for the api activities or any other filter type, the user is responsible to create and set buffer for the other types

Parameters
[in]session_idSession id where these filters will applied to
[in]filter_idThe id of the filter
[in]callbackSynchronous callback
Return values
ROCPROFILER_STATUS_SUCCESSThe function has been executed successfully.
ROCPROFILER_STATUS_ERROR_NOT_INITIALIZED,ifrocprofiler_initialize wasn't called before or if rocprofiler_finalize is called
::ROCPROFILER_STATUS_SESSION_NOT_FOUND,Couldn'tfind session associated with the given session identifier
ROCPROFILER_STATUS_ERROR_FILTER_NOT_SUPPORTED
if the filter is not related to API tracing

◆ rocprofiler_set_buffer_properties()

ROCPROFILER_API rocprofiler_status_t rocprofiler_set_buffer_properties ( rocprofiler_session_id_t  session_id,
rocprofiler_buffer_id_t  buffer_id,
rocprofiler_buffer_property_t buffer_properties,
uint32_t  buffer_properties_count 
)

Setting Buffer Properties This function will set buffer properties.

Parameters
[in]session_idSession id where the buffer is associated with
[in]buffer_idBuffer id of the buffer that the properties are going to be associated with for that filters
[in]buffer_propertiesArray of Flush Properties provided by the user
[in]buffer_properties_countThe count of the flush properties in the array
Return values
ROCPROFILER_STATUS_SUCCESSThe function has been executed successfully.
ROCPROFILER_STATUS_ERROR_NOT_INITIALIZED,ifrocprofiler_initialize wasn't called before or if rocprofiler_finalize is called
::ROCPROFILER_STATUS_SESSION_NOT_FOUNDCouldn't find session associated with the given session identifier
::ROCPROFILER_STATUS_BUFFER_NOT_FOUNDCouldn't find buffer associated with the given buffer identifier
::ROCPROFILER_STATUS_ERROR_SESSION_PROPERTIES_MISMATCHThe given properties data are mismatching the properties kind
::ROCPROFILER_STATUS_ERROR_PROPERTY_DATA_CORRUPTEDData can't be read or corrupted

◆ rocprofiler_set_filter_buffer()

ROCPROFILER_API rocprofiler_status_t rocprofiler_set_filter_buffer ( rocprofiler_session_id_t  session_id,
rocprofiler_filter_id_t  filter_id,
rocprofiler_buffer_id_t  buffer_id 
)

Set Session Filter Buffer This function will associate buffer to a specific filter.

if the user wants to get the API traces for the api calls synchronously then the user is required to call rocprofiler_set_api_trace_sync_callback

Parameters
[in]session_idSession id where these filters will applied to
[in]filter_idThe id of the filter
[in]buffer_idThe id of the buffer
Return values
ROCPROFILER_STATUS_SUCCESSThe function has been executed successfully.
ROCPROFILER_STATUS_ERROR_NOT_INITIALIZED,ifrocprofiler_initialize wasn't called before or if rocprofiler_finalize is called
::ROCPROFILER_STATUS_SESSION_NOT_FOUNDCouldn't find session associated with the given session identifier