2e0ede4761
* [0/N] git submodules
* [1/N] Update cmake, gitignore, external
- clang-tidy file
- update .gitignore
- update main CMakeLists.txt
- update external/CMakeLists.txt
- update rocprofiler_config_interfaces.cmake
- update rocprofiler_formatting.cmake
- update rocprofiler_interfaces.cmake
- update rocprofiler_linting.cmake
- update rocprofiler_options.cmake
- update rocprofiler_utilities.cmake
* [2/N] Update rocprofiler/config.h
- update to work with new rocprofiler.h
* [3/N] Update source/lib/rocprofiler/hsa
- hsa-types.h: static asserts
- hsa.cpp: copyTables scope
- hsa.gen.cpp: ACTIVITY_DOMAIN_HSA_API -> ROCPROFILER_TRACER_ACTIVITY_DOMAIN_HSA_API
- rename some files
- add rocprofiler_ prefix to types and enums
- HSA_API_TABLE_LOOKUP_DEFINITION macro
- get_saved_table() -> get_table()
* [4/N] Update source/lib/common
- CMake: change target_link_libraries
- defines.hpp: remove ppdefs defined in include/rocprofiler/defines.h
* [5/N] Update source/lib/rocprofiler
- updates due to changes in rocprofiler.h
- rocprofiler_config.cpp: remove unions which are now defined in include/rocprofiler
- CMakeLists.txt: rocprofiler.cpp and public hsa-runtime and hip libraries
- rocprofiler.cpp: dummy implementations for:
- rocprofiler_query_available_agents
- rocprofiler_create_context
- rocprofiler_start_context
- rocprofiler_stop_context
- rocprofiler_flush_buffer
- rocprofiler_destroy_buffer
* [6/N] Update license
- replace stale LBNL license
* [7/N] CMake format
[ROCm/rocprofiler-sdk commit: 351d825a8d]
75 lines
2.4 KiB
C++
75 lines
2.4 KiB
C++
|
|
#pragma once
|
|
|
|
#include <rocprofiler/config.h>
|
|
#include <rocprofiler/rocprofiler.h>
|
|
|
|
#include <array>
|
|
#include <atomic>
|
|
#include <bitset>
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
namespace rocprofiler
|
|
{
|
|
namespace internal
|
|
{
|
|
// number of bits to reserve all op codes
|
|
constexpr size_t domain_ops_offset = ROCPROFILER_DOMAIN_OPS_MAX;
|
|
constexpr size_t reserved_domain_size = ROCPROFILER_DOMAIN_OPS_RESERVED * 8;
|
|
constexpr size_t max_configs_count = 8;
|
|
|
|
struct correlation_config
|
|
{
|
|
uint64_t id = 0;
|
|
uint64_t external_id = 0;
|
|
::rocprofiler_external_cid_cb_t external_id_callback = nullptr;
|
|
|
|
static uint64_t get_unique_record_id();
|
|
};
|
|
|
|
struct domain_config
|
|
{
|
|
::rocprofiler_tracer_callback_t user_sync_callback = nullptr;
|
|
int64_t domains = 0;
|
|
std::bitset<reserved_domain_size> opcodes = {};
|
|
|
|
/// check if domain is enabled
|
|
bool operator()(::rocprofiler_tracer_activity_domain_t) const;
|
|
|
|
/// check if op in a domain is enabled
|
|
bool operator()(::rocprofiler_tracer_activity_domain_t, uint32_t) const;
|
|
};
|
|
|
|
struct buffer_config
|
|
{
|
|
::rocprofiler_buffer_callback_t callback = nullptr;
|
|
uint64_t buffer_size;
|
|
// Memory::GenericBuffer* buffer = nullptr;
|
|
uint64_t buffer_idx = 0;
|
|
};
|
|
|
|
using filter_config = ::rocprofiler_filter_config;
|
|
|
|
struct config
|
|
{
|
|
// size is used to ensure that we never read past the end of the version
|
|
size_t size = 0; // = sizeof(rocprofiler_config)
|
|
uint32_t compat_version = 0; // set by user
|
|
uint32_t api_version = 0; // set by rocprofiler
|
|
uint64_t context_idx = 0; // context id index
|
|
void* user_data = nullptr; // user data passed to callbacks
|
|
correlation_config* correlation_id = nullptr; // &my_cid_config (optional)
|
|
buffer_config* buffer = nullptr; // = &my_buffer_config (required)
|
|
domain_config* domain = nullptr; // = &my_domain_config (required)
|
|
filter_config* filter = nullptr; // = &my_filter_config (optional)
|
|
};
|
|
|
|
std::array<rocprofiler::internal::config*, max_configs_count>&
|
|
get_registered_configs();
|
|
|
|
std::array<std::atomic<rocprofiler::internal::config*>, max_configs_count>&
|
|
get_active_configs();
|
|
} // namespace internal
|
|
} // namespace rocprofiler
|