[SDK] Release 1.0 Public API Modifications (#277)
* Make sure all structs/enums can be forward declared
* Updates to counter collection
- consistency updates and cleanup
* Conversion of dimension information to info struct
* Added deprecated folder
* Testing changes
* merge changes
* Fix shadowed variable
* Source code formatting
* Fix shadowed variable
* Update rocprofiler_counter_info_v1_t member names
* Split version.h into version.h and ext_version.h
- ext_version.h contains external version info, e.g. ROCPROFILER_HSA_API_TABLE_MAJOR_VERSION, ROCPROFILER_HSA_RUNTIME_VERSION
- this reduces amount of recompilation after a commit since version.h gets updated with the git revision
* profile_config -> counter_config
* EOF new line
* [Samples] Reduce header includes + reorg counter collection samples
* Misc compilation fixes
- shadowed variables
- use of [[deprecated("...")]] in C code
- unused variables
* Minor misc modifications
- use common:: instead of rocprofiler::common:: when inside rocprofiler namespace
- counters.cpp
- move local anon namespace functions into rocprofiler::counters:: anon namespace
- use std::string_view for get_static_string
- const ref for get_static_ptr
- misc namespace shortening
* [Public API] rocprofiler_get_version_triplet + rocprofiler_version_triplet_t
- struct rocprofiler_version_triplet_t containing fields for the major, minor, and patch version
- public API function: rocprofiler_get_version_triplet
- define C++ operators for rocprofiler_version_triplet_t
- C++ function compute_version_triplet
* [Tests] Improve async-copy-testing test
- relax constraints
- improve logging
* Update counter_config.h doxygen docs
* ROCPROFILER_SDK_BETA_COMPAT
- ppdef which helps with renaming when set to 1
* Remove spurious include
* Fix includes for cxx/version.hpp
* Doxygen fixes for rocprofiler_get_version and rocprofiler_get_version_triplet
* Public API Experimental Designation
- ROCPROFILER_SDK_EXPERIMENTAL added to experimental function
- "(experimental)" added to doxygen @brief entries
* Fix use of assert instead of static_assert in hip/stream.cpp
* Use typedef instead of define for rocprofiler_profile_config_id_t
* Use inline rocprofiler_{create,destroy}_profile_config instead of ppdef
- added <rocprofiler-sdk/deprecated/profile_config.h>
* Doxygen for rocprofiler_{create,destroy}_profile_config
* ROCPROFILER_SDK_DEPRECATED_WARNINGS
* Temporarily comment out ROCPROFILER_SDK_DEPRECATED_WARNINGS=1
* cmake formatting
* Misc variable renaming in samples and tests
* Fix declarations of types
* Fix hip stream tracing service struct name
- rocprofiler_callback_tracing_stream_handle_data_t renamed to rocprofiler_callback_tracing_hip_stream_api_data_t
* Rename "HIP_STREAM_API" to "HIP_STREAM"
---------
Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
Co-authored-by: Benjamin Welton <bewelton@amd.com>
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <rocprofiler-sdk/version.h>
|
||||
#include <rocprofiler-sdk/ext_version.h>
|
||||
|
||||
#include "lib/common/defines.hpp"
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ constexpr uint32_t lds_block_size = 128 * 4;
|
||||
using counter_dimension_id_vec_t = std::vector<rocprofiler_counter_dimension_id_t>;
|
||||
using counter_dimension_info_vec_t = std::vector<rocprofiler_record_dimension_info_t>;
|
||||
|
||||
struct tool_counter_info : rocprofiler_counter_info_v0_t
|
||||
struct tool_counter_info : rocprofiler_counter_info_v1_t
|
||||
{
|
||||
using parent_type = rocprofiler_counter_info_v0_t;
|
||||
using parent_type = rocprofiler_counter_info_v1_t;
|
||||
|
||||
tool_counter_info(rocprofiler_agent_id_t _agent_id,
|
||||
parent_type _info,
|
||||
@@ -125,7 +125,7 @@ void
|
||||
save(ArchiveT& ar, const ::rocprofiler::tool::tool_counter_info& data)
|
||||
{
|
||||
SAVE_DATA_FIELD(agent_id);
|
||||
cereal::save(ar, static_cast<const rocprofiler_counter_info_v0_t&>(data));
|
||||
cereal::save(ar, static_cast<const rocprofiler_counter_info_v1_t&>(data));
|
||||
SAVE_DATA_FIELD(dimension_ids);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,19 +49,6 @@ namespace tool
|
||||
namespace fs = common::filesystem;
|
||||
namespace
|
||||
{
|
||||
rocprofiler_status_t
|
||||
dimensions_info_callback(rocprofiler_counter_id_t /*id*/,
|
||||
const rocprofiler_record_dimension_info_t* dim_info,
|
||||
long unsigned int num_dims,
|
||||
void* user_data)
|
||||
{
|
||||
auto* dimensions_info = static_cast<counter_dimension_info_vec_t*>(user_data);
|
||||
dimensions_info->reserve(num_dims);
|
||||
for(size_t j = 0; j < num_dims; j++)
|
||||
dimensions_info->emplace_back(dim_info[j]);
|
||||
return ROCPROFILER_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
rocprofiler_status_t
|
||||
query_pc_sampling_configuration(const rocprofiler_pc_sampling_configuration_t* configs,
|
||||
long unsigned int num_config,
|
||||
@@ -177,31 +164,17 @@ void metadata::init(inprocess)
|
||||
|
||||
for(size_t i = 0; i < num_counters; ++i)
|
||||
{
|
||||
auto _info = rocprofiler_counter_info_v0_t{};
|
||||
auto _info = rocprofiler_counter_info_v1_t{};
|
||||
auto _dim_ids = std::vector<rocprofiler_counter_dimension_id_t>{};
|
||||
auto _dim_info = std::vector<rocprofiler_record_dimension_info_t>{};
|
||||
|
||||
ROCPROFILER_CHECK(rocprofiler_query_counter_info(
|
||||
counters[i],
|
||||
ROCPROFILER_COUNTER_INFO_VERSION_0,
|
||||
&static_cast<rocprofiler_counter_info_v0_t&>(_info)));
|
||||
ROCPROFILER_COUNTER_INFO_VERSION_1,
|
||||
&static_cast<rocprofiler_counter_info_v1_t&>(_info)));
|
||||
|
||||
if(auto _itr_dim_stat = rocprofiler_iterate_counter_dimensions(
|
||||
counters[i], dimensions_info_callback, &_dim_info);
|
||||
_itr_dim_stat == ROCPROFILER_STATUS_SUCCESS)
|
||||
{
|
||||
_dim_ids.reserve(_dim_info.size());
|
||||
for(auto ditr : _dim_info)
|
||||
_dim_ids.emplace_back(ditr.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
ROCP_WARNING << fmt::format("rocprofiler_iterate_counter_dimensions(...) "
|
||||
"for counter {} returned {} :: {}",
|
||||
_info.name,
|
||||
rocprofiler_get_status_name(_itr_dim_stat),
|
||||
rocprofiler_get_status_string(_itr_dim_stat));
|
||||
}
|
||||
for(uint64_t j = 0; j < _info.dimensions_count; ++j)
|
||||
_dim_ids.emplace_back(_info.dimensions[j].id);
|
||||
|
||||
data_v->at(id).emplace_back(
|
||||
id, _info, std::move(_dim_ids), std::move(_dim_info));
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <rocprofiler-sdk-roctx/defines.h>
|
||||
#include <rocprofiler-sdk-roctx/roctx.h>
|
||||
#include <rocprofiler-sdk-roctx/types.h>
|
||||
#include <rocprofiler-sdk/version.h>
|
||||
#include <rocprofiler-sdk-roctx/version.h>
|
||||
|
||||
namespace rocprofiler
|
||||
{
|
||||
|
||||
@@ -143,7 +143,7 @@ get_table_impl()
|
||||
{
|
||||
rocprofiler::common::init_logging("ROCTX");
|
||||
|
||||
auto*& tbl = rocprofiler::common::static_object<roctx_api_table>::construct();
|
||||
auto*& tbl = common::static_object<roctx_api_table>::construct();
|
||||
|
||||
tbl->core = roctxCoreApiTable_t{sizeof(roctxCoreApiTable_t),
|
||||
&::rocprofiler::roctx::roctxMarkA,
|
||||
|
||||
@@ -531,12 +531,11 @@ hip_stream_display_callback(rocprofiler_callback_tracing_record_t record,
|
||||
rocprofiler_user_data_t* user_data,
|
||||
void* data)
|
||||
{
|
||||
if(tool::get_config().group_by_queue ||
|
||||
record.kind != ROCPROFILER_CALLBACK_TRACING_HIP_STREAM_API)
|
||||
if(tool::get_config().group_by_queue || record.kind != ROCPROFILER_CALLBACK_TRACING_HIP_STREAM)
|
||||
return;
|
||||
// Extract stream ID from record
|
||||
auto* stream_handle_data =
|
||||
static_cast<rocprofiler_callback_tracing_stream_handle_data_t*>(record.payload);
|
||||
static_cast<rocprofiler_callback_tracing_hip_stream_data_t*>(record.payload);
|
||||
auto stream_id = stream_handle_data->stream_id;
|
||||
// STREAM_HANDLE_CREATE and DESTROY are no-ops
|
||||
if(record.operation == ROCPROFILER_HIP_STREAM_CREATE)
|
||||
@@ -996,7 +995,7 @@ buffered_tracing_callback(rocprofiler_context_id_t /*context*/,
|
||||
|
||||
using counter_vec_t = std::vector<rocprofiler_counter_id_t>;
|
||||
using agent_counter_map_t =
|
||||
std::unordered_map<rocprofiler_agent_id_t, std::optional<rocprofiler_profile_config_id_t>>;
|
||||
std::unordered_map<rocprofiler_agent_id_t, std::optional<rocprofiler_counter_config_id_t>>;
|
||||
|
||||
auto
|
||||
get_gpu_agents()
|
||||
@@ -1014,16 +1013,16 @@ struct agent_profiles
|
||||
{
|
||||
std::unordered_map<rocprofiler_agent_id_t, std::atomic<uint64_t>> current_iter;
|
||||
const uint64_t rotation;
|
||||
const std::unordered_map<rocprofiler_agent_id_t, std::vector<rocprofiler_profile_config_id_t>>
|
||||
const std::unordered_map<rocprofiler_agent_id_t, std::vector<rocprofiler_counter_config_id_t>>
|
||||
profiles;
|
||||
};
|
||||
|
||||
std::optional<rocprofiler_profile_config_id_t>
|
||||
std::optional<rocprofiler_counter_config_id_t>
|
||||
construct_counter_collection_profile(rocprofiler_agent_id_t agent_id,
|
||||
const std::set<std::string>& counters)
|
||||
{
|
||||
static const auto gpu_agents_counter_info = get_agent_counter_info();
|
||||
auto profile = std::optional<rocprofiler_profile_config_id_t>{};
|
||||
auto profile = std::optional<rocprofiler_counter_config_id_t>{};
|
||||
auto counters_v = counter_vec_t{};
|
||||
auto found_v = std::vector<std::string_view>{};
|
||||
const auto* agent_v = tool_metadata->get_agent(agent_id);
|
||||
@@ -1078,8 +1077,8 @@ construct_counter_collection_profile(rocprofiler_agent_id_t agent_id,
|
||||
|
||||
if(!counters_v.empty())
|
||||
{
|
||||
auto profile_v = rocprofiler_profile_config_id_t{};
|
||||
ROCPROFILER_CALL(rocprofiler_create_profile_config(
|
||||
auto profile_v = rocprofiler_counter_config_id_t{};
|
||||
ROCPROFILER_CALL(rocprofiler_create_counter_config(
|
||||
agent_id, counters_v.data(), counters_v.size(), &profile_v),
|
||||
"Could not construct profile cfg");
|
||||
profile = profile_v;
|
||||
@@ -1090,7 +1089,7 @@ construct_counter_collection_profile(rocprofiler_agent_id_t agent_id,
|
||||
agent_profiles
|
||||
generate_agent_profiles()
|
||||
{
|
||||
std::unordered_map<rocprofiler_agent_id_t, std::vector<rocprofiler_profile_config_id_t>>
|
||||
std::unordered_map<rocprofiler_agent_id_t, std::vector<rocprofiler_counter_config_id_t>>
|
||||
profiles;
|
||||
std::unordered_map<rocprofiler_agent_id_t, std::atomic<uint64_t>> pos;
|
||||
for(const auto& agent : get_gpu_agents())
|
||||
@@ -1110,7 +1109,7 @@ generate_agent_profiles()
|
||||
}
|
||||
|
||||
// this function creates a rocprofiler profile config on the first entry
|
||||
std::optional<rocprofiler_profile_config_id_t>
|
||||
std::optional<rocprofiler_counter_config_id_t>
|
||||
get_device_counting_service(rocprofiler_agent_id_t agent_id)
|
||||
{
|
||||
static auto agent_profiles = generate_agent_profiles();
|
||||
@@ -1292,7 +1291,7 @@ att_dispatch_callback(rocprofiler_agent_id_t /* agent_id */,
|
||||
|
||||
void
|
||||
dispatch_callback(rocprofiler_dispatch_counting_service_data_t dispatch_data,
|
||||
rocprofiler_profile_config_id_t* config,
|
||||
rocprofiler_counter_config_id_t* config,
|
||||
rocprofiler_user_data_t* user_data,
|
||||
void* /*callback_data_args*/)
|
||||
{
|
||||
@@ -1804,14 +1803,14 @@ tool_init(rocprofiler_client_finalize_t fini_func, void* tool_data)
|
||||
ROCPROFILER_CALL(rocprofiler_create_context(&hip_stream_display_ctx),
|
||||
"failed to create context");
|
||||
|
||||
ROCPROFILER_CALL(rocprofiler_configure_callback_tracing_service(
|
||||
hip_stream_display_ctx,
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_STREAM_API,
|
||||
nullptr,
|
||||
0,
|
||||
hip_stream_display_callback,
|
||||
nullptr),
|
||||
"stream tracing configure failed");
|
||||
ROCPROFILER_CALL(
|
||||
rocprofiler_configure_callback_tracing_service(hip_stream_display_ctx,
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_STREAM,
|
||||
nullptr,
|
||||
0,
|
||||
hip_stream_display_callback,
|
||||
nullptr),
|
||||
"stream tracing configure failed");
|
||||
ROCPROFILER_CALL(rocprofiler_start_context(hip_stream_display_ctx), "start context failed");
|
||||
}
|
||||
if(tool::get_config().kernel_rename || !tool::get_config().group_by_queue)
|
||||
|
||||
@@ -10,19 +10,19 @@ set(ROCPROFILER_LIB_SOURCES
|
||||
agent.cpp
|
||||
buffer.cpp
|
||||
buffer_tracing.cpp
|
||||
device_counting_service.cpp
|
||||
callback_tracing.cpp
|
||||
context.cpp
|
||||
counter_config.cpp
|
||||
counters.cpp
|
||||
dispatch_profile.cpp
|
||||
device_counting_service.cpp
|
||||
dispatch_counting_service.cpp
|
||||
external_correlation.cpp
|
||||
intercept_table.cpp
|
||||
internal_threading.cpp
|
||||
ompt.cpp
|
||||
pc_sampling.cpp
|
||||
profile_config.cpp
|
||||
rocprofiler.cpp
|
||||
registration.cpp
|
||||
rocprofiler.cpp
|
||||
runtime_initialization.cpp)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
@@ -99,7 +99,7 @@ ROCPROFILER_BUFFER_TRACING_KIND_STRING(OMPT)
|
||||
ROCPROFILER_BUFFER_TRACING_KIND_STRING(RUNTIME_INITIALIZATION)
|
||||
ROCPROFILER_BUFFER_TRACING_KIND_STRING(ROCDECODE_API)
|
||||
ROCPROFILER_BUFFER_TRACING_KIND_STRING(ROCJPEG_API)
|
||||
ROCPROFILER_BUFFER_TRACING_KIND_STRING(HIP_STREAM_API)
|
||||
ROCPROFILER_BUFFER_TRACING_KIND_STRING(HIP_STREAM)
|
||||
ROCPROFILER_BUFFER_TRACING_KIND_STRING(HIP_RUNTIME_API_EXT)
|
||||
ROCPROFILER_BUFFER_TRACING_KIND_STRING(HIP_COMPILER_API_EXT)
|
||||
|
||||
@@ -312,7 +312,7 @@ rocprofiler_query_buffer_tracing_kind_operation_name(rocprofiler_buffer_tracing_
|
||||
val = rocprofiler::rocjpeg::name_by_id<ROCPROFILER_ROCJPEG_TABLE_ID_CORE>(operation);
|
||||
break;
|
||||
}
|
||||
case ROCPROFILER_BUFFER_TRACING_HIP_STREAM_API:
|
||||
case ROCPROFILER_BUFFER_TRACING_HIP_STREAM:
|
||||
{
|
||||
val = rocprofiler::hip::stream::name_by_id(operation);
|
||||
break;
|
||||
@@ -460,7 +460,7 @@ rocprofiler_iterate_buffer_tracing_kind_operations(
|
||||
ops = rocprofiler::rocjpeg::get_ids<ROCPROFILER_ROCJPEG_TABLE_ID_CORE>();
|
||||
break;
|
||||
}
|
||||
case ROCPROFILER_BUFFER_TRACING_HIP_STREAM_API:
|
||||
case ROCPROFILER_BUFFER_TRACING_HIP_STREAM:
|
||||
{
|
||||
ops = rocprofiler::hip::stream::get_ids();
|
||||
break;
|
||||
|
||||
@@ -95,7 +95,7 @@ ROCPROFILER_CALLBACK_TRACING_KIND_STRING(OMPT)
|
||||
ROCPROFILER_CALLBACK_TRACING_KIND_STRING(RUNTIME_INITIALIZATION)
|
||||
ROCPROFILER_CALLBACK_TRACING_KIND_STRING(ROCDECODE_API)
|
||||
ROCPROFILER_CALLBACK_TRACING_KIND_STRING(ROCJPEG_API)
|
||||
ROCPROFILER_CALLBACK_TRACING_KIND_STRING(HIP_STREAM_API)
|
||||
ROCPROFILER_CALLBACK_TRACING_KIND_STRING(HIP_STREAM)
|
||||
|
||||
template <size_t Idx, size_t... Tail>
|
||||
std::pair<const char*, size_t>
|
||||
@@ -290,7 +290,7 @@ rocprofiler_query_callback_tracing_kind_operation_name(rocprofiler_callback_trac
|
||||
val = rocprofiler::rocjpeg::name_by_id<ROCPROFILER_ROCJPEG_TABLE_ID_CORE>(operation);
|
||||
break;
|
||||
}
|
||||
case ROCPROFILER_CALLBACK_TRACING_HIP_STREAM_API:
|
||||
case ROCPROFILER_CALLBACK_TRACING_HIP_STREAM:
|
||||
{
|
||||
val = rocprofiler::hip::stream::name_by_id(operation);
|
||||
break;
|
||||
@@ -434,7 +434,7 @@ rocprofiler_iterate_callback_tracing_kind_operations(
|
||||
ops = rocprofiler::rocjpeg::get_ids<ROCPROFILER_ROCJPEG_TABLE_ID_CORE>();
|
||||
break;
|
||||
}
|
||||
case ROCPROFILER_CALLBACK_TRACING_HIP_STREAM_API:
|
||||
case ROCPROFILER_CALLBACK_TRACING_HIP_STREAM:
|
||||
{
|
||||
ops = rocprofiler::hip::stream::get_ids();
|
||||
break;
|
||||
@@ -583,7 +583,7 @@ rocprofiler_iterate_callback_tracing_kind_operation_args(
|
||||
case ROCPROFILER_CALLBACK_TRACING_RUNTIME_INITIALIZATION:
|
||||
case ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API:
|
||||
case ROCPROFILER_CALLBACK_TRACING_ROCJPEG_API:
|
||||
case ROCPROFILER_CALLBACK_TRACING_HIP_STREAM_API:
|
||||
case ROCPROFILER_CALLBACK_TRACING_HIP_STREAM:
|
||||
{
|
||||
return ROCPROFILER_STATUS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
+6
-6
@@ -44,17 +44,17 @@ extern "C" {
|
||||
* @return ::rocprofiler_status_t
|
||||
*/
|
||||
rocprofiler_status_t
|
||||
rocprofiler_create_profile_config(rocprofiler_agent_id_t agent_id,
|
||||
rocprofiler_create_counter_config(rocprofiler_agent_id_t agent_id,
|
||||
rocprofiler_counter_id_t* counters_list,
|
||||
size_t counters_count,
|
||||
rocprofiler_profile_config_id_t* config_id)
|
||||
rocprofiler_counter_config_id_t* config_id)
|
||||
{
|
||||
std::unordered_set<uint64_t> already_added;
|
||||
const auto* agent = ::rocprofiler::agent::get_agent(agent_id);
|
||||
if(!agent) return ROCPROFILER_STATUS_ERROR_AGENT_NOT_FOUND;
|
||||
|
||||
std::shared_ptr<rocprofiler::counters::profile_config> config =
|
||||
std::make_shared<rocprofiler::counters::profile_config>();
|
||||
std::shared_ptr<rocprofiler::counters::counter_config> config =
|
||||
std::make_shared<rocprofiler::counters::counter_config>();
|
||||
|
||||
auto metrics_map = rocprofiler::counters::loadMetrics();
|
||||
const auto& id_map = metrics_map->id_to_metric;
|
||||
@@ -78,7 +78,7 @@ rocprofiler_create_profile_config(rocprofiler_agent_id_t agent_id,
|
||||
if(config_id->handle != 0)
|
||||
{
|
||||
// Copy existing counters from previous config
|
||||
if(auto existing = rocprofiler::counters::get_profile_config(*config_id))
|
||||
if(auto existing = rocprofiler::counters::get_counter_config(*config_id))
|
||||
{
|
||||
for(const auto& metric : existing->metrics)
|
||||
{
|
||||
@@ -100,7 +100,7 @@ rocprofiler_create_profile_config(rocprofiler_agent_id_t agent_id,
|
||||
}
|
||||
|
||||
rocprofiler_status_t
|
||||
rocprofiler_destroy_profile_config(rocprofiler_profile_config_id_t config_id)
|
||||
rocprofiler_destroy_counter_config(rocprofiler_counter_config_id_t config_id)
|
||||
{
|
||||
rocprofiler::counters::destroy_counter_profile(config_id.handle);
|
||||
return ROCPROFILER_STATUS_SUCCESS;
|
||||
@@ -23,28 +23,61 @@
|
||||
#include <rocprofiler-sdk/experimental/counters.h>
|
||||
#include <rocprofiler-sdk/fwd.h>
|
||||
#include <rocprofiler-sdk/rocprofiler.h>
|
||||
#include <rocprofiler-sdk/cxx/operators.hpp>
|
||||
|
||||
#include <fmt/core.h>
|
||||
|
||||
#include "lib/common/container/small_vector.hpp"
|
||||
#include "lib/common/logging.hpp"
|
||||
#include "lib/common/static_object.hpp"
|
||||
#include "lib/common/string_entry.hpp"
|
||||
#include "lib/common/utility.hpp"
|
||||
#include "lib/common/synchronized.hpp"
|
||||
#include "lib/rocprofiler-sdk/agent.hpp"
|
||||
#include "lib/rocprofiler-sdk/counters/dimensions.hpp"
|
||||
#include "lib/rocprofiler-sdk/counters/evaluate_ast.hpp"
|
||||
#include "lib/rocprofiler-sdk/counters/id_decode.hpp"
|
||||
#include "lib/rocprofiler-sdk/counters/metrics.hpp"
|
||||
#include "lib/rocprofiler-sdk/hsa/agent_cache.hpp"
|
||||
#include "lib/rocprofiler-sdk/hsa/queue.hpp"
|
||||
#include "lib/rocprofiler-sdk/hsa/queue_controller.hpp"
|
||||
|
||||
namespace rocprofiler
|
||||
{
|
||||
namespace counters
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const char*
|
||||
get_static_string(const std::string& str)
|
||||
get_static_string(std::string_view str)
|
||||
{
|
||||
return rocprofiler::common::get_string_entry(rocprofiler::common::add_string_entry(str))
|
||||
->c_str();
|
||||
return common::get_string_entry(str)->c_str();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const std::vector<T>*
|
||||
get_static_ptr(const std::vector<T>& vec)
|
||||
{
|
||||
// The use of std::map is purposeful. Keys can be vectors in map and cannot be in unordered_map.
|
||||
// Simplifying the code to create these static objects. Given that they are not created often (
|
||||
// or looked up often), the performance difference between map and unordered_map is negligible.
|
||||
using static_ptr_map = std::map<std::vector<T>, std::unique_ptr<std::vector<T>>>;
|
||||
static auto*& static_ptrs =
|
||||
common::static_object<common::Synchronized<static_ptr_map>>::construct();
|
||||
return static_ptrs->wlock([&](auto& data) {
|
||||
if(auto it = data.find(vec); it != data.end())
|
||||
{
|
||||
return it->second.get();
|
||||
}
|
||||
data[vec] = std::make_unique<std::vector<T>>(vec);
|
||||
return data[vec].get();
|
||||
});
|
||||
}
|
||||
} // namespace
|
||||
} // namespace counters
|
||||
} // namespace rocprofiler
|
||||
|
||||
namespace counters = ::rocprofiler::counters;
|
||||
namespace common = ::rocprofiler::common;
|
||||
|
||||
extern "C" {
|
||||
/**
|
||||
@@ -64,27 +97,132 @@ rocprofiler_query_counter_info(rocprofiler_counter_id_t counter_id,
|
||||
rocprofiler_counter_info_version_id_t version,
|
||||
void* info)
|
||||
{
|
||||
if(version != ROCPROFILER_COUNTER_INFO_VERSION_0)
|
||||
return ROCPROFILER_STATUS_ERROR_INCOMPATIBLE_ABI;
|
||||
auto metrics_map = rocprofiler::counters::loadMetrics();
|
||||
auto metrics_map = counters::loadMetrics();
|
||||
const auto& id_map = metrics_map->id_to_metric;
|
||||
|
||||
const auto& id_map = metrics_map->id_to_metric;
|
||||
auto base_info = [&](auto& out_struct) {
|
||||
if(const auto* metric_ptr = common::get_val(id_map, counter_id.handle))
|
||||
{
|
||||
out_struct.id = counter_id;
|
||||
out_struct.is_constant = (metric_ptr->constant().empty()) ? 0 : 1;
|
||||
out_struct.is_derived = (metric_ptr->expression().empty()) ? 0 : 1;
|
||||
out_struct.name = counters::get_static_string(metric_ptr->name());
|
||||
out_struct.description = counters::get_static_string(metric_ptr->description());
|
||||
out_struct.block = counters::get_static_string(metric_ptr->block());
|
||||
out_struct.expression = counters::get_static_string(metric_ptr->expression());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
auto& out_struct = *static_cast<rocprofiler_counter_info_v0_t*>(info);
|
||||
auto dim_info = [&](auto& out_struct) {
|
||||
auto dim_ptr = counters::get_dimension_cache();
|
||||
|
||||
if(const auto* metric_ptr = rocprofiler::common::get_val(id_map, counter_id.handle))
|
||||
const auto* dims = common::get_val(dim_ptr->id_to_dim, counter_id.handle);
|
||||
if(!dims) return false;
|
||||
|
||||
auto _dim_info = std::vector<rocprofiler_counter_record_dimension_info_t>{};
|
||||
for(const auto& metric_dim : *dims)
|
||||
{
|
||||
_dim_info.emplace_back(rocprofiler_counter_record_dimension_info_t{
|
||||
.name = counters::get_static_string(metric_dim.name()),
|
||||
.instance_size = metric_dim.size(),
|
||||
.id = static_cast<rocprofiler_counter_dimension_id_t>(metric_dim.type())});
|
||||
}
|
||||
|
||||
if(_dim_info.empty())
|
||||
{
|
||||
// Can be 0 if the counter is not known by AQLProfile. This is the case
|
||||
// if it was added in a later version of AQLProfile.
|
||||
out_struct.dimensions = nullptr;
|
||||
out_struct.dimensions_count = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
out_struct.dimensions = counters::get_static_ptr(_dim_info)->data();
|
||||
out_struct.dimensions_count = _dim_info.size();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Construct all possible permutations of instance ids. This is every instance
|
||||
// that can be returned by the counter across all dimensions.
|
||||
auto dim_permutations = [&](auto& out_struct) {
|
||||
auto dim_ptr = counters::get_dimension_cache();
|
||||
|
||||
const auto* dims = common::get_val(dim_ptr->id_to_dim, counter_id.handle);
|
||||
if(!dims) return false;
|
||||
|
||||
std::vector<rocprofiler_counter_instance_id_t> instances;
|
||||
|
||||
for(const auto& metric_dim : *dims)
|
||||
{
|
||||
if(metric_dim.size() == 0) continue;
|
||||
std::vector<rocprofiler_counter_instance_id_t> tmp;
|
||||
// If no instances are found, create the first set of instances
|
||||
if(instances.empty())
|
||||
{
|
||||
for(size_t i = 0; i < metric_dim.size(); i++)
|
||||
{
|
||||
auto& rec = instances.emplace_back();
|
||||
counters::set_dim_in_rec(rec, metric_dim.type(), i);
|
||||
counters::set_counter_in_rec(rec, counter_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// For each instance, create a new set of instances with the new dimension added.
|
||||
// This will create all possible permutations of the dimensions.
|
||||
for(size_t i = 0; i < metric_dim.size(); i++)
|
||||
{
|
||||
for(const auto& instance : instances)
|
||||
{
|
||||
auto& rec = tmp.emplace_back(instance);
|
||||
counters::set_dim_in_rec(rec, metric_dim.type(), i);
|
||||
counters::set_counter_in_rec(rec, counter_id);
|
||||
}
|
||||
}
|
||||
instances = tmp;
|
||||
}
|
||||
}
|
||||
if(instances.empty())
|
||||
{
|
||||
out_struct.instance_ids = nullptr;
|
||||
out_struct.instance_ids_count = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
out_struct.instance_ids = counters::get_static_ptr(instances)->data();
|
||||
out_struct.instance_ids_count = instances.size();
|
||||
return true;
|
||||
};
|
||||
|
||||
switch(version)
|
||||
{
|
||||
out_struct.id = counter_id;
|
||||
out_struct.is_constant = (metric_ptr->constant().empty()) ? 0 : 1;
|
||||
out_struct.is_derived = (metric_ptr->expression().empty()) ? 0 : 1;
|
||||
out_struct.name = get_static_string(metric_ptr->name());
|
||||
out_struct.description = get_static_string(metric_ptr->description());
|
||||
out_struct.block = get_static_string(metric_ptr->block());
|
||||
out_struct.expression = get_static_string(metric_ptr->expression());
|
||||
return ROCPROFILER_STATUS_SUCCESS;
|
||||
case ROCPROFILER_COUNTER_INFO_VERSION_0:
|
||||
{
|
||||
auto& _out_struct = *static_cast<rocprofiler_counter_info_v0_t*>(info);
|
||||
|
||||
if(base_info(_out_struct)) return ROCPROFILER_STATUS_SUCCESS;
|
||||
return ROCPROFILER_STATUS_ERROR_COUNTER_NOT_FOUND;
|
||||
}
|
||||
break;
|
||||
case ROCPROFILER_COUNTER_INFO_VERSION_1:
|
||||
{
|
||||
auto& _out_struct = *static_cast<rocprofiler_counter_info_v1_t*>(info);
|
||||
|
||||
if(!base_info(_out_struct)) return ROCPROFILER_STATUS_ERROR_COUNTER_NOT_FOUND;
|
||||
if(!dim_info(_out_struct)) return ROCPROFILER_STATUS_ERROR_DIM_NOT_FOUND;
|
||||
if(!dim_permutations(_out_struct)) return ROCPROFILER_STATUS_ERROR_DIM_NOT_FOUND;
|
||||
|
||||
return ROCPROFILER_STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
return ROCPROFILER_STATUS_ERROR_INCOMPATIBLE_ABI;
|
||||
}
|
||||
}
|
||||
|
||||
ROCP_ERROR << fmt::format("Could not find counter with id = {}", counter_id.handle);
|
||||
return ROCPROFILER_STATUS_ERROR_COUNTER_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -102,9 +240,9 @@ rocprofiler_query_counter_instance_count(rocprofiler_agent_id_t,
|
||||
size_t* instance_count)
|
||||
{
|
||||
*instance_count = 0;
|
||||
auto dim_ptr = rocprofiler::counters::get_dimension_cache();
|
||||
auto dim_ptr = counters::get_dimension_cache();
|
||||
|
||||
const auto* dims = rocprofiler::common::get_val(dim_ptr->id_to_dim, counter_id.handle);
|
||||
const auto* dims = common::get_val(dim_ptr->id_to_dim, counter_id.handle);
|
||||
if(!dims) return ROCPROFILER_STATUS_ERROR_COUNTER_NOT_FOUND;
|
||||
|
||||
for(const auto& metric_dim : *dims)
|
||||
@@ -133,7 +271,7 @@ rocprofiler_iterate_agent_supported_counters(rocprofiler_agent_id_t
|
||||
const auto* agent = rocprofiler::agent::get_agent(agent_id);
|
||||
if(!agent) return ROCPROFILER_STATUS_ERROR_AGENT_NOT_FOUND;
|
||||
|
||||
auto metrics = rocprofiler::counters::getMetricsForAgent(agent->name);
|
||||
auto metrics = counters::getMetricsForAgent(agent->name);
|
||||
if(metrics.empty()) return ROCPROFILER_STATUS_ERROR_AGENT_ARCH_NOT_SUPPORTED;
|
||||
|
||||
std::vector<rocprofiler_counter_id_t> ids;
|
||||
@@ -158,7 +296,7 @@ rocprofiler_query_record_counter_id(rocprofiler_counter_instance_id_t id,
|
||||
rocprofiler_counter_id_t* counter_id)
|
||||
{
|
||||
// Get counter id from record
|
||||
*counter_id = rocprofiler::counters::rec_to_counter_id(id);
|
||||
*counter_id = counters::rec_to_counter_id(id);
|
||||
return ROCPROFILER_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -167,8 +305,8 @@ rocprofiler_query_record_dimension_position(rocprofiler_counter_instance_id_t i
|
||||
rocprofiler_counter_dimension_id_t dim,
|
||||
size_t* pos)
|
||||
{
|
||||
*pos = rocprofiler::counters::rec_to_dim_pos(
|
||||
id, static_cast<rocprofiler::counters::rocprofiler_profile_counter_instance_types>(dim));
|
||||
*pos = counters::rec_to_dim_pos(
|
||||
id, static_cast<counters::rocprofiler_profile_counter_instance_types>(dim));
|
||||
return ROCPROFILER_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -177,17 +315,17 @@ rocprofiler_iterate_counter_dimensions(rocprofiler_counter_id_t id,
|
||||
rocprofiler_available_dimensions_cb_t info_cb,
|
||||
void* user_data)
|
||||
{
|
||||
auto dim_ptr = rocprofiler::counters::get_dimension_cache();
|
||||
auto dim_ptr = counters::get_dimension_cache();
|
||||
|
||||
const auto* dims = rocprofiler::common::get_val(dim_ptr->id_to_dim, id.handle);
|
||||
const auto* dims = common::get_val(dim_ptr->id_to_dim, id.handle);
|
||||
if(!dims) return ROCPROFILER_STATUS_ERROR_COUNTER_NOT_FOUND;
|
||||
|
||||
// This is likely faster than a map lookup given the limited number of dims.
|
||||
rocprofiler::common::container::small_vector<rocprofiler_record_dimension_info_t, 6> user_dims;
|
||||
auto user_dims = common::container::small_vector<rocprofiler_record_dimension_info_t, 6>{};
|
||||
for(const auto& internal_dim : *dims)
|
||||
{
|
||||
auto& dim = user_dims.emplace_back();
|
||||
dim.name = get_static_string(internal_dim.name());
|
||||
dim.name = counters::get_static_string(internal_dim.name());
|
||||
dim.instance_size = internal_dim.size();
|
||||
dim.id = static_cast<rocprofiler_counter_dimension_id_t>(internal_dim.type());
|
||||
}
|
||||
@@ -205,12 +343,12 @@ rocprofiler_iterate_counter_dimensions(rocprofiler_counter_id_t id,
|
||||
rocprofiler_status_t
|
||||
rocprofiler_load_counter_definition(const char* yaml, size_t size, rocprofiler_counter_flag_t flags)
|
||||
{
|
||||
rocprofiler::counters::CustomCounterDefinition def;
|
||||
counters::CustomCounterDefinition def;
|
||||
if(yaml == nullptr && size != 0) return ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
def.data = std::string(yaml, size);
|
||||
def.append = (flags == ROCPROFILER_COUNTER_FLAG_APPEND_DEFINITION ? true : false);
|
||||
def.loaded = false;
|
||||
return rocprofiler::counters::setCustomCounterDefinition(def);
|
||||
return counters::setCustomCounterDefinition(def);
|
||||
}
|
||||
|
||||
rocprofiler_status_t
|
||||
@@ -226,25 +364,23 @@ rocprofiler_create_counter(const char* name,
|
||||
const auto* agent_ptr = rocprofiler::agent::get_agent(agent);
|
||||
if(!agent_ptr) return ROCPROFILER_STATUS_ERROR_AGENT_NOT_FOUND;
|
||||
|
||||
rocprofiler::counters::Metric new_metric(
|
||||
"",
|
||||
std::string(name, name_len),
|
||||
"",
|
||||
"",
|
||||
std::string((description ? description : ""), description_len),
|
||||
std::string(expr, expr_len),
|
||||
"",
|
||||
-1);
|
||||
counters::Metric new_metric("",
|
||||
std::string(name, name_len),
|
||||
"",
|
||||
"",
|
||||
std::string((description ? description : ""), description_len),
|
||||
std::string(expr, expr_len),
|
||||
"",
|
||||
-1);
|
||||
|
||||
// Validate the metric. Checks for duplicate names and invalid expressions.
|
||||
if(auto status = rocprofiler::counters::check_ast_generation(agent_ptr->name, new_metric);
|
||||
if(auto status = counters::check_ast_generation(agent_ptr->name, new_metric);
|
||||
status != ROCPROFILER_STATUS_SUCCESS)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
auto add_metric =
|
||||
rocprofiler::counters::loadMetrics(true, std::make_pair(agent_ptr->name, new_metric));
|
||||
auto add_metric = counters::loadMetrics(true, std::make_pair(agent_ptr->name, new_metric));
|
||||
|
||||
if(add_metric->arch_to_metric.at(agent_ptr->name).back().name() != new_metric.name())
|
||||
{
|
||||
@@ -256,8 +392,8 @@ rocprofiler_create_counter(const char* name,
|
||||
// Regenerate ASTs and Dimension Cache
|
||||
try
|
||||
{
|
||||
rocprofiler::counters::get_ast_map(true);
|
||||
rocprofiler::counters::get_dimension_cache(true);
|
||||
counters::get_ast_map(true);
|
||||
counters::get_dimension_cache(true);
|
||||
} catch(std::exception& e)
|
||||
{
|
||||
ROCP_FATAL << "Could not regenerate ASTs and Dimension Cache " << e.what();
|
||||
|
||||
@@ -46,12 +46,12 @@ CounterController::CounterController()
|
||||
// Note: these profiles can be used across multiple contexts
|
||||
// and are independent of the context.
|
||||
uint64_t
|
||||
CounterController::add_profile(std::shared_ptr<profile_config>&& config)
|
||||
CounterController::add_profile(std::shared_ptr<counter_config>&& config)
|
||||
{
|
||||
static std::atomic<uint64_t> profile_val = 1;
|
||||
uint64_t ret = 0;
|
||||
_configs.wlock([&](auto& data) {
|
||||
config->id = rocprofiler_profile_config_id_t{.handle = profile_val};
|
||||
config->id = rocprofiler_counter_config_id_t{.handle = profile_val};
|
||||
data.emplace(profile_val, std::move(config));
|
||||
ret = profile_val;
|
||||
profile_val++;
|
||||
@@ -66,11 +66,11 @@ CounterController::destroy_profile(uint64_t id)
|
||||
}
|
||||
|
||||
rocprofiler_status_t
|
||||
CounterController::configure_agent_collection(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer_id,
|
||||
rocprofiler_agent_id_t agent_id,
|
||||
rocprofiler_device_counting_service_callback_t cb,
|
||||
void* user_data)
|
||||
CounterController::configure_agent_collection(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer_id,
|
||||
rocprofiler_agent_id_t agent_id,
|
||||
rocprofiler_device_counting_service_cb_t cb,
|
||||
void* user_data)
|
||||
{
|
||||
auto* ctx_p = rocprofiler::context::get_mutable_registered_context(context_id);
|
||||
if(!ctx_p) return ROCPROFILER_STATUS_ERROR_CONTEXT_INVALID;
|
||||
@@ -127,13 +127,12 @@ CounterController::configure_agent_collection(rocprofiler_context_id_t context_i
|
||||
// the AQL packet generator for injecting packets. Note: the service is created
|
||||
// in the stop state.
|
||||
rocprofiler_status_t
|
||||
CounterController::configure_dispatch(
|
||||
rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer,
|
||||
rocprofiler_dispatch_counting_service_callback_t callback,
|
||||
void* callback_args,
|
||||
rocprofiler_profile_counting_record_callback_t record_callback,
|
||||
void* record_callback_args)
|
||||
CounterController::configure_dispatch(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer,
|
||||
rocprofiler_dispatch_counting_service_cb_t callback,
|
||||
void* callback_args,
|
||||
rocprofiler_dispatch_counting_record_cb_t record_callback,
|
||||
void* record_callback_args)
|
||||
{
|
||||
auto* ctx_p = rocprofiler::context::get_mutable_registered_context(context_id);
|
||||
if(!ctx_p) return ROCPROFILER_STATUS_ERROR_CONTEXT_INVALID;
|
||||
@@ -169,10 +168,10 @@ CounterController::configure_dispatch(
|
||||
return ROCPROFILER_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
std::shared_ptr<profile_config>
|
||||
CounterController::get_profile_cfg(rocprofiler_profile_config_id_t id)
|
||||
std::shared_ptr<counter_config>
|
||||
CounterController::get_profile_cfg(rocprofiler_counter_config_id_t id)
|
||||
{
|
||||
std::shared_ptr<profile_config> cfg;
|
||||
std::shared_ptr<counter_config> cfg;
|
||||
_configs.rlock([&](const auto& map) { cfg = map.at(id.handle); });
|
||||
return cfg;
|
||||
}
|
||||
@@ -185,10 +184,10 @@ get_controller()
|
||||
}
|
||||
|
||||
rocprofiler_status_t
|
||||
create_counter_profile(std::shared_ptr<profile_config> config)
|
||||
create_counter_profile(std::shared_ptr<counter_config> config)
|
||||
{
|
||||
auto status = ROCPROFILER_STATUS_SUCCESS;
|
||||
if(status = counters::counter_callback_info::setup_profile_config(config);
|
||||
if(status = counters::counter_callback_info::setup_counter_config(config);
|
||||
status != ROCPROFILER_STATUS_SUCCESS)
|
||||
{
|
||||
return status;
|
||||
@@ -210,8 +209,8 @@ destroy_counter_profile(uint64_t id)
|
||||
get_controller().destroy_profile(id);
|
||||
}
|
||||
|
||||
std::shared_ptr<profile_config>
|
||||
get_profile_config(rocprofiler_profile_config_id_t id)
|
||||
std::shared_ptr<counter_config>
|
||||
get_counter_config(rocprofiler_counter_config_id_t id)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace counters
|
||||
// to collect counters on, the metrics to collect, the hw
|
||||
// counters needed to evaluate the metrics, and the ASTs.
|
||||
// This profile can be shared among many rocprof contexts.
|
||||
struct profile_config
|
||||
struct counter_config
|
||||
{
|
||||
const rocprofiler_agent_t* agent = nullptr;
|
||||
std::vector<counters::Metric> metrics{};
|
||||
@@ -55,13 +55,12 @@ struct profile_config
|
||||
std::set<counters::Metric> required_special_counters{};
|
||||
// ASTs to evaluate
|
||||
std::vector<counters::EvaluateAST> asts{};
|
||||
rocprofiler_profile_config_id_t id{.handle = 0};
|
||||
rocprofiler_counter_config_id_t id{.handle = 0};
|
||||
// Packet generator to create AQL packets for insertion
|
||||
std::unique_ptr<rocprofiler::aql::CounterPacketConstruct> pkt_generator{nullptr};
|
||||
// A packet cache of AQL packets. This allows reuse of AQL packets (preventing costly
|
||||
// allocation of new packets/destruction).
|
||||
rocprofiler::common::Synchronized<std::vector<std::unique_ptr<rocprofiler::hsa::AQLPacket>>>
|
||||
packets{};
|
||||
common::Synchronized<std::vector<std::unique_ptr<rocprofiler::hsa::AQLPacket>>> packets{};
|
||||
};
|
||||
|
||||
class CounterController
|
||||
@@ -72,7 +71,7 @@ public:
|
||||
// Adds a counter collection profile to our global cache.
|
||||
// Note: these profiles can be used across multiple contexts
|
||||
// and are independent of the context.
|
||||
uint64_t add_profile(std::shared_ptr<profile_config>&& config);
|
||||
uint64_t add_profile(std::shared_ptr<counter_config>&& config);
|
||||
|
||||
void destroy_profile(uint64_t id);
|
||||
// Setup the counter collection service. counter_callback_info is created here
|
||||
@@ -80,37 +79,36 @@ public:
|
||||
// the AQL packet generator for injecting packets. Note: the service is created
|
||||
// in the stop state.
|
||||
static rocprofiler_status_t configure_dispatch(
|
||||
rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer,
|
||||
rocprofiler_dispatch_counting_service_callback_t callback,
|
||||
void* callback_args,
|
||||
rocprofiler_profile_counting_record_callback_t record_callback,
|
||||
void* record_callback_args);
|
||||
std::shared_ptr<profile_config> get_profile_cfg(rocprofiler_profile_config_id_t id);
|
||||
rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer,
|
||||
rocprofiler_dispatch_counting_service_cb_t callback,
|
||||
void* callback_args,
|
||||
rocprofiler_dispatch_counting_record_cb_t record_callback,
|
||||
void* record_callback_args);
|
||||
std::shared_ptr<counter_config> get_profile_cfg(rocprofiler_counter_config_id_t id);
|
||||
|
||||
static rocprofiler_status_t configure_agent_collection(
|
||||
rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer_id,
|
||||
rocprofiler_agent_id_t agent_id,
|
||||
rocprofiler_device_counting_service_callback_t cb,
|
||||
void* user_data);
|
||||
rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer_id,
|
||||
rocprofiler_agent_id_t agent_id,
|
||||
rocprofiler_device_counting_service_cb_t cb,
|
||||
void* user_data);
|
||||
|
||||
private:
|
||||
rocprofiler::common::Synchronized<std::unordered_map<uint64_t, std::shared_ptr<profile_config>>>
|
||||
_configs;
|
||||
common::Synchronized<std::unordered_map<uint64_t, std::shared_ptr<counter_config>>> _configs;
|
||||
};
|
||||
|
||||
CounterController&
|
||||
get_controller();
|
||||
|
||||
rocprofiler_status_t
|
||||
create_counter_profile(std::shared_ptr<profile_config> config);
|
||||
create_counter_profile(std::shared_ptr<counter_config> config);
|
||||
|
||||
void
|
||||
destroy_counter_profile(uint64_t id);
|
||||
|
||||
std::shared_ptr<profile_config>
|
||||
get_profile_config(rocprofiler_profile_config_id_t id);
|
||||
std::shared_ptr<counter_config>
|
||||
get_counter_config(rocprofiler_counter_config_id_t id);
|
||||
|
||||
} // namespace counters
|
||||
} // namespace rocprofiler
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace rocprofiler
|
||||
namespace counters
|
||||
{
|
||||
rocprofiler_status_t
|
||||
counter_callback_info::setup_profile_config(std::shared_ptr<profile_config>& profile)
|
||||
counter_callback_info::setup_counter_config(std::shared_ptr<counter_config>& profile)
|
||||
{
|
||||
if(profile->pkt_generator || !profile->reqired_hw_counters.empty())
|
||||
{
|
||||
@@ -115,12 +115,12 @@ counter_callback_info::setup_profile_config(std::shared_ptr<profile_config>& pro
|
||||
|
||||
rocprofiler_status_t
|
||||
counter_callback_info::get_packet(std::unique_ptr<rocprofiler::hsa::AQLPacket>& ret_pkt,
|
||||
std::shared_ptr<profile_config>& profile)
|
||||
std::shared_ptr<counter_config>& profile)
|
||||
{
|
||||
rocprofiler_status_t status;
|
||||
// Check packet cache
|
||||
profile->packets.wlock([&](auto& pkt_vector) {
|
||||
status = counter_callback_info::setup_profile_config(profile);
|
||||
status = counter_callback_info::setup_counter_config(profile);
|
||||
if(!pkt_vector.empty() && status == ROCPROFILER_STATUS_SUCCESS)
|
||||
{
|
||||
ret_pkt = std::move(pkt_vector.back());
|
||||
@@ -216,21 +216,21 @@ stop_context(const context::context* ctx)
|
||||
}
|
||||
|
||||
rocprofiler_status_t
|
||||
configure_agent_collection(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer_id,
|
||||
rocprofiler_agent_id_t agent_id,
|
||||
rocprofiler_device_counting_service_callback_t cb,
|
||||
void* user_data)
|
||||
configure_agent_collection(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer_id,
|
||||
rocprofiler_agent_id_t agent_id,
|
||||
rocprofiler_device_counting_service_cb_t cb,
|
||||
void* user_data)
|
||||
{
|
||||
return get_controller().configure_agent_collection(
|
||||
context_id, buffer_id, agent_id, cb, user_data);
|
||||
}
|
||||
|
||||
rocprofiler_status_t
|
||||
configure_buffered_dispatch(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer,
|
||||
rocprofiler_dispatch_counting_service_callback_t callback,
|
||||
void* callback_args)
|
||||
configure_buffered_dispatch(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer,
|
||||
rocprofiler_dispatch_counting_service_cb_t callback,
|
||||
void* callback_args)
|
||||
{
|
||||
CHECK_NE(buffer.handle, 0);
|
||||
return get_controller().configure_dispatch(
|
||||
@@ -238,11 +238,11 @@ configure_buffered_dispatch(rocprofiler_context_id_t con
|
||||
}
|
||||
|
||||
rocprofiler_status_t
|
||||
configure_callback_dispatch(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_dispatch_counting_service_callback_t callback,
|
||||
void* callback_data_args,
|
||||
rocprofiler_profile_counting_record_callback_t record_callback,
|
||||
void* record_callback_args)
|
||||
configure_callback_dispatch(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_dispatch_counting_service_cb_t callback,
|
||||
void* callback_data_args,
|
||||
rocprofiler_dispatch_counting_record_cb_t record_callback,
|
||||
void* record_callback_args)
|
||||
{
|
||||
return get_controller().configure_dispatch(context_id,
|
||||
{.handle = 0},
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace counters
|
||||
struct counter_callback_info
|
||||
{
|
||||
// User callback
|
||||
rocprofiler_dispatch_counting_service_callback_t user_cb{nullptr};
|
||||
rocprofiler_dispatch_counting_service_cb_t user_cb{nullptr};
|
||||
// User id
|
||||
void* callback_args{nullptr};
|
||||
// Link to the context this is associated with
|
||||
@@ -58,45 +58,45 @@ struct counter_callback_info
|
||||
// Buffer to use for storing counter data. Used if callback is not set.
|
||||
std::optional<rocprofiler_buffer_id_t> buffer;
|
||||
|
||||
rocprofiler_profile_counting_record_callback_t record_callback;
|
||||
void* record_callback_args;
|
||||
rocprofiler_dispatch_counting_record_cb_t record_callback;
|
||||
void* record_callback_args;
|
||||
|
||||
// Facilitates the return of an AQL Packet to the profile config that constructed it.
|
||||
rocprofiler::common::Synchronized<
|
||||
std::unordered_map<rocprofiler::hsa::AQLPacket*, std::shared_ptr<profile_config>>>
|
||||
common::Synchronized<
|
||||
std::unordered_map<rocprofiler::hsa::AQLPacket*, std::shared_ptr<counter_config>>>
|
||||
packet_return_map{};
|
||||
|
||||
static rocprofiler_status_t setup_profile_config(std::shared_ptr<profile_config>&);
|
||||
static rocprofiler_status_t setup_counter_config(std::shared_ptr<counter_config>&);
|
||||
|
||||
rocprofiler_status_t get_packet(std::unique_ptr<rocprofiler::hsa::AQLPacket>&,
|
||||
std::shared_ptr<profile_config>&);
|
||||
std::shared_ptr<counter_config>&);
|
||||
};
|
||||
|
||||
uint64_t
|
||||
create_counter_profile(std::shared_ptr<rocprofiler::counters::profile_config>&& config);
|
||||
create_counter_profile(std::shared_ptr<rocprofiler::counters::counter_config>&& config);
|
||||
|
||||
void
|
||||
destroy_counter_profile(uint64_t id);
|
||||
|
||||
rocprofiler_status_t
|
||||
configure_buffered_dispatch(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer,
|
||||
rocprofiler_dispatch_counting_service_callback_t callback,
|
||||
void* callback_args);
|
||||
configure_buffered_dispatch(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer,
|
||||
rocprofiler_dispatch_counting_service_cb_t callback,
|
||||
void* callback_args);
|
||||
|
||||
rocprofiler_status_t
|
||||
configure_callback_dispatch(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_dispatch_counting_service_callback_t callback,
|
||||
void* callback_data_args,
|
||||
rocprofiler_profile_counting_record_callback_t record_callback,
|
||||
void* record_callback_args);
|
||||
configure_callback_dispatch(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_dispatch_counting_service_cb_t callback,
|
||||
void* callback_data_args,
|
||||
rocprofiler_dispatch_counting_record_cb_t record_callback,
|
||||
void* record_callback_args);
|
||||
|
||||
rocprofiler_status_t
|
||||
configure_agent_collection(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer_id,
|
||||
rocprofiler_agent_id_t agent_id,
|
||||
rocprofiler_device_counting_service_callback_t cb,
|
||||
void* user_data);
|
||||
configure_agent_collection(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer_id,
|
||||
rocprofiler_agent_id_t agent_id,
|
||||
rocprofiler_device_counting_service_cb_t cb,
|
||||
void* user_data);
|
||||
|
||||
void
|
||||
start_context(const context::context*);
|
||||
|
||||
@@ -103,9 +103,9 @@ header_pkt(hsa_packet_type_t type)
|
||||
}
|
||||
|
||||
std::unique_ptr<hsa::CounterAQLPacket>
|
||||
construct_aql_pkt(std::shared_ptr<profile_config>& profile)
|
||||
construct_aql_pkt(std::shared_ptr<counter_config>& profile)
|
||||
{
|
||||
if(counter_callback_info::setup_profile_config(profile) != ROCPROFILER_STATUS_SUCCESS)
|
||||
if(counter_callback_info::setup_counter_config(profile) != ROCPROFILER_STATUS_SUCCESS)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -422,11 +422,11 @@ start_agent_ctx(const context::context* ctx)
|
||||
{.handle = ctx->context_idx},
|
||||
callback_data.agent_id,
|
||||
[](rocprofiler_context_id_t context_id,
|
||||
rocprofiler_profile_config_id_t config_id) -> rocprofiler_status_t {
|
||||
rocprofiler_counter_config_id_t config_id) -> rocprofiler_status_t {
|
||||
auto* cb_ctx = rocprofiler::context::get_mutable_registered_context(context_id);
|
||||
if(!cb_ctx) return ROCPROFILER_STATUS_ERROR_CONTEXT_INVALID;
|
||||
|
||||
auto config = rocprofiler::counters::get_profile_config(config_id);
|
||||
auto config = rocprofiler::counters::get_counter_config(config_id);
|
||||
if(!config) return ROCPROFILER_STATUS_ERROR_PROFILE_NOT_FOUND;
|
||||
|
||||
if(!cb_ctx->device_counter_collection)
|
||||
|
||||
@@ -38,7 +38,7 @@ struct context;
|
||||
|
||||
namespace counters
|
||||
{
|
||||
struct profile_config;
|
||||
struct counter_config;
|
||||
|
||||
struct agent_callback_data
|
||||
{
|
||||
@@ -56,9 +56,9 @@ struct agent_callback_data
|
||||
rocprofiler_user_data_t user_data = {.value = 0};
|
||||
rocprofiler_user_data_t callback_data = {.value = 0};
|
||||
|
||||
std::shared_ptr<rocprofiler::counters::profile_config> profile = {};
|
||||
std::shared_ptr<rocprofiler::counters::counter_config> profile = {};
|
||||
rocprofiler_agent_id_t agent_id = {.handle = 0};
|
||||
rocprofiler_device_counting_service_callback_t cb = nullptr;
|
||||
rocprofiler_device_counting_service_cb_t cb = nullptr;
|
||||
rocprofiler_buffer_id_t buffer = {.handle = 0};
|
||||
bool set_profile = false;
|
||||
std::vector<rocprofiler_record_counter_t>* cached_counters = nullptr;
|
||||
|
||||
@@ -91,7 +91,7 @@ queue_cb(const context::context* ctx,
|
||||
}
|
||||
}
|
||||
|
||||
auto req_profile = rocprofiler_profile_config_id_t{.handle = 0};
|
||||
auto req_profile = rocprofiler_counter_config_id_t{.handle = 0};
|
||||
auto dispatch_data =
|
||||
common::init_public_api_struct(rocprofiler_dispatch_counting_service_data_t{});
|
||||
|
||||
@@ -147,7 +147,7 @@ completed_cb(const context::context* ctx,
|
||||
{
|
||||
CHECK(info && ctx);
|
||||
|
||||
std::shared_ptr<profile_config> prof_config;
|
||||
std::shared_ptr<counter_config> prof_config;
|
||||
// Get the Profile Config
|
||||
std::unique_ptr<rocprofiler::hsa::AQLPacket> pkt = nullptr;
|
||||
info->packet_return_map.wlock([&](auto& data) {
|
||||
|
||||
@@ -35,7 +35,7 @@ struct completed_cb_params_t
|
||||
std::shared_ptr<counter_callback_info> info;
|
||||
std::shared_ptr<hsa::Queue::queue_info_session_t> session;
|
||||
kernel_dispatch::profiling_time dispatch_time;
|
||||
std::shared_ptr<profile_config> prof_config;
|
||||
std::shared_ptr<counter_config> prof_config;
|
||||
std::unique_ptr<rocprofiler::hsa::AQLPacket> pkt;
|
||||
};
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ buffered_callback(rocprofiler_context_id_t,
|
||||
|
||||
void
|
||||
null_dispatch_callback(rocprofiler_dispatch_counting_service_data_t,
|
||||
rocprofiler_profile_config_id_t*,
|
||||
rocprofiler_counter_config_id_t*,
|
||||
rocprofiler_user_data_t*,
|
||||
void*)
|
||||
{}
|
||||
@@ -209,15 +209,15 @@ TEST(core, check_packet_generation)
|
||||
/**
|
||||
* Check profile construction
|
||||
*/
|
||||
rocprofiler_profile_config_id_t cfg_id = {.handle = 0};
|
||||
rocprofiler_counter_config_id_t cfg_id = {.handle = 0};
|
||||
rocprofiler_counter_id_t id = {.handle = metric.id()};
|
||||
ROCP_ERROR << fmt::format("Generating packet for {}", metric);
|
||||
ROCPROFILER_CALL(
|
||||
rocprofiler_create_profile_config(agent.get_rocp_agent()->id, &id, 1, &cfg_id),
|
||||
rocprofiler_create_counter_config(agent.get_rocp_agent()->id, &id, 1, &cfg_id),
|
||||
"Unable to create profile");
|
||||
auto profile = counters::get_profile_config(cfg_id);
|
||||
auto profile = counters::get_counter_config(cfg_id);
|
||||
ASSERT_TRUE(profile);
|
||||
EXPECT_EQ(counters::counter_callback_info::setup_profile_config(profile),
|
||||
EXPECT_EQ(counters::counter_callback_info::setup_counter_config(profile),
|
||||
ROCPROFILER_STATUS_SUCCESS)
|
||||
<< fmt::format("Could not build profile for {}", metric.name());
|
||||
|
||||
@@ -304,7 +304,7 @@ namespace
|
||||
struct expected_dispatch
|
||||
{
|
||||
// To pass back
|
||||
rocprofiler_profile_config_id_t id = {.handle = 0};
|
||||
rocprofiler_counter_config_id_t id = {.handle = 0};
|
||||
rocprofiler_queue_id_t queue_id = {.handle = 0};
|
||||
rocprofiler_agent_id_t agent_id = {.handle = 0};
|
||||
uint64_t kernel_id = 0;
|
||||
@@ -312,12 +312,12 @@ struct expected_dispatch
|
||||
rocprofiler_async_correlation_id_t correlation_id = {.internal = 0, .external = {.value = 0}};
|
||||
rocprofiler_dim3_t workgroup_size = {0, 0, 0};
|
||||
rocprofiler_dim3_t grid_size = {0, 0, 0};
|
||||
rocprofiler_profile_config_id_t* config = nullptr;
|
||||
rocprofiler_counter_config_id_t* config = nullptr;
|
||||
};
|
||||
|
||||
void
|
||||
user_dispatch_cb(rocprofiler_dispatch_counting_service_data_t dispatch_data,
|
||||
rocprofiler_profile_config_id_t* config,
|
||||
rocprofiler_counter_config_id_t* config,
|
||||
rocprofiler_user_data_t* user_data,
|
||||
void* callback_data_args)
|
||||
{
|
||||
@@ -402,9 +402,9 @@ TEST(core, check_callbacks)
|
||||
expected_dispatch expected = {};
|
||||
rocprofiler_counter_id_t id = {.handle = metric.id()};
|
||||
ROCPROFILER_CALL(
|
||||
rocprofiler_create_profile_config(agent.get_rocp_agent()->id, &id, 1, &expected.id),
|
||||
rocprofiler_create_counter_config(agent.get_rocp_agent()->id, &id, 1, &expected.id),
|
||||
"Unable to create profile");
|
||||
auto profile = counters::get_profile_config(expected.id);
|
||||
auto profile = counters::get_counter_config(expected.id);
|
||||
ASSERT_TRUE(profile);
|
||||
|
||||
std::shared_ptr<counters::counter_callback_info> cb_info =
|
||||
@@ -502,14 +502,14 @@ TEST(core, destroy_counter_profile)
|
||||
expected_dispatch expected = {};
|
||||
rocprofiler_counter_id_t id = {.handle = metric.id()};
|
||||
ROCPROFILER_CALL(
|
||||
rocprofiler_create_profile_config(agent.get_rocp_agent()->id, &id, 1, &expected.id),
|
||||
rocprofiler_create_counter_config(agent.get_rocp_agent()->id, &id, 1, &expected.id),
|
||||
"Unable to create profile");
|
||||
ROCPROFILER_CALL(rocprofiler_destroy_profile_config(expected.id),
|
||||
ROCPROFILER_CALL(rocprofiler_destroy_counter_config(expected.id),
|
||||
"Could not delete profile id");
|
||||
/**
|
||||
* Check the profile was actually destroyed
|
||||
*/
|
||||
auto profile = counters::get_profile_config(expected.id);
|
||||
auto profile = counters::get_counter_config(expected.id);
|
||||
EXPECT_FALSE(profile);
|
||||
}
|
||||
}
|
||||
@@ -538,7 +538,7 @@ TEST(core, start_stop_buffered_ctx)
|
||||
&opt_buff_id),
|
||||
"Could not create buffer");
|
||||
|
||||
ROCPROFILER_CALL(rocprofiler_configure_buffered_dispatch_counting_service(
|
||||
ROCPROFILER_CALL(rocprofiler_configure_buffer_dispatch_counting_service(
|
||||
get_client_ctx(), opt_buff_id, null_dispatch_callback, (void*) 0x12345),
|
||||
"Could not setup buffered service");
|
||||
ROCPROFILER_CALL(rocprofiler_start_context(get_client_ctx()), "start context");
|
||||
@@ -671,16 +671,16 @@ TEST(core, test_profile_incremental)
|
||||
}
|
||||
}
|
||||
|
||||
rocprofiler_profile_config_id_t cfg_id = {};
|
||||
rocprofiler_counter_config_id_t cfg_id = {};
|
||||
|
||||
// Add one counter from each block to incrementally to make sure we can
|
||||
// add them incrementally
|
||||
for(const auto& [block_name, block_metrics] : metric_blocks)
|
||||
{
|
||||
rocprofiler_profile_config_id_t old_id = cfg_id;
|
||||
rocprofiler_counter_config_id_t old_id = cfg_id;
|
||||
rocprofiler_counter_id_t id = {.handle = block_metrics.front().id()};
|
||||
ROCPROFILER_CALL(
|
||||
rocprofiler_create_profile_config(agent.get_rocp_agent()->id, &id, 1, &cfg_id),
|
||||
rocprofiler_create_counter_config(agent.get_rocp_agent()->id, &id, 1, &cfg_id),
|
||||
"Unable to create profile incrementally when we should be able to");
|
||||
EXPECT_NE(old_id.handle, cfg_id.handle)
|
||||
<< "We expect that the handle changes this is due to the existing profile being "
|
||||
@@ -697,7 +697,7 @@ TEST(core, test_profile_incremental)
|
||||
*/
|
||||
rocprofiler_counter_id_t id = {.handle = metric.id()};
|
||||
if(status =
|
||||
rocprofiler_create_profile_config(agent.get_rocp_agent()->id, &id, 1, &cfg_id);
|
||||
rocprofiler_create_counter_config(agent.get_rocp_agent()->id, &id, 1, &cfg_id);
|
||||
status != ROCPROFILER_STATUS_SUCCESS)
|
||||
{
|
||||
break;
|
||||
|
||||
@@ -349,10 +349,10 @@ protected:
|
||||
/**
|
||||
* Check profile construction
|
||||
*/
|
||||
rocprofiler_profile_config_id_t cfg_id = {.handle = 0};
|
||||
rocprofiler_counter_config_id_t cfg_id = {.handle = 0};
|
||||
rocprofiler_counter_id_t id = {.handle = metric.id()};
|
||||
ROCPROFILER_CALL(
|
||||
rocprofiler_create_profile_config(agent.get_rocp_agent()->id, &id, 1, &cfg_id),
|
||||
rocprofiler_create_counter_config(agent.get_rocp_agent()->id, &id, 1, &cfg_id),
|
||||
"Unable to create profile");
|
||||
|
||||
ROCPROFILER_CALL(
|
||||
@@ -362,12 +362,12 @@ protected:
|
||||
agent.get_rocp_agent()->id,
|
||||
[](rocprofiler_context_id_t context_id,
|
||||
rocprofiler_agent_id_t,
|
||||
rocprofiler_agent_set_profile_callback_t set_config,
|
||||
void* user_data) {
|
||||
rocprofiler_device_counting_agent_cb_t set_config,
|
||||
void* user_data) {
|
||||
CHECK(user_data);
|
||||
if(auto status = set_config(
|
||||
context_id,
|
||||
*static_cast<rocprofiler_profile_config_id_t*>(user_data));
|
||||
*static_cast<rocprofiler_counter_config_id_t*>(user_data));
|
||||
status != ROCPROFILER_STATUS_SUCCESS)
|
||||
{
|
||||
ROCP_FATAL << rocprofiler_get_status_string(status);
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
// Allow testing of deprecated calls
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#include "lib/common/utility.hpp"
|
||||
#include "lib/rocprofiler-sdk/agent.hpp"
|
||||
#include "lib/rocprofiler-sdk/aql/packet_construct.hpp"
|
||||
@@ -320,3 +324,4 @@ TEST(dimension, block_dim_test)
|
||||
|
||||
hsa_shut_down();
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -25,12 +25,17 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include <rocprofiler-sdk/rocprofiler.h>
|
||||
|
||||
#include "lib/common/logging.hpp"
|
||||
#include "lib/common/utility.hpp"
|
||||
#include "lib/rocprofiler-sdk/agent.hpp"
|
||||
#include "lib/rocprofiler-sdk/counters/dimensions.hpp"
|
||||
#include "lib/rocprofiler-sdk/counters/metrics.hpp"
|
||||
#include "rocprofiler-sdk/fwd.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -216,16 +221,57 @@ TEST(metrics, check_public_api_query)
|
||||
const auto& id_map = metrics_map->id_to_metric;
|
||||
for(const auto& [id, metric] : id_map)
|
||||
{
|
||||
rocprofiler_counter_info_v0_t version;
|
||||
rocprofiler_counter_info_v1_t info;
|
||||
|
||||
ASSERT_EQ(
|
||||
rocprofiler_query_counter_info(
|
||||
{.handle = id}, ROCPROFILER_COUNTER_INFO_VERSION_0, static_cast<void*>(&version)),
|
||||
ROCPROFILER_STATUS_SUCCESS);
|
||||
EXPECT_EQ(std::string(version.name), metric.name());
|
||||
EXPECT_EQ(std::string(version.block), metric.block());
|
||||
EXPECT_EQ(std::string(version.expression), metric.expression());
|
||||
EXPECT_EQ(version.is_derived, !metric.expression().empty());
|
||||
EXPECT_EQ(std::string(version.description), metric.description());
|
||||
auto dim_ptr = rocprofiler::counters::get_dimension_cache();
|
||||
|
||||
const auto* dims = rocprofiler::common::get_val(dim_ptr->id_to_dim, metric.id());
|
||||
ASSERT_TRUE(dims);
|
||||
|
||||
auto status = rocprofiler_query_counter_info(
|
||||
{.handle = id}, ROCPROFILER_COUNTER_INFO_VERSION_1, static_cast<void*>(&info));
|
||||
ASSERT_EQ(status, ROCPROFILER_STATUS_SUCCESS);
|
||||
EXPECT_EQ(std::string(info.name ? info.name : ""), metric.name());
|
||||
EXPECT_EQ(std::string(info.block ? info.block : ""), metric.block());
|
||||
EXPECT_EQ(std::string(info.expression ? info.expression : ""), metric.expression());
|
||||
EXPECT_EQ(info.is_derived, !metric.expression().empty());
|
||||
EXPECT_EQ(std::string(info.description ? info.description : ""), metric.description());
|
||||
|
||||
EXPECT_EQ(info.dimensions_count, dims->size());
|
||||
for(size_t i = 0; i < info.dimensions_count; i++)
|
||||
{
|
||||
const auto& dim = dims->at(i);
|
||||
EXPECT_EQ(dim.size(), info.dimensions[i].instance_size);
|
||||
EXPECT_EQ(dim.type(), info.dimensions[i].id);
|
||||
EXPECT_EQ(std::string(info.dimensions[i].name), dim.name());
|
||||
}
|
||||
|
||||
size_t instance_count = 0;
|
||||
// Checks the equality with the old rocprofiler_query_counter_instance_count
|
||||
for(const auto& metric_dim : *dims)
|
||||
{
|
||||
if(instance_count == 0)
|
||||
instance_count = metric_dim.size();
|
||||
else if(metric_dim.size() > 0)
|
||||
instance_count = metric_dim.size() * instance_count;
|
||||
}
|
||||
|
||||
EXPECT_EQ(info.instance_ids_count, instance_count);
|
||||
std::set<std::vector<size_t>> dim_permutations;
|
||||
|
||||
for(size_t i = 0; i < info.instance_ids_count; i++)
|
||||
{
|
||||
std::vector<size_t> dim_ids;
|
||||
ASSERT_EQ(rocprofiler::counters::rec_to_counter_id(info.instance_ids[i]).handle,
|
||||
metric.id());
|
||||
for(const auto& metric_dim : *dims)
|
||||
{
|
||||
dim_ids.push_back(
|
||||
rocprofiler::counters::rec_to_dim_pos(info.instance_ids[i], metric_dim.type()));
|
||||
}
|
||||
// Ensure that the premutation is unique
|
||||
ASSERT_EQ(dim_permutations.insert(dim_ids).second, true);
|
||||
}
|
||||
ASSERT_EQ(instance_count, dim_permutations.size());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,11 +37,11 @@ constexpr auto rocprofiler_context_none = ROCPROFILER_CONTEXT_NONE;
|
||||
|
||||
extern "C" {
|
||||
rocprofiler_status_t
|
||||
rocprofiler_configure_device_counting_service(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer_id,
|
||||
rocprofiler_agent_id_t agent_id,
|
||||
rocprofiler_device_counting_service_callback_t cb,
|
||||
void* user_data)
|
||||
rocprofiler_configure_device_counting_service(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer_id,
|
||||
rocprofiler_agent_id_t agent_id,
|
||||
rocprofiler_device_counting_service_cb_t cb,
|
||||
void* user_data)
|
||||
{
|
||||
return rocprofiler::counters::configure_agent_collection(
|
||||
context_id, buffer_id, agent_id, cb, user_data);
|
||||
|
||||
+10
-10
@@ -39,11 +39,11 @@ extern "C" {
|
||||
* @return ::rocprofiler_status_t
|
||||
*/
|
||||
rocprofiler_status_t
|
||||
rocprofiler_configure_buffered_dispatch_counting_service(
|
||||
rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer_id,
|
||||
rocprofiler_dispatch_counting_service_callback_t callback,
|
||||
void* callback_data_args)
|
||||
rocprofiler_configure_buffer_dispatch_counting_service(
|
||||
rocprofiler_context_id_t context_id,
|
||||
rocprofiler_buffer_id_t buffer_id,
|
||||
rocprofiler_dispatch_counting_service_cb_t callback,
|
||||
void* callback_data_args)
|
||||
{
|
||||
return rocprofiler::counters::configure_buffered_dispatch(
|
||||
context_id, buffer_id, callback, callback_data_args);
|
||||
@@ -63,11 +63,11 @@ rocprofiler_configure_buffered_dispatch_counting_service(
|
||||
*/
|
||||
rocprofiler_status_t
|
||||
rocprofiler_configure_callback_dispatch_counting_service(
|
||||
rocprofiler_context_id_t context_id,
|
||||
rocprofiler_dispatch_counting_service_callback_t dispatch_callback,
|
||||
void* dispatch_callback_args,
|
||||
rocprofiler_profile_counting_record_callback_t record_callback,
|
||||
void* record_callback_args)
|
||||
rocprofiler_context_id_t context_id,
|
||||
rocprofiler_dispatch_counting_service_cb_t dispatch_callback,
|
||||
void* dispatch_callback_args,
|
||||
rocprofiler_dispatch_counting_record_cb_t record_callback,
|
||||
void* record_callback_args)
|
||||
{
|
||||
return rocprofiler::counters::configure_callback_dispatch(context_id,
|
||||
dispatch_callback,
|
||||
@@ -20,8 +20,8 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include <rocprofiler-sdk/ext_version.h>
|
||||
#include <rocprofiler-sdk/hip.h>
|
||||
#include <rocprofiler-sdk/version.h>
|
||||
|
||||
#include "lib/common/abi.hpp"
|
||||
#include "lib/common/defines.hpp"
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "lib/rocprofiler-sdk/hip/details/ostream.hpp"
|
||||
|
||||
#include <rocprofiler-sdk/rocprofiler.h>
|
||||
#include <rocprofiler-sdk/version.h>
|
||||
|
||||
#include <hip/hip_runtime_api.h>
|
||||
// must be included after runtime api
|
||||
|
||||
@@ -169,7 +169,7 @@ FuncT create_write_functor(RetT (*func)(Args...))
|
||||
return [](Args... args) -> RetT {
|
||||
using function_args_type = common::mpl::type_list<Args...>;
|
||||
|
||||
using callback_api_data_t = rocprofiler_callback_tracing_stream_handle_data_t;
|
||||
using callback_api_data_t = rocprofiler_callback_tracing_hip_stream_data_t;
|
||||
|
||||
constexpr auto external_corr_id_domain_idx =
|
||||
hip_domain_info<TableIdx>::external_correlation_id_domain_idx;
|
||||
@@ -179,8 +179,8 @@ FuncT create_write_functor(RetT (*func)(Args...))
|
||||
auto buffered_contexts = tracing::buffered_context_data_vec_t{};
|
||||
auto external_corr_ids = tracing::external_correlation_id_map_t{};
|
||||
|
||||
tracing::populate_contexts(ROCPROFILER_CALLBACK_TRACING_HIP_STREAM_API,
|
||||
ROCPROFILER_BUFFER_TRACING_HIP_STREAM_API,
|
||||
tracing::populate_contexts(ROCPROFILER_CALLBACK_TRACING_HIP_STREAM,
|
||||
ROCPROFILER_BUFFER_TRACING_HIP_STREAM,
|
||||
callback_contexts,
|
||||
buffered_contexts,
|
||||
external_corr_ids);
|
||||
@@ -208,7 +208,7 @@ FuncT create_write_functor(RetT (*func)(Args...))
|
||||
internal_corr_id,
|
||||
external_corr_ids,
|
||||
ancestor_corr_id,
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_STREAM_API,
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_STREAM,
|
||||
ROCPROFILER_HIP_STREAM_CREATE,
|
||||
tracer_data);
|
||||
}
|
||||
@@ -232,7 +232,7 @@ FuncT create_destroy_functor(RetT (*func)(Args...))
|
||||
using function_args_type = common::mpl::type_list<Args...>;
|
||||
constexpr auto stream_idx = common::mpl::index_of<hipStream_t, function_args_type>::value;
|
||||
|
||||
using callback_api_data_t = rocprofiler_callback_tracing_stream_handle_data_t;
|
||||
using callback_api_data_t = rocprofiler_callback_tracing_hip_stream_data_t;
|
||||
|
||||
constexpr auto external_corr_id_domain_idx =
|
||||
hip_domain_info<TableIdx>::external_correlation_id_domain_idx;
|
||||
@@ -242,8 +242,8 @@ FuncT create_destroy_functor(RetT (*func)(Args...))
|
||||
auto buffered_contexts = tracing::buffered_context_data_vec_t{};
|
||||
auto external_corr_ids = tracing::external_correlation_id_map_t{};
|
||||
|
||||
tracing::populate_contexts(ROCPROFILER_CALLBACK_TRACING_HIP_STREAM_API,
|
||||
ROCPROFILER_BUFFER_TRACING_HIP_STREAM_API,
|
||||
tracing::populate_contexts(ROCPROFILER_CALLBACK_TRACING_HIP_STREAM,
|
||||
ROCPROFILER_BUFFER_TRACING_HIP_STREAM,
|
||||
callback_contexts,
|
||||
buffered_contexts,
|
||||
external_corr_ids);
|
||||
@@ -268,7 +268,7 @@ FuncT create_destroy_functor(RetT (*func)(Args...))
|
||||
internal_corr_id,
|
||||
external_corr_ids,
|
||||
ancestor_corr_id,
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_STREAM_API,
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_STREAM,
|
||||
ROCPROFILER_HIP_STREAM_DESTROY,
|
||||
tracer_data);
|
||||
}
|
||||
@@ -292,7 +292,7 @@ FuncT create_read_functor(RetT (*func)(Args...))
|
||||
using function_args_type = common::mpl::type_list<Args...>;
|
||||
constexpr auto stream_idx = common::mpl::index_of<hipStream_t, function_args_type>::value;
|
||||
|
||||
using callback_api_data_t = rocprofiler_callback_tracing_stream_handle_data_t;
|
||||
using callback_api_data_t = rocprofiler_callback_tracing_hip_stream_data_t;
|
||||
|
||||
constexpr auto external_corr_id_domain_idx =
|
||||
hip_domain_info<TableIdx>::external_correlation_id_domain_idx;
|
||||
@@ -302,8 +302,8 @@ FuncT create_read_functor(RetT (*func)(Args...))
|
||||
auto buffered_contexts = tracing::buffered_context_data_vec_t{};
|
||||
auto external_corr_ids = tracing::external_correlation_id_map_t{};
|
||||
|
||||
tracing::populate_contexts(ROCPROFILER_CALLBACK_TRACING_HIP_STREAM_API,
|
||||
ROCPROFILER_BUFFER_TRACING_HIP_STREAM_API,
|
||||
tracing::populate_contexts(ROCPROFILER_CALLBACK_TRACING_HIP_STREAM,
|
||||
ROCPROFILER_BUFFER_TRACING_HIP_STREAM,
|
||||
callback_contexts,
|
||||
buffered_contexts,
|
||||
external_corr_ids);
|
||||
@@ -324,7 +324,7 @@ FuncT create_read_functor(RetT (*func)(Args...))
|
||||
internal_corr_id,
|
||||
external_corr_ids,
|
||||
ancestor_corr_id,
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_STREAM_API,
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_STREAM,
|
||||
ROCPROFILER_HIP_STREAM_SET,
|
||||
tracer_data);
|
||||
}
|
||||
@@ -338,7 +338,7 @@ FuncT create_read_functor(RetT (*func)(Args...))
|
||||
{
|
||||
tracing::execute_phase_exit_callbacks(callback_contexts,
|
||||
external_corr_ids,
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_STREAM_API,
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_STREAM,
|
||||
ROCPROFILER_HIP_STREAM_SET,
|
||||
tracer_data);
|
||||
}
|
||||
@@ -368,11 +368,11 @@ enable_stream_stack()
|
||||
if(itr->is_tracing_one_of(ROCPROFILER_CALLBACK_TRACING_MEMORY_COPY,
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_RUNTIME_API,
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API,
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_STREAM_API,
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_STREAM,
|
||||
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY,
|
||||
ROCPROFILER_BUFFER_TRACING_HIP_RUNTIME_API,
|
||||
ROCPROFILER_BUFFER_TRACING_HIP_COMPILER_API,
|
||||
ROCPROFILER_BUFFER_TRACING_HIP_STREAM_API,
|
||||
ROCPROFILER_BUFFER_TRACING_HIP_STREAM,
|
||||
ROCPROFILER_BUFFER_TRACING_HIP_RUNTIME_API_EXT,
|
||||
ROCPROFILER_BUFFER_TRACING_HIP_COMPILER_API_EXT))
|
||||
return true;
|
||||
@@ -430,8 +430,8 @@ update_table(Tp* _orig, std::integral_constant<size_t, OpIdx>)
|
||||
|
||||
// index_of finds the first argument of that type. So find the first and last
|
||||
// arg of the given type and make sure it resolves to the same distance
|
||||
assert(stream_idx == (num_args - rstream_idx - 1) &&
|
||||
"function has more than one stream argument");
|
||||
static_assert(stream_idx == (num_args - rstream_idx - 1),
|
||||
"function has more than one stream argument");
|
||||
|
||||
// don't wrap the compiler API functions unless HIP compiler API tracing is enabled
|
||||
if constexpr(TableIdx == ROCPROFILER_HIP_TABLE_ID_Compiler)
|
||||
@@ -471,8 +471,8 @@ update_table(Tp* _orig, std::integral_constant<size_t, OpIdx>)
|
||||
|
||||
// index_of finds the first argument of that type. So find the first and last
|
||||
// arg of the given type and make sure it resolves to the same distance
|
||||
assert(stream_idx == (num_args - rstream_idx - 1) &&
|
||||
"function has more than one stream argument");
|
||||
static_assert(stream_idx == (num_args - rstream_idx - 1),
|
||||
"function has more than one stream argument");
|
||||
|
||||
// don't wrap the compiler API functions unless HIP compiler API tracing is enabled
|
||||
if constexpr(TableIdx == ROCPROFILER_HIP_TABLE_ID_Compiler)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <rocprofiler-sdk/version.h>
|
||||
#include <rocprofiler-sdk/ext_version.h>
|
||||
|
||||
#include "lib/common/mpl.hpp"
|
||||
#include "lib/common/stringize_arg.hpp"
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include <rocprofiler-sdk/ext_version.h>
|
||||
#include <rocprofiler-sdk/hsa.h>
|
||||
#include <rocprofiler-sdk/version.h>
|
||||
|
||||
#include "lib/common/abi.hpp"
|
||||
#include "lib/common/defines.hpp"
|
||||
|
||||
@@ -152,16 +152,16 @@ public:
|
||||
void set_state(queue_state state);
|
||||
|
||||
private:
|
||||
std::atomic<int> _notifiers = {0};
|
||||
std::atomic<int64_t> _active_async_packets = {0};
|
||||
CoreApiTable _core_api = {};
|
||||
AmdExtTable _ext_api = {};
|
||||
const AgentCache& _agent;
|
||||
rocprofiler::common::Synchronized<callback_map_t> _callbacks = {};
|
||||
hsa_queue_t* _intercept_queue = nullptr;
|
||||
queue_state _state = queue_state::normal;
|
||||
std::mutex _lock_queue;
|
||||
hsa_signal_t _active_kernels = {.handle = 0};
|
||||
std::atomic<int> _notifiers = {0};
|
||||
std::atomic<int64_t> _active_async_packets = {0};
|
||||
CoreApiTable _core_api = {};
|
||||
AmdExtTable _ext_api = {};
|
||||
const AgentCache& _agent;
|
||||
common::Synchronized<callback_map_t> _callbacks = {};
|
||||
hsa_queue_t* _intercept_queue = nullptr;
|
||||
queue_state _state = queue_state::normal;
|
||||
std::mutex _lock_queue;
|
||||
hsa_signal_t _active_kernels = {.handle = 0};
|
||||
};
|
||||
|
||||
inline rocprofiler_queue_id_t
|
||||
|
||||
@@ -444,6 +444,9 @@ impl(Args... args)
|
||||
constexpr auto external_corr_id_domain_idx =
|
||||
amd_tool_api_info<OpIdx>::external_correlation_id_domain_idx;
|
||||
|
||||
// suppress unused-but-set-variable warning
|
||||
common::consume_args(external_corr_id_domain_idx);
|
||||
|
||||
auto&& _tied_args = std::tie(args...);
|
||||
auto& event_data = std::get<0>(_tied_args);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <rocprofiler-sdk/version.h>
|
||||
#include <rocprofiler-sdk/ext_version.h>
|
||||
|
||||
#include "lib/common/stringize_arg.hpp"
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <hsa/hsa.h>
|
||||
#include <rocprofiler-sdk/version.h>
|
||||
#include <rocprofiler-sdk/ext_version.h>
|
||||
|
||||
#include "lib/common/mpl.hpp"
|
||||
#include "lib/common/stringize_arg.hpp"
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "lib/rocprofiler-sdk/ompt/details/format.hpp"
|
||||
|
||||
#include <rocprofiler-sdk/ompt/omp-tools.h>
|
||||
#include <rocprofiler-sdk/version.h>
|
||||
|
||||
#include <fmt/core.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
@@ -207,7 +207,7 @@ record_callback(rocprofiler_dispatch_counting_service_data_t /*dispatch_data*/,
|
||||
|
||||
void
|
||||
dispatch_callback(rocprofiler_dispatch_counting_service_data_t /*dispatch_data*/,
|
||||
rocprofiler_profile_config_id_t* /*config*/,
|
||||
rocprofiler_counter_config_id_t* /*config*/,
|
||||
rocprofiler_user_data_t* /*user_data*/,
|
||||
void* /*callback_data_args*/)
|
||||
{}
|
||||
@@ -215,7 +215,7 @@ dispatch_callback(rocprofiler_dispatch_counting_service_data_t /*dispatch_data*/
|
||||
void
|
||||
set_profile(rocprofiler_context_id_t /*context_id*/,
|
||||
rocprofiler_agent_id_t /*agent*/,
|
||||
rocprofiler_agent_set_profile_callback_t /*set_config*/,
|
||||
rocprofiler_device_counting_agent_cb_t /*set_config*/,
|
||||
void*)
|
||||
{}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "lib/common/abi.hpp"
|
||||
#include "lib/common/defines.hpp"
|
||||
|
||||
#include <rocprofiler-sdk/ext_version.h>
|
||||
#include <rocprofiler-sdk/rccl.h>
|
||||
#include <rocprofiler-sdk/version.h>
|
||||
|
||||
namespace rocprofiler
|
||||
{
|
||||
|
||||
@@ -245,17 +245,19 @@ find_clients()
|
||||
return true;
|
||||
};
|
||||
|
||||
auto emplace_client = [&data, priority_offset](
|
||||
constexpr auto client_id_size = sizeof(rocprofiler_client_id_t);
|
||||
auto emplace_client = [&data, priority_offset](
|
||||
std::string_view _name,
|
||||
void* _dlhandle,
|
||||
auto* _cfg_func) -> std::optional<client_library>& {
|
||||
uint32_t _prio = priority_offset + data.size();
|
||||
return data.emplace_back(client_library{std::string{_name},
|
||||
_dlhandle,
|
||||
_cfg_func,
|
||||
nullptr,
|
||||
rocprofiler_client_id_t{nullptr, _prio},
|
||||
rocprofiler_client_id_t{nullptr, _prio}});
|
||||
return data.emplace_back(
|
||||
client_library{std::string{_name},
|
||||
_dlhandle,
|
||||
_cfg_func,
|
||||
nullptr,
|
||||
rocprofiler_client_id_t{client_id_size, nullptr, _prio},
|
||||
rocprofiler_client_id_t{client_id_size, nullptr, _prio}});
|
||||
};
|
||||
|
||||
auto rocprofiler_configure_dlsym = [](auto _handle) {
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "lib/common/abi.hpp"
|
||||
#include "lib/common/defines.hpp"
|
||||
|
||||
#include <rocprofiler-sdk/ext_version.h>
|
||||
#include <rocprofiler-sdk/rocdecode.h>
|
||||
#include <rocprofiler-sdk/version.h>
|
||||
|
||||
namespace rocprofiler
|
||||
{
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "lib/common/abi.hpp"
|
||||
#include "lib/common/defines.hpp"
|
||||
|
||||
#include <rocprofiler-sdk/ext_version.h>
|
||||
#include <rocprofiler-sdk/rocjpeg.h>
|
||||
#include <rocprofiler-sdk/version.h>
|
||||
|
||||
namespace rocprofiler
|
||||
{
|
||||
|
||||
@@ -153,6 +153,15 @@ rocprofiler_get_version(uint32_t* major, uint32_t* minor, uint32_t* patch)
|
||||
return ROCPROFILER_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
rocprofiler_status_t
|
||||
rocprofiler_get_version_triplet(rocprofiler_version_triplet_t* info)
|
||||
{
|
||||
*info = {.major = ROCPROFILER_VERSION_MAJOR,
|
||||
.minor = ROCPROFILER_VERSION_MINOR,
|
||||
.patch = ROCPROFILER_VERSION_PATCH};
|
||||
return ROCPROFILER_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
rocprofiler_status_t
|
||||
rocprofiler_get_timestamp(rocprofiler_timestamp_t* ts)
|
||||
{
|
||||
|
||||
@@ -142,10 +142,10 @@ inject_barriers(hsa_barrier& barrier, QueueController::queue_map_t& queues)
|
||||
|
||||
for(auto& [hsa_queue, fq] : queues)
|
||||
{
|
||||
auto pkt = barrier.enqueue_packet(fq.get());
|
||||
ASSERT_EQ(pkt.has_value(), true);
|
||||
hsa_barrier_and_packet_t* packets = (hsa_barrier_and_packet_t*) hsa_queue->base_address;
|
||||
enqueue_pkt(hsa_queue, packets, pkt->barrier_and);
|
||||
auto _pkt = barrier.enqueue_packet(fq.get());
|
||||
ASSERT_EQ(_pkt.has_value(), true);
|
||||
hsa_barrier_and_packet_t* _packets = (hsa_barrier_and_packet_t*) hsa_queue->base_address;
|
||||
enqueue_pkt(hsa_queue, _packets, _pkt->barrier_and);
|
||||
|
||||
// Construct packet that will trigger async handler after barrier is released
|
||||
rocprofiler_packet post_barrier{};
|
||||
@@ -158,7 +158,7 @@ inject_barriers(hsa_barrier& barrier, QueueController::queue_map_t& queues)
|
||||
0,
|
||||
barrier_signal_handler,
|
||||
static_cast<void*>(completion_signal));
|
||||
enqueue_pkt(hsa_queue, packets, post_barrier.barrier_and);
|
||||
enqueue_pkt(hsa_queue, _packets, post_barrier.barrier_and);
|
||||
}
|
||||
|
||||
// Ensure that the barrier packet is reached on all queues
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <rocprofiler-sdk/ext_version.h>
|
||||
#include <rocprofiler-sdk/fwd.h>
|
||||
#include <rocprofiler-sdk/rocprofiler.h>
|
||||
#include <rocprofiler-sdk/version.h>
|
||||
@@ -28,6 +29,8 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <tuple>
|
||||
|
||||
TEST(rocprofiler_lib, version)
|
||||
{
|
||||
auto correct_version = std::tuple<uint32_t, uint32_t, uint32_t>(
|
||||
|
||||
Reference in New Issue
Block a user