Skip to content

Commit

Permalink
Add option to skip barrier marker events in traces (#320)
Browse files Browse the repository at this point in the history
* Add option to skip barrier marker events in traces

* Formatting

* Apply review suggestions

Co-authored-by: Jonathan R. Madsen <jrmadsen@users.noreply.github.com>

* clang-format

* Formatting

---------

Co-authored-by: Jonathan R. Madsen <jrmadsen@users.noreply.github.com>
Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
  • Loading branch information
3 people committed Jan 10, 2024
1 parent 5b42702 commit 82cbe3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions source/lib/core/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,10 @@ configure_settings(bool _init)
"HSA API type to collect", "", "roctracer", "rocm",
"advanced");

OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_ROCTRACER_DISCARD_BARRIERS",
"Skip barrier marker events in traces", false, "roctracer",
"rocm", "advanced");

OMNITRACE_CONFIG_SETTING(
std::string, "OMNITRACE_ROCM_EVENTS",
"ROCm hardware counters. Use ':device=N' syntax to specify collection on device "
Expand Down
8 changes: 6 additions & 2 deletions source/lib/omnitrace/library/roctracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,8 +928,11 @@ hip_activity_callback(const char* begin, const char* end, void* arg)
using Phase = critical_trace::Phase;

if(!trait::runtime_enabled<comp::roctracer>::get()) return;
static auto _kernel_names = std::unordered_map<const char*, std::string>{};
static auto _indexes = std::unordered_map<uint64_t, int>{};
static auto _kernel_names = std::unordered_map<const char*, std::string>{};
static auto _indexes = std::unordered_map<uint64_t, int>{};
static auto _skip_barrier_packets =
config::get_setting_value<bool>("OMNITRACE_ROCTRACER_DISCARD_BARRIERS")
.value_or(false);
const roctracer_record_t* record = reinterpret_cast<const roctracer_record_t*>(begin);
const roctracer_record_t* end_record =
reinterpret_cast<const roctracer_record_t*>(end);
Expand All @@ -956,6 +959,7 @@ hip_activity_callback(const char* begin, const char* end, void* arg)
}
if(record->domain != ACTIVITY_DOMAIN_HIP_OPS) continue;
if(record->op > HIP_OP_ID_BARRIER) continue;
if(_skip_barrier_packets && record->op == HIP_OP_ID_BARRIER) continue;

const char* op_name =
roctracer_op_string(record->domain, record->op, record->kind);
Expand Down

0 comments on commit 82cbe3f

Please sign in to comment.