Renamed agent profiling service to device counting service (#1132)
* Renamed agent profiling service to device counting service
Name more aptly represents what agent profiling did (device wide
counter collection). Conversion of existing user code can be
performed by the following find/sed command:
find . -type f -exec sed -i 's/rocprofiler_agent_profile_callback_t/rocprofiler_device_counting_service_callback_t/g; s/rocprofiler_configure_agent_profile_counting_service/rocprofiler_configure_device_counting_service/g; s/agent_profile.h/device_counting_service.h/g; s/rocprofiler_sample_agent_profile_counting_service/rocprofiler_sample_device_counting_service/g' {} +
* Converted dispatch profile to dispatch counting service
* Debug for functioal counters test
* Minor changes for CI
* Minor fix
* More fixes for CI
* Update evaluate_ast.cpp
---------
Co-authored-by: Benjamin Welton <ben@amd.com>
This commit is contained in:
@@ -107,28 +107,29 @@ set_tests_properties(
|
||||
"${counter-collection-functional-counter-env}" FAIL_REGULAR_EXPRESSION
|
||||
"${ROCPROFILER_DEFAULT_FAIL_REGEX}")
|
||||
|
||||
add_library(counter-collection-agent-profiling-client SHARED)
|
||||
target_sources(counter-collection-agent-profiling-client PRIVATE agent_profiling.cpp
|
||||
client.hpp)
|
||||
add_library(counter-collection-device-profiling-client SHARED)
|
||||
target_sources(counter-collection-device-profiling-client PRIVATE device_counting.cpp
|
||||
client.hpp)
|
||||
target_link_libraries(
|
||||
counter-collection-agent-profiling-client
|
||||
counter-collection-device-profiling-client
|
||||
PUBLIC rocprofiler-sdk::samples-build-flags
|
||||
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::samples-common-library)
|
||||
|
||||
add_executable(counter-collection-agent-profiling)
|
||||
target_sources(counter-collection-agent-profiling PRIVATE main.cpp)
|
||||
target_link_libraries(counter-collection-agent-profiling
|
||||
PRIVATE counter-collection-agent-profiling-client Threads::Threads)
|
||||
add_executable(counter-collection-device-profiling)
|
||||
target_sources(counter-collection-device-profiling PRIVATE main.cpp)
|
||||
target_link_libraries(counter-collection-device-profiling
|
||||
PRIVATE counter-collection-device-profiling-client Threads::Threads)
|
||||
|
||||
rocprofiler_samples_get_preload_env(PRELOAD_ENV counter-collection-agent-profiling-client)
|
||||
rocprofiler_samples_get_preload_env(PRELOAD_ENV
|
||||
counter-collection-device-profiling-client)
|
||||
|
||||
set(counter-collection-functional-counter-env "${PRELOAD_ENV}" "${LIBRARY_PATH_ENV}")
|
||||
|
||||
add_test(NAME counter-collection-agent-profiling
|
||||
COMMAND $<TARGET_FILE:counter-collection-agent-profiling>)
|
||||
add_test(NAME counter-collection-device-profiling
|
||||
COMMAND $<TARGET_FILE:counter-collection-device-profiling>)
|
||||
|
||||
set_tests_properties(
|
||||
counter-collection-agent-profiling
|
||||
counter-collection-device-profiling
|
||||
PROPERTIES TIMEOUT 120 LABELS "samples" ENVIRONMENT
|
||||
"${counter-collection-functional-counter-env}" FAIL_REGULAR_EXPRESSION
|
||||
"${ROCPROFILER_DEFAULT_FAIL_REGEX}")
|
||||
|
||||
@@ -67,7 +67,7 @@ get_client_ctx()
|
||||
}
|
||||
|
||||
void
|
||||
record_callback(rocprofiler_profile_counting_dispatch_data_t dispatch_data,
|
||||
record_callback(rocprofiler_dispatch_counting_service_data_t dispatch_data,
|
||||
rocprofiler_record_counter_t* record_data,
|
||||
size_t record_count,
|
||||
rocprofiler_user_data_t user_data,
|
||||
@@ -95,7 +95,7 @@ record_callback(rocprofiler_profile_counting_dispatch_data_t dispatch_data,
|
||||
* to collect the counter SQ_WAVES for all kernel dispatch packets.
|
||||
*/
|
||||
void
|
||||
dispatch_callback(rocprofiler_profile_counting_dispatch_data_t dispatch_data,
|
||||
dispatch_callback(rocprofiler_dispatch_counting_service_data_t dispatch_data,
|
||||
rocprofiler_profile_config_id_t* config,
|
||||
rocprofiler_user_data_t* /*user_data*/,
|
||||
void* /*callback_data_args*/)
|
||||
@@ -168,7 +168,7 @@ dispatch_callback(rocprofiler_profile_counting_dispatch_data_t dispatch_data,
|
||||
}
|
||||
|
||||
// Create a colleciton profile for the counters
|
||||
rocprofiler_profile_config_id_t profile;
|
||||
rocprofiler_profile_config_id_t profile = {.handle = 0};
|
||||
ROCPROFILER_CALL(rocprofiler_create_profile_config(dispatch_data.dispatch_info.agent_id,
|
||||
collect_counters.data(),
|
||||
collect_counters.size(),
|
||||
@@ -185,7 +185,7 @@ tool_init(rocprofiler_client_finalize_t, void* user_data)
|
||||
{
|
||||
ROCPROFILER_CALL(rocprofiler_create_context(&get_client_ctx()), "context creation failed");
|
||||
|
||||
ROCPROFILER_CALL(rocprofiler_configure_callback_dispatch_profile_counting_service(
|
||||
ROCPROFILER_CALL(rocprofiler_configure_callback_dispatch_counting_service(
|
||||
get_client_ctx(), dispatch_callback, nullptr, record_callback, user_data),
|
||||
"Could not setup counting service");
|
||||
ROCPROFILER_CALL(rocprofiler_start_context(get_client_ctx()), "start context");
|
||||
|
||||
@@ -126,7 +126,7 @@ buffered_callback(rocprofiler_context_id_t,
|
||||
{
|
||||
// Print the returned counter data.
|
||||
auto* record =
|
||||
static_cast<rocprofiler_profile_counting_dispatch_record_t*>(header->payload);
|
||||
static_cast<rocprofiler_dispatch_counting_service_record_t*>(header->payload);
|
||||
ss << "[Dispatch_Id: " << record->dispatch_info.dispatch_id
|
||||
<< " Kernel_ID: " << record->dispatch_info.kernel_id
|
||||
<< " Corr_Id: " << record->correlation_id.internal << ")]\n";
|
||||
@@ -179,7 +179,7 @@ get_profile_cache()
|
||||
* to collect the counter SQ_WAVES for all kernel dispatch packets.
|
||||
*/
|
||||
void
|
||||
dispatch_callback(rocprofiler_profile_counting_dispatch_data_t dispatch_data,
|
||||
dispatch_callback(rocprofiler_dispatch_counting_service_data_t dispatch_data,
|
||||
rocprofiler_profile_config_id_t* config,
|
||||
rocprofiler_user_data_t* /*user_data*/,
|
||||
void* /*callback_data_args*/)
|
||||
@@ -255,7 +255,7 @@ build_profile_for_agent(rocprofiler_agent_id_t agent,
|
||||
}
|
||||
|
||||
// Create and return the profile
|
||||
rocprofiler_profile_config_id_t profile;
|
||||
rocprofiler_profile_config_id_t profile = {.handle = 0};
|
||||
ROCPROFILER_CALL(rocprofiler_create_profile_config(
|
||||
agent, collect_counters.data(), collect_counters.size(), &profile),
|
||||
"Could not construct profile cfg");
|
||||
@@ -352,7 +352,7 @@ tool_init(rocprofiler_client_finalize_t, void* user_data)
|
||||
// counters to collect by returning a profile config id. In this example, we create the profile
|
||||
// configs above and store them in the map get_profile_cache() so we can look them up at
|
||||
// dispatch.
|
||||
ROCPROFILER_CALL(rocprofiler_configure_buffered_dispatch_profile_counting_service(
|
||||
ROCPROFILER_CALL(rocprofiler_configure_buffered_dispatch_counting_service(
|
||||
get_client_ctx(), get_buffer(), dispatch_callback, nullptr),
|
||||
"Could not setup buffered service");
|
||||
|
||||
|
||||
+3
-3
@@ -193,7 +193,7 @@ build_profile_for_agent(rocprofiler_agent_id_t agent)
|
||||
}
|
||||
}
|
||||
|
||||
rocprofiler_profile_config_id_t profile;
|
||||
rocprofiler_profile_config_id_t profile = {.handle = 0};
|
||||
ROCPROFILER_CALL(rocprofiler_create_profile_config(
|
||||
agent, collect_counters.data(), collect_counters.size(), &profile),
|
||||
"Could not construct profile cfg");
|
||||
@@ -266,7 +266,7 @@ tool_init(rocprofiler_client_finalize_t, void* user_data)
|
||||
return 1;
|
||||
}
|
||||
|
||||
ROCPROFILER_CALL(rocprofiler_configure_agent_profile_counting_service(
|
||||
ROCPROFILER_CALL(rocprofiler_configure_device_counting_service(
|
||||
get_client_ctx(), get_buffer(), agent_id, set_profile, nullptr),
|
||||
"Could not setup buffered service");
|
||||
|
||||
@@ -275,7 +275,7 @@ tool_init(rocprofiler_client_finalize_t, void* user_data)
|
||||
rocprofiler_start_context(get_client_ctx());
|
||||
while(exit_toggle().load() == false)
|
||||
{
|
||||
rocprofiler_sample_agent_profile_counting_service(
|
||||
rocprofiler_sample_device_counting_service(
|
||||
get_client_ctx(), {.value = count}, ROCPROFILER_COUNTER_FLAG_NONE);
|
||||
count++;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <rocprofiler-sdk/registration.h>
|
||||
#include <rocprofiler-sdk/rocprofiler.h>
|
||||
|
||||
#define PRINT_ONLY_FAILING true
|
||||
#define PRINT_ONLY_FAILING false
|
||||
|
||||
/**
|
||||
* Tests the collection of all counters on the agent the test is run on.
|
||||
@@ -222,7 +222,7 @@ get_agent_info()
|
||||
}
|
||||
|
||||
void
|
||||
dispatch_callback(rocprofiler_profile_counting_dispatch_data_t dispatch_data,
|
||||
dispatch_callback(rocprofiler_dispatch_counting_service_data_t dispatch_data,
|
||||
rocprofiler_profile_config_id_t* config,
|
||||
rocprofiler_user_data_t* /*user_data*/,
|
||||
void* /*callback_data_args*/)
|
||||
@@ -304,7 +304,7 @@ dispatch_callback(rocprofiler_profile_counting_dispatch_data_t dispatch_data,
|
||||
}
|
||||
if(cap.remaining.empty()) return;
|
||||
|
||||
rocprofiler_profile_config_id_t profile;
|
||||
rocprofiler_profile_config_id_t profile = {.handle = 0};
|
||||
|
||||
// Select the next counter to collect.
|
||||
if(rocprofiler_create_profile_config(
|
||||
@@ -312,6 +312,8 @@ dispatch_callback(rocprofiler_profile_counting_dispatch_data_t dispatch_data,
|
||||
ROCPROFILER_STATUS_SUCCESS)
|
||||
{
|
||||
*config = profile;
|
||||
std::clog << "Attempting to read counter "
|
||||
<< cap.expected_counter_names.at(cap.remaining.back().handle) << "\n";
|
||||
}
|
||||
|
||||
cap.remaining.pop_back();
|
||||
@@ -338,7 +340,7 @@ tool_init(rocprofiler_client_finalize_t, void*)
|
||||
|
||||
ROCPROFILER_CALL(rocprofiler_assign_callback_thread(get_buffer(), client_thread),
|
||||
"failed to assign thread for buffer");
|
||||
ROCPROFILER_CALL(rocprofiler_configure_buffered_dispatch_profile_counting_service(
|
||||
ROCPROFILER_CALL(rocprofiler_configure_buffered_dispatch_counting_service(
|
||||
get_client_ctx(), get_buffer(), dispatch_callback, nullptr),
|
||||
"Could not setup buffered service");
|
||||
rocprofiler_start_context(get_client_ctx());
|
||||
|
||||
Reference in New Issue
Block a user