From 95cbbc6b3abec1034885fa84f6101d8055de0cd6 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Sat, 11 Nov 2017 11:32:24 -0600 Subject: [PATCH] adding GFX9 counters [ROCm/rocprofiler commit: 8b8970334efd4dfacf2835a4c76ad14a39e81f65] --- projects/rocprofiler/src/core/context.h | 25 ++++-- projects/rocprofiler/test/input.xml | 3 +- projects/rocprofiler/test/metrics.xml | 109 +++++++++++++++++++++++- 3 files changed, 125 insertions(+), 12 deletions(-) diff --git a/projects/rocprofiler/src/core/context.h b/projects/rocprofiler/src/core/context.h index cb32064717..c08c76e03f 100644 --- a/projects/rocprofiler/src/core/context.h +++ b/projects/rocprofiler/src/core/context.h @@ -147,7 +147,10 @@ class Context { } } + // Initialize rocprofiler context void Initialize(rocprofiler_info_t* info_array, const uint32_t info_count) { + // Set input features filter, to not duplicate referenced features + // Set iput features data as uninitialized info_map_t input_map; for (unsigned i = 0; i < info_count; ++i) { rocprofiler_info_t* info = &info_array[i]; @@ -155,27 +158,33 @@ class Context { info->data.kind = ROCPROFILER_UNINIT; } + // Adding zero group, always present if (info_count) set_.push_back(Group(agent_info_, this, 0)); + // Processing input features for (unsigned i = 0; i < info_count; ++i) { rocprofiler_info_t* info = &info_array[i]; + info->data.kind = ROCPROFILER_UNINIT; info_map_[info->name] = info; const rocprofiler_type_t type = info->type; const char* name = info->name; - if (type == ROCPROFILER_TYPE_METRIC) { + if (type == ROCPROFILER_TYPE_METRIC) { // Processing metrics features const Metric* metric = metrics_->Get(name); - if (metric == NULL) EXC_RAISING(HSA_STATUS_ERROR, "metric '" << name << "' is not found"); + if (metric == NULL) EXC_RAISING(HSA_STATUS_ERROR, "input metric '" << name << "' is not found"); auto ret = metrics_map_.insert({name, metric}); - if (!ret.second) EXC_RAISING(HSA_STATUS_ERROR, "metric '" << name << "' is registered more then once"); + if (!ret.second) EXC_RAISING(HSA_STATUS_ERROR, "input metric '" << name << "' is registered more then once"); counters_vec_t counters_vec = metric->GetCounters(); - if (counters_vec.empty()) EXC_RAISING(HSA_STATUS_ERROR, "metric name '" << name << "' is not found"); + if (counters_vec.empty()) EXC_RAISING(HSA_STATUS_ERROR, "bad metric '" << name << "' is empty"); for (const counter_t* counter : counters_vec) { + // For metrics expressions checking that there is no the same counter in the input metrics + // and also that the counter wasn't registered already by another input metric expression if (metric->GetExpr()) { - auto it = input_map.find(counter->name); - if (it != input_map.end()) { + auto inp_it = input_map.find(counter->name); + auto inf_it = info_map_.find(counter->name); + if ((inp_it != input_map.end()) || (inf_it != info_map_.end())) { continue; } else { info = NewCounterInfo(counter); @@ -208,9 +217,9 @@ class Context { const uint32_t group_index = block_status.group_index; set_[group_index].Insert(profile_info_t{event, NULL, 0, info}); } - } else if (type == ROCPROFILER_TYPE_TRACE) { + } else if (type == ROCPROFILER_TYPE_TRACE) { // Processing traces features set_[0].Insert(profile_info_t{NULL, info->parameters, info->parameter_count, info}); - } else { + } else { EXC_RAISING(HSA_STATUS_ERROR, "bad rocprofiler type (" << type << ")"); } } diff --git a/projects/rocprofiler/test/input.xml b/projects/rocprofiler/test/input.xml index 1c690c79a0..7bfd9b81e0 100644 --- a/projects/rocprofiler/test/input.xml +++ b/projects/rocprofiler/test/input.xml @@ -1,4 +1,5 @@ - + + + + + @@ -10,33 +13,133 @@ + + + + + # average for (16 instances x 4 shader engines) + + # sun for 16 instances + + + + + # FETCH_SIZE, kilobytes + # The total kilobytes fetched from the video memory. This is measured with all extra fetches and any cache or memory effects taken into account. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + # average for (16 instances x 4 shader engines) + + # sum for 16 instances + + + + + + + + # FETCH_SIZE, kilobytes + # The total kilobytes fetched from the video memory. This is measured with all extra fetches and any cache or memory effects taken into account. + + + + # GPU_BUSY, percentage + # The percentage of time GPU was busy. + + + # MEM_BUSY_AVR, percentage + # The percentage of GPUTime the memory unit is active. The result includes the stall time (MemUnitStalled). This is measured with all extra fetches and writes and any cache or memory effects taken into account. Value range: 0% to 100% (fetch-bound). + + # VWRITE_INSTS # The average number of vector write instructions to the video memory executed per work-item (affected by flow control). Excludes FLAT instructions that write to video memory. - + # SFETCH_INSTS # The average number of scalar fetch instructions from the video memory executed per work-item (affected by flow control). - + # VALU_INSTS # The average number of vector ALU instructions executed per work-item (affected by flow control). + # L2CACHE_HIT, percentage + # The percentage of fetch, write, atomic, and other instructions that hit the data in L2 cache. Value range: 0% (no hit) to 100% (optimal). +