diff --git a/src/core/context.h b/src/core/context.h index 38a58262e7..856c702485 100644 --- a/src/core/context.h +++ b/src/core/context.h @@ -435,7 +435,9 @@ class Context { set_[group_index].Insert(profile_info_t{event, NULL, 0, info}); } } else if (kind == ROCPROFILER_FEATURE_KIND_TRACE) { // Processing traces features - if (name != NULL) { + if (info->parameters != NULL) { + set_[0].Insert(profile_info_t{NULL, info->parameters, info->parameter_count, info}); + } else { const Metric* metric = metrics_->Get(name); if (metric == NULL) EXC_RAISING(HSA_STATUS_ERROR, "input metric '" << name << "' is not found"); @@ -445,8 +447,6 @@ class Context { const counter_t* counter = counters_vec[0]; const event_t* event = &(counter->event); set_[0].Insert(profile_info_t{event, NULL, 0, info}); - } else { - set_[0].Insert(profile_info_t{NULL, info->parameters, info->parameter_count, info}); } } else { EXC_RAISING(HSA_STATUS_ERROR, "bad rocprofiler feature kind (" << kind << ")"); diff --git a/src/core/profile.h b/src/core/profile.h index 3658ebb0bf..223e2e5edf 100644 --- a/src/core/profile.h +++ b/src/core/profile.h @@ -248,12 +248,15 @@ class TraceProfile : public Profile { } void Insert(const profile_info_t& info) { - Profile::Insert(info); - if (info.event != NULL) { + if (info.parameters != NULL) { + Profile::Insert(info); + for (unsigned j = 0; j < info.parameter_count; ++j) { + Config(&profile_).Insert(info.parameters[j]); + } + } else if (info.event != NULL) { Config(&profile_).Insert(*(info.event)); - } - for (unsigned j = 0; j < info.parameter_count; ++j) { - Config(&profile_).Insert(info.parameters[j]); + } else { + EXC_ABORT(HSA_STATUS_ERROR, "invalid trace info inserted"); } } diff --git a/test/run.sh b/test/run.sh index 44d78e14e5..a8967b2aa0 100755 --- a/test/run.sh +++ b/test/run.sh @@ -109,12 +109,12 @@ eval_test "'rocprof' libtool test n-threads" ./test/ctrl ## SPM test -export ROCP_KITER=1 -export ROCP_DITER=1 +export ROCP_KITER=3 +export ROCP_DITER=3 export ROCP_AGENTS=1 export ROCP_THRS=1 export ROCP_INPUT=spm_input.xml -xeval_test "libtool test, SPM trace test" ./test/ctrl +eval_test "libtool test, SPM trace test" ./test/ctrl ## Libtool test, counter sets diff --git a/test/tool/tool.cpp b/test/tool/tool.cpp index e3e46d5113..3ecef03d4d 100644 --- a/test/tool/tool.cpp +++ b/test/tool/tool.cpp @@ -435,6 +435,7 @@ void output_results(const context_entry_t* entry, const char* label) { break; } default: + if (is_spm_trace) continue; fprintf(stderr, "RPL-tool: undefined data kind(%u)\n", p->data.kind); abort(); } @@ -1046,6 +1047,7 @@ extern "C" PUBLIC_API void OnLoadToolProp(rocprofiler_settings_t* settings) features[index] = {}; features[index].kind = ROCPROFILER_FEATURE_KIND_TRACE; features[index].data.result_bytes.copy = to_copy_data; + features[index].name = strdup(name.c_str()); uint32_t parameter_count = 0; for (const auto* node : entry->nodes) {