Use -sdk suffix and reset VERSION to 0.0.0 (#263)

* Fix find_package(rocprofiler) in build tree

* Move include/rocprofiler to include/rocprofiler-sdk

* Update include/CMakeLists.txt

- add_subdirectory(rocprofiler-sdk)

* Move lib/rocprofiler to lib/rocprofiler-sdk

* Move lib/rocprofiler-tool to lib/rocprofiler-sdk-tool

* Update lib/CMakeLists.txt

- add_subdirectory(rocprofiler-sdk)
- add_subdirectory(rocprofiler-sdk-tool)

* Update lib/rocprofiler-sdk/CMakeLists.txt

* Rename rocprofiler-tool to rocprofiler-sdk-tool

* Replace include rocprofiler/ with include rocprofiler-sdk/

* Replace include lib/rocprofiler/ with include lib/rocprofiler-sdk/

* Set VERSION to 0.0.0 and finish install to rocprofiler-sdk

* More fixes for rocprofiler -> rocprofiler-sdk

- fix issue with rocprofiler-sdk-config.cmake.in
- fix counters xml install path

* Fix documentation generation

* Create rocprofiler_LIB_ROCPROFILER_SDK_DIR for build tree

* cmake formatting (cmake-format) (#264)

Co-authored-by: jrmadsen <jrmadsen@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Jonathan R. Madsenandgithub-actions[bot] authored and GitHub committed 2023-11-29 20:43:18 -06:00
1 parent fe5d074375
commit 9a0c84efa6
194 files changed
+1055 -593

No files matched your search

@@ -0,0 +1,41 @@
#
#
# Installation of public headers
#
#
configure_file(${CMAKE_CURRENT_LIST_DIR}/version.h.in
${CMAKE_CURRENT_BINARY_DIR}/version.h @ONLY)
set(ROCPROFILER_HEADER_FILES
# core headers
rocprofiler.h
rocprofiler_plugin.h
# secondary headers
agent.h
agent_profile.h
buffer.h
buffer_tracing.h
callback_tracing.h
context.h
counters.h
defines.h
dispatch_profile.h
external_correlation.h
fwd.h
hip.h
hsa.h
intercept_table.h
internal_threading.h
marker.h
pc_sampling.h
profile_config.h
registration.h
spm.h
${CMAKE_CURRENT_BINARY_DIR}/version.h)
install(FILES ${ROCPROFILER_HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocprofiler-sdk)
add_subdirectory(hip)
add_subdirectory(hsa)
add_subdirectory(marker)
+212
View File
@@ -0,0 +1,212 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/defines.h>
#include <rocprofiler-sdk/fwd.h>
#include <hsakmt/hsakmttypes.h>
#include <stdint.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup AGENTS Agent Information
* @brief needs brief description
*
* @{
*/
/**
* @brief Cache information for an agent.
*/
typedef struct rocprofiler_agent_cache_t
{
uint64_t processor_id_low; ///< Identifies the processor number
uint64_t size; ///< Size of the cache
uint32_t level; ///< Integer representing level: 1, 2, 3, 4, etc.
uint32_t cache_line_size; ///< Cache line size in bytes
uint32_t cache_lines_per_tag; ///< Cache lines per Cache Tag
uint32_t association; ///< Cache Associativity
uint32_t latency; ///< Cache latency in ns
HsaCacheType type;
} rocprofiler_agent_cache_t;
/**
* @brief IO link information for an agent.
*/
typedef struct rocprofiler_agent_io_link_t
{
HSA_IOLINKTYPE type; ///< Discoverable IoLink Properties (optional)
uint32_t version_major; ///< Bus interface version (optional)
uint32_t version_minor; ///< Bus interface version (optional)
uint32_t node_from; ///< See @ref rocprofiler_agent_id_t
uint32_t node_to; ///< See @ref rocprofiler_agent_id_t
uint32_t weight; ///< weight factor (derived from CDIT)
uint32_t min_latency; ///< minimum cost of time to transfer (rounded to ns)
uint32_t max_latency; ///< maximum cost of time to transfer (rounded to ns)
uint32_t min_bandwidth; ///< minimum interface Bandwidth in MB/s
uint32_t max_bandwidth; ///< maximum interface Bandwidth in MB/s
uint32_t recommended_transfer_size; ///< recommended transfer size to reach maximum bandwidth
///< in bytes
HSA_LINKPROPERTY flags; ///< override flags (may be active for specific platforms)
} rocprofiler_agent_io_link_t;
/**
* @brief Memory bank information for an agent.
*/
typedef struct rocprofiler_agent_mem_bank_t
{
HSA_HEAPTYPE heap_type;
HSA_MEMORYPROPERTY flags;
uint32_t width; ///< the number of parallel bits of the memoryinterface
uint32_t mem_clk_max; ///< clock for the memory, this allows computing the available
///< bandwidth to the memory when needed
uint64_t size_in_bytes; ///< physical memory size of the memory range in bytes
} rocprofiler_agent_mem_bank_t;
/**
* @brief Agent.
*/
typedef struct rocprofiler_agent_t
{
uint64_t size; ///< set to sizeof(rocprofiler_agent_t) by rocprofiler. This can be used for
///< versioning and compatibility handling
rocprofiler_agent_id_t id; ///< Internal opaque identifier
rocprofiler_agent_type_t type; ///< Enumeration for identifying the agent type (CPU, GPU, etc.)
uint32_t cpu_cores_count; ///< # of latency (= CPU) cores present on this HSA node. This value
///< is 0 for a HSA node with no such cores, e.g a "discrete HSA GPU"
uint32_t simd_count; ///< # of HSA throughtput (= GPU) FCompute cores ("SIMD") present in a
///< node. This value is 0 if no FCompute cores are present (e.g. pure
///< "CPU node").
uint32_t mem_banks_count; ///< # of discoverable memory bank affinity properties on this
///< "H-NUMA" node.
uint32_t caches_count; ///< # of discoverable cache affinity properties on this "H-NUMA" node.
uint32_t io_links_count; ///< # of discoverable IO link affinity properties of this node
///< connecting to other nodes.
uint32_t cpu_core_id_base; ///< low value of the logical processor ID of the latency (= CPU)
///< cores available on this node
uint32_t simd_id_base; ///< low value of the logical processor ID of the throughput (= GPU)
///< units available on this node
uint32_t max_waves_per_simd; ///< This identifies the max. number of launched waves per SIMD.
///< If NumFComputeCores is 0, this value is ignored.
uint32_t lds_size_in_kb; ///< Size of Local Data Store in Kilobytes per SIMD Wavefront
uint32_t gds_size_in_kb; ///< Size of Global Data Store in Kilobytes shared across SIMD
///< Wavefronts
uint32_t num_gws; ///< Number of GWS barriers
uint32_t wave_front_size; ///< Number of SIMD cores per wavefront executed, typically 64, may
///< be 32 or a different value for some HSA based architectures
uint32_t num_xcc; ///< Number of XCC
uint32_t cu_count; ///< Number of compute units
uint32_t array_count; ///< Number of SIMD arrays
uint32_t num_shader_banks; ///< Number of Shader Banks or Shader Engines, typical values are 1
///< or 2
uint32_t simd_arrays_per_engine; ///< Number of SIMD arrays per engine
uint32_t cu_per_simd_array; ///< Number of Compute Units (CU) per SIMD array
uint32_t simd_per_cu; ///< Number of SIMD representing a Compute Unit (CU)
uint32_t max_slots_scratch_cu; ///< Number of temp. memory ("scratch") wave slots available to
///< access, may be 0 if HW has no restrictions
uint32_t gfx_target_version; ///< major_version=((value / 10000) % 100)
///< minor_version=((value / 100) % 100)
///< patch_version=(value % 100)
uint16_t vendor_id; ///< GPU vendor id; 0 on latency (= CPU)-only nodes
uint16_t device_id; ///< GPU device id; 0 on latency (= CPU)-only nodes
uint32_t location_id; ///< GPU BDF (Bus/Device/function number) - identifies the device
///< location in the overall system
uint32_t domain; ///< PCI domain of the GPU
uint32_t drm_render_minor; ///< DRM render device minor device number
uint32_t num_sdma_engines; ///< number of PCIe optimized SDMA engines
uint32_t num_sdma_xgmi_engines; ///< number of XGMI optimized SDMA engines
uint32_t num_sdma_queues_per_engine; ///< number of SDMA queue per one engine
uint32_t num_cp_queues; ///< number of Compute queues
uint32_t max_engine_clk_ccompute; ///< maximum engine clocks for CPU, including any boost
///< capabilities
uint32_t max_engine_clk_fcompute; ///< GPU only. Maximum engine clocks for GPU, including any
///< boost capabilities
HSA_ENGINE_VERSION sdma_fw_version; ///< GPU only
HSA_ENGINE_ID
fw_version; ///< GPU only. Identifier (rev) of the GPU uEngine or Firmware, may be 0
HSA_CAPABILITY capability; ///< GPU only
uint32_t cu_per_engine; ///< computed
uint32_t max_waves_per_cu; ///< computed
uint32_t family_id; ///< Family code
uint32_t workgroup_max_size; ///< GPU only. Maximum total number of work-items in a work-group.
uint32_t grid_max_size; ///< GPU only. Maximum number of fbarriers per work-group. Must be at
///< least 32.
uint64_t local_mem_size; ///< GPU only. Local memory size
uint64_t hive_id; ///< XGMI Hive the GPU node belongs to in the system. It is an opaque and
///< static number hash created by the PSP
uint64_t gpu_id; ///< GPU only. KFD identifier
rocprofiler_dim3_t workgroup_max_dim; ///< GPU only. Maximum number of work-items of each
///< dimension of a work-group.
rocprofiler_dim3_t grid_max_dim; ///< GPU only. Maximum number of work-items of each dimension
///< of a grid.
const rocprofiler_agent_mem_bank_t* mem_banks;
const rocprofiler_agent_cache_t* caches;
const rocprofiler_agent_io_link_t* io_links;
const char* name; ///< Name of the agent. Will be identical to product name for CPU
const char* vendor_name; ///< Vendor of agent (will be AMD)
const char* product_name; ///< Marketing name
const char* model_name; ///< GPU only. Will be something like vega20, mi200, etc.
uint64_t num_pc_sampling_configs; ///< GPU only. Number of PC sampling modes available for this
///< device type. Note: if another process is currently using
///< PC sampling on this agent, this value will be zero so
///< do not assume the number of PC sampling configurations
///< based on the device type.
const rocprofiler_pc_sampling_configuration_t*
pc_sampling_configs; ///< GPU only. Array of PC sampling configuration types.
uint32_t node_id; ///< Node sequence number. This will be equivalent to the HSA-runtime
///< HSA_AMD_AGENT_INFO_DRIVER_NODE_ID property
uint32_t reserved0; ///< reserved padding
} rocprofiler_agent_t;
/**
* @brief Callback function type for querying the available agents
*
* @param [in] agents Array of pointers to agents
* @param [in] num_agents Number of agents in array
* @param [in] user_data Data pointer passback
* @return ::rocprofiler_status_t
*/
typedef rocprofiler_status_t (*rocprofiler_available_agents_cb_t)(
const rocprofiler_agent_t** agents,
size_t num_agents,
void* user_data);
/**
* @brief Receive synchronous callback with an array of available agents at moment of invocation
*
* @param [in] callback Callback function accepting list of agents
* @param [in] agent_size Should be set to sizeof(rocprofiler_agent_t)
* @param [in] user_data Data pointer provided to callback
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_query_available_agents(rocprofiler_available_agents_cb_t callback,
size_t agent_size,
void* user_data) ROCPROFILER_NONNULL(1);
/** @} */
ROCPROFILER_EXTERN_C_FINI
@@ -0,0 +1,73 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/defines.h>
#include <rocprofiler-sdk/fwd.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup AGENT_PROFILE_COUNTING_SERVICE Agent Profile Counting Service
* @brief needs brief description
*
* @{
*/
/**
* @brief ROCProfiler Agent Profile Counting Data.
*
* Counters, including identifiers to get counter information and Counters values
*/
typedef struct
{
/**
*/
rocprofiler_record_counter_t* counters;
uint64_t counters_count;
} rocprofiler_agent_profile_counting_data_t;
/**
* @brief Configure Profile Counting Service for agent.
*
* @param [in] buffer_id
* @param [in] profile_config_id
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_configure_agent_profile_counting_service(
rocprofiler_buffer_id_t buffer_id,
rocprofiler_profile_config_id_t profile_config_id);
/**
* @brief Sample Profile Counting Service for agent.
*
* @param [out] data // It is always a size of one
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_sample_agent_profile_counting_service(rocprofiler_agent_profile_counting_data_t* data);
/** @} */
ROCPROFILER_EXTERN_C_FINI
+109
View File
@@ -0,0 +1,109 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/defines.h>
#include <rocprofiler-sdk/fwd.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup BUFFER_HANDLING Buffer Handling
* @brief Creation, destruction, and flushing of buffers populated with data from rocprofiler
*
* @{
*
* Every Buffer is associated with a specific service kind.
* OR
* Every Buffer is associated with a specific service ID.
*
*/
/**
* @brief Async callback function.
*
* @code{.cpp}
* for(size_t i = 0; i < num_headers; ++i)
* {
* rocprofiler_record_header_t* hdr = headers[i];
* if(hdr->kind == ROCPROFILER_RECORD_KIND_PC_SAMPLE)
* {
* auto* data = static_cast<rocprofiler_pc_sample_t*>(&hdr->payload);
* ...
* }
* }
* @endcode
*/
typedef void (*rocprofiler_buffer_tracing_cb_t)(rocprofiler_context_id_t context,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_record_header_t** headers,
size_t num_headers,
void* data,
uint64_t drop_count);
/**
* @brief Create buffer.
*
* @param [in] context Context identifier associated with buffer
* @param [in] size Size of the buffer in bytes
* @param [in] watermark - watermark size, where the callback is called, if set
* to 0 then the callback will be called on every record
* @param [in] policy Behavior policy when buffer is full
* @param [in] callback Callback to invoke when buffer is flushed/full
* @param [in] callback_data Data to provide in callback function
* @param [out] buffer_id Identification handle for buffer
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_create_buffer(rocprofiler_context_id_t context,
size_t size,
size_t watermark,
rocprofiler_buffer_policy_t policy,
rocprofiler_buffer_tracing_cb_t callback,
void* callback_data,
rocprofiler_buffer_id_t* buffer_id) ROCPROFILER_NONNULL(5, 7);
/**
* @brief Destroy buffer.
*
* @param [in] buffer_id
* @return ::rocprofiler_status_t
*
* Note: This will destroy the buffer even if it is not empty. The user can
* call @ref ::rocprofiler_flush_buffer before it to make sure the buffer is empty.
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_destroy_buffer(rocprofiler_buffer_id_t buffer_id);
/**
* @brief Flush buffer.
*
* @param [in] buffer_id
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_flush_buffer(rocprofiler_buffer_id_t buffer_id);
/** @} */
ROCPROFILER_EXTERN_C_FINI
@@ -0,0 +1,344 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/agent.h>
#include <rocprofiler-sdk/defines.h>
#include <rocprofiler-sdk/fwd.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup BUFFER_TRACING_SERVICE Asynchronous Tracing Service
* @brief Receive callbacks for batches of records from an internal (background) thread
*
* @{
*/
/**
* @brief ROCProfiler Buffer HSA API Tracer Record.
* TODO(aelwazir): Add comments against every variable
*/
typedef struct
{
uint64_t size;
rocprofiler_buffer_tracing_kind_t kind;
rocprofiler_correlation_id_t correlation_id;
rocprofiler_tracing_operation_t operation; // rocprofiler/hsa.h
rocprofiler_timestamp_t start_timestamp;
rocprofiler_timestamp_t end_timestamp;
rocprofiler_thread_id_t thread_id;
} rocprofiler_buffer_tracing_hsa_api_record_t;
/**
* @brief ROCProfiler Buffer HIP API Tracer Record.
* TODO(aelwazir): Add comments against every variable
*/
typedef struct
{
uint64_t size;
rocprofiler_buffer_tracing_kind_t kind;
rocprofiler_correlation_id_t correlation_id;
rocprofiler_tracing_operation_t operation; // rocprofiler/hip.h
rocprofiler_timestamp_t start_timestamp;
rocprofiler_timestamp_t end_timestamp;
rocprofiler_thread_id_t thread_id;
} rocprofiler_buffer_tracing_hip_api_record_t;
/**
* @brief ROCProfiler Buffer Marker Tracer Record.
* TODO(aelwazir): Add comments against every variable
*/
typedef struct
{
uint64_t size;
rocprofiler_buffer_tracing_kind_t kind;
rocprofiler_correlation_id_t correlation_id;
rocprofiler_tracing_operation_t operation; // rocprofiler/marker.h
rocprofiler_timestamp_t timestamp;
rocprofiler_thread_id_t thread_id;
uint64_t marker_id; // rocprofiler_marker_id_t
// const char* message; // (Need Review?)
} rocprofiler_buffer_tracing_marker_record_t;
/**
* @brief ROCProfiler Buffer Memory Copy Tracer Record.
* TODO(aelwazir): Add comments against every variable
*/
typedef struct
{
uint64_t size;
rocprofiler_buffer_tracing_kind_t kind;
rocprofiler_correlation_id_t correlation_id;
rocprofiler_timestamp_t start_timestamp;
rocprofiler_timestamp_t end_timestamp;
rocprofiler_agent_id_t agent_id;
rocprofiler_queue_id_t queue_id;
rocprofiler_kernel_id_t kernel_id;
} rocprofiler_buffer_tracing_memory_copy_record_t;
/**
* @brief ROCProfiler Buffer Kernel Dispatch Tracer Record.
* TODO(aelwazir): Add comments against every variable
*/
typedef struct
{
uint64_t size;
rocprofiler_buffer_tracing_kind_t kind;
rocprofiler_correlation_id_t correlation_id;
rocprofiler_timestamp_t start_timestamp;
rocprofiler_timestamp_t end_timestamp;
rocprofiler_agent_id_t agent_id;
rocprofiler_queue_id_t queue_id;
rocprofiler_kernel_id_t kernel_id;
uint32_t private_segment_size;
uint32_t group_segment_size;
rocprofiler_dim3_t workgroup_size;
rocprofiler_dim3_t grid_size;
} rocprofiler_buffer_tracing_kernel_dispatch_record_t;
/**
* @brief ROCProfiler Buffer Page Migration Tracer Record.
* TODO(aelwazir): Add comments against every variable
*/
typedef struct
{
uint64_t size;
rocprofiler_buffer_tracing_kind_t kind;
rocprofiler_correlation_id_t correlation_id;
rocprofiler_timestamp_t start_timestamp;
rocprofiler_timestamp_t end_timestamp;
rocprofiler_queue_id_t queue_id;
// Not Sure What is the info needed here?
} rocprofiler_buffer_tracing_page_migration_record_t;
/**
* @brief ROCProfiler Buffer Scratch Memory Tracer Record.
* TODO(aelwazir): Add comments against every variable
*/
typedef struct
{
uint64_t size;
rocprofiler_buffer_tracing_kind_t kind;
rocprofiler_correlation_id_t correlation_id;
rocprofiler_timestamp_t start_timestamp;
rocprofiler_timestamp_t end_timestamp;
rocprofiler_queue_id_t queue_id;
// Not Sure What is the info needed here?
} rocprofiler_buffer_tracing_scratch_memory_record_t;
/**
* @brief ROCProfiler Buffer Queue Scheduling Tracer Record.
* TODO(aelwazir): Add comments against every variable
*/
typedef struct
{
uint64_t size;
rocprofiler_buffer_tracing_kind_t kind;
rocprofiler_correlation_id_t correlation_id;
rocprofiler_timestamp_t start_timestamp;
rocprofiler_timestamp_t end_timestamp;
rocprofiler_queue_id_t queue_id;
// Not Sure What is the info needed here?
} rocprofiler_buffer_tracing_queue_scheduling_record_t;
// TODO(aelwazir): Review with Jonathan if Code Object is in the buffer tracing
/**
* @brief ROCProfiler Code Object Tracer Buffer Record.
*
* We need to guarantee that these records are in the buffer before the
* corresponding Exit Phase API calls are called.
*/
// typedef struct {
// rocprofiler_buffer_tracing_record_header_t header;
// rocprofiler_tracing_code_object_kind_id_t kind;
// } rocprofiler_buffer_tracing_code_object_header_t;
/**
* @brief ROCProfiler Code Object Load Tracer Buffer Record.
*
*/
// typedef struct {
// rocprofiler_buffer_tracing_code_object_header_t header;
// uint64_t load_base; // code object load base
// uint64_t load_size; // code object load size
// const char *uri; // URI string (NULL terminated)
// rocprofiler_timestamp_t timestamp;
// // uint32_t storage_type; // code object storage type (Need Review?)
// // int storage_file; // origin file descriptor (Need Review?)
// // uint64_t memory_base; // origin memory base (Need Review?)
// // uint64_t memory_size; // origin memory size (Need Review?)
// // uint64_t load_delta; // code object load delta (Need Review?)
// } rocprofiler_buffer_tracing_code_object_load_record_t;
/**
* @brief ROCProfiler Code Object UnLoad Tracer Buffer Record.
*
*/
// typedef struct {
// rocprofiler_buffer_tracing_code_object_header_t header;
// uint64_t load_base; // code object load base
// rocprofiler_timestamp_t timestamp;
// } rocprofiler_buffer_tracing_code_object_unload_record_t;
/**
* @brief ROCProfiler Code Object Kernel Symbol Tracer Buffer Record.
*
*/
// typedef struct {
// rocprofiler_buffer_tracing_code_object_header_t header;
// const char *kernel_name; // kernel name string (NULL terminated)
// uint64_t kernel_descriptor; // kernel descriptor (Need to be changed from
// // uint64_t to ::rocprofiler_address_t)
// // rocprofiler_timestamp_t timestamp; // (Need Review?)
// } rocprofiler_buffer_tracing_code_object_kernel_symbol_record_t;
/**
* @brief ROCProfiler Buffer External Correlation Tracer Record.
*/
typedef struct
{
uint64_t size;
rocprofiler_buffer_tracing_kind_t kind;
rocprofiler_correlation_id_t correlation_id;
} rocprofiler_buffer_tracing_correlation_record_t;
/**
* @brief Callback function for mapping @ref rocprofiler_buffer_tracing_kind_t ids to
* string names. @see rocprofiler_iterate_buffer_trace_kind_names.
*/
typedef int (*rocprofiler_buffer_tracing_kind_cb_t)(rocprofiler_buffer_tracing_kind_t kind,
void* data);
/**
* @brief Callback function for mapping the operations of a given @ref
* rocprofiler_buffer_tracing_kind_t to string names. @see
* rocprofiler_iterate_buffer_trace_kind_operation_names.
*/
typedef int (*rocprofiler_buffer_tracing_kind_operation_cb_t)(
rocprofiler_buffer_tracing_kind_t kind,
uint32_t operation,
void* data);
/**
* @brief Configure Buffer Tracing Service.
*
* @param [in] context_id
* @param [in] kind
* @param [in] operations
* @param [in] operations_count
* @param [in] buffer_id
* @return ::rocprofiler_status_t
*
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_configure_buffer_tracing_service(rocprofiler_context_id_t context_id,
rocprofiler_buffer_tracing_kind_t kind,
rocprofiler_tracing_operation_t* operations,
size_t operations_count,
rocprofiler_buffer_id_t buffer_id);
/**
* @brief Query the name of the buffer tracing kind. The name retrieved from this function is a
* string literal that is encoded in the read-only section of the binary (i.e. it is always
* "allocated" and never "deallocated").
*
* @param [in] kind Buffer tracing domain
* @param [out] name If non-null and the name is a constant string that does not require dynamic
* allocation, this paramter will be set to the address of the string literal, otherwise it will
* be set to nullptr
* @param [out] name_len If non-null, this will be assigned the length of the name (regardless of
* the name is a constant string or requires dynamic allocation)
* @return ::rocprofiler_status_t
* @retval ::ROCPROFILER_STATUS_ERROR_KIND_NOT_FOUND Returned if the domain id is not valid
* @retval ::ROCPROFILER_STATUS_SUCCESS Returned if a valid domain, regardless if there is a
* constant string or not.
*/
rocprofiler_status_t
rocprofiler_query_buffer_tracing_kind_name(rocprofiler_buffer_tracing_kind_t kind,
const char** name,
uint64_t* name_len) ROCPROFILER_API;
/**
* @brief Query the name of the buffer tracing kind. The name retrieved from this function is a
* string literal that is encoded in the read-only section of the binary (i.e. it is always
* "allocated" and never "deallocated").
*
* @param [in] kind Buffer tracing domain
* @param [in] operation Enumeration id value which maps to a specific API function or event type
* @param [out] name If non-null and the name is a constant string that does not require dynamic
* allocation, this paramter will be set to the address of the string literal, otherwise it will
* be set to nullptr
* @param [out] name_len If non-null, this will be assigned the length of the name (regardless of
* the name is a constant string or requires dynamic allocation)
* @return ::rocprofiler_status_t
* @retval ::ROCPROFILER_STATUS_ERROR_KIND_NOT_FOUND An invalid domain id
* @retval ::ROCPROFILER_STATUS_ERROR_OPERATION_NOT_FOUND The operation number is not recognized for
* the given domain
* @retval ::ROCPROFILER_STATUS_ERROR_NOT_IMPLEMENTED Rocprofiler does not support providing the
* operation name within this domain
* @retval ::ROCPROFILER_STATUS_SUCCESS Valid domain and operation, regardless of whether there is a
* constant string or not.
*/
rocprofiler_status_t
rocprofiler_query_buffer_tracing_kind_operation_name(rocprofiler_buffer_tracing_kind_t kind,
uint32_t operation,
const char** name,
uint64_t* name_len) ROCPROFILER_API;
/**
* @brief Iterate over all the mappings of the buffer tracing kinds and get a buffer with the id
* mapped to a constant string. The strings provided in the arg will be valid pointers for the
* entire duration of the program. It is recommended to call this function once and cache this data
* in the client instead of making multiple on-demand calls.
*
* TODO(aelwazir): to be modified
*
* @param [in] callback Callback function invoked for each enumeration value in @ref
* rocprofiler_buffer_tracing_kind_t with the exception of the `NONE` and `LAST` values.
* @param [in] data User data passed back into the callback
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_iterate_buffer_tracing_kinds(rocprofiler_buffer_tracing_kind_cb_t callback, void* data)
ROCPROFILER_NONNULL(1);
/**
* @brief Iterates over all the operations for a given @ref
* rocprofiler_buffer_tracing_kind_t and invokes the callback with the kind and operation
* id. This is useful to build a map of the operation names during tool initialization instead of
* querying rocprofiler everytime in the callback hotpath.
*
* @param [in] kind which buffer tracing kind operations to iterate over
* @param [in] callback Callback function invoked for each operation associated with @ref
* rocprofiler_buffer_tracing_kind_t with the exception of the `NONE` and `LAST` values.
* @param [in] data User data passed back into the callback
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_iterate_buffer_tracing_kind_operations(
rocprofiler_buffer_tracing_kind_t kind,
rocprofiler_buffer_tracing_kind_operation_cb_t callback,
void* data) ROCPROFILER_NONNULL(2);
/** @} */
ROCPROFILER_EXTERN_C_FINI
@@ -0,0 +1,337 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/defines.h>
#include <rocprofiler-sdk/fwd.h>
#include <rocprofiler-sdk/hip.h>
#include <rocprofiler-sdk/hsa.h>
#include <rocprofiler-sdk/marker.h>
#include <hsa/hsa_ven_amd_loader.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup CALLBACK_TRACING_SERVICE Synchronous Tracing Services
* @brief Receive immediate callbacks on the calling thread
*
* @{
*/
/**
* @brief ROCProfiler Enumeration for code object storage types (identical values to
* `hsa_ven_amd_loader_code_object_storage_type_t` enumeration)
*/
typedef enum
{
ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_NONE = HSA_VEN_AMD_LOADER_CODE_OBJECT_STORAGE_TYPE_NONE,
ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_FILE = HSA_VEN_AMD_LOADER_CODE_OBJECT_STORAGE_TYPE_FILE,
ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_MEMORY =
HSA_VEN_AMD_LOADER_CODE_OBJECT_STORAGE_TYPE_MEMORY,
ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_LAST,
} rocprofiler_code_object_storage_type_t;
/**
* @brief ROCProfiler HSA API Callback Data.
*/
typedef struct
{
uint64_t size; ///< size of this struct
rocprofiler_hsa_api_args_t args;
rocprofiler_hsa_api_retval_t retval;
} rocprofiler_callback_tracing_hsa_api_data_t;
/**
* @brief ROCProfiler HIP API Tracer Callback Data.
*/
typedef struct
{
uint64_t size; ///< size of this struct
rocprofiler_hip_api_args_t args;
rocprofiler_hip_api_retval_t retval;
} rocprofiler_callback_tracing_hip_api_data_t;
/**
* @brief ROCProfiler Marker Tracer Callback Data.
*/
typedef struct
{
uint64_t size; ///< size of this struct
rocprofiler_marker_api_args_t args;
rocprofiler_marker_api_retval_t retval;
} rocprofiler_callback_tracing_marker_api_data_t;
/**
* @brief ROCProfiler Code Object Load Tracer Callback Record.
*/
typedef struct
{
uint64_t size; ///< size of this struct
uint64_t code_object_id; ///< unique code object identifier
rocprofiler_agent_id_t rocp_agent; ///< The agent on which this loaded code object is loaded
hsa_agent_t hsa_agent; ///< The agent on which this loaded code object is loaded
const char* uri; ///< The URI name from which the code object was loaded
uint64_t load_base; ///< The base memory address at which the code object is loaded. This is
///< the base address of the allocation for the lowest addressed segment of
///< the code object that is loaded. Note that any non-loaded segments
///< before the first loaded segment are ignored.
uint64_t load_size; ///< The byte size of the loaded code objects contiguous memory allocation.
int64_t load_delta; ///< The signed byte address difference of the memory address at which the
///< code object is loaded minus the virtual address specified in the code
///< object that is loaded.
rocprofiler_code_object_storage_type_t
storage_type; ///< storage type of the code object reader used to load the loaded code
///< object
union
{
struct
{
int storage_file; ///< file descriptor of the code object that was loaded. Access this
///< field if @ref rocprofiler_code_object_storage_type_t is
///< @ref ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_FILE
};
struct
{
uint64_t memory_base; ///< The memory address of the first byte of the code object that
///< was loaded. Access this
///< field if @ref rocprofiler_code_object_storage_type_t is
///< @ref ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_MEMORY
uint64_t memory_size; ///< The memory size in bytes of the code object that was loaded.
///< Access this field if @ref
///< rocprofiler_code_object_storage_type_t is
///< @ref ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_MEMORY
};
};
} rocprofiler_callback_tracing_code_object_load_data_t;
/**
* @brief ROCProfiler Code Object Kernel Symbol Tracer Callback Record.
*
*/
typedef struct
{
uint64_t size; ///< size of this struct
uint64_t kernel_id; ///< unique symbol identifier value
uint64_t code_object_id; ///< parent unique code object identifier
const char* kernel_name; ///< name of the kernel
uint64_t kernel_object; ///< kernel object handle, used in the kernel dispatch packet
uint32_t kernarg_segment_size; ///< size of memory (in bytes) allocated for kernel arguments.
///< Will be multiple of 16
uint32_t kernarg_segment_alignment; ///< Alignment (in bytes) of the buffer used to pass
///< arguments to the kernel
uint32_t group_segment_size; ///< Size of static group segment memory required by the kernel
///< (per work-group), in bytes
uint32_t private_segment_size; ///< Size of static private, spill, and arg segment memory
///< required by this kernel (per work-item), in bytes.
} rocprofiler_callback_tracing_code_object_kernel_symbol_register_data_t;
/**
* @brief API Tracing callback function. This function is invoked twice per API function: once
* before the function is invoked and once after the function is invoked. The external correlation
* id value within the record is assigned the value at the top of the external correlation id stack.
* It is permissible to invoke @ref rocprofiler_push_external_correlation_id within the enter phase;
* when a new external correlation id is pushed during the enter phase, rocprofiler will use that
* external correlation id for any async events and provide the new external correlation id during
* the exit callback... In other words, pushing a new external correlation id within the enter
* callback will result in that external correlation id value in the exit callback (which may or may
* not be different from the external correlation id value in the enter callback). If a tool pushes
* new external correlation ids in the enter phase, it is recommended to pop the external
* correlation id in the exit callback.
*
* @param [in] record Callback record data
* @param [in,out] user_data This paramter can be used to retain information in between the enter
* and exit phases.
* @param [in] callback_data User data provided when configuring the callback tracing service
*/
typedef void (*rocprofiler_callback_tracing_cb_t)(rocprofiler_callback_tracing_record_t record,
rocprofiler_user_data_t* user_data,
void* callback_data) ROCPROFILER_NONNULL(2);
/**
* @brief Callback function for mapping @ref rocprofiler_callback_tracing_kind_t ids to
* string names. @see rocprofiler_iterate_callback_tracing_kind_names.
*/
typedef int (*rocprofiler_callback_tracing_kind_cb_t)(rocprofiler_callback_tracing_kind_t kind,
void* data);
/**
* @brief Callback function for mapping the operations of a given @ref
* rocprofiler_callback_tracing_kind_t to string names. @see
* rocprofiler_iterate_callback_tracing_kind_operation_names.
*/
typedef int (*rocprofiler_callback_tracing_kind_operation_cb_t)(
rocprofiler_callback_tracing_kind_t kind,
uint32_t operation,
void* data);
/**
* @brief Callback function for iterating over the function arguments to a traced function.
* This function will be invoked for each argument.
* @see rocprofiler_iterate_callback_tracing_operation_args
*
* @param [in] kind domain
* @param [in] operation associated domain operation
* @param [in] arg_number the argument number, starting at zero
* @param [in] arg_name the name of the argument in the prototype (or rocprofiler union)
* @param [in] arg_value_str conversion of the argument to a string, e.g. operator<< overload
* @param [in] arg_value_addr the address of the argument stored by rocprofiler.
* @param [in] data user data
*/
typedef int (*rocprofiler_callback_tracing_operation_args_cb_t)(
rocprofiler_callback_tracing_kind_t kind,
uint32_t operation,
uint32_t arg_number,
const char* arg_name,
const char* arg_value_str,
const void* const arg_value_addr,
void* data);
/**
* @brief Configure Callback Tracing Service. The callback tracing service provides two synchronous
* callbacks around an API function on the same thread as the application which is invoking the API
* function. This function can only be invoked once per @ref
* rocprofiler_callback_tracing_kind_t value, i.e. it can be invoked once for the HSA API,
* once for the HIP API, and so on but it will fail if it is invoked for the HSA API twice. Please
* note, the callback API does have the potentially non-trivial overhead of copying the function
* arguments into the record. If you are willing to let rocprofiler record the timestamps, do not
* require synchronous notifications of the API calls, and want to lowest possible overhead, use the
* @see BUFFER_TRACING_SERVICE.
*
* @param [in] context_id Context to associate the service with
* @param [in] kind The domain of the callback tracing service
* @param [in] operations Array of operations in the domain (i.e. enum values which identify
* specific API functions). If this is null, all API functions in the domain will be traced
* @param [in] operations_count If the operations array is non-null, set this to the size of the
* array.
* @param [in] callback The function to invoke before and after an API function
* @param [in] callback_args Data provided to every invocation of the callback function
* @return ::rocprofiler_status_t
* @retval ::ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED Invoked outside of the initialization
* function in @ref rocprofiler_tool_configure_result_t provided to rocprofiler via @ref
* rocprofiler_configure function
* @retval ::ROCPROFILER_STATUS_ERROR_CONTEXT_NOT_FOUND The provided context is not valid/registered
* @retval ::ROCPROFILER_STATUS_ERROR_SERVICE_ALREADY_CONFIGURED if the same @ref
* rocprofiler_callback_tracing_kind_t value is provided more than once (per context) -- in
* other words, we do not support overriding or combining the operations in separate function calls.
*
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_configure_callback_tracing_service(rocprofiler_context_id_t context_id,
rocprofiler_callback_tracing_kind_t kind,
rocprofiler_tracing_operation_t* operations,
size_t operations_count,
rocprofiler_callback_tracing_cb_t callback,
void* callback_args);
/**
* @brief Query the name of the callback tracing kind. The name retrieved from this function is a
* string literal that is encoded in the read-only section of the binary (i.e. it is always
* "allocated" and never "deallocated").
*
* @param [in] kind Callback tracing domain
* @param [out] name If non-null and the name is a constant string that does not require dynamic
* allocation, this paramter will be set to the address of the string literal, otherwise it will
* be set to nullptr
* @param [out] name_len If non-null, this will be assigned the length of the name (regardless of
* the name is a constant string or requires dynamic allocation)
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t
rocprofiler_query_callback_tracing_kind_name(rocprofiler_callback_tracing_kind_t kind,
const char** name,
uint64_t* name_len) ROCPROFILER_API;
/**
* @brief Query the name of the callback tracing kind. The name retrieved from this function is a
* string literal that is encoded in the read-only section of the binary (i.e. it is always
* "allocated" and never "deallocated").
*
* @param [in] kind Callback tracing domain
* @param [in] operation Enumeration id value which maps to a specific API function or event type
* @param [out] name If non-null and the name is a constant string that does not require dynamic
* allocation, this paramter will be set to the address of the string literal, otherwise it will
* be set to nullptr
* @param [out] name_len If non-null, this will be assigned the length of the name (regardless of
* the name is a constant string or requires dynamic allocation)
* @return ::rocprofiler_status_t
* @retval ::ROCPROFILER_STATUS_ERROR_KIND_NOT_FOUND Domain id is not valid
* @retval ::ROCPROFILER_STATUS_SUCCESS Valid domain provided, regardless if there is a constant
* string or not.
*/
rocprofiler_status_t
rocprofiler_query_callback_tracing_kind_operation_name(rocprofiler_callback_tracing_kind_t kind,
uint32_t operation,
const char** name,
uint64_t* name_len) ROCPROFILER_API;
/**
* @brief Iterate over all the mappings of the callback tracing kinds and get a callback for each
* kind.
*
* @param [in] callback Callback function invoked for each enumeration value in @ref
* rocprofiler_callback_tracing_kind_t with the exception of the `NONE` and `LAST` values.
* @param [in] data User data passed back into the callback
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_iterate_callback_tracing_kinds(rocprofiler_callback_tracing_kind_cb_t callback,
void* data) ROCPROFILER_NONNULL(1);
/**
* @brief Iterates over all the mappings of the operations for a given @ref
* rocprofiler_callback_tracing_kind_t and invokes the callback with the kind id, operation
* id, and user-provided data.
*
* @param [in] kind which tracing callback kind operations to iterate over
* @param [in] callback Callback function invoked for each operation associated with @ref
* rocprofiler_callback_tracing_kind_t with the exception of the `NONE` and `LAST` values.
* @param [in] data User data passed back into the callback
* @return ::rocprofiler_status_t
* @retval ::ROCPROFILER_STATUS_ERROR_KIND_NOT_FOUND Invalid domain id
* @retval ::ROCPROFILER_STATUS_SUCCESS Valid domain
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_iterate_callback_tracing_kind_operations(
rocprofiler_callback_tracing_kind_t kind,
rocprofiler_callback_tracing_kind_operation_cb_t callback,
void* data) ROCPROFILER_NONNULL(2);
/**
* @brief Iterates over all the arguments for the traced function (when available). This is
* particularly useful when tools want to annotate traces with the function arguments. See
* @example samples/api_callback_tracing/client.cpp for a usage example.
*
* @param[in] record Record provided by service callback
* @param[in] callback The callback function which will be invoked for each argument
* @param[in] user_data Data to be passed to each invocation of the callback
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_iterate_callback_tracing_kind_operation_args(
rocprofiler_callback_tracing_record_t record,
rocprofiler_callback_tracing_operation_args_cb_t callback,
void* user_data) ROCPROFILER_NONNULL(2);
/** @} */
ROCPROFILER_EXTERN_C_FINI
+94
View File
@@ -0,0 +1,94 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/defines.h>
#include <rocprofiler-sdk/fwd.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup CONTEXT_OPERATIONS Context Handling
* @brief Associate services with a handle. This handle is used to activate/deactivate the services
* during the application runtime.
*
* @{
*/
/**
* The NULL Context handle.
*/
#define ROCPROFILER_CONTEXT_NONE ROCPROFILER_HANDLE_LITERAL(rocprofiler_context_id_t, UINT64_MAX)
/**
* @brief Create context.
*
* @param [out] context_id Context identifier
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_create_context(rocprofiler_context_id_t* context_id) ROCPROFILER_NONNULL(1);
/**
* @brief Start context.
*
* @param [in] context_id
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_start_context(rocprofiler_context_id_t context_id);
/**
* @brief Stop context.
*
* @param [in] context_id
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_stop_context(rocprofiler_context_id_t context_id);
/**
* @brief Query whether context is active.
*
* @param [in] context_id
* @param [out] status If context is active, this will be a nonzero value
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_context_is_active(rocprofiler_context_id_t context_id, int* status)
ROCPROFILER_NONNULL(2);
/**
* @brief Query whether the context is valid
*
* @param [in] context_id
* @param [out] status If context is invalid, this will be a nonzero value
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_context_is_valid(rocprofiler_context_id_t context_id, int* status)
ROCPROFILER_NONNULL(2);
/** @} */
ROCPROFILER_EXTERN_C_FINI
+135
View File
@@ -0,0 +1,135 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/agent.h>
#include <rocprofiler-sdk/defines.h>
#include <rocprofiler-sdk/fwd.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup COUNTERS Hardware counters Information
* @brief Query functions related to hardware counters
* @{
*/
/**
* @brief Query counter id information from record_id
*
* @param [in] id record id from rocprofiler_record_counter_t
* @param [out] counter_id counter id associated with the record
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_query_record_counter_id(rocprofiler_counter_instance_id_t id,
rocprofiler_counter_id_t* counter_id) ROCPROFILER_NONNULL(2);
/**
* @brief Query dimension position from record_id
*
* @param [in] id record id from rocprofiler_record_counter_t
* @param [in] dim dimension for which positional info is requested
* @param [out] pos value of the dimension in id.
* @return ::rocprofiler_status_t
*
* TODO(aelwazir): rocprofiler_status_t types that can be returned
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_query_record_dimension_position(rocprofiler_counter_instance_id_t id,
rocprofiler_counter_dimension_id_t dim,
size_t* pos) ROCPROFILER_NONNULL(3);
/**
* @brief Return information about the dimension for a specified counter
*
* @param [in] id counter id to query dimension info for.
* @param [in] dim dimension
* @param [out] info info on the dimension (name, instance_size)
* @return ::rocprofiler_status_t
*
* TODO(aelwazir): rocprofiler_status_t types that can be returned
*
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_query_record_dimension_info(rocprofiler_counter_id_t id,
rocprofiler_counter_dimension_id_t dim,
rocprofiler_record_dimension_info_t* info)
ROCPROFILER_NONNULL(3);
/**
* @brief Query Counter name as a literal string.
*
* @param [in] counter_id @see rocprofiler_iterate_agent_supported_counters to get the available
* counter IDs
* @param [out] name returns a pointer to the name of the counter
* @param [out] size returns the size of the name returned
* @return ::rocprofiler_status_t
*
* TODO(aelwazir): rocprofiler_status_t types that can be returned
*
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_query_counter_name(rocprofiler_counter_id_t counter_id, const char** name, size_t* size)
ROCPROFILER_NONNULL(2, 3);
/**
* @brief This call returns the number of instances specific counter contains.
* WARNING: There is a restriction on this call in the alpha/beta release
* of rocprof. This call will not return correct instance information in
* tool_init and must be called as part of the dispatch callback for accurate
* instance counting information. The reason for this restriction is that HSA
* is not yet loaded on tool_init.
*
* @param [in] agent rocprofiler agent
* @param [in] counter_id counter id (obtained from iterate_agent_supported_counters)
* @param [out] instance_count number of instances the counter has
* @return rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_query_counter_instance_count(rocprofiler_agent_t agent,
rocprofiler_counter_id_t counter_id,
size_t* instance_count) ROCPROFILER_NONNULL(3);
// TODO(aelwazir): Ben to add a brief
typedef rocprofiler_status_t (*rocprofiler_available_counters_cb_t)(
rocprofiler_counter_id_t* counters,
size_t num_counters,
void* user_data);
/**
* @brief Query Agent Counters Availability.
*
* @param [in] agent GPU agent
* @param [in] cb callback to caller to get counters
* @param [in] user_data data to pass into the callback
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_iterate_agent_supported_counters(rocprofiler_agent_t agent,
rocprofiler_available_counters_cb_t cb,
void* user_data) ROCPROFILER_NONNULL(2);
/** @} */
ROCPROFILER_EXTERN_C_FINI
+129
View File
@@ -0,0 +1,129 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
/**
* @defgroup SYMBOL_VERSIONING_GROUP Symbol Versions
*
* @brief The names used for the shared library versioned symbols.
*
* Every function is annotated with one of the version macros defined in this
* section. Each macro specifies a corresponding symbol version string. After
* dynamically loading the shared library with @p dlopen, the address of each
* function can be obtained using @p dlsym with the name of the function and
* its corresponding symbol version string. An error will be reported by @p
* dlvsym if the installed library does not support the version for the
* function specified in this version of the interface.
*
* @{
*/
/**
* @brief The function was introduced in version 10.0 of the interface and has the
* symbol version string of ``"ROCPROFILER_10.0"``.
*/
#define ROCPROFILER_VERSION_10_0
/** @} */
#if !defined(ROCPROFILER_ATTRIBUTE)
# if defined(_MSC_VER)
# define ROCPROFILER_ATTRIBUTE(...) __declspec(__VA_ARGS__)
# else
# define ROCPROFILER_ATTRIBUTE(...) __attribute__((__VA_ARGS__))
# endif
#endif
#if !defined(ROCPROFILER_PUBLIC_API)
# if defined(_MSC_VER)
# define ROCPROFILER_PUBLIC_API ROCPROFILER_ATTRIBUTE(dllexport)
# else
# define ROCPROFILER_PUBLIC_API ROCPROFILER_ATTRIBUTE(visibility("default"))
# endif
#endif
#if !defined(ROCPROFILER_HIDDEN_API)
# if defined(_MSC_VER)
# define ROCPROFILER_HIDDEN_API
# else
# define ROCPROFILER_HIDDEN_API ROCPROFILER_ATTRIBUTE(visibility("hidden"))
# endif
#endif
#if !defined(ROCPROFILER_EXPORT_DECORATOR)
# define ROCPROFILER_EXPORT_DECORATOR ROCPROFILER_PUBLIC_API
#endif
#if !defined(ROCPROFILER_IMPORT_DECORATOR)
# if defined(_MSC_VER)
# define ROCPROFILER_IMPORT_DECORATOR ROCPROFILER_ATTRIBUTE(dllimport)
# else
# define ROCPROFILER_IMPORT_DECORATOR
# endif
#endif
#define ROCPROFILER_EXPORT ROCPROFILER_EXPORT_DECORATOR
#define ROCPROFILER_IMPORT ROCPROFILER_IMPORT_DECORATOR
#if !defined(ROCPROFILER_API)
# if defined(rocprofiler_EXPORTS)
# define ROCPROFILER_API ROCPROFILER_EXPORT
# else
# define ROCPROFILER_API ROCPROFILER_IMPORT
# endif
#endif
#if defined(__has_attribute)
# if __has_attribute(nonnull)
# define ROCPROFILER_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
# else
# define ROCPROFILER_NONNULL(...)
# endif
#else
# if defined(__GNUC__)
# define ROCPROFILER_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
# else
# define ROCPROFILER_NONNULL(...)
# endif
#endif
#if __cplusplus >= 201103L // C++11
/* c++11 allows extended initializer lists. */
# define ROCPROFILER_HANDLE_LITERAL(type, value) (type{value})
#elif __STDC_VERSION__ >= 199901L
/* c99 allows compound literals. */
# define ROCPROFILER_HANDLE_LITERAL(type, value) ((type){value})
#else
# define ROCPROFILER_HANDLE_LITERAL(type, value) \
{ \
value \
}
#endif
#ifdef __cplusplus
# define ROCPROFILER_EXTERN_C_INIT extern "C" {
# define ROCPROFILER_EXTERN_C_FINI }
#else
# define ROCPROFILER_EXTERN_C_INIT
# define ROCPROFILER_EXTERN_C_FINI
#endif
@@ -0,0 +1,85 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/agent.h>
#include <rocprofiler-sdk/defines.h>
#include <rocprofiler-sdk/fwd.h>
#include <rocprofiler-sdk/hsa.h>
#include <rocprofiler-sdk/profile_config.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup DISPATCH_PROFILE_COUNTING_SERVICE Dispatch Profile Counting Service
* @brief Per-dispatch hardware counter collection service
*
* @{
*/
/**
* @brief Kernel Dispatch Callback. This is a callback that is invoked before the kernel
* is enqueued into the HSA queue. What counters to collect for a kernel are set
* via passing back a profile config (config) in this callback. These counters
* will be collected and emplaced in the buffer with @ref rocprofiler_buffer_id_t used when
* setting up this callback.
*
* @param [in] queue_id Queue the kernel dispatch packet is being enqueued onto
* @param [in] agent Agent of this queue
* @param [in] correlation_id Correlation ID for this dispatch
* @param [in] dispatch_packet Kernel dispatch packet about to be enqueued into HSA
* @param [in] callback_data_args Callback supplied via buffered_dispatch_profile_counting_service
* @param [out] config Profile config detailing the counters to collect for this kernel
*/
typedef void (*rocprofiler_profile_counting_dispatch_callback_t)(
rocprofiler_queue_id_t queue_id,
const rocprofiler_agent_t* agent,
rocprofiler_correlation_id_t correlation_id,
const hsa_kernel_dispatch_packet_t* dispatch_packet,
void* callback_data_args,
rocprofiler_profile_config_id_t* config);
/**
* @brief Configure buffered dispatch profile Counting Service.
* Collects the counters in dispatch packets and stores them
* in a buffer with @p buffer_id. The buffer may contain packets from more than
* one dispatch (denoted by correlation id). Will trigger the
* callback based on the parameters setup in @p buffer_id.
*
* // TODO(aelwazir): Should this be per agent?
*
* @param [in] context_id context id
* @param [in] buffer_id id of the buffer to use for the counting service
* @param [in] callback callback to perform when dispatch is enqueued
* @param [in] callback_data_args callback data
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_configure_buffered_dispatch_profile_counting_service(
rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_profile_counting_dispatch_callback_t callback,
void* callback_data_args);
/** @} */
ROCPROFILER_EXTERN_C_FINI
@@ -0,0 +1,77 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/defines.h>
#include <rocprofiler-sdk/fwd.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup EXTERNAL_CORRELATION External Correlation IDs
* @brief User-defined correlation identifiers to supplement rocprofiler generated correlation ids
*
* @{
*/
/**
* @brief Push default value for `external` field in @ref rocprofiler_correlation_id_t onto stack.
*
* External correlation ids are thread-local values. However, if rocprofiler internally requests an
* external correlation id on a non-main thread and an external correlation id has not been pushed
* for this thread, the external correlation ID will default to the latest external correlation id
* on the main thread -- this allows tools to push an external correlation id once on the main
* thread for, say, the MPI rank or process-wide UUID and this value will be used by all subsequent
* child threads.
*
* @param [in] context Associated context
* @param [in] tid thread identifier. @see rocprofiler_get_thread_id
* @param [in] external_correlation_id User data to place in external field in @ref
* rocprofiler_correlation_id_t
* @return ::rocprofiler_status_t
* @retval ::ROCPROFILER_STATUS_ERROR_CONTEXT_NOT_FOUND Context does not exist
* @retval ::ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT Thread id is not valid
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_push_external_correlation_id(rocprofiler_context_id_t context,
rocprofiler_thread_id_t tid,
rocprofiler_user_data_t external_correlation_id);
/**
* @brief Pop default value for `external` field in @ref rocprofiler_correlation_id_t off of stack
*
* @param [in] context Associated context
* @param [in] tid thread identifier. @see rocprofiler_get_thread_id
* @param [out] external_correlation_id Correlation id data popped off the stack
* @return ::rocprofiler_status_t
* @retval ::ROCPROFILER_STATUS_ERROR_CONTEXT_NOT_FOUND Context does not exist
* @retval ::ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT Thread id is not valid
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_pop_external_correlation_id(rocprofiler_context_id_t context,
rocprofiler_thread_id_t tid,
rocprofiler_user_data_t* external_correlation_id);
/** @} */
ROCPROFILER_EXTERN_C_FINI
+483
View File
@@ -0,0 +1,483 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/defines.h>
#include <stddef.h>
#include <stdint.h>
ROCPROFILER_EXTERN_C_INIT
//--------------------------------------------------------------------------------------//
//
// ENUMERATIONS
//
//--------------------------------------------------------------------------------------//
/**
* @defgroup BASIC_DATA_TYPES Basic data types
* @brief Basic data types and typedefs
*
* @{
*/
// TODO(aelwazir): Do we need to add a null (way) for every handle?
// TODO(aelwazir): Remove API Data args from the doxygen?
// TODO(aelwazir): Not everything in bin needs to be installed bin, use libexec or share?
/**
* @brief Status codes.
*/
typedef enum // NOLINT(performance-enum-size)
{
ROCPROFILER_STATUS_SUCCESS = 0, ///< No error occurred
ROCPROFILER_STATUS_ERROR, ///< Generalized error
ROCPROFILER_STATUS_ERROR_CONTEXT_NOT_FOUND, ///< No valid context for given context id
ROCPROFILER_STATUS_ERROR_BUFFER_NOT_FOUND, ///< No valid buffer for given buffer id
ROCPROFILER_STATUS_ERROR_KIND_NOT_FOUND, ///< Kind identifier is invalid
ROCPROFILER_STATUS_ERROR_OPERATION_NOT_FOUND, ///< Operation identifier is invalid for domain
ROCPROFILER_STATUS_ERROR_THREAD_NOT_FOUND, ///< No valid thread for given thread id
ROCPROFILER_STATUS_ERROR_AGENT_NOT_FOUND, ///< Agent identifier not found
ROCPROFILER_STATUS_ERROR_COUNTER_NOT_FOUND, ///< Counter identifier does not exist
ROCPROFILER_STATUS_ERROR_CONTEXT_ERROR, ///> Generalized context error
ROCPROFILER_STATUS_ERROR_CONTEXT_INVALID, ///< Context configuration is not valid
ROCPROFILER_STATUS_ERROR_CONTEXT_NOT_STARTED, ///< Context was not started (e.g., atomic swap
///< into active array failed)
ROCPROFILER_STATUS_ERROR_CONTEXT_CONFLICT, ///< Context operation failed due to a conflict with
///< another context
ROCPROFILER_STATUS_ERROR_BUFFER_BUSY, ///< buffer operation failed because it currently busy
///< handling another request (e.g. flushing)
ROCPROFILER_STATUS_ERROR_SERVICE_ALREADY_CONFIGURED, ///< service has already been configured
///< in context
ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED, ///< Function call is not valid outside of
///< rocprofiler configuration (i.e.
///< function called post-initialization)
ROCPROFILER_STATUS_ERROR_NOT_IMPLEMENTED, ///< Function is not implemented
ROCPROFILER_STATUS_ERROR_INCOMPATIBLE_ABI, ///< Data structure provided by user is incompatible
///< with current version of rocprofiler
ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT, ///< Function invoked with one or more invalid
///< arguments
ROCPROFILER_STATUS_LAST,
} rocprofiler_status_t;
/**
* @brief Buffer record categories. This enumeration type is encoded in @ref
* rocprofiler_record_header_t category field
*/
typedef enum // NOLINT(performance-enum-size)
{
ROCPROFILER_BUFFER_CATEGORY_NONE = 0,
ROCPROFILER_BUFFER_CATEGORY_TRACING,
ROCPROFILER_BUFFER_CATEGORY_PC_SAMPLING,
ROCPROFILER_BUFFER_CATEGORY_COUNTERS,
ROCPROFILER_BUFFER_CATEGORY_LAST,
} rocprofiler_buffer_category_t;
/**
* @brief Agent type.
*/
typedef enum // NOLINT(performance-enum-size)
{
ROCPROFILER_AGENT_TYPE_NONE = 0, ///< Agent type is unknown
ROCPROFILER_AGENT_TYPE_CPU, ///< Agent type is a CPU
ROCPROFILER_AGENT_TYPE_GPU, ///< Agent type is a GPU
ROCPROFILER_AGENT_TYPE_LAST,
} rocprofiler_agent_type_t;
/**
* @brief Service Callback Phase.
*/
typedef enum // NOLINT(performance-enum-size)
{
ROCPROFILER_CALLBACK_PHASE_NONE = 0, ///< Callback has no phase
ROCPROFILER_CALLBACK_PHASE_ENTER, ///< Callback invoked prior to function execution
ROCPROFILER_CALLBACK_PHASE_LOAD =
ROCPROFILER_CALLBACK_PHASE_ENTER, ///< Callback invoked prior to code object loading
ROCPROFILER_CALLBACK_PHASE_EXIT, ///< Callback invoked after to function execution
ROCPROFILER_CALLBACK_PHASE_UNLOAD =
ROCPROFILER_CALLBACK_PHASE_EXIT, ///< Callback invoked prior to code object unloading
ROCPROFILER_CALLBACK_PHASE_LAST,
} rocprofiler_callback_phase_t;
/**
* @brief Service Callback Tracing Kind.
*/
typedef enum // NOLINT(performance-enum-size)
{
ROCPROFILER_CALLBACK_TRACING_NONE = 0,
ROCPROFILER_CALLBACK_TRACING_HSA_API, ///< Callbacks for HSA functions
ROCPROFILER_CALLBACK_TRACING_HIP_API, ///< Callbacks for HIP functions
ROCPROFILER_CALLBACK_TRACING_MARKER_API, ///< Callbacks for ROCTx functions
ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT, ///< Callbacks for code object info
ROCPROFILER_CALLBACK_TRACING_KERNEL_DISPATCH, ///< Callbacks for kernel dispatches
ROCPROFILER_CALLBACK_TRACING_LAST,
} rocprofiler_callback_tracing_kind_t;
/**
* @brief Service Buffer Tracing Kind.
*/
typedef enum // NOLINT(performance-enum-size)
{
ROCPROFILER_BUFFER_TRACING_NONE = 0,
ROCPROFILER_BUFFER_TRACING_HSA_API, ///< Buffer HSA function calls
ROCPROFILER_BUFFER_TRACING_HIP_API, ///< Buffer HIP function calls
ROCPROFILER_BUFFER_TRACING_MARKER_API, ///< Buffer ROCTx function calls
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY, ///< Buffer memory copy info
ROCPROFILER_BUFFER_TRACING_KERNEL_DISPATCH, ///< Buffer kernel dispatch info
ROCPROFILER_BUFFER_TRACING_PAGE_MIGRATION, ///< Buffer page migration info
ROCPROFILER_BUFFER_TRACING_SCRATCH_MEMORY, ///< Buffer scratch memory reclaimation info
ROCPROFILER_BUFFER_TRACING_EXTERNAL_CORRELATION, ///< Buffer external correlation info
// To determine if this is possible to implement?
// ROCPROFILER_BUFFER_TRACING_QUEUE_SCHEDULING,
ROCPROFILER_BUFFER_TRACING_LAST,
} rocprofiler_buffer_tracing_kind_t;
/**
* @brief ROCProfiler Code Object Tracer Operation.
*/
typedef enum // NOLINT(performance-enum-size)
{
ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT_NONE = 0,
ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT_LOAD,
ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT_DEVICE_KERNEL_SYMBOL_REGISTER,
// next two are part of hipRegisterFunction API.
// ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT_HOST_KERNEL_SYMBOL_REGISTER,
ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT_LAST,
} rocprofiler_callback_tracing_code_object_operation_t;
/**
* @brief Memory Copy Operation.
*/
typedef enum // NOLINT(performance-enum-size)
{
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY_NONE = 0,
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY_DEVICE_TO_HOST,
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY_HOST_TO_DEVICE,
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY_DEVICE_TO_DEVICE,
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY_LAST,
} rocprofiler_buffer_tracing_memory_copy_operation_t;
/**
* @brief PC Sampling Method.
*/
typedef enum // NOLINT(performance-enum-size)
{
ROCPROFILER_PC_SAMPLING_METHOD_NONE = 0,
ROCPROFILER_PC_SAMPLING_METHOD_STOCHASTIC,
ROCPROFILER_PC_SAMPLING_METHOD_HOST_TRAP,
ROCPROFILER_PC_SAMPLING_METHOD_LAST,
} rocprofiler_pc_sampling_method_t;
/**
* @brief PC Sampling Unit.
*/
typedef enum // NOLINT(performance-enum-size)
{
ROCPROFILER_PC_SAMPLING_UNIT_NONE = 0, ///< Sample interval has unspecified units
ROCPROFILER_PC_SAMPLING_UNIT_INSTRUCTIONS, ///< Sample interval is in instructions
ROCPROFILER_PC_SAMPLING_UNIT_CYCLES, ///< Sample interval is in cycles
ROCPROFILER_PC_SAMPLING_UNIT_TIME, ///< Sample internval is in nanoseconds
ROCPROFILER_PC_SAMPLING_UNIT_LAST,
} rocprofiler_pc_sampling_unit_t;
/**
* @brief Actions when Buffer is full.
*/
typedef enum // NOLINT(performance-enum-size)
{
ROCPROFILER_BUFFER_POLICY_NONE = 0, ///< No policy has been set
ROCPROFILER_BUFFER_POLICY_DISCARD, ///< Drop records when buffer is full
ROCPROFILER_BUFFER_POLICY_LOSSLESS, ///< Block when buffer is full
ROCPROFILER_BUFFER_POLICY_LAST,
} rocprofiler_buffer_policy_t;
/**
* @brief Enumeration for specifying runtime libraries supported by rocprofiler. This enumeration is
* used for intercept tables and thread creation callbacks. @see INTERCEPT_TABLE and @see
* INTERNAL_THREADING.
*/
typedef enum
{
ROCPROFILER_LIBRARY = (1 << 0),
ROCPROFILER_HSA_LIBRARY = (1 << 1),
ROCPROFILER_HIP_LIBRARY = (1 << 2),
ROCPROFILER_MARKER_LIBRARY = (1 << 3),
ROCPROFILER_LIBRARY_LAST = ROCPROFILER_MARKER_LIBRARY,
} rocprofiler_runtime_library_t;
//--------------------------------------------------------------------------------------//
//
// ALIASES
//
//--------------------------------------------------------------------------------------//
/**
* @brief ROCProfiler Timestamp.
*/
typedef uint64_t rocprofiler_timestamp_t;
/**
* @brief ROCProfiler Address.
*/
typedef uint64_t rocprofiler_address_t;
/**
* @brief Thread ID. Value will be equivalent to `syscall(__NR_gettid)`
*/
typedef uint64_t rocprofiler_thread_id_t;
/**
* @brief Tracing Operation ID. Depending on the kind, operations can be determined.
* If the value is equal to zero that means all operations will be considered
* for tracing.
*/
typedef uint32_t rocprofiler_tracing_operation_t;
/**
* @brief Kernel identifier type
*
*/
typedef uint64_t rocprofiler_kernel_id_t;
// forward declaration of struct
typedef struct rocprofiler_pc_sampling_configuration_s rocprofiler_pc_sampling_configuration_t;
typedef struct rocprofiler_pc_sampling_record_s rocprofiler_pc_sampling_record_t;
/**
* @brief Unique record id encoding both the counter
* and dimensional values (positions) for the record.
*/
typedef uint64_t rocprofiler_counter_instance_id_t;
/**
* @brief A dimension for counter instances. Some example
* dimensions include XCC, SM (Shader), etc. This
* value represents the dimension beind described
* or queried about.
*/
typedef uint64_t rocprofiler_counter_dimension_id_t;
//--------------------------------------------------------------------------------------//
//
// UNIONS
//
//--------------------------------------------------------------------------------------//
/**
* @brief User-assignable data type
*
*/
typedef union rocprofiler_user_data_t
{
uint64_t value;
void* ptr;
} rocprofiler_user_data_t;
//--------------------------------------------------------------------------------------//
//
// STRUCTS
//
//--------------------------------------------------------------------------------------//
/**
* @brief Context ID.
*/
typedef struct
{
uint64_t handle;
} rocprofiler_context_id_t;
/**
* @brief Queue ID.
*/
typedef struct
{
uint64_t handle;
} rocprofiler_queue_id_t;
/**
* @brief ROCProfiler Record Correlation ID.
*/
typedef struct
{
uint64_t internal;
rocprofiler_user_data_t external;
} rocprofiler_correlation_id_t;
/**
* @struct rocprofiler_buffer_id_t
* @brief Buffer ID.
*/
typedef struct
{
uint64_t handle;
} rocprofiler_buffer_id_t;
/**
* @brief Agent Identifier
*/
typedef struct
{
uint64_t handle;
} rocprofiler_agent_id_t;
/**
* @brief Counter ID.
*/
typedef struct
{
uint64_t handle;
} rocprofiler_counter_id_t;
/**
* @brief Profile Configurations
* @see rocprofiler_create_profile_config for how to create.
*/
typedef struct
{
uint64_t handle; // Opaque handle
} rocprofiler_profile_config_id_t;
/**
* @brief Multi-dimensional struct of data used to describe GPU workgroup and grid sizes
*/
typedef struct rocprofiler_dim3_t
{
uint32_t x;
uint32_t y;
uint32_t z;
} rocprofiler_dim3_t;
/**
* @brief Tracing record
*
*/
typedef struct rocprofiler_callback_tracing_record_t
{
rocprofiler_context_id_t context_id;
rocprofiler_thread_id_t thread_id;
rocprofiler_correlation_id_t correlation_id;
rocprofiler_callback_tracing_kind_t kind;
uint32_t operation;
rocprofiler_callback_phase_t phase;
void* payload;
} rocprofiler_callback_tracing_record_t;
/**
* @brief Generic record with type identifier(s) and a pointer to data. This data type is used with
* buffered data.
*
* @code{.cpp}
* void
* tool_tracing_callback(rocprofiler_record_header_t** headers,
* size_t num_headers)
* {
* for(size_t i = 0; i < num_headers; ++i)
* {
* rocprofiler_record_header_t* header = headers[i];
*
* if(header->category == ROCPROFILER_BUFFER_CATEGORY_TRACING &&
* header->kind == ROCPROFILER_BUFFER_TRACING_HSA_API)
* {
* // cast to rocprofiler_buffer_tracing_hsa_api_record_t which
* // is type associated with this category + kind
* auto* record =
* static_cast<rocprofiler_buffer_tracing_hsa_api_record_t*>(header->payload);
*
* // trivial test
* assert(record->start_timestamp <= record->end_timestamp);
* }
* }
* }
*
* @endcode
*/
typedef struct
{
union
{
struct
{
uint32_t category; ///< rocprofiler_buffer_category_t
uint32_t kind; ///< domain
};
uint64_t hash; ///< generic identifier. You can compute this via: `uint64_t hash = category
///< | ((uint64_t)(kind) << 32)`, e.g.
};
void* payload;
} rocprofiler_record_header_t;
/**
* @brief Function for computing the unsigned 64-bit hash value in @ref rocprofiler_record_header_t
* from a category and kind (two unsigned 32-bit values)
*
* @param [in] category a value from @ref rocprofiler_buffer_category_t
* @param [in] kind depending on the category, this is the domain value, e.g., @ref
* rocprofiler_buffer_tracing_kind_t value
* @return uint64_t hash value of category and kind
*/
static inline uint64_t
rocprofiler_record_header_compute_hash(uint32_t category, uint32_t kind)
{
uint64_t value = category;
value |= ((uint64_t)(kind)) << 32;
return value;
}
/**
* @brief Details for the dimension, including its size, for a counter record.
*/
typedef struct
{
const char* name;
size_t instance_size;
} rocprofiler_record_dimension_info_t;
/**
* @brief ROCProfiler Profile Counting Counter Record per instance.
*/
typedef struct
{
rocprofiler_counter_instance_id_t id;
double counter_value; //<< counter value
rocprofiler_correlation_id_t corr_id;
} rocprofiler_record_counter_t;
/**
* @brief ROCProfiler SPM Record.
*
*/
typedef struct
{
/**
* Counters, including identifiers to get counter information and Counters
* values
*/
rocprofiler_record_counter_t* counters;
uint64_t counters_count;
} rocprofiler_spm_record_t;
/** @} */
ROCPROFILER_EXTERN_C_FINI
+26
View File
@@ -0,0 +1,26 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/hip/api_args.h>
#include <rocprofiler-sdk/hip/api_id.h>
@@ -0,0 +1,9 @@
#
#
# Installation of public HIP headers
#
#
set(ROCPROFILER_HIP_HEADER_FILES api_args.h api_id.h)
install(FILES ${ROCPROFILER_HIP_HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocprofiler-sdk/hip)
File diff suppressed because it is too large. Load diff
+436
View File
@@ -0,0 +1,436 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#pragma once
/**
* @brief ROCProfiler enumeration of HIP API tracing operations
*/
typedef enum // NOLINT(performance-enum-size)
{
ROCPROFILER_HIP_API_ID_NONE = -1,
ROCPROFILER_HIP_API_ID___hipPopCallConfiguration = 0,
ROCPROFILER_HIP_API_ID___hipPushCallConfiguration,
ROCPROFILER_HIP_API_ID_hipArray3DCreate,
ROCPROFILER_HIP_API_ID_hipArrayCreate,
ROCPROFILER_HIP_API_ID_hipArrayDestroy,
ROCPROFILER_HIP_API_ID_hipChooseDevice,
ROCPROFILER_HIP_API_ID_hipConfigureCall,
ROCPROFILER_HIP_API_ID_hipCtxCreate,
ROCPROFILER_HIP_API_ID_hipCtxDestroy,
ROCPROFILER_HIP_API_ID_hipCtxDisablePeerAccess,
ROCPROFILER_HIP_API_ID_hipCtxEnablePeerAccess,
ROCPROFILER_HIP_API_ID_hipCtxGetApiVersion,
ROCPROFILER_HIP_API_ID_hipCtxGetCacheConfig,
ROCPROFILER_HIP_API_ID_hipCtxGetCurrent,
ROCPROFILER_HIP_API_ID_hipCtxGetDevice,
ROCPROFILER_HIP_API_ID_hipCtxGetFlags,
ROCPROFILER_HIP_API_ID_hipCtxGetSharedMemConfig,
ROCPROFILER_HIP_API_ID_hipCtxPopCurrent,
ROCPROFILER_HIP_API_ID_hipCtxPushCurrent,
ROCPROFILER_HIP_API_ID_hipCtxSetCacheConfig,
ROCPROFILER_HIP_API_ID_hipCtxSetCurrent,
ROCPROFILER_HIP_API_ID_hipCtxSetSharedMemConfig,
ROCPROFILER_HIP_API_ID_hipCtxSynchronize,
ROCPROFILER_HIP_API_ID_hipDestroyExternalMemory,
ROCPROFILER_HIP_API_ID_hipDestroyExternalSemaphore,
ROCPROFILER_HIP_API_ID_hipDeviceCanAccessPeer,
ROCPROFILER_HIP_API_ID_hipDeviceComputeCapability,
ROCPROFILER_HIP_API_ID_hipDeviceDisablePeerAccess,
ROCPROFILER_HIP_API_ID_hipDeviceEnablePeerAccess,
ROCPROFILER_HIP_API_ID_hipDeviceGet,
ROCPROFILER_HIP_API_ID_hipDeviceGetAttribute,
ROCPROFILER_HIP_API_ID_hipDeviceGetByPCIBusId,
ROCPROFILER_HIP_API_ID_hipDeviceGetCacheConfig,
ROCPROFILER_HIP_API_ID_hipDeviceGetLimit,
ROCPROFILER_HIP_API_ID_hipDeviceGetName,
ROCPROFILER_HIP_API_ID_hipDeviceGetP2PAttribute,
ROCPROFILER_HIP_API_ID_hipDeviceGetPCIBusId,
ROCPROFILER_HIP_API_ID_hipDeviceGetSharedMemConfig,
ROCPROFILER_HIP_API_ID_hipDeviceGetStreamPriorityRange,
ROCPROFILER_HIP_API_ID_hipDevicePrimaryCtxGetState,
ROCPROFILER_HIP_API_ID_hipDevicePrimaryCtxRelease,
ROCPROFILER_HIP_API_ID_hipDevicePrimaryCtxReset,
ROCPROFILER_HIP_API_ID_hipDevicePrimaryCtxRetain,
ROCPROFILER_HIP_API_ID_hipDevicePrimaryCtxSetFlags,
ROCPROFILER_HIP_API_ID_hipDeviceReset,
ROCPROFILER_HIP_API_ID_hipDeviceSetCacheConfig,
ROCPROFILER_HIP_API_ID_hipDeviceSetSharedMemConfig,
ROCPROFILER_HIP_API_ID_hipDeviceSynchronize,
ROCPROFILER_HIP_API_ID_hipDeviceTotalMem,
ROCPROFILER_HIP_API_ID_RESERVED_50,
ROCPROFILER_HIP_API_ID_hipDrvMemcpy2DUnaligned,
ROCPROFILER_HIP_API_ID_hipDrvMemcpy3D,
ROCPROFILER_HIP_API_ID_hipDrvMemcpy3DAsync,
ROCPROFILER_HIP_API_ID_hipEventCreate,
ROCPROFILER_HIP_API_ID_hipEventCreateWithFlags,
ROCPROFILER_HIP_API_ID_hipEventDestroy,
ROCPROFILER_HIP_API_ID_hipEventElapsedTime,
ROCPROFILER_HIP_API_ID_hipEventQuery,
ROCPROFILER_HIP_API_ID_hipEventRecord,
ROCPROFILER_HIP_API_ID_hipEventSynchronize,
ROCPROFILER_HIP_API_ID_hipExtGetLinkTypeAndHopCount,
ROCPROFILER_HIP_API_ID_hipExtLaunchKernel,
ROCPROFILER_HIP_API_ID_hipExtLaunchMultiKernelMultiDevice,
ROCPROFILER_HIP_API_ID_hipExtMallocWithFlags,
ROCPROFILER_HIP_API_ID_hipExtModuleLaunchKernel,
ROCPROFILER_HIP_API_ID_hipExtStreamCreateWithCUMask,
ROCPROFILER_HIP_API_ID_hipExtStreamGetCUMask,
ROCPROFILER_HIP_API_ID_hipExternalMemoryGetMappedBuffer,
ROCPROFILER_HIP_API_ID_hipFree,
ROCPROFILER_HIP_API_ID_hipFreeArray,
ROCPROFILER_HIP_API_ID_hipFreeHost,
ROCPROFILER_HIP_API_ID_hipFreeMipmappedArray,
ROCPROFILER_HIP_API_ID_hipFuncGetAttribute,
ROCPROFILER_HIP_API_ID_hipFuncGetAttributes,
ROCPROFILER_HIP_API_ID_hipFuncSetAttribute,
ROCPROFILER_HIP_API_ID_hipFuncSetCacheConfig,
ROCPROFILER_HIP_API_ID_hipFuncSetSharedMemConfig,
ROCPROFILER_HIP_API_ID_hipGetDevice,
ROCPROFILER_HIP_API_ID_hipGetDeviceCount,
ROCPROFILER_HIP_API_ID_hipGetDeviceFlags,
ROCPROFILER_HIP_API_ID_hipGetDeviceProperties,
ROCPROFILER_HIP_API_ID_RESERVED_82,
ROCPROFILER_HIP_API_ID_hipGetErrorString,
ROCPROFILER_HIP_API_ID_hipGetLastError,
ROCPROFILER_HIP_API_ID_hipGetMipmappedArrayLevel,
ROCPROFILER_HIP_API_ID_hipGetSymbolAddress,
ROCPROFILER_HIP_API_ID_hipGetSymbolSize,
ROCPROFILER_HIP_API_ID_hipHccModuleLaunchKernel,
ROCPROFILER_HIP_API_ID_hipHostAlloc,
ROCPROFILER_HIP_API_ID_hipHostFree,
ROCPROFILER_HIP_API_ID_hipHostGetDevicePointer,
ROCPROFILER_HIP_API_ID_hipHostGetFlags,
ROCPROFILER_HIP_API_ID_hipHostMalloc,
ROCPROFILER_HIP_API_ID_hipHostRegister,
ROCPROFILER_HIP_API_ID_hipHostUnregister,
ROCPROFILER_HIP_API_ID_hipImportExternalMemory,
ROCPROFILER_HIP_API_ID_hipImportExternalSemaphore,
ROCPROFILER_HIP_API_ID_hipInit,
ROCPROFILER_HIP_API_ID_hipIpcCloseMemHandle,
ROCPROFILER_HIP_API_ID_hipIpcGetEventHandle,
ROCPROFILER_HIP_API_ID_hipIpcGetMemHandle,
ROCPROFILER_HIP_API_ID_hipIpcOpenEventHandle,
ROCPROFILER_HIP_API_ID_hipIpcOpenMemHandle,
ROCPROFILER_HIP_API_ID_hipLaunchByPtr,
ROCPROFILER_HIP_API_ID_hipLaunchCooperativeKernel,
ROCPROFILER_HIP_API_ID_hipLaunchCooperativeKernelMultiDevice,
ROCPROFILER_HIP_API_ID_hipLaunchKernel,
ROCPROFILER_HIP_API_ID_hipMalloc,
ROCPROFILER_HIP_API_ID_hipMalloc3D,
ROCPROFILER_HIP_API_ID_hipMalloc3DArray,
ROCPROFILER_HIP_API_ID_hipMallocArray,
ROCPROFILER_HIP_API_ID_hipMallocHost,
ROCPROFILER_HIP_API_ID_hipMallocManaged,
ROCPROFILER_HIP_API_ID_hipMallocMipmappedArray,
ROCPROFILER_HIP_API_ID_hipMallocPitch,
ROCPROFILER_HIP_API_ID_hipMemAdvise,
ROCPROFILER_HIP_API_ID_hipMemAllocHost,
ROCPROFILER_HIP_API_ID_hipMemAllocPitch,
ROCPROFILER_HIP_API_ID_hipMemGetAddressRange,
ROCPROFILER_HIP_API_ID_hipMemGetInfo,
ROCPROFILER_HIP_API_ID_hipMemPrefetchAsync,
ROCPROFILER_HIP_API_ID_hipMemPtrGetInfo,
ROCPROFILER_HIP_API_ID_hipMemRangeGetAttribute,
ROCPROFILER_HIP_API_ID_hipMemRangeGetAttributes,
ROCPROFILER_HIP_API_ID_hipMemcpy,
ROCPROFILER_HIP_API_ID_hipMemcpy2D,
ROCPROFILER_HIP_API_ID_hipMemcpy2DAsync,
ROCPROFILER_HIP_API_ID_hipMemcpy2DFromArray,
ROCPROFILER_HIP_API_ID_hipMemcpy2DFromArrayAsync,
ROCPROFILER_HIP_API_ID_hipMemcpy2DToArray,
ROCPROFILER_HIP_API_ID_hipMemcpy2DToArrayAsync,
ROCPROFILER_HIP_API_ID_hipMemcpy3D,
ROCPROFILER_HIP_API_ID_hipMemcpy3DAsync,
ROCPROFILER_HIP_API_ID_hipMemcpyAsync,
ROCPROFILER_HIP_API_ID_hipMemcpyAtoH,
ROCPROFILER_HIP_API_ID_hipMemcpyDtoD,
ROCPROFILER_HIP_API_ID_hipMemcpyDtoDAsync,
ROCPROFILER_HIP_API_ID_hipMemcpyDtoH,
ROCPROFILER_HIP_API_ID_hipMemcpyDtoHAsync,
ROCPROFILER_HIP_API_ID_hipMemcpyFromArray,
ROCPROFILER_HIP_API_ID_hipMemcpyFromSymbol,
ROCPROFILER_HIP_API_ID_hipMemcpyFromSymbolAsync,
ROCPROFILER_HIP_API_ID_hipMemcpyHtoA,
ROCPROFILER_HIP_API_ID_hipMemcpyHtoD,
ROCPROFILER_HIP_API_ID_hipMemcpyHtoDAsync,
ROCPROFILER_HIP_API_ID_hipMemcpyParam2D,
ROCPROFILER_HIP_API_ID_hipMemcpyParam2DAsync,
ROCPROFILER_HIP_API_ID_hipMemcpyPeer,
ROCPROFILER_HIP_API_ID_hipMemcpyPeerAsync,
ROCPROFILER_HIP_API_ID_hipMemcpyToArray,
ROCPROFILER_HIP_API_ID_hipMemcpyToSymbol,
ROCPROFILER_HIP_API_ID_hipMemcpyToSymbolAsync,
ROCPROFILER_HIP_API_ID_hipMemcpyWithStream,
ROCPROFILER_HIP_API_ID_hipMemset,
ROCPROFILER_HIP_API_ID_hipMemset2D,
ROCPROFILER_HIP_API_ID_hipMemset2DAsync,
ROCPROFILER_HIP_API_ID_hipMemset3D,
ROCPROFILER_HIP_API_ID_hipMemset3DAsync,
ROCPROFILER_HIP_API_ID_hipMemsetAsync,
ROCPROFILER_HIP_API_ID_hipMemsetD16,
ROCPROFILER_HIP_API_ID_hipMemsetD16Async,
ROCPROFILER_HIP_API_ID_hipMemsetD32,
ROCPROFILER_HIP_API_ID_hipMemsetD32Async,
ROCPROFILER_HIP_API_ID_hipMemsetD8,
ROCPROFILER_HIP_API_ID_hipMemsetD8Async,
ROCPROFILER_HIP_API_ID_hipModuleGetFunction,
ROCPROFILER_HIP_API_ID_hipModuleGetGlobal,
ROCPROFILER_HIP_API_ID_hipModuleGetTexRef,
ROCPROFILER_HIP_API_ID_hipModuleLaunchKernel,
ROCPROFILER_HIP_API_ID_hipModuleLoad,
ROCPROFILER_HIP_API_ID_hipModuleLoadData,
ROCPROFILER_HIP_API_ID_hipModuleLoadDataEx,
ROCPROFILER_HIP_API_ID_hipModuleOccupancyMaxActiveBlocksPerMultiprocessor,
ROCPROFILER_HIP_API_ID_hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags,
ROCPROFILER_HIP_API_ID_hipModuleOccupancyMaxPotentialBlockSize,
ROCPROFILER_HIP_API_ID_hipModuleOccupancyMaxPotentialBlockSizeWithFlags,
ROCPROFILER_HIP_API_ID_hipModuleUnload,
ROCPROFILER_HIP_API_ID_hipOccupancyMaxActiveBlocksPerMultiprocessor,
ROCPROFILER_HIP_API_ID_hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags,
ROCPROFILER_HIP_API_ID_hipOccupancyMaxPotentialBlockSize,
ROCPROFILER_HIP_API_ID_hipPeekAtLastError,
ROCPROFILER_HIP_API_ID_hipPointerGetAttributes,
ROCPROFILER_HIP_API_ID_hipProfilerStart,
ROCPROFILER_HIP_API_ID_hipProfilerStop,
ROCPROFILER_HIP_API_ID_RESERVED_185,
ROCPROFILER_HIP_API_ID_hipSetDevice,
ROCPROFILER_HIP_API_ID_hipSetDeviceFlags,
ROCPROFILER_HIP_API_ID_hipSetupArgument,
ROCPROFILER_HIP_API_ID_hipSignalExternalSemaphoresAsync,
ROCPROFILER_HIP_API_ID_hipStreamAddCallback,
ROCPROFILER_HIP_API_ID_hipStreamAttachMemAsync,
ROCPROFILER_HIP_API_ID_hipStreamCreate,
ROCPROFILER_HIP_API_ID_hipStreamCreateWithFlags,
ROCPROFILER_HIP_API_ID_hipStreamCreateWithPriority,
ROCPROFILER_HIP_API_ID_hipStreamDestroy,
ROCPROFILER_HIP_API_ID_hipStreamGetFlags,
ROCPROFILER_HIP_API_ID_hipStreamGetPriority,
ROCPROFILER_HIP_API_ID_hipStreamQuery,
ROCPROFILER_HIP_API_ID_hipStreamSynchronize,
ROCPROFILER_HIP_API_ID_hipStreamWaitEvent,
ROCPROFILER_HIP_API_ID_hipStreamWaitValue32,
ROCPROFILER_HIP_API_ID_hipStreamWaitValue64,
ROCPROFILER_HIP_API_ID_hipStreamWriteValue32,
ROCPROFILER_HIP_API_ID_hipStreamWriteValue64,
ROCPROFILER_HIP_API_ID_hipWaitExternalSemaphoresAsync,
ROCPROFILER_HIP_API_ID_hipCreateSurfaceObject,
ROCPROFILER_HIP_API_ID_hipDestroySurfaceObject,
ROCPROFILER_HIP_API_ID_hipGraphAddKernelNode,
ROCPROFILER_HIP_API_ID_hipGraphAddMemcpyNode,
ROCPROFILER_HIP_API_ID_hipGraphAddMemsetNode,
ROCPROFILER_HIP_API_ID_hipGraphCreate,
ROCPROFILER_HIP_API_ID_hipGraphDestroy,
ROCPROFILER_HIP_API_ID_hipGraphExecDestroy,
ROCPROFILER_HIP_API_ID_hipGraphInstantiate,
ROCPROFILER_HIP_API_ID_hipGraphLaunch,
ROCPROFILER_HIP_API_ID_hipMipmappedArrayCreate,
ROCPROFILER_HIP_API_ID_hipMipmappedArrayDestroy,
ROCPROFILER_HIP_API_ID_hipMipmappedArrayGetLevel,
ROCPROFILER_HIP_API_ID_hipStreamBeginCapture,
ROCPROFILER_HIP_API_ID_hipStreamEndCapture,
ROCPROFILER_HIP_API_ID_hipTexRefGetAddress,
ROCPROFILER_HIP_API_ID_hipTexRefGetFlags,
ROCPROFILER_HIP_API_ID_hipTexRefGetFormat,
ROCPROFILER_HIP_API_ID_hipTexRefGetMaxAnisotropy,
ROCPROFILER_HIP_API_ID_hipTexRefGetMipMappedArray,
ROCPROFILER_HIP_API_ID_hipTexRefGetMipmapLevelBias,
ROCPROFILER_HIP_API_ID_hipTexRefGetMipmapLevelClamp,
ROCPROFILER_HIP_API_ID_hipTexRefSetAddress,
ROCPROFILER_HIP_API_ID_hipTexRefSetAddress2D,
ROCPROFILER_HIP_API_ID_hipTexRefSetBorderColor,
ROCPROFILER_HIP_API_ID_hipTexRefSetFormat,
ROCPROFILER_HIP_API_ID_hipTexRefSetMaxAnisotropy,
ROCPROFILER_HIP_API_ID_hipTexRefSetMipmapLevelClamp,
ROCPROFILER_HIP_API_ID_hipTexRefSetMipmappedArray,
ROCPROFILER_HIP_API_ID_hipGLGetDevices,
ROCPROFILER_HIP_API_ID_hipGraphAddDependencies,
ROCPROFILER_HIP_API_ID_hipGraphAddEmptyNode,
ROCPROFILER_HIP_API_ID_hipGraphExecKernelNodeSetParams,
ROCPROFILER_HIP_API_ID_hipGraphGetNodes,
ROCPROFILER_HIP_API_ID_hipGraphGetRootNodes,
ROCPROFILER_HIP_API_ID_hipGraphKernelNodeGetParams,
ROCPROFILER_HIP_API_ID_hipGraphKernelNodeSetParams,
ROCPROFILER_HIP_API_ID_hipGraphMemcpyNodeGetParams,
ROCPROFILER_HIP_API_ID_hipGraphMemcpyNodeSetParams,
ROCPROFILER_HIP_API_ID_hipGraphMemsetNodeGetParams,
ROCPROFILER_HIP_API_ID_hipGraphMemsetNodeSetParams,
ROCPROFILER_HIP_API_ID_hipGraphicsGLRegisterBuffer,
ROCPROFILER_HIP_API_ID_hipGraphicsMapResources,
ROCPROFILER_HIP_API_ID_hipGraphicsResourceGetMappedPointer,
ROCPROFILER_HIP_API_ID_hipGraphicsUnmapResources,
ROCPROFILER_HIP_API_ID_hipGraphicsUnregisterResource,
ROCPROFILER_HIP_API_ID_hipGraphAddChildGraphNode,
ROCPROFILER_HIP_API_ID_hipGraphAddEventRecordNode,
ROCPROFILER_HIP_API_ID_hipGraphAddEventWaitNode,
ROCPROFILER_HIP_API_ID_hipGraphAddHostNode,
ROCPROFILER_HIP_API_ID_hipGraphAddMemcpyNode1D,
ROCPROFILER_HIP_API_ID_hipGraphAddMemcpyNodeFromSymbol,
ROCPROFILER_HIP_API_ID_hipGraphAddMemcpyNodeToSymbol,
ROCPROFILER_HIP_API_ID_hipGraphChildGraphNodeGetGraph,
ROCPROFILER_HIP_API_ID_hipGraphClone,
ROCPROFILER_HIP_API_ID_hipGraphDestroyNode,
ROCPROFILER_HIP_API_ID_hipGraphEventRecordNodeGetEvent,
ROCPROFILER_HIP_API_ID_hipGraphEventRecordNodeSetEvent,
ROCPROFILER_HIP_API_ID_hipGraphEventWaitNodeGetEvent,
ROCPROFILER_HIP_API_ID_hipGraphEventWaitNodeSetEvent,
ROCPROFILER_HIP_API_ID_hipGraphExecChildGraphNodeSetParams,
ROCPROFILER_HIP_API_ID_hipGraphExecEventRecordNodeSetEvent,
ROCPROFILER_HIP_API_ID_hipGraphExecEventWaitNodeSetEvent,
ROCPROFILER_HIP_API_ID_hipGraphExecHostNodeSetParams,
ROCPROFILER_HIP_API_ID_hipGraphExecMemcpyNodeSetParams,
ROCPROFILER_HIP_API_ID_hipGraphExecMemcpyNodeSetParams1D,
ROCPROFILER_HIP_API_ID_hipGraphExecMemcpyNodeSetParamsFromSymbol,
ROCPROFILER_HIP_API_ID_hipGraphExecMemcpyNodeSetParamsToSymbol,
ROCPROFILER_HIP_API_ID_hipGraphExecMemsetNodeSetParams,
ROCPROFILER_HIP_API_ID_hipGraphExecUpdate,
ROCPROFILER_HIP_API_ID_hipGraphGetEdges,
ROCPROFILER_HIP_API_ID_hipGraphHostNodeGetParams,
ROCPROFILER_HIP_API_ID_hipGraphHostNodeSetParams,
ROCPROFILER_HIP_API_ID_hipGraphInstantiateWithFlags,
ROCPROFILER_HIP_API_ID_hipGraphMemcpyNodeSetParams1D,
ROCPROFILER_HIP_API_ID_hipGraphMemcpyNodeSetParamsFromSymbol,
ROCPROFILER_HIP_API_ID_hipGraphMemcpyNodeSetParamsToSymbol,
ROCPROFILER_HIP_API_ID_hipGraphNodeFindInClone,
ROCPROFILER_HIP_API_ID_hipGraphNodeGetDependencies,
ROCPROFILER_HIP_API_ID_hipGraphNodeGetDependentNodes,
ROCPROFILER_HIP_API_ID_hipGraphNodeGetType,
ROCPROFILER_HIP_API_ID_hipGraphRemoveDependencies,
ROCPROFILER_HIP_API_ID_hipStreamGetCaptureInfo,
ROCPROFILER_HIP_API_ID_hipStreamGetCaptureInfo_v2,
ROCPROFILER_HIP_API_ID_hipStreamIsCapturing,
ROCPROFILER_HIP_API_ID_hipStreamUpdateCaptureDependencies,
ROCPROFILER_HIP_API_ID_hipDrvPointerGetAttributes,
ROCPROFILER_HIP_API_ID_hipGraphicsGLRegisterImage,
ROCPROFILER_HIP_API_ID_hipGraphicsSubResourceGetMappedArray,
ROCPROFILER_HIP_API_ID_hipPointerGetAttribute,
ROCPROFILER_HIP_API_ID_RESERVED_296,
ROCPROFILER_HIP_API_ID_hipThreadExchangeStreamCaptureMode,
ROCPROFILER_HIP_API_ID_hipDeviceGetUuid,
ROCPROFILER_HIP_API_ID_hipGetChannelDesc,
ROCPROFILER_HIP_API_ID_hipGraphKernelNodeGetAttribute,
ROCPROFILER_HIP_API_ID_hipGraphKernelNodeSetAttribute,
ROCPROFILER_HIP_API_ID_hipLaunchHostFunc,
ROCPROFILER_HIP_API_ID_hipDeviceGetDefaultMemPool,
ROCPROFILER_HIP_API_ID_hipDeviceGetMemPool,
ROCPROFILER_HIP_API_ID_hipDeviceSetMemPool,
ROCPROFILER_HIP_API_ID_hipFreeAsync,
ROCPROFILER_HIP_API_ID_hipMallocAsync,
ROCPROFILER_HIP_API_ID_hipMallocFromPoolAsync,
ROCPROFILER_HIP_API_ID_hipMemPoolCreate,
ROCPROFILER_HIP_API_ID_hipMemPoolDestroy,
ROCPROFILER_HIP_API_ID_hipMemPoolExportPointer,
ROCPROFILER_HIP_API_ID_hipMemPoolExportToShareableHandle,
ROCPROFILER_HIP_API_ID_hipMemPoolGetAccess,
ROCPROFILER_HIP_API_ID_hipMemPoolGetAttribute,
ROCPROFILER_HIP_API_ID_hipMemPoolImportFromShareableHandle,
ROCPROFILER_HIP_API_ID_hipMemPoolImportPointer,
ROCPROFILER_HIP_API_ID_hipMemPoolSetAccess,
ROCPROFILER_HIP_API_ID_hipMemPoolSetAttribute,
ROCPROFILER_HIP_API_ID_hipMemPoolTrimTo,
ROCPROFILER_HIP_API_ID_hipMemAddressFree,
ROCPROFILER_HIP_API_ID_hipMemAddressReserve,
ROCPROFILER_HIP_API_ID_hipMemCreate,
ROCPROFILER_HIP_API_ID_hipMemExportToShareableHandle,
ROCPROFILER_HIP_API_ID_hipMemGetAccess,
ROCPROFILER_HIP_API_ID_hipMemGetAllocationGranularity,
ROCPROFILER_HIP_API_ID_hipMemGetAllocationPropertiesFromHandle,
ROCPROFILER_HIP_API_ID_hipMemImportFromShareableHandle,
ROCPROFILER_HIP_API_ID_hipMemMap,
ROCPROFILER_HIP_API_ID_hipMemMapArrayAsync,
ROCPROFILER_HIP_API_ID_hipMemRelease,
ROCPROFILER_HIP_API_ID_hipMemRetainAllocationHandle,
ROCPROFILER_HIP_API_ID_hipMemSetAccess,
ROCPROFILER_HIP_API_ID_hipMemUnmap,
ROCPROFILER_HIP_API_ID_hipDeviceSetGraphMemAttribute,
ROCPROFILER_HIP_API_ID_hipDeviceGetGraphMemAttribute,
ROCPROFILER_HIP_API_ID_hipDeviceGraphMemTrim,
ROCPROFILER_HIP_API_ID_hipDeviceSetLimit,
ROCPROFILER_HIP_API_ID_hipTexRefSetArray,
ROCPROFILER_HIP_API_ID_hipTexRefSetFlags,
ROCPROFILER_HIP_API_ID_hipTexRefSetMipmapLevelBias,
ROCPROFILER_HIP_API_ID_hipDriverGetVersion,
ROCPROFILER_HIP_API_ID_hipGraphUpload,
ROCPROFILER_HIP_API_ID_hipRuntimeGetVersion,
ROCPROFILER_HIP_API_ID_hipUserObjectCreate,
ROCPROFILER_HIP_API_ID_hipUserObjectRelease,
ROCPROFILER_HIP_API_ID_hipUserObjectRetain,
ROCPROFILER_HIP_API_ID_hipGraphRetainUserObject,
ROCPROFILER_HIP_API_ID_hipGraphReleaseUserObject,
ROCPROFILER_HIP_API_ID_hipGraphDebugDotPrint,
ROCPROFILER_HIP_API_ID_hipGraphKernelNodeCopyAttributes,
ROCPROFILER_HIP_API_ID_hipGraphNodeGetEnabled,
ROCPROFILER_HIP_API_ID_hipGraphNodeSetEnabled,
ROCPROFILER_HIP_API_ID_hipPointerSetAttribute,
ROCPROFILER_HIP_API_ID_hipGraphAddMemAllocNode,
ROCPROFILER_HIP_API_ID_hipGraphAddMemFreeNode,
ROCPROFILER_HIP_API_ID_hipGraphMemAllocNodeGetParams,
ROCPROFILER_HIP_API_ID_hipGraphMemFreeNodeGetParams,
ROCPROFILER_HIP_API_ID_hipModuleLaunchCooperativeKernel,
ROCPROFILER_HIP_API_ID_hipModuleLaunchCooperativeKernelMultiDevice,
ROCPROFILER_HIP_API_ID_hipArray3DGetDescriptor,
ROCPROFILER_HIP_API_ID_hipArrayGetDescriptor,
ROCPROFILER_HIP_API_ID_hipArrayGetInfo,
ROCPROFILER_HIP_API_ID_hipStreamGetDevice,
ROCPROFILER_HIP_API_ID_LAST,
//
// Deprecated or removed
//
ROCPROFILER_HIP_API_ID_hipBindTexture = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipBindTexture2D = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipBindTextureToArray = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipBindTextureToMipmappedArray = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipCreateTextureObject = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipDestroyTextureObject = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipDeviceGetCount = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipGetTextureAlignmentOffset = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipGetTextureObjectResourceDesc = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipGetTextureObjectResourceViewDesc = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipGetTextureObjectTextureDesc = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipGetTextureReference = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipMemcpy2DArrayToArray = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipMemcpyArrayToArray = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipMemcpyAtoA = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipMemcpyAtoD = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipMemcpyAtoHAsync = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipMemcpyDtoA = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipMemcpyFromArrayAsync = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipMemcpyHtoAAsync = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipMemcpyToArrayAsync = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipModuleLaunchKernelExt = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipSetValidDevices = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipTexObjectCreate = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipTexObjectDestroy = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipTexObjectGetResourceDesc = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipTexObjectGetResourceViewDesc = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipTexObjectGetTextureDesc = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipTexRefGetAddressMode = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipTexRefGetArray = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipTexRefGetBorderColor = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipTexRefGetFilterMode = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipTexRefGetMipmapFilterMode = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipTexRefGetMipmappedArray = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipTexRefSetAddressMode = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipTexRefSetFilterMode = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipTexRefSetMipmapFilterMode = ROCPROFILER_HIP_API_ID_NONE,
ROCPROFILER_HIP_API_ID_hipUnbindTexture = ROCPROFILER_HIP_API_ID_NONE,
} rocprofiler_hip_api_id_t;
+43
View File
@@ -0,0 +1,43 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
// without AMD_INTERNAL_BUILD defined, including the hsa/hsa.h looks for headers in inc/ folder
// so we always want it defined but we set ROCPROFILER_DEFINED_AMD_INTERNAL_BUILD to 1 to tell
// us that after this include, we should undefine it
#ifndef AMD_INTERNAL_BUILD
# define AMD_INTERNAL_BUILD
# ifndef ROCPROFILER_DEFINED_AMD_INTERNAL_BUILD
# define ROCPROFILER_DEFINED_AMD_INTERNAL_BUILD 1
# endif
#endif
#include <rocprofiler-sdk/hsa/api_args.h>
#include <rocprofiler-sdk/hsa/api_id.h>
#include <rocprofiler-sdk/hsa/table_api_id.h>
#include <hsa/hsa.h>
#if defined(ROCPROFILER_DEFINED_AMD_INTERNAL_BUILD) && ROCPROFILER_DEFINED_AMD_INTERNAL_BUILD > 0
# undef AMD_INTERNAL_BUILD
#endif
@@ -0,0 +1,9 @@
#
#
# Installation of public HSA headers
#
#
set(ROCPROFILER_HSA_HEADER_FILES api_args.h api_id.h table_api_id.h)
install(FILES ${ROCPROFILER_HSA_HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocprofiler-sdk/hsa)
File diff suppressed because it is too large. Load diff
+248
View File
@@ -0,0 +1,248 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#pragma once
#include <rocprofiler-sdk/version.h>
/**
* @brief ROCProfiler enumeration of HSA API tracing operations
*/
typedef enum // NOLINT(performance-enum-size)
{
ROCPROFILER_HSA_API_ID_NONE = -1,
// block: CoreApi API
ROCPROFILER_HSA_API_ID_hsa_init = 0,
ROCPROFILER_HSA_API_ID_hsa_shut_down,
ROCPROFILER_HSA_API_ID_hsa_system_get_info,
ROCPROFILER_HSA_API_ID_hsa_system_extension_supported,
ROCPROFILER_HSA_API_ID_hsa_system_get_extension_table,
ROCPROFILER_HSA_API_ID_hsa_iterate_agents,
ROCPROFILER_HSA_API_ID_hsa_agent_get_info,
ROCPROFILER_HSA_API_ID_hsa_queue_create,
ROCPROFILER_HSA_API_ID_hsa_soft_queue_create,
ROCPROFILER_HSA_API_ID_hsa_queue_destroy,
ROCPROFILER_HSA_API_ID_hsa_queue_inactivate,
ROCPROFILER_HSA_API_ID_hsa_queue_load_read_index_scacquire,
ROCPROFILER_HSA_API_ID_hsa_queue_load_read_index_relaxed,
ROCPROFILER_HSA_API_ID_hsa_queue_load_write_index_scacquire,
ROCPROFILER_HSA_API_ID_hsa_queue_load_write_index_relaxed,
ROCPROFILER_HSA_API_ID_hsa_queue_store_write_index_relaxed,
ROCPROFILER_HSA_API_ID_hsa_queue_store_write_index_screlease,
ROCPROFILER_HSA_API_ID_hsa_queue_cas_write_index_scacq_screl,
ROCPROFILER_HSA_API_ID_hsa_queue_cas_write_index_scacquire,
ROCPROFILER_HSA_API_ID_hsa_queue_cas_write_index_relaxed,
ROCPROFILER_HSA_API_ID_hsa_queue_cas_write_index_screlease,
ROCPROFILER_HSA_API_ID_hsa_queue_add_write_index_scacq_screl,
ROCPROFILER_HSA_API_ID_hsa_queue_add_write_index_scacquire,
ROCPROFILER_HSA_API_ID_hsa_queue_add_write_index_relaxed,
ROCPROFILER_HSA_API_ID_hsa_queue_add_write_index_screlease,
ROCPROFILER_HSA_API_ID_hsa_queue_store_read_index_relaxed,
ROCPROFILER_HSA_API_ID_hsa_queue_store_read_index_screlease,
ROCPROFILER_HSA_API_ID_hsa_agent_iterate_regions,
ROCPROFILER_HSA_API_ID_hsa_region_get_info,
ROCPROFILER_HSA_API_ID_hsa_agent_get_exception_policies,
ROCPROFILER_HSA_API_ID_hsa_agent_extension_supported,
ROCPROFILER_HSA_API_ID_hsa_memory_register,
ROCPROFILER_HSA_API_ID_hsa_memory_deregister,
ROCPROFILER_HSA_API_ID_hsa_memory_allocate,
ROCPROFILER_HSA_API_ID_hsa_memory_free,
ROCPROFILER_HSA_API_ID_hsa_memory_copy,
ROCPROFILER_HSA_API_ID_hsa_memory_assign_agent,
ROCPROFILER_HSA_API_ID_hsa_signal_create,
ROCPROFILER_HSA_API_ID_hsa_signal_destroy,
ROCPROFILER_HSA_API_ID_hsa_signal_load_relaxed,
ROCPROFILER_HSA_API_ID_hsa_signal_load_scacquire,
ROCPROFILER_HSA_API_ID_hsa_signal_store_relaxed,
ROCPROFILER_HSA_API_ID_hsa_signal_store_screlease,
ROCPROFILER_HSA_API_ID_hsa_signal_wait_relaxed,
ROCPROFILER_HSA_API_ID_hsa_signal_wait_scacquire,
ROCPROFILER_HSA_API_ID_hsa_signal_and_relaxed,
ROCPROFILER_HSA_API_ID_hsa_signal_and_scacquire,
ROCPROFILER_HSA_API_ID_hsa_signal_and_screlease,
ROCPROFILER_HSA_API_ID_hsa_signal_and_scacq_screl,
ROCPROFILER_HSA_API_ID_hsa_signal_or_relaxed,
ROCPROFILER_HSA_API_ID_hsa_signal_or_scacquire,
ROCPROFILER_HSA_API_ID_hsa_signal_or_screlease,
ROCPROFILER_HSA_API_ID_hsa_signal_or_scacq_screl,
ROCPROFILER_HSA_API_ID_hsa_signal_xor_relaxed,
ROCPROFILER_HSA_API_ID_hsa_signal_xor_scacquire,
ROCPROFILER_HSA_API_ID_hsa_signal_xor_screlease,
ROCPROFILER_HSA_API_ID_hsa_signal_xor_scacq_screl,
ROCPROFILER_HSA_API_ID_hsa_signal_exchange_relaxed,
ROCPROFILER_HSA_API_ID_hsa_signal_exchange_scacquire,
ROCPROFILER_HSA_API_ID_hsa_signal_exchange_screlease,
ROCPROFILER_HSA_API_ID_hsa_signal_exchange_scacq_screl,
ROCPROFILER_HSA_API_ID_hsa_signal_add_relaxed,
ROCPROFILER_HSA_API_ID_hsa_signal_add_scacquire,
ROCPROFILER_HSA_API_ID_hsa_signal_add_screlease,
ROCPROFILER_HSA_API_ID_hsa_signal_add_scacq_screl,
ROCPROFILER_HSA_API_ID_hsa_signal_subtract_relaxed,
ROCPROFILER_HSA_API_ID_hsa_signal_subtract_scacquire,
ROCPROFILER_HSA_API_ID_hsa_signal_subtract_screlease,
ROCPROFILER_HSA_API_ID_hsa_signal_subtract_scacq_screl,
ROCPROFILER_HSA_API_ID_hsa_signal_cas_relaxed,
ROCPROFILER_HSA_API_ID_hsa_signal_cas_scacquire,
ROCPROFILER_HSA_API_ID_hsa_signal_cas_screlease,
ROCPROFILER_HSA_API_ID_hsa_signal_cas_scacq_screl,
ROCPROFILER_HSA_API_ID_hsa_isa_from_name,
ROCPROFILER_HSA_API_ID_hsa_isa_get_info,
ROCPROFILER_HSA_API_ID_hsa_isa_compatible,
ROCPROFILER_HSA_API_ID_hsa_code_object_serialize,
ROCPROFILER_HSA_API_ID_hsa_code_object_deserialize,
ROCPROFILER_HSA_API_ID_hsa_code_object_destroy,
ROCPROFILER_HSA_API_ID_hsa_code_object_get_info,
ROCPROFILER_HSA_API_ID_hsa_code_object_get_symbol,
ROCPROFILER_HSA_API_ID_hsa_code_symbol_get_info,
ROCPROFILER_HSA_API_ID_hsa_code_object_iterate_symbols,
ROCPROFILER_HSA_API_ID_hsa_executable_create,
ROCPROFILER_HSA_API_ID_hsa_executable_destroy,
ROCPROFILER_HSA_API_ID_hsa_executable_load_code_object,
ROCPROFILER_HSA_API_ID_hsa_executable_freeze,
ROCPROFILER_HSA_API_ID_hsa_executable_get_info,
ROCPROFILER_HSA_API_ID_hsa_executable_global_variable_define,
ROCPROFILER_HSA_API_ID_hsa_executable_agent_global_variable_define,
ROCPROFILER_HSA_API_ID_hsa_executable_readonly_variable_define,
ROCPROFILER_HSA_API_ID_hsa_executable_validate,
ROCPROFILER_HSA_API_ID_hsa_executable_get_symbol,
ROCPROFILER_HSA_API_ID_hsa_executable_symbol_get_info,
ROCPROFILER_HSA_API_ID_hsa_executable_iterate_symbols,
ROCPROFILER_HSA_API_ID_hsa_status_string,
ROCPROFILER_HSA_API_ID_hsa_extension_get_name,
ROCPROFILER_HSA_API_ID_hsa_system_major_extension_supported,
ROCPROFILER_HSA_API_ID_hsa_system_get_major_extension_table,
ROCPROFILER_HSA_API_ID_hsa_agent_major_extension_supported,
ROCPROFILER_HSA_API_ID_hsa_cache_get_info,
ROCPROFILER_HSA_API_ID_hsa_agent_iterate_caches,
ROCPROFILER_HSA_API_ID_hsa_signal_silent_store_relaxed,
ROCPROFILER_HSA_API_ID_hsa_signal_silent_store_screlease,
ROCPROFILER_HSA_API_ID_hsa_signal_group_create,
ROCPROFILER_HSA_API_ID_hsa_signal_group_destroy,
ROCPROFILER_HSA_API_ID_hsa_signal_group_wait_any_scacquire,
ROCPROFILER_HSA_API_ID_hsa_signal_group_wait_any_relaxed,
ROCPROFILER_HSA_API_ID_hsa_agent_iterate_isas,
ROCPROFILER_HSA_API_ID_hsa_isa_get_info_alt,
ROCPROFILER_HSA_API_ID_hsa_isa_get_exception_policies,
ROCPROFILER_HSA_API_ID_hsa_isa_get_round_method,
ROCPROFILER_HSA_API_ID_hsa_wavefront_get_info,
ROCPROFILER_HSA_API_ID_hsa_isa_iterate_wavefronts,
ROCPROFILER_HSA_API_ID_hsa_code_object_get_symbol_from_name,
ROCPROFILER_HSA_API_ID_hsa_code_object_reader_create_from_file,
ROCPROFILER_HSA_API_ID_hsa_code_object_reader_create_from_memory,
ROCPROFILER_HSA_API_ID_hsa_code_object_reader_destroy,
ROCPROFILER_HSA_API_ID_hsa_executable_create_alt,
ROCPROFILER_HSA_API_ID_hsa_executable_load_program_code_object,
ROCPROFILER_HSA_API_ID_hsa_executable_load_agent_code_object,
ROCPROFILER_HSA_API_ID_hsa_executable_validate_alt,
ROCPROFILER_HSA_API_ID_hsa_executable_get_symbol_by_name,
ROCPROFILER_HSA_API_ID_hsa_executable_iterate_agent_symbols,
ROCPROFILER_HSA_API_ID_hsa_executable_iterate_program_symbols,
// block: AmdExt API
ROCPROFILER_HSA_API_ID_hsa_amd_coherency_get_type,
ROCPROFILER_HSA_API_ID_hsa_amd_coherency_set_type,
ROCPROFILER_HSA_API_ID_hsa_amd_profiling_set_profiler_enabled,
ROCPROFILER_HSA_API_ID_hsa_amd_profiling_async_copy_enable,
ROCPROFILER_HSA_API_ID_hsa_amd_profiling_get_dispatch_time,
ROCPROFILER_HSA_API_ID_hsa_amd_profiling_get_async_copy_time,
ROCPROFILER_HSA_API_ID_hsa_amd_profiling_convert_tick_to_system_domain,
ROCPROFILER_HSA_API_ID_hsa_amd_signal_async_handler,
ROCPROFILER_HSA_API_ID_hsa_amd_async_function,
ROCPROFILER_HSA_API_ID_hsa_amd_signal_wait_any,
ROCPROFILER_HSA_API_ID_hsa_amd_queue_cu_set_mask,
ROCPROFILER_HSA_API_ID_hsa_amd_memory_pool_get_info,
ROCPROFILER_HSA_API_ID_hsa_amd_agent_iterate_memory_pools,
ROCPROFILER_HSA_API_ID_hsa_amd_memory_pool_allocate,
ROCPROFILER_HSA_API_ID_hsa_amd_memory_pool_free,
ROCPROFILER_HSA_API_ID_hsa_amd_memory_async_copy,
ROCPROFILER_HSA_API_ID_hsa_amd_memory_async_copy_on_engine,
ROCPROFILER_HSA_API_ID_hsa_amd_memory_copy_engine_status,
ROCPROFILER_HSA_API_ID_hsa_amd_agent_memory_pool_get_info,
ROCPROFILER_HSA_API_ID_hsa_amd_agents_allow_access,
ROCPROFILER_HSA_API_ID_hsa_amd_memory_pool_can_migrate,
ROCPROFILER_HSA_API_ID_hsa_amd_memory_migrate,
ROCPROFILER_HSA_API_ID_hsa_amd_memory_lock,
ROCPROFILER_HSA_API_ID_hsa_amd_memory_unlock,
ROCPROFILER_HSA_API_ID_hsa_amd_memory_fill,
ROCPROFILER_HSA_API_ID_hsa_amd_interop_map_buffer,
ROCPROFILER_HSA_API_ID_hsa_amd_interop_unmap_buffer,
ROCPROFILER_HSA_API_ID_hsa_amd_image_create,
ROCPROFILER_HSA_API_ID_hsa_amd_pointer_info,
ROCPROFILER_HSA_API_ID_hsa_amd_pointer_info_set_userdata,
ROCPROFILER_HSA_API_ID_hsa_amd_ipc_memory_create,
ROCPROFILER_HSA_API_ID_hsa_amd_ipc_memory_attach,
ROCPROFILER_HSA_API_ID_hsa_amd_ipc_memory_detach,
ROCPROFILER_HSA_API_ID_hsa_amd_signal_create,
ROCPROFILER_HSA_API_ID_hsa_amd_ipc_signal_create,
ROCPROFILER_HSA_API_ID_hsa_amd_ipc_signal_attach,
ROCPROFILER_HSA_API_ID_hsa_amd_register_system_event_handler,
ROCPROFILER_HSA_API_ID_hsa_amd_queue_intercept_create,
ROCPROFILER_HSA_API_ID_hsa_amd_queue_intercept_register,
ROCPROFILER_HSA_API_ID_hsa_amd_queue_set_priority,
ROCPROFILER_HSA_API_ID_hsa_amd_memory_async_copy_rect,
ROCPROFILER_HSA_API_ID_hsa_amd_runtime_queue_create_register,
ROCPROFILER_HSA_API_ID_hsa_amd_memory_lock_to_pool,
ROCPROFILER_HSA_API_ID_hsa_amd_register_deallocation_callback,
ROCPROFILER_HSA_API_ID_hsa_amd_deregister_deallocation_callback,
ROCPROFILER_HSA_API_ID_hsa_amd_signal_value_pointer,
ROCPROFILER_HSA_API_ID_hsa_amd_svm_attributes_set,
ROCPROFILER_HSA_API_ID_hsa_amd_svm_attributes_get,
ROCPROFILER_HSA_API_ID_hsa_amd_svm_prefetch_async,
ROCPROFILER_HSA_API_ID_hsa_amd_spm_acquire,
ROCPROFILER_HSA_API_ID_hsa_amd_spm_release,
ROCPROFILER_HSA_API_ID_hsa_amd_spm_set_dest_buffer,
ROCPROFILER_HSA_API_ID_hsa_amd_queue_cu_get_mask,
ROCPROFILER_HSA_API_ID_hsa_amd_portable_export_dmabuf,
ROCPROFILER_HSA_API_ID_hsa_amd_portable_close_dmabuf,
// block: ImageExt API
ROCPROFILER_HSA_API_ID_hsa_ext_image_get_capability,
ROCPROFILER_HSA_API_ID_hsa_ext_image_data_get_info,
ROCPROFILER_HSA_API_ID_hsa_ext_image_create,
ROCPROFILER_HSA_API_ID_hsa_ext_image_import,
ROCPROFILER_HSA_API_ID_hsa_ext_image_export,
ROCPROFILER_HSA_API_ID_hsa_ext_image_copy,
ROCPROFILER_HSA_API_ID_hsa_ext_image_clear,
ROCPROFILER_HSA_API_ID_hsa_ext_image_destroy,
ROCPROFILER_HSA_API_ID_hsa_ext_sampler_create,
ROCPROFILER_HSA_API_ID_hsa_ext_sampler_destroy,
ROCPROFILER_HSA_API_ID_hsa_ext_image_get_capability_with_layout,
ROCPROFILER_HSA_API_ID_hsa_ext_image_data_get_info_with_layout,
ROCPROFILER_HSA_API_ID_hsa_ext_image_create_with_layout,
#if HSA_AMD_EXT_API_TABLE_MAJOR_VERSION >= 0x02
ROCPROFILER_HSA_API_ID_hsa_amd_vmem_address_reserve,
ROCPROFILER_HSA_API_ID_hsa_amd_vmem_address_free,
ROCPROFILER_HSA_API_ID_hsa_amd_vmem_handle_create,
ROCPROFILER_HSA_API_ID_hsa_amd_vmem_handle_release,
ROCPROFILER_HSA_API_ID_hsa_amd_vmem_map,
ROCPROFILER_HSA_API_ID_hsa_amd_vmem_unmap,
ROCPROFILER_HSA_API_ID_hsa_amd_vmem_set_access,
ROCPROFILER_HSA_API_ID_hsa_amd_vmem_get_access,
ROCPROFILER_HSA_API_ID_hsa_amd_vmem_export_shareable_handle,
ROCPROFILER_HSA_API_ID_hsa_amd_vmem_import_shareable_handle,
ROCPROFILER_HSA_API_ID_hsa_amd_vmem_retain_alloc_handle,
ROCPROFILER_HSA_API_ID_hsa_amd_vmem_get_alloc_properties_from_handle,
#endif
ROCPROFILER_HSA_API_ID_LAST,
} rocprofiler_hsa_api_id_t;
@@ -0,0 +1,33 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#pragma once
// NOLINTNEXTLINE(performance-enum-size)
typedef enum
{
ROCPROFILER_HSA_API_TABLE_ID_NONE = -1,
ROCPROFILER_HSA_API_TABLE_ID_CoreApi = 0,
ROCPROFILER_HSA_API_TABLE_ID_AmdExt,
ROCPROFILER_HSA_API_TABLE_ID_ImageExt,
ROCPROFILER_HSA_API_TABLE_ID_LAST,
} rocprofiler_hsa_table_api_id_t;
@@ -0,0 +1,223 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/defines.h>
#include <rocprofiler-sdk/fwd.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup INTERCEPT_TABLE Intercept table for runtime libraries
* @brief 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.
*
* @{
*/
/**
* @brief Callback type when a new runtime library is loaded. @see
* rocprofiler_at_runtime_api_registration
* @param [in] type Type of API table
* @param [in] lib_version Major, minor, and patch version of library encoded into single number
* similar to @ref ROCPROFILER_VERSION
* @param [in] lib_instance The number of times this runtime library has been registered previously
* @param [in] tables An array of pointers to the API tables
* @param [in] num_tables The size of the array of pointers to the API tables
* @param [in] user_data The pointer to the data provided to @ref
* rocprofiler_at_runtime_api_registration
*/
typedef void (*rocprofiler_intercept_library_cb_t)(rocprofiler_runtime_library_t type,
uint64_t lib_version,
uint64_t lib_instance,
void** tables,
uint64_t num_tables,
void* user_data);
/**
* @brief Invoke this function to receive callbacks when a ROCm library registers its API
* intercept table with rocprofiler. Use the @ref rocprofiler_runtime_library_t enumeration for
* specifying which raw API tables the tool would like to have access to. E.g. including @ref
* ROCPROFILER_HSA_LIBRARY in the @ref rocprofiler_at_runtime_api_registration function call
* communicates to rocprofiler that, when rocprofiler receives a `HsaApiTable` instance, the tool
* would like rocprofiler to provide it access too.
*
* When the HIP, HSA, and ROCTx libraries are initialized (either explicitly or on the first
* invocation of one of their public API functions), these runtimes will provide a table of function
* pointers to the rocprofiler library via the rocprofiler-register library if the
* `rocprofiler_configure` symbol is visible in the application's symbol table. The vast majority of
* tools will want to use the @ref CALLBACK_TRACING_SERVICE to trace these runtime APIs, however,
* some tools may want or require installing their own intercept functions in lieu of receiving
* these callbacks and those tools should use the @ref rocprofiler_at_runtime_api_registration to
* install their intercept functions. There are no restrictions to where or how early this function
* can be invoked but it will return ::ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED if it is
* invoked after rocprofiler has requested all the tool configurations. Thus, it is highly
* recommended to invoke this function within the @ref rocprofiler_configure function or the
* callback passed to the @ref rocprofiler_force_configure function -- the reason for this
* recommendation is that if @ref rocprofiler_at_runtime_api_registration is invoked in one of these
* locations, rocprofiler can guarantee that the tool will be passed the API table because, at the
* first instance of a runtime registering it's API table, rocprofiler will ensure that, in the case
* of the former, rocprofiler will invoke all of the @ref rocprofiler_configure symbols that are
* visible before checking the list of tools which want to receive the API tables and, in the case
* of the latter, @ref rocprofiler_force_configure will fail with error code @ref
* ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED if a runtime has already been registered (and,
* therefore, already scanned and invoked the visible @ref rocprofiler_configure symbols and
* completed the tool initialization). If @ref rocprofiler_at_runtime_api_registration is invoked
* outside of these recommended places, even if it is done before the `main` function starts (e.g.
* in a library init/constructor function), it is possible that another library, such as ROCm-aware
* MPI, caused the HIP and HSA runtime libraries to be initialized when that library was loaded. In
* this aforementioned scenario, if the ROCm-aware MPI library library init/constructor function
* runs before your library init/constructor function, rocprofiler will have already processed the
* API table and will not provide the API table to the tool due to the fact that the API may already
* be in use and, thus, any modifications to the table might result in thread-safety violations or
* more disastrous consequences.
*
* @param [in] callback Callback to tool invoked when a runtime registers their API table with
* rocprofiler
* @param [in] libs Bitwise-or of libraries, e.g. `ROCPROFILER_HSA_LIBRARY | ROCPROFILER_HIP_LIBRARY
* | ROCPROFILER_MARKER_LIBRARY` means the callbacks will be invoked whenever the HSA, HIP, and
* ROCTx libraries register the intercept table.
* @param [in] data Data to provide to callback(s)
* @return ::rocprofiler_status_t
* @retval ::ROCPROFILER_STATUS_SUCCESS Callback was registered for specified runtime(s)
* @retval ::ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED rocprofiler has already initialized
* @retval ::ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT this error code is returned if
* `ROCPROFILER_LIBRARY` is included in bitwise-or of the libs
* @retval ::ROCPROFILER_STATUS_ERROR_NOT_IMPLEMENTED this error code is returned if one of the
* specified libraries does not have support for API intercept tables (which should not be the case
* by the time this code is publicly released)
*
* @code{.cpp}
* namespace
* {
* // this function generates a wrapper around the original function that
* // prints out the function name and then invokes the original function
* template <size_t Idx, typename RetT, typename... Args>
* auto
* generate_wrapper(const char* name, RetT (*func)(Args...))
* {
* using functor_type = RetT (*)(Args...);
*
* // save function name, "real function"
* static const auto* func_name = name;
* static functor_type underlying_func = func;
* static functor_type wrapped_func = [](Args... args) -> RetT {
* std::cout << "Wrapping " << func_name << "..." << std::endl;
* if(underlying_func) return underlying_func(args...);
* if constexpr(!std::is_void<RetT>::value) return RetT{};
* };
*
* return wrapped_func;
* }
*
*
* // this macro installs the wrapper in place of the original function
* #define GENERATE_WRAPPER(TABLE, FUNC) \
* TABLE->FUNC##_fn = generate_wrapper<__COUNTER__>(#FUNC, TABLE->FUNC##_fn)
*
*
* // this is the function that gets called when the HSA runtime
* // intercept table is registered with rocprofiler
* void
* api_registration_callback(rocprofiler_runtime_library_t type,
* uint64_t lib_version,
* uint64_t lib_instance,
* void** tables,
* uint64_t num_tables,
* void* user_data)
* {
* if(type != ROCPROFILER_HSA_LIBRARY)
* throw std::runtime_error{"unexpected library type: " +
* std::to_string(static_cast<int>(type))};
* if(lib_instance != 0) throw std::runtime_error{"multiple instances of HSA runtime library"};
* if(num_tables != 1) throw std::runtime_error{"expected only one table of type HsaApiTable"};
*
* auto* hsa_api_table = static_cast<HsaApiTable*>(tables[0]);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_agent_get_info);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_agent_iterate_isas);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_code_object_reader_create_from_memory);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_executable_create_alt);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_executable_freeze);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_executable_get_symbol_by_name);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_executable_iterate_symbols);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_executable_load_agent_code_object);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_executable_symbol_get_info);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_isa_get_info_alt);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_iterate_agents);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_queue_add_write_index_screlease);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_queue_create);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_queue_load_read_index_relaxed);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_queue_load_read_index_scacquire);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_signal_create);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_signal_destroy);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_signal_load_relaxed);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_signal_silent_store_relaxed);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_signal_store_screlease);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_signal_wait_scacquire);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_system_get_info);
* GENERATE_WRAPPER(hsa_api_table->core_, hsa_system_get_major_extension_table);
* }
* } // namespace
*
*
* extern "C" rocprofiler_tool_configure_result_t*
* rocprofiler_configure(uint32_t version,
* const char* runtime_version,
* uint32_t priority,
* rocprofiler_client_id_t* id)
* {
* // set the client name
* id->name = "ExampleTool";
*
* // specify that we only want to intercept the HSA library
* rocprofiler_at_runtime_api_registration(api_registration_callback,
* ROCPROFILER_HSA_LIBRARY, nullptr);
*
* return nullptr;
* }
* @endcode
*
* @example intercept_table/client.cpp
* Example demonstrating @ref rocprofiler_at_runtime_api_registration usage
*/
rocprofiler_status_t
rocprofiler_at_runtime_api_registration(rocprofiler_intercept_library_cb_t callback,
int libs,
void* data) ROCPROFILER_API;
/** @} */
ROCPROFILER_EXTERN_C_FINI
@@ -0,0 +1,128 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/defines.h>
#include <rocprofiler-sdk/fwd.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup INTERNAL_THREADING Internal Thread Handling
* @brief Callbacks before and after threads created internally by libraries
*
* @{
* @example api_buffered_tracing/client.cpp
* Example demonstrating @ref BUFFER_TRACING_SERVICE that includes usage of @ref
* rocprofiler_at_internal_thread_create, @ref rocprofiler_create_callback_thread, and @ref
* rocprofiler_assign_callback_thread.
*/
/**
* @brief Callback type before and after internal thread creation. @see
* rocprofiler_at_internal_thread_create
*
*/
typedef void (*rocprofiler_internal_thread_library_cb_t)(rocprofiler_runtime_library_t, void*);
/**
* @brief Invoke this function to receive callbacks before and after the creation of an internal
* thread by a library which as invoked on the thread which is creating the internal thread(s).
*
* Use the @ref rocprofiler_runtime_library_t enumeration for specifying which libraries you want
* callbacks before and after the library creates an internal thread. These callbacks will be
* invoked on the thread that is about to create the new thread (not on the newly created thread).
* In thread-aware tools that wrap pthread_create, this can be used to disable the wrapper before
* the pthread_create invocation and re-enable the wrapper afterwards. In many cases, tools will
* want to ignore the thread(s) created by rocprofiler since these threads do not exist in the
* normal application execution, whereas the internal threads for HSA, HIP, etc. are created in
* normal application execution; however, the HIP, HSA, etc. internal threads are typically
* background threads which just monitor kernel completion and are unlikely to contribute to any
* performance issues. Please note that the postcreate callback is guaranteed to be invoked after
* the underlying system call to create a new thread but it does not guarantee that the new thread
* has been started. Please note, that once these callbacks are registered, they cannot be removed
* so the caller is responsible for ignoring these callbacks if they want to ignore them beyond a
* certain point in the application.
*
* @param [in] precreate Callback invoked immediately before a new internal thread is created
* @param [in] postcreate Callback invoked immediately after a new internal thread is created
* @param [in] libs Bitwise-or of libraries, e.g. `ROCPROFILER_LIBRARY | ROCPROFILER_MARKER_LIBRARY`
* means the callbacks will be invoked whenever rocprofiler and/or the marker library create
* internal threads but not when the HSA or HIP libraries create internal threads.
* @param [in] data Data shared between callbacks
* @return ::rocprofiler_status_t
* @retval ::ROCPROFILER_STATUS_SUCCESS There are currently no conditions which result in any other
* value, even if internal threads have already been created
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_at_internal_thread_create(rocprofiler_internal_thread_library_cb_t precreate,
rocprofiler_internal_thread_library_cb_t postcreate,
int libs,
void* data);
/**
* @brief opaque handle to an internal thread identifier which delivers callbacks for buffers
* @see rocprofiler_create_callback_thread
*/
typedef struct
{
uint64_t handle;
} rocprofiler_callback_thread_t;
/**
* @brief Create a handle to a unique thread (created by rocprofiler) which, when associated with a
* particular buffer, will guarantee those buffered results always get delivered on the same thread.
* This is useful to prevent/control thread-safety issues and/or enable multithreaded processing of
* buffers with non-overlapping data
*
* @param [in] cb_thread_id User-provided pointer to a @ref rocprofiler_callback_thread_t
* @return ::rocprofiler_status_t
* @retval ::ROCPROFILER_STATUS_SUCCESS Successful thread creation
* @retval ::ROCPROFILER_STATUS_ERROR Failed to create thread
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_create_callback_thread(rocprofiler_callback_thread_t* cb_thread_id)
ROCPROFILER_NONNULL(1);
/**
* @brief By default, all buffered results are delivered on the same thread. Using @ref
* rocprofiler_create_callback_thread, one or more buffers can be assigned to deliever their results
* on a unique, dedicated thread.
*
* @param [in] buffer_id Buffer identifier
* @param [in] cb_thread_id Callback thread identifier via @ref rocprofiler_create_callback_thread
* @return ::rocprofiler_status_t
* @retval ::ROCPROFILER_STATUS_SUCCESS Successful assignment of the delivery thread for the given
* buffer
* @retval ::ROCPROFILER_STATUS_ERROR_THREAD_NOT_FOUND Thread identifier did not match any of the
* threads created by rocprofiler
* @retval ::ROCPROFILER_STATUS_ERROR_BUFFER_NOT_FOUND Buffer identifier did not match any of the
* buffers registered with rocprofiler
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_assign_callback_thread(rocprofiler_buffer_id_t buffer_id,
rocprofiler_callback_thread_t cb_thread_id);
/** @} */
ROCPROFILER_EXTERN_C_FINI
+26
View File
@@ -0,0 +1,26 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/marker/api_args.h>
#include <rocprofiler-sdk/marker/api_id.h>
@@ -0,0 +1,9 @@
#
#
# Installation of public HSA headers
#
#
set(ROCPROFILER_MARKER_HEADER_FILES api_args.h api_id.h)
install(FILES ${ROCPROFILER_MARKER_HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocprofiler-sdk/marker)
@@ -0,0 +1,56 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#pragma once
#include <stdint.h>
typedef uint64_t roctx_range_id_t;
typedef union rocprofiler_marker_api_retval_u
{
uint32_t uint32_t_retval;
uint64_t uint64_t_retval;
} rocprofiler_marker_api_retval_t;
typedef union rocprofiler_marker_api_args_u
{
struct
{
const char* message;
} roctxMarkA;
struct
{
const char* message;
} roctxRangePushA;
struct
{
} roctxRangePop;
struct
{
const char* message;
} roctxRangeStartA;
struct
{
roctx_range_id_t id;
} roctxRangeStop;
} rocprofiler_marker_api_args_t;
@@ -0,0 +1,37 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#pragma once
/**
* @brief ROCProfiler enumeration of Marker (ROCTx) API tracing operations
*/
typedef enum // NOLINT(performance-enum-size)
{
ROCPROFILER_MARKER_API_ID_NONE = -1,
ROCPROFILER_MARKER_API_ID_roctxMarkA = 0,
ROCPROFILER_MARKER_API_ID_roctxRangePushA,
ROCPROFILER_MARKER_API_ID_roctxRangePop,
ROCPROFILER_MARKER_API_ID_roctxRangeStartA,
ROCPROFILER_MARKER_API_ID_roctxRangeStop,
ROCPROFILER_MARKER_API_ID_LAST,
} rocprofiler_marker_api_id_t;
@@ -0,0 +1,295 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/agent.h>
#include <rocprofiler-sdk/defines.h>
#include <rocprofiler-sdk/fwd.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup PC_SAMPLING_SERVICE PC Sampling
* @brief Enabling PC (Program Counter) Sampling for GPU Activity
* @{
*/
/**
* @brief Function used to configure the PC sampling service on the GPU agent with @p agent_id.
* @brief Function used to configure the PC sampling service on the GPU agent with @p agent_id.
* Prerequisites are the following:
* - The user must create a context and supply its @p context_id. By using this context,
* - The user must create a context and supply its @p context_id. By using this context,
* the user can start/stop PC sampling on the agent. For more information,
* please @see `rocprofiler_start_context`/`rocprofiler_stop_context`.
* - The user must create a buffer and supply its @p buffer_id. Rocprofiler uses the buffer
* - The user must create a buffer and supply its @p buffer_id. Rocprofiler uses the buffer
* to deliver the PC samples to the user. For more information about the data delivery,
* please @see `rocprofiler_create_buffer` and `rocprofiler_buffer_tracing_cb_t`.
*
* Before calling this function, we recommend querying PC sampling configurations
* supported by the GPU agent via the `rocprofiler_query_pc_sampling_agent_configurations`.
* The user then chooses the @p method, @p unit, and @p interval to match one of the
* available configurations. Note that the @p interval must belong to the range of values
* The user then chooses the @p method, @p unit, and @p interval to match one of the
* available configurations. Note that the @p interval must belong to the range of values
* [available_config.min_interval, available_config.max_interval],
* where available_config is the instance of the `rocprofiler_pc_sampling_configuration_s`
* supported at the moment.
*
* Rocprofiler checks whether the requsted configuration is actually supported
* at the moment of calling this function. If the answer is yes, it returns
* the ROCPROFILER_STATUS_SUCCESS. Otherwise, notifies the caller about the
* rejection reason via the returned status code. For more information
* about the status codes, please @see rocprofiler_status_t.
*
* Constraint1: A GPU agent can be configured to support at most one running PC sampling
* configuration at any time, which implies some of the consequences described below.
* After the tool configures the PC sampling with one of the available configurations,
* rocprofiler guarantees that this configuration will be valid for the tool's
* lifetime. The tool can start and stop the configured PC sampling service whenever convenient.
*
* Constraint2: Since the same GPU agent can be used by multiple processes concurrently,
* Rocprofiler cannot guarantee the exclusive access to the PC sampling capability.
* The consequence is the following scenario. The tool TA that belongs to the process PA,
* calls the `rocprofiler_query_pc_sampling_agent_configurations` that returns the
* two supported configurations CA and CB by the agent. Then the toolb TB of the process PB,
* configures the PC sampling on the same agent by using the configuration CB.
* Subsequently, the TA tries configuring the CA on the agent, and it fails.
* To point out that this case happened, we introduce a special status code (TODO: ARE WE)?
* When this status code is observed by the tool TA, it queties all available configurations again
* by calling `rocprofiler_query_pc_sampling_agent_configurations`,
* that returns only CB this time. The tool TA can choose CB, so that both
* TA and TB use the PC sampling capability in the separate processes.
*
* Constraints3: We allow only one context to contain the configured PC sampling service
* within the process, that implies that at most one of the loaded tools can use PC sampling.
* One context can contains multiple PC sampling services configured for different GPU agents.
*
* @param [in] context_id - id of the context used for starting/stopping PC sampling service
* @param [in] agent_id - id of the agent on which caller tries using PC sampling capability
* @param [in] method - the type of PC sampling the caller tries to use on the agent.
* @param [in] unit - The unit appropriate to the PC sampling type/method.
* @param [in] interval - frequency at which PC samples are generated
* @param [in] buffer_id - id of the buffer used for delivering PC samples
* @return ::rocprofiler_status_t
*
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_configure_pc_sampling_service(rocprofiler_context_id_t context_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_pc_sampling_method_t method,
rocprofiler_pc_sampling_unit_t unit,
uint64_t interval,
rocprofiler_buffer_id_t buffer_id);
/**
* @brief PC sampling configuration supported by a GPU agent.
* @var rocprofiler_pc_sampling_configuration_s::method
* Sampling method supported by the GPU
* agent. Currenlty, it can take one of the following two values:
* - ROCPROFILER_PC_SAMPLING_METHOD_HOST_TRAP: a background host thread
* periodically interrupts waves execution on the GPU to generate PC samples
* - ROCPROFILER_PC_SAMPLING_METHOD_STOCHASTIC: performance monitoring hardware
* on the GPU periodically interrupts waves to generate PC samples.
* @var rocprofiler_pc_sampling_configuration_s::unit
* A unit used to specify the period of the
* @ref method for samples generation.
* @var rocprofiler_pc_sampling_configuration_s::min_interval
* the highest possible frequencey for
* generating samples using @ref method.
* @var rocprofiler_pc_sampling_configuration_s::max_interval
* the lowest possible frequency for
* generating samples using @ref method
* @var rocprofiler_pc_sampling_configuration_s::flags
* TODO: ???
*/
struct rocprofiler_pc_sampling_configuration_s
{
rocprofiler_pc_sampling_method_t method;
rocprofiler_pc_sampling_unit_t unit;
size_t min_interval;
size_t max_interval;
uint64_t flags;
};
/**
* @brief The rocprofiler calls the tool's callback to deliver the list
* of available configurations upon the calls to the @ref
* rocprofiler_query_pc_sampling_agent_configurations.
*
* @param[out] configs - The list of PC sampling configurations supported by the agent of the
* moment of invoking @ref rocprofiler_query_pc_sampling_agent_configurations.
* @param[out] num_config - The number of configuration contained in the underlying
* In case the GPU agent does not support PC sampling, the value is 0.
* @param[in] user_data - A pointer passed as the last argument of the
* @ref rocprofiler_query_pc_sampling_agent_configurations
*/
typedef rocprofiler_status_t (*rocprofiler_available_pc_sampling_configurations_cb_t)(
const rocprofiler_pc_sampling_configuration_t* configs,
size_t num_config,
void* user_data);
/**
* @brief Query PC Sampling Configuration.
*
* @param [in] agent_id - id of the agent for which available configuration will be listed
* @param [in] cb - User callback that delivers the available PC sampling configurations
* @param [in] user_data - passed to the @p cb
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_query_pc_sampling_agent_configurations(
rocprofiler_agent_id_t agent_id,
rocprofiler_available_pc_sampling_configurations_cb_t cb,
void* user_data) ROCPROFILER_NONNULL(2, 3);
/**
* @brief The header of the @ref rocprofiler_pc_sampling_record_s, indicating
* what fields of the @ref rocprofiler_pc_sampling_record_s instance are meaningful
* @brief The header of the @ref rocprofiler_pc_sampling_record_s, indicating
* what fields of the @ref rocprofiler_pc_sampling_record_s instance are meaningful
* for the sample.
* @var rocprofiler_pc_sampling_header_v1_t::valid
* the sample is valid
* @var rocprofiler_pc_sampling_header_v1_t::type
* The following values are possible:
* - 0 - reserved
* - 1 - host trap pc sample
* - 2 - stochastic pc sample
* - 3 - perfcounter (unsupported at the moment)
* - other values does not mean anything at the moment
* @var rocprofiler_pc_sampling_header_v1_t::has_stall_reason
* whether the sample contains
* information about the stall reason. If so, please @see rocprofiler_pc_sampling_snapshot_v1_t.
* @var rocprofiler_pc_sampling_header_v1_t::has_wave_cnt
* whether the @ref rocprofiler_pc_sampling_record_s::wave_count contains
* meaningful value
* @var rocprofiler_pc_sampling_header_v1_t::has_memory_counter
* whether the content of the @ref
* rocprofiler_pc_sampling_memorycounters_v1_t is meaningful
*/
typedef struct
{
uint8_t valid : 1;
uint8_t type : 4; // 0=reserved, 1=hosttrap, 2=stochastic, 3=perfcounter, >=4 possible v2?
uint8_t has_stall_reason : 1;
uint8_t has_wave_cnt : 1;
uint8_t has_memory_counter : 1;
} rocprofiler_pc_sampling_header_v1_t;
/**
* @brief TODO: provide the description
*/
typedef struct
{
uint32_t dual_issue_valu : 1;
uint32_t inst_type : 4;
uint32_t reason_not_issued : 7;
uint32_t arb_state_issue : 10;
uint32_t arb_state_stall : 10;
} rocprofiler_pc_sampling_snapshot_v1_t;
/**
* @brief TODO: provide the description
*/
typedef union
{
struct
{
uint32_t load_cnt : 6;
uint32_t store_cnt : 6;
uint32_t bvh_cnt : 3;
uint32_t sample_cnt : 6;
uint32_t ds_cnt : 6;
uint32_t km_cnt : 5;
};
uint32_t raw;
} rocprofiler_pc_sampling_memorycounters_v1_t;
// TODO: The definition of this structure might change over time
// to reduce the space needed to represent a single sample.
/**
* @brief ROCProfiler PC Sampling Record corresponding to the interrupted wave.
* @var rocprofiler_pc_sampling_record_s::flags
* header that indicates what fields are meaningful
* for the PC sample. The values depend on what the underlying GPU agent architecture supports.
* @var rocprofiler_pc_sampling_record_s::chiplet
* chiplet index
* @var rocprofiler_pc_sampling_record_s::wave_id
* wave identifier within the workgroup
* @var rocprofiler_pc_sampling_record_s::wave_issued
* a flags indicated whether the wave is
* issueing the instruction' represented by the @ref pc at the moment of interruption.
* @var rocprofiler_pc_sampling_record_s::reserved
* FIXME: reserved 7 bits, must be zero.
* @var rocprofiler_pc_sampling_record_s::hw_id
* compute unit identifier
* @var rocprofiler_pc_sampling_record_s::pc
* The current program counter of the wave at the moment
* of interruption
* @var rocprofiler_pc_sampling_record_s::exec_mask
* shows how many SIMD lanes of the wave were
* executing the instruction represented by the @ref pc. Useful to understand thread-divergance
* within the wave
* @var rocprofiler_pc_sampling_record_s::workgroup_id_x
* the x coordinate of the wave within the workgroup
* @var rocprofiler_pc_sampling_record_s::workgroup_id_y
* the y coordinate of the wave within the workgroup
* @var rocprofiler_pc_sampling_record_s::workgroup_id_z
* the y coordinate of the wave within the workgroup
* @var rocprofiler_pc_sampling_record_s::wave_count
* FIXME: number of waves active at the CU at the moment of sample generation???
* @var rocprofiler_pc_sampling_record_s::timestamp
* represents the GPU timestamp when the sample is generated
* @var rocprofiler_pc_sampling_record_s::correlation_id
* correlation id of the API call that
* initiated kernel laucnh. The interrupted wave is executed as part of the kernel.
* @var rocprofiler_pc_sampling_record_s::snapshot
* TODO:
* @var rocprofiler_pc_sampling_record_s::memory_counters
* TODO:
*/
struct rocprofiler_pc_sampling_record_s
{
rocprofiler_pc_sampling_header_v1_t flags;
uint8_t chiplet;
uint8_t wave_id;
uint8_t wave_issued : 1;
uint8_t reserved : 7;
uint32_t hw_id;
uint64_t pc;
uint64_t exec_mask;
uint32_t workgroup_id_x;
uint32_t workgroup_id_y;
uint32_t workgroup_id_z;
uint32_t wave_count;
uint64_t timestamp;
rocprofiler_correlation_id_t correlation_id;
rocprofiler_pc_sampling_snapshot_v1_t snapshot;
rocprofiler_pc_sampling_memorycounters_v1_t memory_counters;
};
/** @} */
ROCPROFILER_EXTERN_C_FINI
@@ -0,0 +1,65 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/agent.h>
#include <rocprofiler-sdk/defines.h>
#include <rocprofiler-sdk/fwd.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup PROFILE_CONFIG Profile Configurations
* @brief Group one or more hardware counters into a unique handle
*
* @{
*/
/**
* @brief Create Profile Configuration.
*
* @param [in] agent Agent identifier
* @param [in] counters_list List of GPU counters
* @param [in] counters_count Size of counters list
* @param [out] config_id Identifier for GPU counters group
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_create_profile_config(rocprofiler_agent_t agent,
rocprofiler_counter_id_t* counters_list,
size_t counters_count,
rocprofiler_profile_config_id_t* config_id)
ROCPROFILER_NONNULL(4);
/**
* @brief Destroy Profile Configuration.
*
* @param [in] config_id
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_destroy_profile_config(rocprofiler_profile_config_id_t config_id);
/** @} */
ROCPROFILER_EXTERN_C_FINI
@@ -0,0 +1,224 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/defines.h>
#include <rocprofiler-sdk/fwd.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup REGISTRATION_GROUP Tool registration
*
* Data types and functions for tool registration with rocprofiler
* @{
*/
/**
* @brief A pointer to this data structure is provided to the client tool initialization function.
* The name member can be set by the client to assist with debugging (e.g. rocprofiler cannot start
* your context because there is a conflicting context started by `<name>` -- at least that is the
* plan). The handle member is a unique identifer assigned by rocprofiler for the client and the
* client can store it and pass it to the @ref rocprofiler_client_finalize_t function to force
* finalization (i.e. deactivate all of it's contexts) for the client.
*/
typedef struct
{
const char* name; ///< clients should set this value for debugging
const uint32_t handle; ///< internal handle
} rocprofiler_client_id_t;
// TODO(aelwazir): Add Docs
typedef void (*rocprofiler_client_finalize_t)(rocprofiler_client_id_t);
// TODO(aelwazir): Add Docs
typedef int (*rocprofiler_tool_initialize_t)(rocprofiler_client_finalize_t finalize_func,
void* tool_data);
// TODO(aelwazir): Add Docs
typedef void (*rocprofiler_tool_finalize_t)(void* tool_data);
/**
* @brief Data structure containing a initialization, finalization, and data
* TODO(aelwazir): Add correlation with rocprofiler_configure.
*
*/
typedef struct
{
size_t size; ///< in case of future extensions
rocprofiler_tool_initialize_t initialize; ///< context creation
rocprofiler_tool_finalize_t finalize; ///< cleanup
void* tool_data; ///< data to provide to init and fini callbacks
} rocprofiler_tool_configure_result_t;
/**
* @brief Query whether rocprofiler has already scanned the binary for all the instances of @ref
* rocprofiler_configure (or is currently scanning). If rocprofiler has completed it's scan, clients
* can directly register themselves with rocprofiler.
*
* @param [out] status 0 indicates rocprofiler has not been initialized (i.e. configured), 1
* indicates rocprofiler has been initialized, -1 indicates rocprofiler is currently initializing.
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t
rocprofiler_is_initialized(int* status) ROCPROFILER_API;
/**
* @brief Query rocprofiler finalization status.
*
* @param [out] status 0 indicates rocprofiler has not been finalized, 1 indicates rocprofiler has
* been finalized, -1 indicates rocprofiler is currently finalizing.
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t
rocprofiler_is_finalized(int* status) ROCPROFILER_API;
/**
* @brief This is the special function that tools define to enable rocprofiler support. The tool
* should return a pointer to
* @ref rocprofiler_tool_configure_result_t which will contain a function pointer to (1) an
* initialization function where all the contexts are created, (2) a finalization function (if
* necessary) which will be invoked when rocprofiler shutdown and, (3) a pointer to any data that
* the tool wants communicated between the @ref rocprofiler_tool_configure_result_t::initialize and
* @ref rocprofiler_tool_configure_result_t::finalize functions. If the user
*
* @param [in] version The version of rocprofiler: `(10000 * major) + (100 * minor) + patch`
* @param [in] runtime_version String descriptor of the rocprofiler version and other relevant info.
* @param [in] priority How many client tools were initialized before this client tool
* @param [in, out] client_id tool identifier value.
* @return rocprofiler_tool_configure_result_t*
*
* @code{.cpp}
* #include <rocprofiler-sdk/registration.h>
*
* static rocprofiler_client_id_t my_client_id;
* static rocprofiler_client_finalize_t my_fini_func;
* static int my_tool_data = 1234;
*
* static int my_init_func(rocprofiler_client_finalize_t fini_func,
* void* tool_data)
* {
* my_fini_func = fini_func;
*
* assert(*static_cast<int*>(tool_data) == 1234 && "tool_data is wrong");
*
* rocprofiler_context_id_t ctx;
* rocprofiler_create_context(&ctx);
*
* if(int valid_ctx = 0;
* rocprofiler_context_is_valid(ctx, &valid_ctx) != ROCPROFILER_STATUS_SUCCESS ||
* valid_ctx != 0)
* {
* // notify rocprofiler that initialization failed
* // and all the contexts, buffers, etc. created
* // should be ignored
* return -1;
* }
*
* if(rocprofiler_start_context(ctx) != ROCPROFILER_STATUS_SUCCESS)
* {
* // notify rocprofiler that initialization failed
* // and all the contexts, buffers, etc. created
* // should be ignored
* return -1;
* }
*
* // no errors
* return 0;
* }
*
* static int my_fini_func(void* tool_data)
* {
* assert(*static_cast<int*>(tool_data) == 1234 && "tool_data is wrong");
* }
*
* rocprofiler_tool_configure_result_t*
* rocprofiler_configure(uint32_t version,
* const char* runtime_version,
* uint32_t priority,
* rocprofiler_client_id_t* client_id)
* {
* // only activate if main tool
* if(priority > 0) return nullptr;
*
* // set the client name
* client_id->name = "ExampleTool";
*
* // make a copy of client info
* my_client_id = *client_id;
*
* // compute major/minor/patch version info
* uint32_t major = version / 10000;
* uint32_t minor = (version % 10000) / 100;
* uint32_t patch = version % 100;
*
* // print info
* printf("Configuring rocprofiler (v%u.%u.%u) [%s]\n", major, minor, patch, runtime_version);
*
* // create configure data
* static auto cfg = rocprofiler_tool_configure_result_t{ &my_init_func,
* &my_fini_func,
* &my_tool_data };
*
* // return pointer to configure data
* return &cfg;
* }
* @endcode
*/
rocprofiler_tool_configure_result_t*
rocprofiler_configure(uint32_t version,
const char* runtime_version,
uint32_t priority,
rocprofiler_client_id_t* client_id) ROCPROFILER_PUBLIC_API;
// NOTE: we use ROCPROFILER_PUBLIC_API above instead of ROCPROFILER_API because we always
// want the symbol to be visible when the user includes the header for the prototype
/**
* @brief Function pointer typedef for @ref rocprofiler_configure function
* @param [in] version The version of rocprofiler: `(10000 * major) + (100 * minor) + patch`
* @param [in] runtime_version String descriptor of the rocprofiler version and other relevant info.
* @param [in] priority How many client tools were initialized before this client tool
* @param [in, out] client_id tool identifier value.
*/
typedef rocprofiler_tool_configure_result_t* (*rocprofiler_configure_func_t)(
uint32_t version,
const char* runtime_version,
uint32_t priority,
rocprofiler_client_id_t* client_id);
/**
* @brief Function for explicitly registering a configuration with rocprofiler. This can be invoked
* before any ROCm runtimes (lazily) initialize and context(s) can be started before the runtimes
* initialize.
* @param [in] configure_func Address of @ref rocprofiler_configure function. A null pointer is
* acceptable if the address is not known
* @returns rocprofiler_status_t If rocprofiler has already been configured, or is currently being
* configured, this function will return @ref ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED.
*/
rocprofiler_status_t
rocprofiler_force_configure(rocprofiler_configure_func_t configure_func) ROCPROFILER_API;
/** @} */
ROCPROFILER_EXTERN_C_FINI
@@ -0,0 +1,129 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <stddef.h>
#include <stdint.h>
#include "rocprofiler-sdk/defines.h"
#include "rocprofiler-sdk/fwd.h"
/**
* @defgroup VERSIONING_GROUP Library Versioning
* @brief Version information about the interface and the associated installed library.
*
* The semantic version of the interface following semver.org rules. A context
* that uses this interface is only compatible with the installed library if
* the major version numbers match and the interface minor version number is
* less than or equal to the installed library minor version number.
*
* @{
*/
#include "rocprofiler-sdk/version.h"
ROCPROFILER_EXTERN_C_INIT
/**
* @fn rocprofiler_status_t rocprofiler_get_version(uint32_t* major, uint32_t* minor, uint32_t*
* patch)
* @brief Query the version of the installed library.
*
* Return the version of the installed library. This can be used to check if
* it is compatible with this interface version. This function can be used
* even when the library is not initialized.
*
* @param [out] major The major version number is stored if non-NULL.
* @param [out] minor The minor version number is stored if non-NULL.
* @param [out] patch The patch version number is stored if non-NULL.
*/
rocprofiler_status_t
rocprofiler_get_version(uint32_t* major, uint32_t* minor, uint32_t* patch) ROCPROFILER_API;
ROCPROFILER_EXTERN_C_FINI
/** @} */
#include "rocprofiler-sdk/agent.h"
// #include "rocprofiler-sdk/agent_profile.h"
#include "rocprofiler-sdk/buffer.h"
#include "rocprofiler-sdk/buffer_tracing.h"
#include "rocprofiler-sdk/callback_tracing.h"
#include "rocprofiler-sdk/context.h"
#include "rocprofiler-sdk/counters.h"
#include "rocprofiler-sdk/dispatch_profile.h"
#include "rocprofiler-sdk/external_correlation.h"
#include "rocprofiler-sdk/hip.h"
#include "rocprofiler-sdk/hsa.h"
#include "rocprofiler-sdk/intercept_table.h"
#include "rocprofiler-sdk/internal_threading.h"
// #include "rocprofiler-sdk/marker.h"
#include "rocprofiler-sdk/pc_sampling.h"
#include "rocprofiler-sdk/profile_config.h"
// #include "rocprofiler-sdk/spm.h"
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup MISCELLANEOUS_GROUP Miscellaneous Utility Functions
*
* @{
*/
/**
* @fn rocprofiler_status_t rocprofiler_get_timestamp(rocprofiler_timestamp_t* ts)
* @brief Get the timestamp value that rocprofiler uses
* @param [out] ts Output address of the rocprofiler timestamp value
*/
rocprofiler_status_t
rocprofiler_get_timestamp(rocprofiler_timestamp_t* ts) ROCPROFILER_API ROCPROFILER_NONNULL(1);
/**
* @fn rocprofiler_status_t rocprofiler_get_thread_id(rocprofiler_thread_id_t* tid)
* @brief Get the identifier value of the current thread that is used by rocprofiler
* @param [out] tid Output address of the rocprofiler thread id value
*/
rocprofiler_status_t
rocprofiler_get_thread_id(rocprofiler_thread_id_t* tid) ROCPROFILER_API ROCPROFILER_NONNULL(1);
/**
* @fn const char* rocprofiler_get_status_name(rocprofiler_status_t status)
* @brief Return the string encoding of @ref rocprofiler_status_t value
* @param [in] status error code value
* @return Will return a nullptr if invalid/unsupported @ref rocprofiler_status_t value is provided.
*/
const char*
rocprofiler_get_status_name(rocprofiler_status_t status) ROCPROFILER_API;
/**
* @fn const char* rocprofiler_get_status_string(rocprofiler_status_t status)
* @brief Return the message associated with @ref rocprofiler_status_t value
* @param [in] status error code value
* @return Will return a nullptr if invalid/unsupported @ref rocprofiler_status_t value is provided.
*/
const char*
rocprofiler_get_status_string(rocprofiler_status_t status) ROCPROFILER_API;
/** @} */
ROCPROFILER_EXTERN_C_FINI
@@ -0,0 +1,136 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
/** @section rocprofiler_plugin_api ROCProfiler Plugin API
*
* The ROCProfiler Plugin API is used by the ROCProfiler Tool to output all
* profiling information. Different implementations of the ROCProfiler Plugin
* API can be developed that output the data in different formats. The
* ROCProfiler Tool can be configured to load a specific library that supports
* the user desired format.
*
* The API is not thread safe. It is the responsibility of the ROCProfiler Tool
* to ensure the operations are synchronized and not called concurrently. There
* is no requirement for the ROCProfiler Tool to report trace data in any
* specific order. If the format supported by plugin requires specific
* ordering, it is the responsibility of the plugin implementation to perform
* any necessary sorting.
*/
/**
* @file
* ROCProfiler Tool Plugin API interface.
*/
#pragma once
#include "rocprofiler-sdk/rocprofiler.h"
#include <stdint.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup ROCPROFILER_PLUGINS ROCProfiler Plugin API Specification
* @{
*/
/**
* @defgroup INITIALIZATION_GROUP Initialization and Finalization
* @brief The ROCProfiler Plugin API must be initialized before using any of the
* operations to report trace data, and finalized after the last trace data has
* been reported.
* @ingroup ROCPROFILER_PLUGINS
*
* @{
*/
/**
* @brief Initialize plugin. Must be called before any other operation.
*
* @param[in] rocprofiler_major_version The major version of the ROCProfiler API
* being used by the ROCProfiler Tool. An error is reported if this does not
* match the major version of the ROCProfiler API used to build the plugin
* library. This ensures compatibility of the trace data format.
* @param[in] rocprofiler_minor_version The minor version of the ROCProfiler API
* being used by the ROCProfiler Tool. An error is reported if the
* @p rocprofiler_major_version matches and this is greater than the minor
* version of the ROCProfiler API used to build the plugin library. This ensures
* compatibility of the trace data format.
* @param[in] data Pointer to the data passed to the ROCProfiler Plugin by the tool
* @return Returns 0 on success and -1 on error.
*/
ROCPROFILER_EXPORT int
rocprofiler_plugin_initialize(uint32_t rocprofiler_major_version,
uint32_t rocprofiler_minor_version,
void* data);
/**
* @brief Finalize plugin.
* This must be called after ::rocprofiler_plugin_initialize and after all
* profiling data has been reported by
* rocprofiler_plugin_write_kernel_records
*/
ROCPROFILER_EXPORT void
rocprofiler_plugin_finalize();
/** @} */
/**
* @defgroup profiling_record_write_functions Profiling data reporting
* @brief Operations to output profiling data.
* @ingroup ROCPROFILER_PLUGINS
*
* @{
*/
// TODO(aelwazir): Recheck wording of the description
/**
* Report Buffer Records.
*
* @param[in] context_id context ID
* @param[in] buffer_id Buffer ID
* @param[in] headers Array of ::rocprofiler_record_header_t
* @param[in] num_headers Number of ::rocprofiler_record_header_t entries in array
* @return Returns 0 on success and -1 on error.
*/
ROCPROFILER_EXPORT int
rocprofiler_plugin_write_buffer_records(rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_record_header_t** headers,
size_t num_headers);
/**
* @brief Report Synchronous Record.
*
* @param[in] record Synchronous Tracer record.
* @return Returns 0 on success and -1 on error.
*/
ROCPROFILER_EXPORT int
rocprofiler_plugin_write_record(rocprofiler_record_header_t record);
/** @} */
/** @} */
ROCPROFILER_EXTERN_C_FINI
+54
View File
@@ -0,0 +1,54 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/defines.h>
#include <rocprofiler-sdk/fwd.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup SPM_SERVICE SPM Service
* @brief Streaming Performance Monitoring
*
* @{
*/
/**
* @brief Configure SPM Service.
*
* @param [in] context_id
* @param [in] buffer_id
* @param [in] profile_config
* @param [in] interval
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_configure_spm_service(rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_profile_config_id_t profile_config,
uint64_t interval);
/** @} */
ROCPROFILER_EXTERN_C_FINI
+117
View File
@@ -0,0 +1,117 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
/**
* @def ROCPROFILER_VERSION_MAJOR
* @brief The major version of the interface as a macro so it can be used
* by the preprocessor.
* @addtogroup VERSIONING_GROUP
*
* @def ROCPROFILER_VERSION_MINOR
* @brief The minor version of the interface as a macro so it can be used
* by the preprocessor.
* @addtogroup VERSIONING_GROUP
*
* @def ROCPROFILER_VERSION_PATCH
* @brief The patch version of the interface as a macro so it can be used
* by the preprocessor.
* @addtogroup VERSIONING_GROUP
*
* @def ROCPROFILER_VERSION
* @brief Numerically increasing version number encoding major, minor, and patch via
computing `((10000 * <MAJOR>) + (100 * <MINOR>) + <PATCH>)`.
* @addtogroup VERSIONING_GROUP
*
* @def ROCPROFILER_SOVERSION
* @brief Shared object versioning value whose value is at least `(10000 * <MAJOR>)`.
* @addtogroup VERSIONING_GROUP
*
* @def ROCPROFILER_VERSION_STRING
* @brief Version string in form: `<MAJOR>.<MINOR>.<PATCH>`.
* @addtogroup VERSIONING_GROUP
*
* @def ROCPROFILER_GIT_DESCRIBE
* @brief String encoding of `git describe --tags` when rocprofiler was built.
* @addtogroup VERSIONING_GROUP
*
* @def ROCPROFILER_GIT_REVISION
* @brief String encoding of `git rev-parse HEAD` when rocprofiler was built.
* @addtogroup VERSIONING_GROUP
*
* @def ROCPROFILER_LIBRARY_ARCH
* @brief Architecture triplet of rocprofiler build.
* @addtogroup VERSIONING_GROUP
*
* @def ROCPROFILER_SYSTEM_NAME
* @brief Target operating system for rocprofiler build, e.g. Linux.
* @addtogroup VERSIONING_GROUP
*
* @def ROCPROFILER_SYSTEM_PROCESSOR
* @brief Target architecture for rocprofiler build.
* @addtogroup VERSIONING_GROUP
*
* @def ROCPROFILER_SYSTEM_VERSION
* @brief Version of the operating system which built rocprofiler
* @addtogroup VERSIONING_GROUP
*
* @def ROCPROFILER_COMPILER_ID
* @brief C++ compiler identifier which built rocprofiler, e.g., GNU
* @addtogroup VERSIONING_GROUP
*
* @def ROCPROFILER_COMPILER_VERSION
* @brief C++ compiler version which built rocprofiler
* @addtogroup VERSIONING_GROUP
*/
// clang-format off
#define ROCPROFILER_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define ROCPROFILER_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define ROCPROFILER_VERSION_PATCH @PROJECT_VERSION_PATCH@
#define ROCPROFILER_SOVERSION (10000 * @PROJECT_VERSION_MAJOR@)
#define ROCPROFILER_VERSION_STRING "@FULL_VERSION_STRING@"
#define ROCPROFILER_GIT_DESCRIBE "@ROCPROFILER_GIT_DESCRIBE@"
#define ROCPROFILER_GIT_REVISION "@ROCPROFILER_GIT_REVISION@"
// system info during compilation
#define ROCPROFILER_LIBRARY_ARCH "@CMAKE_LIBRARY_ARCHITECTURE@"
#define ROCPROFILER_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@"
#define ROCPROFILER_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@"
#define ROCPROFILER_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@"
// compiler information
#define ROCPROFILER_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@"
#define ROCPROFILER_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@"
#define ROCPROFILER_HSA_RUNTIME_VERSION_MAJOR @HSA_RUNTIME_VERSION_MAJOR@
#define ROCPROFILER_HSA_RUNTIME_VERSION_MINOR @HSA_RUNTIME_VERSION_MINOR@
// clang-format on
#define ROCPROFILER_VERSION \
((10000 * ROCPROFILER_VERSION_MAJOR) + (100 * ROCPROFILER_VERSION_MINOR) + \
ROCPROFILER_VERSION_PATCH)
// latest hsa-runtime version supported
#define ROCPROFILER_HSA_RUNTIME_VERSION \
((10000 * ROCPROFILER_HSA_RUNTIME_VERSION_MAJOR) + \
(100 * ROCPROFILER_HSA_RUNTIME_VERSION_MINOR))