From 88f277107e08893a185fbb7b3bf445d8b1443d8f Mon Sep 17 00:00:00 2001 From: Benjamin Welton Date: Tue, 18 Jun 2024 23:40:19 -0700 Subject: [PATCH] Replicate global counters across all derived counters (#936) Fix derived counters to have globals replicated across all architectures (that support them). --------- Co-authored-by: Benjamin Welton [ROCm/rocprofiler-sdk commit: ab92bef1a4767a6e3a8694461ae768444ceb1fcb] --- .../lib/rocprofiler-sdk/counters/metrics.cpp | 2 +- .../counters/tests/metrics_test.cpp | 2 +- .../counters/tests/metrics_test.h | 50 ++++++- .../counters/xml/derived_counters.xml | 127 +++++++++--------- 4 files changed, 113 insertions(+), 68 deletions(-) diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/metrics.cpp b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/metrics.cpp index 8c0d25b2c9..59dd33cdb5 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/metrics.cpp +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/metrics.cpp @@ -101,7 +101,7 @@ loadXml(const std::string& filename, bool load_constants = false) * respec the XML (which we should...). */ if(gfx_name.find("metric") == std::string::npos || - gfx_name.find("top.") == std::string::npos) + gfx_name.find("top.") == std::string::npos || gfx_name.find("gfx") == std::string::npos) continue; auto& metricVec = diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/metrics_test.cpp b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/metrics_test.cpp index e77e51d937..05bd3d0278 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/metrics_test.cpp +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/metrics_test.cpp @@ -171,7 +171,7 @@ TEST(metrics, check_agent_valid) if(other_gfx == gfx) continue; for(const auto& metric : other_counters) { - if(common_metrics.count(metric.id())) continue; + if(common_metrics.count(metric.id()) || !metric.special().empty()) continue; EXPECT_EQ(counters::checkValidMetric(gfx, metric), false) << fmt::format("GFX {} has Metric {} but shouldn't", gfx, metric); } diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/metrics_test.h b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/metrics_test.h index 65b917942a..b552924f27 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/metrics_test.h +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/counters/tests/metrics_test.h @@ -166,7 +166,52 @@ static const std::unordered_map>> derived_gfx908 = {{"gfx908", - {{"GPU_UTIL", + {{"GPUBusy", + "", + "", + "100*GRBM_GUI_ACTIVE/GRBM_COUNT", + "The percentage of time GPU was busy."}, + {"Wavefronts", "", "", "SQ_WAVES", "Total wavefronts."}, + {"VALUInsts", + "", + "", + "SQ_INSTS_VALU/SQ_WAVES", + "The average number of vector ALU instructions executed per work-item (affected by flow " + "control)."}, + {"SALUInsts", + "", + "", + "SQ_INSTS_SALU/SQ_WAVES", + "The average number of scalar ALU instructions executed per work-item (affected by flow " + "control)."}, + {"SFetchInsts", + "", + "", + "SQ_INSTS_SMEM/SQ_WAVES", + "The average number of scalar fetch instructions from the video memory executed per " + "work-item (affected by flow control)."}, + {"GDSInsts", + "", + "", + "SQ_INSTS_GDS/SQ_WAVES", + "The average number of GDS read or GDS write instructions executed per work item " + "(affected by flow control)."}, + {"MemUnitBusy", + "", + "", + "100*reduce(TA_TA_BUSY,max)/GRBM_GUI_ACTIVE/SE_NUM", + "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)."}, + {"ALUStalledByLDS", + "", + "", + "400*SQ_WAIT_INST_LDS/SQ_WAVES/GRBM_GUI_ACTIVE", + "The percentage of GPUTime ALU units are stalled by the LDS input queue being full or " + "the output queue being not ready. If there are LDS bank conflicts, reduce them. " + "Otherwise, try reducing the number of LDS accesses if possible. Value range: 0% " + "(optimal) to 100% (bad)."}, + {"GPU_UTIL", "", "", "100*GRBM_GUI_ACTIVE/GRBM_COUNT", @@ -175,7 +220,8 @@ static const std::unordered_map + + # GPUBusy The percentage of time GPU was busy. + + + # Wavefronts Total wavefronts. + + + # VALUInsts The average number of vector ALU instructions executed per work-item (affected by flow control). + + + # SALUInsts The average number of scalar ALU instructions executed per work-item (affected by flow control). + + + # SFetchInsts The average number of scalar fetch instructions from the video memory executed per work-item (affected by flow control). + + + # GDSInsts The average number of GDS read or GDS write instructions executed per work item (affected by flow control). + + + # MemUnitBusy 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). + + + # ALUStalledByLDS The percentage of GPUTime ALU units are stalled by the LDS input queue being full or the output queue being not ready. If there are LDS bank conflicts, reduce them. Otherwise, try reducing the number of LDS accesses if possible. Value range: 0% (optimal) to 100% (bad). + + + + + @@ -33,7 +92,7 @@ - + @@ -428,7 +487,7 @@ - + @@ -476,7 +535,7 @@ - + @@ -517,63 +576,3 @@ #Navi21 - - - - # GPUBusy The percentage of time GPU was busy. - - - # Wavefronts Total wavefronts. - - - # VALUInsts The average number of vector ALU instructions executed per work-item (affected by flow control). - - - # SALUInsts The average number of scalar ALU instructions executed per work-item (affected by flow control). - - - # SFetchInsts The average number of scalar fetch instructions from the video memory executed per work-item (affected by flow control). - - - # GDSInsts The average number of GDS read or GDS write instructions executed per work item (affected by flow control). - - - # MemUnitBusy 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). - - - # ALUStalledByLDS The percentage of GPUTime ALU units are stalled by the LDS input queue being full or the output queue being not ready. If there are LDS bank conflicts, reduce them. Otherwise, try reducing the number of LDS accesses if possible. Value range: 0% (optimal) to 100% (bad). - - -