Fix building of PC Sampling Experiment (#22)
* Fix pc_sample building * source formatting (clang-format v11) (#43) Co-authored-by: jrmadsen <jrmadsen@users.noreply.github.com> * Update samples/pc_sampling/CMakeLists.txt * Allow static_asserts from hsa/types.hpp to be disabled via build flags (#24) * Fix pc_sample building * Fix up hsa type checks * Fix pc_sample building * source formatting (clang-format v11) * Revert check, now allow checks to be disabled by compiler defines. * Update samples/pc_sampling/common.h --------- Co-authored-by: bwelton <bwelton@users.noreply.github.com> Co-authored-by: Jonathan R. Madsen <jrmadsen@users.noreply.github.com> * Update single-user-host-trap-retries-service-instantiation.cpp - include vector --------- Co-authored-by: Jonathan R. Madsen <jrmadsen@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: bwelton <bwelton@users.noreply.github.com>
This commit is contained in:
@@ -16,8 +16,8 @@ const std::string_view MI200_NAME = "gfx90a";
|
||||
|
||||
#define ROCPROFILER_CALL(result, msg) \
|
||||
{ \
|
||||
rocprofiler_status_t status = result; \
|
||||
if(status != ROCPROFILER_STATUS_SUCCESS) \
|
||||
rocprofiler_status_t CHECKSTATUS = result; \
|
||||
if(CHECKSTATUS != ROCPROFILER_STATUS_SUCCESS) \
|
||||
{ \
|
||||
puts(#result " failed"); \
|
||||
} \
|
||||
@@ -28,8 +28,8 @@ const std::string_view MI200_NAME = "gfx90a";
|
||||
// after previous initialization.
|
||||
#define ROCPROFILER_CALL_FAILS(result, msg) \
|
||||
{ \
|
||||
rocprofiler_status_t status = result; \
|
||||
if(status == ROCPROFILER_STATUS_SUCCESS) \
|
||||
rocprofiler_status_t CHECKSTATUS = result; \
|
||||
if(CHECKSTATUS == ROCPROFILER_STATUS_SUCCESS) \
|
||||
{ \
|
||||
puts(#result " succeeded"); \
|
||||
} \
|
||||
@@ -80,7 +80,7 @@ find_first_gpu_agent()
|
||||
ROCPROFILER_CALL(rocprofiler_query_available_agents(&find_first_gpu_agent_impl,
|
||||
sizeof(rocprofiler_agent_t),
|
||||
static_cast<void*>(&gpu_agent)),
|
||||
"Failed to find GPU agents");
|
||||
"Could not query GPU agents");
|
||||
|
||||
return gpu_agent;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "common.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
|
||||
#define HOST_TRAP_INTERVAL 1000
|
||||
|
||||
@@ -53,11 +54,11 @@ second_user()
|
||||
|
||||
// After failure, the second user queries available configuration and observes the one chosen by
|
||||
// the first user.
|
||||
rocprofiler_pc_sampling_configuration_t* configs;
|
||||
size_t config_count;
|
||||
ROCPROFILER_CALL(
|
||||
rocprofiler_query_pc_sampling_agent_configurations(gpu_agent, configs, &config_count),
|
||||
"The second user cannot query available configurations");
|
||||
size_t config_count = 10;
|
||||
std::vector<rocprofiler_pc_sampling_configuration_t> configs(config_count);
|
||||
ROCPROFILER_CALL(rocprofiler_query_pc_sampling_agent_configurations(
|
||||
gpu_agent, configs.data(), &config_count),
|
||||
"The second user cannot query available configurations");
|
||||
|
||||
// Only one configuration should be listed, and its parameters should match the parameters set
|
||||
// by the first user. Vladimir: Is it ok to use assertions? In the release mode, they might be
|
||||
@@ -71,9 +72,6 @@ second_user()
|
||||
assert(first_user_config.min_interval == host_trap_interval &&
|
||||
first_user_config.min_interval == first_user_config.max_interval);
|
||||
|
||||
// Vladimir: Do we need to explicitly free queried configurations?
|
||||
free(configs);
|
||||
|
||||
// Reuse the same configuration set by the first user.
|
||||
// The second user is satisfied with the configuration chosen by the first user, so it
|
||||
// starts PC sampling.
|
||||
@@ -106,8 +104,6 @@ second_user()
|
||||
int
|
||||
main(int /*argc*/, char** /*argv*/)
|
||||
{
|
||||
rocprofiler_status_t status;
|
||||
|
||||
// creating a context
|
||||
rocprofiler_context_id_t context_id;
|
||||
ROCPROFILER_CALL(rocprofiler_create_context(&context_id), "Cannot create context\n");
|
||||
@@ -127,11 +123,10 @@ main(int /*argc*/, char** /*argv*/)
|
||||
"Cannot create pc sampling buffer");
|
||||
|
||||
// PC sampling service configuration
|
||||
rocprofiler_pc_sampling_method_t host_trap_sampling_method =
|
||||
ROCPROFILER_PC_SAMPLING_METHOD_HOST_TRAP;
|
||||
rocprofiler_pc_sampling_unit_t host_trap_sampling_unit_time = ROCPROFILER_PC_SAMPLING_UNIT_TIME;
|
||||
host_trap_sampling_method = ROCPROFILER_PC_SAMPLING_METHOD_HOST_TRAP;
|
||||
host_trap_sampling_unit_time = ROCPROFILER_PC_SAMPLING_UNIT_TIME;
|
||||
// Vladimir: What units are we using for time? ms, micro secs, ns?
|
||||
uint64_t host_trap_interval = HOST_TRAP_INTERVAL;
|
||||
host_trap_interval = HOST_TRAP_INTERVAL;
|
||||
// Instantiating the first PC sampling service succeeds.
|
||||
ROCPROFILER_CALL(rocprofiler_configure_pc_sampling_service(context_id,
|
||||
gpu_agent,
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
int
|
||||
main(int /*argc*/, char** /*argv*/)
|
||||
{
|
||||
rocprofiler_status_t status;
|
||||
|
||||
// creating a context
|
||||
rocprofiler_context_id_t context_id;
|
||||
ROCPROFILER_CALL(rocprofiler_create_context(&context_id), "Cannot create context\n");
|
||||
|
||||
Reference in New Issue
Block a user