Misc AFAR VII updates + clang-tidy-19 + bump version to 0.6.0 (#54)
* Misc AFAR VII updates + clang-tidy-19 + bump version to 0.6.0 - move tests/rocprofv3/trace-period to tests/rocprofv3/collection-period - bump clang-tidy to v19 - fix misc clang-tidy errors * Update the collection period test - don't attach files on fail bc when test is disabled, it causes problems --------- Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
此提交包含在:
@@ -52,7 +52,6 @@
|
||||
#include <cereal/types/set.hpp>
|
||||
#include <cereal/types/stack.hpp>
|
||||
#include <cereal/types/string.hpp>
|
||||
#include <cereal/types/tuple.hpp>
|
||||
#include <cereal/types/unordered_map.hpp>
|
||||
#include <cereal/types/unordered_set.hpp>
|
||||
#include <cereal/types/utility.hpp>
|
||||
|
||||
@@ -86,8 +86,8 @@ record_header_buffer::get_record_headers(size_t _n)
|
||||
{
|
||||
auto _lk = rhb_raii_lock{*this};
|
||||
|
||||
auto _sz = m_index.load(std::memory_order_acquire);
|
||||
if(_n > _sz) _n = _sz;
|
||||
auto _sz = m_index.load(std::memory_order_acquire);
|
||||
_n = std::min(_n, _sz);
|
||||
auto _ret = record_ptr_vec_t{};
|
||||
_ret.reserve(_n);
|
||||
for(size_t i = 0; i < _n; ++i)
|
||||
|
||||
@@ -75,7 +75,7 @@ get_new_capacity(size_t min_size, size_t /*t_size*/, size_t old_capacity)
|
||||
|
||||
// In theory 2*capacity can overflow if the capacity is 64 bit, but the
|
||||
// original capacity would never be large enough for this to be a problem.
|
||||
size_t new_capacity = 2 * old_capacity + 1; // Always grow.
|
||||
size_t new_capacity = (2 * old_capacity) + 1; // Always grow.
|
||||
return std::clamp(new_capacity, min_size, max_size);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -1311,10 +1311,8 @@ tool_init(rocprofiler_client_finalize_t fini_func, void* tool_data)
|
||||
auto agent_ptr_vec = get_gpu_agents();
|
||||
for(auto& itr : agent_ptr_vec)
|
||||
{
|
||||
auto method = static_cast<rocprofiler_pc_sampling_method_t>(
|
||||
tool::get_config().pc_sampling_method_value);
|
||||
auto unit = static_cast<rocprofiler_pc_sampling_unit_t>(
|
||||
tool::get_config().pc_sampling_unit_value);
|
||||
auto method = tool::get_config().pc_sampling_method_value;
|
||||
auto unit = tool::get_config().pc_sampling_unit_value;
|
||||
if(if_pc_sample_config_match(
|
||||
itr->id, method, unit, tool::get_config().pc_sampling_interval))
|
||||
{
|
||||
|
||||
@@ -631,30 +631,6 @@ get_agent_mapping()
|
||||
static auto*& _v = common::static_object<std::vector<agent_pair>>::construct();
|
||||
return *CHECK_NOTNULL(_v);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
std::vector<const rocprofiler_agent_t*>
|
||||
get_agents()
|
||||
{
|
||||
auto& agents = rocprofiler::agent::get_agent_topology();
|
||||
auto pointers = std::vector<const rocprofiler_agent_t*>{};
|
||||
pointers.reserve(agents.size());
|
||||
for(auto& agent : agents)
|
||||
{
|
||||
pointers.emplace_back(agent.get());
|
||||
}
|
||||
return pointers;
|
||||
}
|
||||
|
||||
const rocprofiler_agent_t*
|
||||
get_agent(rocprofiler_agent_id_t id)
|
||||
{
|
||||
for(const auto& itr : get_agents())
|
||||
{
|
||||
if(itr && itr->id.handle == id.handle) return itr;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const std::vector<aqlprofile_agent_handle_t>&
|
||||
get_aql_handles()
|
||||
@@ -682,6 +658,30 @@ get_aql_handles()
|
||||
|
||||
return *CHECK_NOTNULL(_v);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
std::vector<const rocprofiler_agent_t*>
|
||||
get_agents()
|
||||
{
|
||||
auto& agents = rocprofiler::agent::get_agent_topology();
|
||||
auto pointers = std::vector<const rocprofiler_agent_t*>{};
|
||||
pointers.reserve(agents.size());
|
||||
for(auto& agent : agents)
|
||||
{
|
||||
pointers.emplace_back(agent.get());
|
||||
}
|
||||
return pointers;
|
||||
}
|
||||
|
||||
const rocprofiler_agent_t*
|
||||
get_agent(rocprofiler_agent_id_t id)
|
||||
{
|
||||
for(const auto& itr : get_agents())
|
||||
{
|
||||
if(itr && itr->id.handle == id.handle) return itr;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const aqlprofile_agent_handle_t*
|
||||
get_aql_agent(rocprofiler_agent_id_t id)
|
||||
|
||||
@@ -103,7 +103,6 @@ struct memory_allocation_info;
|
||||
using searchtype = SEARCHTYPE; \
|
||||
auto& operator()() const { return ITERATEFUNC; } \
|
||||
static constexpr auto operation_idx = ROCPROFILER_MEMORY_ALLOCATION_##ENUM; \
|
||||
static constexpr auto name = "MEMORY_ALLOCATION_" #ENUM; \
|
||||
\
|
||||
template <size_t TableIdx, size_t OpIdx, typename RetT, typename... Args> \
|
||||
static auto get_memory_allocation_impl(RetT (*)(Args...)) \
|
||||
@@ -112,13 +111,6 @@ struct memory_allocation_info;
|
||||
} \
|
||||
};
|
||||
|
||||
SPECIALIZE_MEMORY_ALLOCATION_INFO(HSA_NONE,
|
||||
NONE,
|
||||
region_to_agent_map,
|
||||
region_to_agent_pair,
|
||||
hsa_region_t,
|
||||
get_core_table()->hsa_agent_iterate_regions_fn,
|
||||
memory_allocation_impl)
|
||||
SPECIALIZE_MEMORY_ALLOCATION_INFO(HSA_MEMORY_ALLOCATE,
|
||||
ALLOCATE,
|
||||
region_to_agent_map,
|
||||
@@ -425,32 +417,32 @@ get_agent(T val, IterateFunc iterate_func, CallbackFunc callback)
|
||||
return existing.count(val) == 0 ? null_rocp_agent_id : existing.at(val);
|
||||
}
|
||||
|
||||
void*
|
||||
rocprofiler_address_t
|
||||
handle_starting_addr(void** starting_addr_pointer)
|
||||
{
|
||||
return *starting_addr_pointer;
|
||||
return rocprofiler_address_t{.ptr = (starting_addr_pointer) ? *starting_addr_pointer : nullptr};
|
||||
}
|
||||
|
||||
// The handle field of hsa_amd_vmem_alloc_handle_t is the starting address
|
||||
// cast as uint64_t, so returning the handle field after casting to void* suffices
|
||||
void*
|
||||
rocprofiler_address_t
|
||||
handle_starting_addr(hsa_amd_vmem_alloc_handle_t* vmem_alloc_handle)
|
||||
{
|
||||
return reinterpret_cast<void*>(vmem_alloc_handle->handle);
|
||||
return rocprofiler_address_t{.value = (vmem_alloc_handle) ? vmem_alloc_handle->handle : 0};
|
||||
}
|
||||
|
||||
// Handling starting address for free memory operations
|
||||
void*
|
||||
rocprofiler_address_t
|
||||
handle_starting_addr(void* starting_addr_pointer)
|
||||
{
|
||||
return starting_addr_pointer;
|
||||
return rocprofiler_address_t{.ptr = starting_addr_pointer};
|
||||
}
|
||||
|
||||
// Handles starting address for releasing handle
|
||||
void*
|
||||
rocprofiler_address_t
|
||||
handle_starting_addr(hsa_amd_vmem_alloc_handle_t vmem_alloc_handle)
|
||||
{
|
||||
return reinterpret_cast<void*>(vmem_alloc_handle.handle);
|
||||
return rocprofiler_address_t{.value = vmem_alloc_handle.handle};
|
||||
}
|
||||
|
||||
// Wrapper implementation that stores memory allocation information
|
||||
@@ -539,7 +531,7 @@ memory_allocation_impl(Args... args)
|
||||
// checks before retrieving starting address?
|
||||
if(starting_addr_pointer != nullptr)
|
||||
{
|
||||
_data.address.ptr = handle_starting_addr(starting_addr_pointer);
|
||||
_data.address = handle_starting_addr(starting_addr_pointer);
|
||||
}
|
||||
|
||||
if(!tracing_data.empty())
|
||||
@@ -584,6 +576,8 @@ memory_free_impl(Args... args)
|
||||
constexpr auto operation = memory_allocation_op<OpIdx>::operation_idx;
|
||||
constexpr auto rocprofiler_enum = memory_allocation_info<operation>::operation_idx;
|
||||
|
||||
common::consume_args(arg_indices<OpIdx>::size_idx, arg_indices<OpIdx>::region_idx);
|
||||
|
||||
auto&& _tied_args = std::tie(args...);
|
||||
memory_allocation_data _data{};
|
||||
|
||||
@@ -609,7 +603,7 @@ memory_free_impl(Args... args)
|
||||
_data.tid = common::get_tid();
|
||||
_data.func = rocprofiler_enum;
|
||||
_data.correlation_id = context::get_latest_correlation_id();
|
||||
_data.address.ptr = handle_starting_addr(std::get<address_idx>(_tied_args));
|
||||
_data.address = handle_starting_addr(std::get<address_idx>(_tied_args));
|
||||
|
||||
if(!_data.correlation_id)
|
||||
{
|
||||
|
||||
新增問題並參考
封鎖使用者