SWDEV-406401: Adding Kernel Duration as a Metric
Change-Id: If5137ce0bdb65d87ca9d86fa860cb95b240081ce
[ROCm/rocprofiler commit: f1f5c4485d]
This commit is contained in:
committed by
Ammar Elwazir
parent
41223f8297
commit
5f784afbe5
@@ -1,6 +1,7 @@
|
||||
#include "basic_counters.xml"
|
||||
|
||||
<gfx8_expr>
|
||||
<metric name="KERNEL_DURATION" expr=1 descr="The duration of the kernel dispatch"></metric>
|
||||
<metric name="TA_BUSY_avr" expr=avr(TA_TA_BUSY,16) descr="TA block is busy. Average over TA instances."></metric>
|
||||
<metric name="TA_BUSY_max" expr=max(TA_TA_BUSY,16) descr="TA block is busy. Max over TA instances."></metric>
|
||||
<metric name="TA_BUSY_min" expr=min(TA_TA_BUSY,16) descr="TA block is busy. Min over TA instances."></metric>
|
||||
@@ -35,6 +36,7 @@
|
||||
</gfx8_expr>
|
||||
|
||||
<gfx9_expr>
|
||||
<metric name="KERNEL_DURATION" expr=1 descr="The duration of the kernel dispatch"></metric>
|
||||
<metric name="TA_BUSY_avr" expr=avr(TA_TA_BUSY,16) descr="TA block is busy. Average over TA instances."></metric>
|
||||
<metric name="TA_BUSY_max" expr=max(TA_TA_BUSY,16) descr="TA block is busy. Max over TA instances."></metric>
|
||||
<metric name="TA_BUSY_min" expr=min(TA_TA_BUSY,16) descr="TA block is busy. Min over TA instances."></metric>
|
||||
@@ -325,7 +327,7 @@
|
||||
<metric name="TA_BUFFER_ATOMIC_WAVEFRONTS_sum" expr=sum(TA_BUFFER_ATOMIC_WAVEFRONTS,16) descr="Number of buffer atomic wavefronts processed by TA. Sum over TA instances."></metric>
|
||||
<metric name="TA_BUFFER_TOTAL_CYCLES_sum" expr=sum(TA_BUFFER_TOTAL_CYCLES,16) descr="Number of buffer cycles issued to TC. Sum over TA instances."></metric>
|
||||
<metric name="TA_BUFFER_COALESCED_READ_CYCLES_sum" expr=sum(TA_BUFFER_COALESCED_READ_CYCLES,16) descr="Number of buffer coalesced read cycles issued to TC. Sum over TA instances."></metric>
|
||||
<metric name="TA_BUFFER_COALESCED_WRITE_CYCLES_sum" expr=sum(TA_BUFFER_COALESCED_WRITE_CYCLES,16) descr="Number of buffer coalesced write cycles issued to TC. Sum over TA instances."></metric>
|
||||
<metric name="TA_BUFFER_COALESCED_WRITE_CYCLES_sum" expr=sum(TA_BUFFER_COALESCED_WRITE_CYCLES,16) descr="Number of buffer coalesced write cycles issued to TC. Sum over TA instances."></metric>
|
||||
<metric name="TD_TD_BUSY_sum" expr=sum(TD_TD_BUSY,16) descr="TD is processing or waiting for data. Perf_Windowing not supported for this counter. Sum over TD instances."></metric>
|
||||
<metric name="TD_TC_STALL_sum" expr=sum(TD_TC_STALL,16) descr="TD is stalled waiting for TC data. Sum over TD instances."></metric>
|
||||
<metric name="TD_LOAD_WAVEFRONT_sum" expr=sum(TD_LOAD_WAVEFRONT,16) descr="Count the wavefronts with opcode = load, include atomics and store. Sum over TD instances."></metric>
|
||||
@@ -426,6 +428,7 @@
|
||||
</gfx940_expr>
|
||||
|
||||
<gfx10_expr>
|
||||
<metric name="KERNEL_DURATION" expr=1 descr="The duration of the kernel dispatch"></metric>
|
||||
<metric name="MeanOccupancyPerCU" expr=GRBM_COUNT*0+SQ_LEVEL_WAVES*0+SQ_ACCUM_PREV/GRBM_GUI_ACTIVE/CU_NUM descr="Mean occupancy per compute unit."></metric>
|
||||
<metric name="MeanOccupancyPerActiveCU" expr=GRBM_COUNT*0+SQ_LEVEL_WAVES*0+SQ_ACCUM_PREV*4/SQ_BUSY_CYCLES/CU_NUM descr="Mean occupancy per active compute unit."></metric>
|
||||
|
||||
@@ -470,6 +473,7 @@
|
||||
</gfx1032_expr>
|
||||
|
||||
<gfx11_expr>
|
||||
<metric name="KERNEL_DURATION" expr=1 descr="The duration of the kernel dispatch"></metric>
|
||||
<metric name="GPU_UTIL" expr=100*GRBM_GUI_ACTIVE/GRBM_COUNT descr="Percentage of the time that GUI is active"></metric>
|
||||
<metric name="WAVE_DEP_WAIT" expr=100*SQ_WAIT_ANY/SQ_WAVE_CYCLES descr="Percentage of the SQ_WAVE_CYCLE time spent waiting for anything."></metric>
|
||||
<metric name="WAVE_ISSUE_WAIT" expr=100*SQ_WAIT_INST_ANY/SQ_WAVE_CYCLES descr="Percentage of the SQ_WAVE_CYCLE time spent waiting for any instruction issue."></metric>
|
||||
|
||||
@@ -108,6 +108,12 @@ bool metrics::ExtractMetricEvents(
|
||||
// adding result object for derived metric
|
||||
std::lock_guard<std::mutex> lock(extract_metric_events_lock);
|
||||
|
||||
if(metric_names[i].compare("KERNEL_DURATION")==0) {
|
||||
if (results_map.find(metric_names[i]) == results_map.end()) {
|
||||
results_map[metric_names[i]] = new results_t(metric_names[i], {}, xcc_count);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
counters_vec = metric->GetCounters();
|
||||
if (counters_vec.empty())
|
||||
rocprofiler::fatal("bad metric '%s' is empty", metric_names[i].c_str());
|
||||
@@ -178,7 +184,7 @@ bool metrics::GetCounterData(hsa_ven_amd_aqlprofile_profile_t* profile, hsa_agen
|
||||
}
|
||||
|
||||
bool metrics::GetMetricsData(std::map<std::string, results_t*>& results_map,
|
||||
std::vector<const Metric*>& metrics_list) {
|
||||
std::vector<const Metric*>& metrics_list, uint64_t kernel_duration) {
|
||||
MetricArgs<std::map<std::string, results_t*>> args(&results_map);
|
||||
for (auto& metric : metrics_list) {
|
||||
const xml::Expr* expr = metric->GetExpr();
|
||||
@@ -186,6 +192,10 @@ bool metrics::GetMetricsData(std::map<std::string, results_t*>& results_map,
|
||||
auto it = results_map.find(metric->GetName());
|
||||
if (it == results_map.end()) rocprofiler::fatal("metric results not found ");
|
||||
results_t* res = it->second;
|
||||
if(metric->GetName().compare("KERNEL_DURATION") == 0) {
|
||||
res->val_double = kernel_duration;
|
||||
continue;
|
||||
}
|
||||
res->val_double = expr->Eval(args);
|
||||
}
|
||||
}
|
||||
@@ -196,7 +206,7 @@ bool metrics::GetMetricsData(std::map<std::string, results_t*>& results_map,
|
||||
void metrics::GetCountersAndMetricResultsByXcc(uint32_t xcc_index,
|
||||
std::vector<results_t*>& results_list,
|
||||
std::map<std::string, results_t*>& results_map,
|
||||
std::vector<const Metric*>& metrics_list) {
|
||||
std::vector<const Metric*>& metrics_list, uint64_t kernel_duration) {
|
||||
for (auto it = results_list.begin(); it != results_list.end(); it++) {
|
||||
(*it)->val_double =
|
||||
(*it)->xcc_vals[xcc_index]; // set val_double to hold value for specific xcc
|
||||
@@ -207,5 +217,5 @@ void metrics::GetCountersAndMetricResultsByXcc(uint32_t xcc_index,
|
||||
it->second->xcc_vals[xcc_index]; // set val_double to hold value for specific xcc
|
||||
}
|
||||
|
||||
GetMetricsData(results_map, metrics_list);
|
||||
GetMetricsData(results_map, metrics_list, kernel_duration);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef std::vector<double> xcc_results_t;
|
||||
|
||||
class results_t{
|
||||
public:
|
||||
results_t(std::string in_name, event_t in_event, uint32_t xcc_count):
|
||||
results_t(std::string in_name, event_t in_event, uint32_t xcc_count):
|
||||
name(in_name), val_double(0), event(in_event) {
|
||||
xcc_vals.resize(xcc_count);
|
||||
std::fill(xcc_vals.begin(), xcc_vals.end(), 0);
|
||||
@@ -75,11 +75,11 @@ bool GetCounterData(hsa_ven_amd_aqlprofile_profile_t* profile, hsa_agent_t gpu_a
|
||||
std::vector<results_t*>& results_list);
|
||||
|
||||
bool GetMetricsData(std::map<std::string, results_t*>& results_map,
|
||||
std::vector<const Metric*>& metrics_list);
|
||||
std::vector<const Metric*>& metrics_list, uint64_t kernel_duration = 0);
|
||||
|
||||
void GetCountersAndMetricResultsByXcc(uint32_t xcc_index, std::vector<results_t*>& results_list,
|
||||
std::map<std::string, results_t*>& results_map,
|
||||
std::vector<const Metric*>& metrics_list);
|
||||
std::map<std::string, results_t*>& results_map,
|
||||
std::vector<const Metric*>& metrics_list, uint64_t kernel_duration = 0);
|
||||
|
||||
} // namespace metrics
|
||||
} // namespace rocprofiler
|
||||
|
||||
@@ -213,6 +213,7 @@ class MetricsDict {
|
||||
xml_->AddConst("top.const.metric", "SIMD_NUM",
|
||||
agent_info->getSimdCountPerCU() * agent_info->getCUCount());
|
||||
xml_->AddConst("top.const.metric", "SE_NUM", agent_info->getShaderEngineCount());
|
||||
xml_->AddConst("top.const.metric", "LDS_BANKS", 32);
|
||||
ImportMetrics(agent_info, "const");
|
||||
agent_name_ = agent_info->getName();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user