From 4027ee7a7a29ce1bee0891898ed72350c18f19d2 Mon Sep 17 00:00:00 2001 From: amokice-amd Date: Thu, 12 Feb 2026 15:55:28 +0000 Subject: [PATCH 1/8] separate compute views to functions Add pie chart to summary view add table, piechart and barchart to summary view Move charts to classes Move logic to separate classes Small clean Fix merge mistakes --- CMakeLists.txt | 4 +- .../rocprofvis_compute_summary_view.cpp | 64 ++ .../compute/rocprofvis_compute_summary_view.h | 34 + .../src/compute/rocprofvis_compute_view.cpp | 1002 +++++++++-------- .../src/compute/rocprofvis_compute_view.h | 25 + .../ROCPROFVIS_COMPUTE_MODEL_TYPES.CPP | 33 + .../compute/rocprofvis_compute_model_types.h | 35 +- src/view/src/widgets/rocprofvis_charts.cpp | 124 ++ src/view/src/widgets/rocprofvis_charts.h | 43 + 9 files changed, 905 insertions(+), 459 deletions(-) create mode 100644 src/view/src/compute/rocprofvis_compute_summary_view.cpp create mode 100644 src/view/src/compute/rocprofvis_compute_summary_view.h create mode 100644 src/view/src/model/compute/ROCPROFVIS_COMPUTE_MODEL_TYPES.CPP create mode 100644 src/view/src/widgets/rocprofvis_charts.cpp create mode 100644 src/view/src/widgets/rocprofvis_charts.h diff --git a/CMakeLists.txt b/CMakeLists.txt index daa4d838..495486bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES") -option(COMPUTE_UI_SUPPORT "Build with support for Rocprof Compute .CSVs" OFF) +option(COMPUTE_UI_SUPPORT "Build with support for Rocprof Compute .CSVs" ON) option(ROCPROFVIS_DEVELOPER_MODE "Enable developer mode features" OFF) option(ROCPROFVIS_ENABLE_INTERNAL_BANNER "Show diagonal internal build banner" OFF) option(USE_NATIVE_FILE_DIALOG "Use the OS native file dialog instead of ImGui file dialog" ON) @@ -105,6 +105,7 @@ set(VIEW_FILES src/view/src/rocprofvis_time_to_pixel.cpp src/view/src/rocprofvis_minimap.cpp src/view/src/widgets/rocprofvis_widget.cpp + src/view/src/widgets/rocprofvis_charts.cpp src/view/src/widgets/rocprofvis_split_containers.cpp src/view/src/widgets/rocprofvis_tab_container.cpp src/view/src/widgets/rocprofvis_editable_textfield.cpp @@ -121,6 +122,7 @@ list(APPEND VIEW_FILES src/view/src/model/compute/rocprofvis_compute_data_model.cpp src/view/src/compute/rocprofvis_compute_root.cpp src/view/src/compute/legacy/rocprofvis_compute_summary.cpp + src/view/src/compute/rocprofvis_compute_summary_view.cpp src/view/src/compute/legacy/rocprofvis_compute_block.cpp src/view/src/compute/legacy/rocprofvis_compute_table.cpp src/view/src/compute/rocprofvis_compute_data_provider.cpp diff --git a/src/view/src/compute/rocprofvis_compute_summary_view.cpp b/src/view/src/compute/rocprofvis_compute_summary_view.cpp new file mode 100644 index 00000000..2abebf75 --- /dev/null +++ b/src/view/src/compute/rocprofvis_compute_summary_view.cpp @@ -0,0 +1,64 @@ +// Copyright Advanced Micro Devices, Inc. +// SPDX-License-Identifier: MIT + +#include "rocprofvis_compute_summary_view.h" +#include "implot/implot.h" + +constexpr float DROPDOWN_SCALE = 15.0f; + +namespace RocProfVis +{ +namespace View +{ +void +NewComputeSummaryView::RenderSummaryView(const WorkloadInfo& workload) +{ + m_kernel_table_renderer(workload); + + static uint32_t selected_chart_id = 0; + + ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * DROPDOWN_SCALE); + if(ImGui::BeginCombo("ChartView", m_chart_views[selected_chart_id].data())) + { + for(uint32_t index = 0; index < m_chart_views.size(); index++) + { + const bool is_selected = (selected_chart_id == index); + if(ImGui::Selectable(m_chart_views[index].data(), is_selected)) + { + selected_chart_id = index; + } + + if(is_selected) ImGui::SetItemDefaultFocus(); + } + ImGui::EndCombo(); + } + + ImGui::BeginChild("Chart"); + + if(selected_chart_id == 0) + RenderPieChart(workload); + else if(selected_chart_id == 1) + RenderBarChart(workload); + + ImGui::EndChild(); // Chart +} + +void +NewComputeSummaryView::RenderPieChart(const WorkloadInfo& workload) +{ + m_pie_chart.UpdateData( + workload.GenerateChartData()); // TODO: Avoid updating each frames, think how to + // doit if it changes + m_pie_chart.Render(); +} + +void +NewComputeSummaryView::RenderBarChart(const WorkloadInfo& workload) +{ + m_bar_chart.UpdateData(workload.GenerateChartData()); + m_bar_chart.Render(); +} + + +} // namespace View +} // namespace RocProfVis \ No newline at end of file diff --git a/src/view/src/compute/rocprofvis_compute_summary_view.h b/src/view/src/compute/rocprofvis_compute_summary_view.h new file mode 100644 index 00000000..9ccedb23 --- /dev/null +++ b/src/view/src/compute/rocprofvis_compute_summary_view.h @@ -0,0 +1,34 @@ +// Copyright Advanced Micro Devices, Inc. +// SPDX-License-Identifier: MIT + +#pragma once +#include "../model/compute/rocprofvis_compute_model_types.h" +#include "../widgets/rocprofvis_charts.h" +#include + +namespace RocProfVis +{ +namespace View +{ + +class NewComputeSummaryView +{ +public: + NewComputeSummaryView( + std::function kernel_table_renderer) + : m_kernel_table_renderer(kernel_table_renderer) {}; + void RenderSummaryView(const WorkloadInfo& workload); +private: + void RenderPieChart(const WorkloadInfo& workload); + void RenderBarChart(const WorkloadInfo& workload); + std::function m_kernel_table_renderer; + + const std::vector m_chart_views = { "Pie Chart", "Bar Chart" }; + + PieChart m_pie_chart; + BarChart m_bar_chart; +}; + + +} // namespace View +} // namespace RocProfVis \ No newline at end of file diff --git a/src/view/src/compute/rocprofvis_compute_view.cpp b/src/view/src/compute/rocprofvis_compute_view.cpp index b1f4f175..803a8d8d 100644 --- a/src/view/src/compute/rocprofvis_compute_view.cpp +++ b/src/view/src/compute/rocprofvis_compute_view.cpp @@ -15,6 +15,7 @@ namespace RocProfVis { namespace View { +constexpr float DROPDOWN_SCALE = 15.0f; ComputeView::ComputeView() : m_view_created(false) @@ -239,6 +240,10 @@ ComputeWorkloadView::ComputeWorkloadView(DataProvider& data_provider, std::share ComputeTester::ComputeTester(DataProvider& data_provider) : m_data_provider(data_provider) , m_selections({ true, 0, {}, {}, SelectionState::FP32, {}, {}, {} }) +, m_summary_view([this](const WorkloadInfo& workload) +{ + this->RenderKernels(workload); +}) , m_display_names({ { { kRPVControllerRooflineCeilingComputeVALUI8, "VALU I8" }, @@ -281,7 +286,7 @@ ComputeTester::Render() { const std::unordered_map& workloads = m_data_provider.ComputeModel().GetWorkloads(); - ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * 15.0f); + ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * DROPDOWN_SCALE); if(ImGui::BeginCombo("Workloads", workloads.count(m_selections.workload_id) > 0 ? workloads.at(m_selections.workload_id).name.c_str() @@ -303,301 +308,381 @@ ComputeTester::Render() } ImGui::EndCombo(); } + + static uint32_t selected_view_id = 0; + ImGui::SameLine(); + ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * DROPDOWN_SCALE); + if(ImGui::BeginCombo("View", m_views[selected_view_id].data())) + { + for(uint32_t index = 0; index < m_views.size(); index++) + { + const bool is_selected = (selected_view_id == index); + if(ImGui::Selectable(m_views[index].data(), is_selected)) + selected_view_id = index; + + if(is_selected) + ImGui::SetItemDefaultFocus(); + } + ImGui::EndCombo(); + } + if(workloads.count(m_selections.workload_id) > 0) { - ImGui::BeginChild("sv"); - ImGui::BeginChild("info", ImVec2(0, 0), - ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); - const WorkloadInfo& workload = workloads.at(m_selections.workload_id); - if(workload.system_info.size() == 2 && - workload.system_info[0].size() == workload.system_info[1].size()) + ImGui::BeginChild("sv"); //What is sv? + RenderSelectedView(workloads, selected_view_id); + ImGui::EndChild(); //Sv + m_selections.init = false; + } +} + +void +ComputeTester::RenderSelectedView( + const std::unordered_map& workloads, uint32_t view_index) +{ + const WorkloadInfo& workload = workloads.at(m_selections.workload_id); + switch(view_index) // TODO: Replace index to something readable + { + case 0: { - ImGui::BeginChild("sys_info", - ImVec2(ImGui::GetContentRegionAvail().x / 2.0f, 0.0f), - ImGuiChildFlags_AutoResizeY); - ImGui::Text("System Information"); - if(ImGui::BeginTable("", static_cast(workload.system_info.size()), - ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders)) + RenderSystemAndConfig(workload); + break; + } + case 1: + { + RenderProfilingConfig(workload); + break; + } + case 2: + { + RenderMetrics(workload); + break; + } + case 3: + { + RenderKernels(workload); + break; + } + case 4: + { + RenderFetcher(workload); + break; + } + case 5: + { + RenderRoofLine(workload); + break; + } + case 6: + { + RenderSummaryView(workload); + break; + } + } +} + +void +ComputeTester::RenderSystemAndConfig(const WorkloadInfo& workload) +{ + ImGui::BeginChild("info", ImVec2(0, 0), + ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); + if(workload.system_info.size() == 2 && + workload.system_info[0].size() == workload.system_info[1].size()) + { + ImGui::BeginChild("sys_info", + ImVec2(ImGui::GetContentRegionAvail().x / 2.0f, 0.0f), + ImGuiChildFlags_AutoResizeY); + ImGui::Text("System Information"); + if(ImGui::BeginTable("", static_cast(workload.system_info.size()), + ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders)) + { + for(size_t i = 0; i < workload.system_info[0].size(); i++) { - for(size_t i = 0; i < workload.system_info[0].size(); i++) - { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text(workload.system_info[0][i].c_str()); - ImGui::TableNextColumn(); - ImGui::Text(workload.system_info[1][i].c_str()); - } - ImGui::EndTable(); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text(workload.system_info[0][i].c_str()); + ImGui::TableNextColumn(); + ImGui::Text(workload.system_info[1][i].c_str()); } - ImGui::EndChild(); + ImGui::EndTable(); } - if(workload.profiling_config.size() == 2 && - workload.profiling_config[0].size() == workload.profiling_config[1].size()) + ImGui::EndChild(); + } + ImGui::EndChild(); +} + +void +ComputeTester::RenderProfilingConfig(const WorkloadInfo& workload) +{ + if(workload.profiling_config.size() == 2 && + workload.profiling_config[0].size() == workload.profiling_config[1].size()) + { + ImGui::BeginChild("config", ImVec2(0, 0), ImGuiChildFlags_AutoResizeY); + ImGui::Text("Profiling Configuration"); + if(ImGui::BeginTable("", static_cast(workload.profiling_config.size()), + ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders)) { - ImGui::SameLine(); - ImGui::BeginChild("config", ImVec2(0, 0), ImGuiChildFlags_AutoResizeY); - ImGui::Text("Profiling Configuration"); - if(ImGui::BeginTable("", static_cast(workload.profiling_config.size()), - ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders)) + for(size_t i = 0; i < workload.profiling_config[0].size(); i++) { - for(size_t i = 0; i < workload.profiling_config[0].size(); i++) - { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text(workload.profiling_config[0][i].c_str()); - ImGui::TableNextColumn(); - ImGui::Text(workload.profiling_config[1][i].c_str()); - } - ImGui::EndTable(); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text(workload.profiling_config[0][i].c_str()); + ImGui::TableNextColumn(); + ImGui::Text(workload.profiling_config[1][i].c_str()); } - ImGui::EndChild(); + ImGui::EndTable(); } ImGui::EndChild(); - ImGui::NewLine(); - ImGui::BeginChild("metrics", ImVec2(0, 0), - ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); - ImGui::Text("Available Metrics"); - for(const std::pair& category : - workload.available_metrics.tree) + } +} + +void +ComputeTester::RenderMetrics(const WorkloadInfo& workload) +{ + ImGui::BeginChild("metrics", ImVec2(0, 0), + ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); + ImGui::Text("Available Metrics"); + for(const std::pair& category : + workload.available_metrics.tree) + { + ImGui::PushID(static_cast(category.first)); + if(ImGui::TreeNodeEx(std::string("[" + std::to_string(category.second.id) + "] " + + category.second.name) + .c_str())) { - ImGui::PushID(static_cast(category.first)); - if(ImGui::TreeNodeEx(std::string("[" + std::to_string(category.second.id) + - "] " + category.second.name) - .c_str())) + for(const std::pair& table : + category.second.tables) { - for(const std::pair& table : - category.second.tables) + ImGui::PushID(static_cast(table.first)); + std::string partial_metric_id = std::to_string(category.second.id) + "." + + std::to_string(table.second.id); + bool table_selected = + m_selections.metric_ids.count(category.first) > 0 && + m_selections.metric_ids.at(category.first).count(table.first) > 0 && + m_selections.metric_ids.at(category.first).at(table.first).first; + bool table_selected_changed = ImGui::Selectable("", table_selected); + if(table_selected_changed) { - ImGui::PushID(static_cast(table.first)); - std::string partial_metric_id = std::to_string(category.second.id) + - "." + std::to_string(table.second.id); - bool table_selected = - m_selections.metric_ids.count(category.first) > 0 && - m_selections.metric_ids.at(category.first).count(table.first) > - 0 && - m_selections.metric_ids.at(category.first).at(table.first).first; - bool table_selected_changed = ImGui::Selectable("", table_selected); - if(table_selected_changed) + if(table_selected) { - if(table_selected) + if(m_selections.metric_ids.at(category.first).size() == 1) { - if(m_selections.metric_ids.at(category.first).size() == 1) - { - m_selections.metric_ids.erase(category.first); - } - else - { - m_selections.metric_ids.at(category.first) - .erase(table.first); - } + m_selections.metric_ids.erase(category.first); } else { - m_selections.metric_ids[category.first][table.first] = { true, - {} }; + m_selections.metric_ids.at(category.first).erase(table.first); } } - ImGui::SameLine(0.0f); - ImGui::BeginDisabled(table_selected); - if(ImGui::TreeNodeEx( - std::string("[" + partial_metric_id + "] " + table.second.name) - .c_str(), - ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_Bullet)) + else + { + m_selections.metric_ids[category.first][table.first] = { true, + {} }; + } + } + ImGui::SameLine(0.0f); + ImGui::BeginDisabled(table_selected); + if(ImGui::TreeNodeEx( + std::string("[" + partial_metric_id + "] " + table.second.name) + .c_str(), + ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_Bullet)) + { + if(ImGui::BeginTable("", 5, + ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | + ImGuiTableFlags_SizingStretchSame)) { - if(ImGui::BeginTable("", 5, - ImGuiTableFlags_RowBg | - ImGuiTableFlags_Borders | - ImGuiTableFlags_SizingStretchSame)) + int col = 0; + for(const std::pair& + entry : table.second.entries) { - int col = 0; - for(const std::pair& - entry : table.second.entries) + if(col % 5 == 0) { - if(col % 5 == 0) - { - ImGui::TableNextRow(); - } - ImGui::TableNextColumn(); - bool entry_selected = - m_selections.metric_ids.count(category.first) > 0 && - m_selections.metric_ids.at(category.first) - .count(table.first) > 0 && - m_selections.metric_ids.at(category.first) - .at(table.first) - .second.count(entry.first) > 0; - if(ImGui::Selectable( - std::string("[" + partial_metric_id + "." + - std::to_string(entry.second.id) + - "] " + entry.second.name) - .c_str(), - entry_selected)) + ImGui::TableNextRow(); + } + ImGui::TableNextColumn(); + bool entry_selected = + m_selections.metric_ids.count(category.first) > 0 && + m_selections.metric_ids.at(category.first) + .count(table.first) > 0 && + m_selections.metric_ids.at(category.first) + .at(table.first) + .second.count(entry.first) > 0; + if(ImGui::Selectable( + std::string("[" + partial_metric_id + "." + + std::to_string(entry.second.id) + "] " + + entry.second.name) + .c_str(), + entry_selected)) + { + if(entry_selected) { - if(entry_selected) + if(m_selections.metric_ids.at(category.first) + .at(table.first) + .second.size() == 1) { if(m_selections.metric_ids.at(category.first) - .at(table.first) - .second.size() == 1) + .size() == 1) { - if(m_selections.metric_ids.at(category.first) - .size() == 1) - { - m_selections.metric_ids.erase( - category.first); - } - else - { - m_selections.metric_ids.at(category.first) - .erase(table.first); - } + m_selections.metric_ids.erase(category.first); } else { m_selections.metric_ids.at(category.first) - .at(table.first) - .second.erase(entry.first); + .erase(table.first); } } else { - m_selections - .metric_ids[category.first][table.first] - .second.insert(entry.first); + m_selections.metric_ids.at(category.first) + .at(table.first) + .second.erase(entry.first); } } - if(ImGui::BeginItemTooltip()) + else { - ImGui::PushTextWrapPos(500.0f); - ImGui::Text("Description: "); - ImGui::SameLine(); - ImGui::Text(entry.second.description.c_str()); - ImGui::Text("Unit: "); - ImGui::SameLine(); - ImGui::Text(entry.second.unit.c_str()); - ImGui::PopTextWrapPos(); - ImGui::EndTooltip(); + m_selections.metric_ids[category.first][table.first] + .second.insert(entry.first); } - col++; } - ImGui::EndTable(); + if(ImGui::BeginItemTooltip()) + { + ImGui::PushTextWrapPos(500.0f); + ImGui::Text("Description: "); + ImGui::SameLine(); + ImGui::Text(entry.second.description.c_str()); + ImGui::Text("Unit: "); + ImGui::SameLine(); + ImGui::Text(entry.second.unit.c_str()); + ImGui::PopTextWrapPos(); + ImGui::EndTooltip(); + } + col++; } - ImGui::TreePop(); + ImGui::EndTable(); } - ImGui::EndDisabled(); - ImGui::PopID(); + ImGui::TreePop(); } - ImGui::TreePop(); + ImGui::EndDisabled(); + ImGui::PopID(); } - ImGui::PopID(); + ImGui::TreePop(); } - ImGui::EndChild(); - ImGui::NewLine(); - ImGui::BeginChild("kernels", ImVec2(0, 0), - ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); - ImGui::Text("Kernels"); - if(ImGui::BeginTable("", 8, - ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | - ImGuiTableFlags_SizingStretchSame)) + ImGui::PopID(); + } + ImGui::EndChild(); +} + +void +ComputeTester::RenderKernels(const WorkloadInfo& workload) +{ + ImGui::BeginChild("kernels", ImVec2(0, 0), + ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); + ImGui::Text("Kernels"); + if(ImGui::BeginTable("", 8, + ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | + ImGuiTableFlags_SizingStretchSame)) + { + ImGui::TableSetupColumn("ID"); + ImGui::TableSetupColumn("Name"); + ImGui::TableSetupColumn("Invocation Count"); + ImGui::TableSetupColumn("Total Duration"); + ImGui::TableSetupColumn("Min Duration"); + ImGui::TableSetupColumn("Max Duration"); + ImGui::TableSetupColumn("Mean Duration"); + ImGui::TableSetupColumn("Median Duration"); + ImGui::TableHeadersRow(); + for(const std::pair& kernel : workload.kernels) { - ImGui::TableSetupColumn("ID"); - ImGui::TableSetupColumn("Name"); - ImGui::TableSetupColumn("Invocation Count"); - ImGui::TableSetupColumn("Total Duration"); - ImGui::TableSetupColumn("Min Duration"); - ImGui::TableSetupColumn("Max Duration"); - ImGui::TableSetupColumn("Mean Duration"); - ImGui::TableSetupColumn("Median Duration"); - ImGui::TableHeadersRow(); - for(const std::pair& kernel : workload.kernels) + ImGui::PushID(static_cast(kernel.second.id)); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.id); + ImGui::SameLine(); + bool kernel_selected = m_selections.kernel_ids.count(kernel.second.id) > 0; + if(ImGui::Selectable("", kernel_selected, + ImGuiSelectableFlags_SpanAllColumns)) { - ImGui::PushID(static_cast(kernel.second.id)); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.id); - ImGui::SameLine(); - bool kernel_selected = - m_selections.kernel_ids.count(kernel.second.id) > 0; - if(ImGui::Selectable("", kernel_selected, - ImGuiSelectableFlags_SpanAllColumns)) + if(kernel_selected) { - if(kernel_selected) - { - m_selections.kernel_ids.erase(kernel.second.id); - } - else - { - m_selections.kernel_ids.insert(kernel.second.id); - } + m_selections.kernel_ids.erase(kernel.second.id); + } + else + { + m_selections.kernel_ids.insert(kernel.second.id); } - ImGui::TableNextColumn(); - ImGui::Text(kernel.second.name.c_str()); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.invocation_count); - ImGui::TableNextColumn(); - ImGui::Text("%llu", kernel.second.duration_total); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.duration_min); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.duration_max); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.duration_mean); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.duration_median); - ImGui::PopID(); } - ImGui::EndTable(); + ImGui::TableNextColumn(); + ImGui::Text(kernel.second.name.c_str()); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.invocation_count); + ImGui::TableNextColumn(); + ImGui::Text("%llu", kernel.second.duration_total); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_min); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_max); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_mean); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_median); + ImGui::PopID(); } - ImGui::EndChild(); - ImGui::NewLine(); - ImGui::BeginChild("fetcher", ImVec2(0, 0), - ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); - ImGui::Text("Fetcher"); - if(ImGui::BeginTable( - "selected_metrics", 1, - ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | - ImGuiTableFlags_SizingStretchSame, - ImVec2((ImGui::GetContentRegionAvail().x - ImGui::CalcTextSize("for").x) / - 2.0f, - 0.0f))) + ImGui::EndTable(); + } + ImGui::EndChild(); +} + +void +ComputeTester::RenderFetcher(const WorkloadInfo& workload) +{ + ImGui::BeginChild("fetcher", ImVec2(0, 0), + ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); + ImGui::Text("Fetcher"); + if(ImGui::BeginTable( + "selected_metrics", 1, + ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | + ImGuiTableFlags_SizingStretchSame, + ImVec2((ImGui::GetContentRegionAvail().x - ImGui::CalcTextSize("for").x) / + 2.0f, + 0.0f))) + { + ImGui::TableSetupColumn("Metric ID(s)"); + ImGui::TableHeadersRow(); + if(m_selections.metric_ids.empty()) { - ImGui::TableSetupColumn("Metric ID(s)"); - ImGui::TableHeadersRow(); - if(m_selections.metric_ids.empty()) - { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::TextDisabled("None"); - } - else + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TextDisabled("None"); + } + else + { + for(const std::pair< + const uint32_t, + std::unordered_map>>>& + category : m_selections.metric_ids) { - for(const std::pair< - const uint32_t, - std::unordered_map< - uint32_t, std::pair>>>& - category : m_selections.metric_ids) + for(const std::pair>>& + table : category.second) { - for(const std::pair>>& - table : category.second) + if(table.second.second.empty()) + { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("%u.%u", category.first, table.first); + } + else { - if(table.second.second.empty()) + for(const uint32_t& entry : table.second.second) { ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::Text("%u.%u", category.first, table.first); - } - else - { - for(const uint32_t& entry : table.second.second) - { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("%u.%u.%u", category.first, table.first, - entry); - } + ImGui::Text("%u.%u.%u", category.first, table.first, entry); } } } } + } ImGui::EndTable(); } @@ -836,175 +921,153 @@ ComputeTester::Render() ImPlot::SetupAxisScale(ImAxis_X1, ImPlotScale_Log10); ImPlot::SetupAxisScale(ImAxis_Y1, ImPlotScale_Log10); - for(const std::pair& kernel : workload.kernels) + for(const std::pair& kernel : workload.kernels) + { + for(const std::pair< + const rocprofvis_controller_roofline_kernel_intensity_type_t, + KernelInfo::Roofline::Intensity>& intensity : + kernel.second.roofline.intensities) { - for(const std::pair< - const rocprofvis_controller_roofline_kernel_intensity_type_t, - KernelInfo::Roofline::Intensity>& intensity : - kernel.second.roofline.intensities) + if(m_selections.intensities.count(kernel.second.id) > 0 && + m_selections.intensities.at(kernel.second.id) + .count(intensity.second.type) > 0) { - if(m_selections.intensities.count(kernel.second.id) > 0 && - m_selections.intensities.at(kernel.second.id) - .count(intensity.second.type) > 0) - { - ImGui::PushID(i++); - ImPlot::PlotScatter("", &intensity.second.position.x, - &intensity.second.position.y, 1); - ImGui::PopID(); - } + ImGui::PushID(i++); + ImPlot::PlotScatter("", &intensity.second.position.x, + &intensity.second.position.y, 1); + ImGui::PopID(); } } - for(const auto& compute_it : workload.roofline.ceiling_compute) + } + for(const auto& compute_it : workload.roofline.ceiling_compute) + { + for(const auto& bandwidth_it : compute_it.second) { - for(const auto& bandwidth_it : compute_it.second) + if(m_selections.ceilings_compute.count(compute_it.first) > 0 && + m_selections.ceilings_compute.at(compute_it.first) + .count(bandwidth_it.first) > 0) { - if(m_selections.ceilings_compute.count(compute_it.first) > 0 && - m_selections.ceilings_compute.at(compute_it.first) - .count(bandwidth_it.first) > 0) - { - ImGui::PushID(i++); - ImPlot::PlotLineG( - "", - [](int idx, void* user_data) -> ImPlotPoint { - const WorkloadInfo::Roofline::Line* line = - static_cast( - user_data); - ImPlotPoint point(-1.0, -1.0); - if(line) + ImGui::PushID(i++); + ImPlot::PlotLineG( + "", + [](int idx, void* user_data) -> ImPlotPoint { + const WorkloadInfo::Roofline::Line* line = + static_cast( + user_data); + ImPlotPoint point(-1.0, -1.0); + if(line) + { + if(idx == 0) { - if(idx == 0) - { - point.x = line->p1.x; - point.y = line->p1.y; - } - else - { - point.x = line->p2.x; - point.y = line->p2.y; - } + point.x = line->p1.x; + point.y = line->p1.y; } - return point; - }, - (void*) &bandwidth_it.second.position, 2); - ImGui::PopID(); - } - } - } - for(const auto& bandwidth_it : workload.roofline.ceiling_bandwidth) - { - for(const auto& compute_it : bandwidth_it.second) - { - if(m_selections.ceilings_bandwidth.count(bandwidth_it.first) > 0 && - m_selections.ceilings_bandwidth.at(bandwidth_it.first) - .count(compute_it.first) > 0) - { - ImGui::PushID(i++); - ImPlot::PlotLineG( - "", - [](int idx, void* user_data) -> ImPlotPoint { - const WorkloadInfo::Roofline::Line* line = - static_cast( - user_data); - ImPlotPoint point(-1.0, -1.0); - if(line) + else { - if(idx == 0) - { - point.x = line->p1.x; - point.y = line->p1.y; - } - else - { - point.x = line->p2.x; - point.y = line->p2.y; - } + point.x = line->p2.x; + point.y = line->p2.y; } - return point; - }, - (void*) &compute_it.second.position, 2); - ImGui::PopID(); - } + } + return point; + }, + (void*) &bandwidth_it.second.position, 2); + ImGui::PopID(); } } - ImPlot::EndPlot(); } - int preset_idx = static_cast(m_selections.roofline_preset); - if(m_selections.init || - ImGui::Combo("Presets", &preset_idx, "FP32\0FP64\0Custom\0\0")) + for(const auto& bandwidth_it : workload.roofline.ceiling_bandwidth) { - m_selections.roofline_preset = - static_cast(preset_idx); - if(m_selections.roofline_preset == SelectionState::FP32) + for(const auto& compute_it : bandwidth_it.second) { - m_selections.ceilings_compute = { - { kRPVControllerRooflineCeilingComputeMFMAFP32, - { kRPVControllerRooflineCeilingTypeBandwidthLDS } }, - { kRPVControllerRooflineCeilingComputeVALUFP32, - { kRPVControllerRooflineCeilingTypeBandwidthLDS } } - }; - m_selections.ceilings_bandwidth = { - { kRPVControllerRooflineCeilingTypeBandwidthHBM, - { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, - { kRPVControllerRooflineCeilingTypeBandwidthL2, - { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, - { kRPVControllerRooflineCeilingTypeBandwidthL1, - { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, - { kRPVControllerRooflineCeilingTypeBandwidthLDS, - { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, - }; - for(const std::pair& kernel : - workload.kernels) + if(m_selections.ceilings_bandwidth.count(bandwidth_it.first) > 0 && + m_selections.ceilings_bandwidth.at(bandwidth_it.first) + .count(compute_it.first) > 0) { - for(const std::pair< - const rocprofvis_controller_roofline_kernel_intensity_type_t, - KernelInfo::Roofline::Intensity>& intensity : - kernel.second.roofline.intensities) - { - m_selections.intensities[kernel.second.id].insert( - intensity.second.type); - } + ImGui::PushID(i++); + ImPlot::PlotLineG( + "", + [](int idx, void* user_data) -> ImPlotPoint { + const WorkloadInfo::Roofline::Line* line = + static_cast( + user_data); + ImPlotPoint point(-1.0, -1.0); + if(line) + { + if(idx == 0) + { + point.x = line->p1.x; + point.y = line->p1.y; + } + else + { + point.x = line->p2.x; + point.y = line->p2.y; + } + } + return point; + }, + (void*) &compute_it.second.position, 2); + ImGui::PopID(); } } - else if(m_selections.roofline_preset == SelectionState::FP64) + } + ImPlot::EndPlot(); + } + + int preset_idx = static_cast(m_selections.roofline_preset); + if(m_selections.init || + ImGui::Combo("Presets", &preset_idx, "FP32\0FP64\0Custom\0\0")) + { + m_selections.roofline_preset = + static_cast(preset_idx); + if(m_selections.roofline_preset == SelectionState::FP32) + { + m_selections.ceilings_compute = { + { kRPVControllerRooflineCeilingComputeMFMAFP32, + { kRPVControllerRooflineCeilingTypeBandwidthLDS } }, + { kRPVControllerRooflineCeilingComputeVALUFP32, + { kRPVControllerRooflineCeilingTypeBandwidthLDS } } + }; + m_selections.ceilings_bandwidth = { + { kRPVControllerRooflineCeilingTypeBandwidthHBM, + { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, + { kRPVControllerRooflineCeilingTypeBandwidthL2, + { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, + { kRPVControllerRooflineCeilingTypeBandwidthL1, + { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, + { kRPVControllerRooflineCeilingTypeBandwidthLDS, + { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, + }; + for(const std::pair& kernel : workload.kernels) { - m_selections.ceilings_compute = { - { kRPVControllerRooflineCeilingComputeMFMAFP64, - { kRPVControllerRooflineCeilingTypeBandwidthLDS } }, - { kRPVControllerRooflineCeilingComputeVALUFP64, - { kRPVControllerRooflineCeilingTypeBandwidthLDS } } - }; - m_selections.ceilings_bandwidth = { - { kRPVControllerRooflineCeilingTypeBandwidthHBM, - { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, - { kRPVControllerRooflineCeilingTypeBandwidthL2, - { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, - { kRPVControllerRooflineCeilingTypeBandwidthL1, - { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, - { kRPVControllerRooflineCeilingTypeBandwidthLDS, - { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, - }; - for(const std::pair& kernel : - workload.kernels) + for(const std::pair< + const rocprofvis_controller_roofline_kernel_intensity_type_t, + KernelInfo::Roofline::Intensity>& intensity : + kernel.second.roofline.intensities) { - for(const std::pair< - const rocprofvis_controller_roofline_kernel_intensity_type_t, - KernelInfo::Roofline::Intensity>& intensity : - kernel.second.roofline.intensities) - { - m_selections.intensities[kernel.second.id].insert( - intensity.second.type); - } + m_selections.intensities[kernel.second.id].insert( + intensity.second.type); } } } - if(m_selections.roofline_preset == SelectionState::Custom && - ImGui::BeginTable("customizer", 2, - ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | - ImGuiTableFlags_SizingStretchSame)) + else if(m_selections.roofline_preset == SelectionState::FP64) { - ImGui::TableSetupColumn("Type"); - ImGui::TableSetupColumn("Element"); - ImGui::TableHeadersRow(); + m_selections.ceilings_compute = { + { kRPVControllerRooflineCeilingComputeMFMAFP64, + { kRPVControllerRooflineCeilingTypeBandwidthLDS } }, + { kRPVControllerRooflineCeilingComputeVALUFP64, + { kRPVControllerRooflineCeilingTypeBandwidthLDS } } + }; + m_selections.ceilings_bandwidth = { + { kRPVControllerRooflineCeilingTypeBandwidthHBM, + { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, + { kRPVControllerRooflineCeilingTypeBandwidthL2, + { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, + { kRPVControllerRooflineCeilingTypeBandwidthL1, + { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, + { kRPVControllerRooflineCeilingTypeBandwidthLDS, + { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, + }; for(const std::pair& kernel : workload.kernels) { for(const std::pair< @@ -1012,106 +1075,125 @@ ComputeTester::Render() KernelInfo::Roofline::Intensity>& intensity : kernel.second.roofline.intensities) { - ImGui::PushID(i++); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("Kernel Intensity"); - ImGui::SameLine(); - bool show = m_selections.intensities.count(kernel.second.id) > 0 && - m_selections.intensities.at(kernel.second.id) - .count(intensity.second.type) > 0; - if(ImGui::Selectable("", show, ImGuiSelectableFlags_SpanAllColumns)) - { - if(show) - { + m_selections.intensities[kernel.second.id].insert( + intensity.second.type); + } + } + } + } + + if(m_selections.roofline_preset == SelectionState::Custom && + ImGui::BeginTable("customizer", 2, + ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | + ImGuiTableFlags_SizingStretchSame)) + { + ImGui::TableSetupColumn("Type"); + ImGui::TableSetupColumn("Element"); + ImGui::TableHeadersRow(); + for(const std::pair& kernel : workload.kernels) + { + for(const std::pair< + const rocprofvis_controller_roofline_kernel_intensity_type_t, + KernelInfo::Roofline::Intensity>& intensity : + kernel.second.roofline.intensities) + { + ImGui::PushID(i++); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("Kernel Intensity"); + ImGui::SameLine(); + bool show = m_selections.intensities.count(kernel.second.id) > 0 && m_selections.intensities.at(kernel.second.id) - .erase(intensity.second.type); - } - else - { - m_selections.intensities[kernel.second.id].insert( - intensity.second.type); - } + .count(intensity.second.type) > 0; + if(ImGui::Selectable("", show, ImGuiSelectableFlags_SpanAllColumns)) + { + if(show) + { + m_selections.intensities.at(kernel.second.id) + .erase(intensity.second.type); + } + else + { + m_selections.intensities[kernel.second.id].insert( + intensity.second.type); } - ImGui::TableNextColumn(); - ImGui::Text("ID:%u - %s", kernel.second.id, - m_display_names.intensity.at(intensity.second.type)); - ImGui::PopID(); } + ImGui::TableNextColumn(); + ImGui::Text("ID:%u - %s", kernel.second.id, + m_display_names.intensity.at(intensity.second.type)); + ImGui::PopID(); } - for(const auto& compute_it : workload.roofline.ceiling_compute) + } + for(const auto& compute_it : workload.roofline.ceiling_compute) + { + for(const auto& bandwidth_it : compute_it.second) { - for(const auto& bandwidth_it : compute_it.second) + ImGui::PushID(i++); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("Compute Ceiling"); + ImGui::SameLine(); + bool show = m_selections.ceilings_compute.count(compute_it.first) > 0 && + m_selections.ceilings_compute.at(compute_it.first) + .count(bandwidth_it.first) > 0; + if(ImGui::Selectable("", show, ImGuiSelectableFlags_SpanAllColumns)) { - ImGui::PushID(i++); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("Compute Ceiling"); - ImGui::SameLine(); - bool show = - m_selections.ceilings_compute.count(compute_it.first) > 0 && + if(show) + { m_selections.ceilings_compute.at(compute_it.first) - .count(bandwidth_it.first) > 0; - if(ImGui::Selectable("", show, ImGuiSelectableFlags_SpanAllColumns)) + .erase(bandwidth_it.first); + } + else { - if(show) - { - m_selections.ceilings_compute.at(compute_it.first) - .erase(bandwidth_it.first); - } - else - { - m_selections.ceilings_compute[compute_it.first].insert( - bandwidth_it.first); - } + m_selections.ceilings_compute[compute_it.first].insert( + bandwidth_it.first); } - ImGui::TableNextColumn(); - ImGui::Text("%s-%s", - m_display_names.ceiling_compute.at(compute_it.first), - m_display_names.ceiling_bandwidth.at(bandwidth_it.first)); - ImGui::PopID(); } + ImGui::TableNextColumn(); + ImGui::Text("%s-%s", m_display_names.ceiling_compute.at(compute_it.first), + m_display_names.ceiling_bandwidth.at(bandwidth_it.first)); + ImGui::PopID(); } - for(const auto& bandwidth_it : workload.roofline.ceiling_bandwidth) + } + for(const auto& bandwidth_it : workload.roofline.ceiling_bandwidth) + { + for(const auto& compute_it : bandwidth_it.second) { - for(const auto& compute_it : bandwidth_it.second) + ImGui::PushID(i++); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("Bandwidth Ceiling"); + ImGui::SameLine(); + bool show = + m_selections.ceilings_bandwidth.count(bandwidth_it.first) > 0 && + m_selections.ceilings_bandwidth.at(bandwidth_it.first) + .count(compute_it.first) > 0; + if(ImGui::Selectable("", show, ImGuiSelectableFlags_SpanAllColumns)) { - ImGui::PushID(i++); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("Bandwidth Ceiling"); - ImGui::SameLine(); - bool show = - m_selections.ceilings_bandwidth.count(bandwidth_it.first) > 0 && + if(show) + { m_selections.ceilings_bandwidth.at(bandwidth_it.first) - .count(compute_it.first) > 0; - if(ImGui::Selectable("", show, ImGuiSelectableFlags_SpanAllColumns)) + .erase(compute_it.first); + } + else { - if(show) - { - m_selections.ceilings_bandwidth.at(bandwidth_it.first) - .erase(compute_it.first); - } - else - { - m_selections.ceilings_bandwidth[bandwidth_it.first].insert( - compute_it.first); - } + m_selections.ceilings_bandwidth[bandwidth_it.first].insert( + compute_it.first); } - ImGui::TableNextColumn(); - ImGui::Text("%s-%s", - m_display_names.ceiling_bandwidth.at(bandwidth_it.first), - m_display_names.ceiling_compute.at(compute_it.first)); - ImGui::PopID(); } + ImGui::TableNextColumn(); + ImGui::Text("%s-%s", + m_display_names.ceiling_bandwidth.at(bandwidth_it.first), + m_display_names.ceiling_compute.at(compute_it.first)); + ImGui::PopID(); } - ImGui::EndTable(); } - ImGui::EndChild(); - ImGui::EndChild(); - m_selections.init = false; + ImGui::EndTable(); } + ImGui::EndChild(); + m_selections.init = false; + RenderKernelSelectionTable(); } @@ -1234,5 +1316,11 @@ ComputeTester::RenderKernelSelectionTable() } } +void +ComputeTester::RenderSummaryView(const WorkloadInfo& workload) +{ + m_summary_view.RenderSummaryView(workload); +} + } // namespace View } // namespace RocProfVis diff --git a/src/view/src/compute/rocprofvis_compute_view.h b/src/view/src/compute/rocprofvis_compute_view.h index b27a8ed4..47e00af7 100644 --- a/src/view/src/compute/rocprofvis_compute_view.h +++ b/src/view/src/compute/rocprofvis_compute_view.h @@ -6,6 +6,7 @@ #include "rocprofvis_root_view.h" #include "widgets/rocprofvis_tab_container.h" #include "rocprofvis_compute_selection.h" +#include "rocprofvis_compute_summary_view.h" namespace RocProfVis { @@ -81,6 +82,7 @@ class ComputeWorkloadView: public RocWidget std::shared_ptr m_compute_selection; }; + class ComputeTester : public RocWidget { public: @@ -135,9 +137,32 @@ class ComputeTester : public RocWidget intensity; }; + void RenderSelectedView(const std::unordered_map& workloads, + uint32_t view_index); + void RenderSystemAndConfig(const WorkloadInfo& workload); + void RenderProfilingConfig(const WorkloadInfo& workload); + void RenderMetrics(const WorkloadInfo& workload); + void RenderKernels(const WorkloadInfo& workload); + void RenderFetcher(const WorkloadInfo& workload); + void RenderRoofLine(const WorkloadInfo& workload); + void RenderSummaryView(const WorkloadInfo& workload); + + const std::vector m_views = { "System Information", + "Profiling Configuration", "Metrics", + "Kernels", + "Fetcher", + "RoofLine", + "Summary View" }; //TODO: figure out better way to store it + + + DataProvider& m_data_provider; SelectionState m_selections; DisplayStrings m_display_names; + + NewComputeSummaryView m_summary_view; + PieChart m_pie_chart; + BarChart m_bar_chart; }; } // namespace View diff --git a/src/view/src/model/compute/ROCPROFVIS_COMPUTE_MODEL_TYPES.CPP b/src/view/src/model/compute/ROCPROFVIS_COMPUTE_MODEL_TYPES.CPP new file mode 100644 index 00000000..3f2fa04e --- /dev/null +++ b/src/view/src/model/compute/ROCPROFVIS_COMPUTE_MODEL_TYPES.CPP @@ -0,0 +1,33 @@ +#include "rocprofvis_compute_model_types.h" + +namespace RocProfVis +{ +namespace View +{ +ChartData +WorkloadInfo::GenerateChartData() const +{ + ChartData data; + double total = 0.0; + for(const auto& kernel : kernels) + { + data.m_labels.push_back(kernel.second.name.c_str()); + data.m_x_values.push_back(static_cast(kernel.second.duration_total)); + data.m_y_values.push_back(static_cast(data.m_y_values.size())); + data.m_x_max = std::max(data.m_x_max, data.m_x_values.back()); + total += data.m_x_values.back(); + } + + data.m_fractions.resize( + data.m_x_values + .size()); // TODO: It need only for PieChart thing how to read of there + for(size_t i = 0; i < data.m_x_values.size(); ++i) + { + data.m_fractions[i] = data.m_x_values[i] / total; + } + + return data; +}; + +} +} diff --git a/src/view/src/model/compute/rocprofvis_compute_model_types.h b/src/view/src/model/compute/rocprofvis_compute_model_types.h index 531ae0b3..ac5dd9c3 100644 --- a/src/view/src/model/compute/rocprofvis_compute_model_types.h +++ b/src/view/src/model/compute/rocprofvis_compute_model_types.h @@ -75,6 +75,15 @@ struct KernelInfo Roofline roofline; }; +struct ChartData +{ + std::vector m_labels; + std::vector m_x_values; + std::vector m_y_values; + std::vector m_fractions; // TODO: needed only for Pie + double m_x_max; // TODO: needed only for BAR +}; + struct WorkloadInfo { struct Roofline @@ -108,7 +117,31 @@ struct WorkloadInfo AvailableMetrics available_metrics; std::unordered_map kernels; Roofline roofline; -}; + ChartData GenerateChartData() const + { + ChartData data; + double total = 0.0; + for(const auto& kernel : kernels) + { + data.m_labels.push_back(kernel.second.name.c_str()); + data.m_x_values.push_back(static_cast(kernel.second.duration_total)); + data.m_y_values.push_back(static_cast(data.m_y_values.size())); + data.m_x_max = std::max(data.m_x_max, data.m_x_values.back()); + total += data.m_x_values.back(); + } + + data.m_fractions.resize( + data.m_x_values + .size()); // TODO: It need only for PieChart thing how to read of there + for(size_t i = 0; i < data.m_x_values.size(); ++i) + { + data.m_fractions[i] = data.m_x_values[i] / total; + } + + return data; + }; // TODO: generate diferent data depend by params + + }; struct MetricValue { diff --git a/src/view/src/widgets/rocprofvis_charts.cpp b/src/view/src/widgets/rocprofvis_charts.cpp new file mode 100644 index 00000000..6c9c1212 --- /dev/null +++ b/src/view/src/widgets/rocprofvis_charts.cpp @@ -0,0 +1,124 @@ +// Copyright Advanced Micro Devices, Inc. +// SPDX-License-Identifier: MIT + +#pragma once + +#include "rocprofvis_charts.h" +#include "implot/implot.h" + +constexpr ImVec2 ITEM_SPACING_DEFAULT = ImVec2(8, 4); + +namespace RocProfVis +{ +namespace View +{ + + PieChart::PieChart() { m_chart_title = "Kernels Pie"; } + +void +ChartBase::UpdateData(ChartData data) +{ + m_data = std::move(data); +} + +void +PieChart::Render() +{ + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ITEM_SPACING_DEFAULT); + ImGui::Separator(); + ImGui::PopStyleVar(); + + ImGui::PushID(m_chart_title); + if(ImPlot::BeginPlot(m_chart_title, ImVec2(-1, 0), + ImPlotFlags_Equal | ImPlotFlags_NoInputs)) + { + ImPlot::SetupAxes(nullptr, nullptr, ImPlotAxisFlags_NoDecorations, + ImPlotAxisFlags_NoDecorations); + ImPlot::SetupAxesLimits(0, 1, 0, 1); + + const ImVec2 plot_size = ImPlot::GetPlotSize(); + const float margin_px = 8.0f; // TODO: move to constants + const float max_radius_px = + 0.5f * (std::min(plot_size.x, plot_size.y)) -margin_px; + const double radius = + 0.08; // TODO: Calculate radius + // std::max(0.0f, max_radius_px) / + // std::min(plot_size.x, plot_size.y); // normalized 0..0.5-ish + + const double cx = 0.5; + const double cy = 0.5; + const double angle0 = 90.0; + + ImPlot::PlotPieChart( + m_data.m_labels.data(), m_data.m_fractions.data(), + static_cast(m_data.m_fractions.size()), cx, cy, radius, + [](double value, char* buff, int size, void*) -> int { + if(value > 0.05) return snprintf(buff, size, "%.1f%%", value * 100.0); + buff[0] = '\0'; + return 0; + }, + nullptr, angle0, ImPlotPieChartFlags_None); + + ImPlot::EndPlot(); + } + ImGui::PopID(); +} + +void +ChartBase::ClearData() +{ + m_data.m_labels.clear(); + m_data.m_x_values.clear(); + m_data.m_y_values.clear(); + m_data.m_fractions.clear(); +} + +BarChart::BarChart() { m_chart_title = "Kernels Bar"; } + +void +BarChart::Render() +{ + const char* title = "Kernels Bar"; + + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ITEM_SPACING_DEFAULT); + ImGui::Separator(); + ImGui::PopStyleVar(); + + const double bar_height = 0.7; + + ImPlot::PushColormap(ImPlotColormap_Plasma); + + if(ImPlot::BeginPlot(title, ImVec2(-1, 0), + ImPlotFlags_NoInputs | ImPlotFlags_NoLegend)) + { + ImPlot::SetupAxis(ImAxis_X1, "Invocations", + ImPlotAxisFlags_NoSideSwitch | ImPlotAxisFlags_NoHighlight); + ImPlot::SetupAxis(ImAxis_Y1, "Kernels", + ImPlotAxisFlags_NoSideSwitch | ImPlotAxisFlags_NoHighlight); + + ImPlot::SetupAxisTicks(ImAxis_Y1, m_data.m_y_values.data(), + static_cast(m_data.m_y_values.size()), + m_data.m_labels.data()); + ImPlot::SetupAxisLimits(ImAxis_X1, 0.0, + m_data.m_x_max > 0.0 ? m_data.m_x_max * 1.05 : 1.0, + ImPlotCond_Always); + ImPlot::SetupAxisLimits(ImAxis_Y1, -0.5, + static_cast(m_data.m_y_values.size()) - 0.5, + ImPlotCond_Always); + + const int count = static_cast(m_data.m_x_values.size()); + for(int i = 0; i < count; ++i) + { + const double color = + count > 1 ? static_cast(i) / (count - 1) : 0.5; // 0..1 + ImPlot::SetNextFillStyle(ImPlot::SampleColormap(color)); + ImPlot::PlotBars(m_data.m_labels[i], &m_data.m_x_values[i], 1, bar_height, + static_cast(i), ImPlotBarsFlags_Horizontal); + } + + ImPlot::EndPlot(); + } + ImPlot::PopColormap(); +} +} // namespace View +} // namespace RocProfVis \ No newline at end of file diff --git a/src/view/src/widgets/rocprofvis_charts.h b/src/view/src/widgets/rocprofvis_charts.h new file mode 100644 index 00000000..3534b279 --- /dev/null +++ b/src/view/src/widgets/rocprofvis_charts.h @@ -0,0 +1,43 @@ +// Copyright Advanced Micro Devices, Inc. +// SPDX-License-Identifier: MIT + +#pragma once +#include "rocprofvis_widget.h" +#include "../model/compute/rocprofvis_compute_model_types.h" + +namespace RocProfVis +{ +namespace View +{ + +class ChartBase : public RocWidget +{ +public: + ChartBase() = default; + ~ChartBase() = default; + void UpdateData(ChartData data); + +protected: + void ClearData(); + const char* m_chart_title; + ChartData m_data; +}; + +class PieChart : public ChartBase +{ +public: + PieChart(); + ~PieChart() = default; + void Render() override; +}; + +class BarChart : public ChartBase +{ +public: + BarChart(); + ~BarChart() = default; + void Render() override; +}; + +} // namespace View +} // namespace RocProfVis \ No newline at end of file From 456b7bab0eb0754276f991cec3ec5b6902b8d506 Mon Sep 17 00:00:00 2001 From: amokice-amd Date: Wed, 18 Feb 2026 19:11:32 +0000 Subject: [PATCH 2/8] Add metric selector --- .../rocprofvis_compute_summary_view.cpp | 52 +++++++++++++++---- .../compute/rocprofvis_compute_summary_view.h | 9 +++- .../compute/rocprofvis_compute_model_types.h | 31 +++++++++-- 3 files changed, 78 insertions(+), 14 deletions(-) diff --git a/src/view/src/compute/rocprofvis_compute_summary_view.cpp b/src/view/src/compute/rocprofvis_compute_summary_view.cpp index 2abebf75..b4913d9c 100644 --- a/src/view/src/compute/rocprofvis_compute_summary_view.cpp +++ b/src/view/src/compute/rocprofvis_compute_summary_view.cpp @@ -16,7 +16,6 @@ NewComputeSummaryView::RenderSummaryView(const WorkloadInfo& workload) m_kernel_table_renderer(workload); static uint32_t selected_chart_id = 0; - ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * DROPDOWN_SCALE); if(ImGui::BeginCombo("ChartView", m_chart_views[selected_chart_id].data())) { @@ -33,29 +32,64 @@ NewComputeSummaryView::RenderSummaryView(const WorkloadInfo& workload) ImGui::EndCombo(); } - ImGui::BeginChild("Chart"); + ImGui::SameLine(); + + static uint32_t selected_metric = 0; + ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * DROPDOWN_SCALE); + if(ImGui::BeginCombo("Metric", m_metric_views[selected_metric].data())) + { + for(uint32_t index = 0; index < m_metric_views.size(); index++) + { + const bool is_selected = (selected_metric == index); + if(ImGui::Selectable(m_metric_views[index].data(), is_selected)) + { + selected_metric = index; + } + if(is_selected) ImGui::SetItemDefaultFocus(); + } + ImGui::EndCombo(); + } + + ImGui::BeginChild("Chart"); if(selected_chart_id == 0) - RenderPieChart(workload); + RenderPieChart(workload, GetMetricNameByIndex(selected_metric)); else if(selected_chart_id == 1) - RenderBarChart(workload); + RenderBarChart(workload, GetMetricNameByIndex(selected_metric)); ImGui::EndChild(); // Chart } +KernelMetric +NewComputeSummaryView::GetMetricNameByIndex(uint32_t index) const +{ + switch (index) + { + case 0: return KernelMetric::InvocationCount; + case 1: return KernelMetric::DurationTotal; + case 2: return KernelMetric::DurationMin; + case 3: return KernelMetric::DurationMax; + case 4: return KernelMetric::DurationMean; + case 5: return KernelMetric::DurationMedian; + default: + assert(false && "Invalid metric index"); + return KernelMetric::InvocationCount; // Default case, should not happen + } +} + void -NewComputeSummaryView::RenderPieChart(const WorkloadInfo& workload) +NewComputeSummaryView::RenderPieChart(const WorkloadInfo& workload, KernelMetric metric) { m_pie_chart.UpdateData( - workload.GenerateChartData()); // TODO: Avoid updating each frames, think how to - // doit if it changes + workload.GenerateChartData(metric)); // TODO: Avoid updating each frames, think + // how to do it if it changes m_pie_chart.Render(); } void -NewComputeSummaryView::RenderBarChart(const WorkloadInfo& workload) +NewComputeSummaryView::RenderBarChart(const WorkloadInfo& workload, KernelMetric metric) { - m_bar_chart.UpdateData(workload.GenerateChartData()); + m_bar_chart.UpdateData(workload.GenerateChartData(metric)); m_bar_chart.Render(); } diff --git a/src/view/src/compute/rocprofvis_compute_summary_view.h b/src/view/src/compute/rocprofvis_compute_summary_view.h index 9ccedb23..574a11cf 100644 --- a/src/view/src/compute/rocprofvis_compute_summary_view.h +++ b/src/view/src/compute/rocprofvis_compute_summary_view.h @@ -19,11 +19,16 @@ class NewComputeSummaryView : m_kernel_table_renderer(kernel_table_renderer) {}; void RenderSummaryView(const WorkloadInfo& workload); private: - void RenderPieChart(const WorkloadInfo& workload); - void RenderBarChart(const WorkloadInfo& workload); + KernelMetric GetMetricNameByIndex(uint32_t metric) const; + void RenderPieChart(const WorkloadInfo& workload, KernelMetric metric); + void RenderBarChart(const WorkloadInfo& workload, KernelMetric metric); std::function m_kernel_table_renderer; const std::vector m_chart_views = { "Pie Chart", "Bar Chart" }; + const std::vector m_metric_views = { + "Invocation Count", "Duration Total", "Duration Min", + "Duration Max", "Duration Mean", "Duration Median" + }; PieChart m_pie_chart; BarChart m_bar_chart; diff --git a/src/view/src/model/compute/rocprofvis_compute_model_types.h b/src/view/src/model/compute/rocprofvis_compute_model_types.h index ac5dd9c3..363cf554 100644 --- a/src/view/src/model/compute/rocprofvis_compute_model_types.h +++ b/src/view/src/model/compute/rocprofvis_compute_model_types.h @@ -51,6 +51,17 @@ struct Point double y; }; +enum class KernelMetric : uint64_t +{ + InvocationCount, + DurationTotal, + DurationMin, + DurationMax, + DurationMean, + DurationMedian, + COUNT +}; + struct KernelInfo { struct Roofline @@ -73,6 +84,20 @@ struct KernelInfo uint32_t duration_mean; uint32_t duration_median; Roofline roofline; + + uint64_t get(KernelMetric metric) const + { + switch(metric) + { + case KernelMetric::InvocationCount: return invocation_count; + case KernelMetric::DurationTotal: return duration_total; + case KernelMetric::DurationMin: return duration_min; + case KernelMetric::DurationMax: return duration_max; + case KernelMetric::DurationMean: return duration_mean; + case KernelMetric::DurationMedian: return duration_median; + default: return 0; + } + }; }; struct ChartData @@ -117,14 +142,14 @@ struct WorkloadInfo AvailableMetrics available_metrics; std::unordered_map kernels; Roofline roofline; - ChartData GenerateChartData() const + ChartData GenerateChartData(KernelMetric metric) const { ChartData data; double total = 0.0; for(const auto& kernel : kernels) { data.m_labels.push_back(kernel.second.name.c_str()); - data.m_x_values.push_back(static_cast(kernel.second.duration_total)); + data.m_x_values.push_back(static_cast(kernel.second.get(metric))); data.m_y_values.push_back(static_cast(data.m_y_values.size())); data.m_x_max = std::max(data.m_x_max, data.m_x_values.back()); total += data.m_x_values.back(); @@ -139,7 +164,7 @@ struct WorkloadInfo } return data; - }; // TODO: generate diferent data depend by params + }; }; From 5854943287689cedab8dcc3ca7001e8a28bdb9f5 Mon Sep 17 00:00:00 2001 From: amokice-amd Date: Thu, 19 Feb 2026 13:11:19 +0000 Subject: [PATCH 3/8] Add summary view to tabs --- .../rocprofvis_compute_summary_view.cpp | 140 +++++++++++++----- .../compute/rocprofvis_compute_summary_view.h | 19 ++- .../src/compute/rocprofvis_compute_view.cpp | 12 +- .../src/compute/rocprofvis_compute_view.h | 14 +- 4 files changed, 123 insertions(+), 62 deletions(-) diff --git a/src/view/src/compute/rocprofvis_compute_summary_view.cpp b/src/view/src/compute/rocprofvis_compute_summary_view.cpp index b4913d9c..434d3a78 100644 --- a/src/view/src/compute/rocprofvis_compute_summary_view.cpp +++ b/src/view/src/compute/rocprofvis_compute_summary_view.cpp @@ -11,57 +11,131 @@ namespace RocProfVis namespace View { void -NewComputeSummaryView::RenderSummaryView(const WorkloadInfo& workload) +ComputeSummaryView::Render() { - m_kernel_table_renderer(workload); - - static uint32_t selected_chart_id = 0; + const std::unordered_map& workloads = + m_data_provider.ComputeModel().GetWorkloads(); ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * DROPDOWN_SCALE); - if(ImGui::BeginCombo("ChartView", m_chart_views[selected_chart_id].data())) + if(ImGui::BeginCombo("Workloads", + workloads.count(m_selected_workload_id) > 0 + ? workloads.at(m_selected_workload_id).name.c_str() + : "-")) { - for(uint32_t index = 0; index < m_chart_views.size(); index++) + if(ImGui::Selectable("-", m_selected_workload_id == 0)) + { + m_selected_workload_id = 0; + } + for(const std::pair& workload : workloads) { - const bool is_selected = (selected_chart_id == index); - if(ImGui::Selectable(m_chart_views[index].data(), is_selected)) + if(ImGui::Selectable(workload.second.name.c_str(), + m_selected_workload_id == workload.second.id)) { - selected_chart_id = index; + m_selected_workload_id = workload.second.id; } - - if(is_selected) ImGui::SetItemDefaultFocus(); } ImGui::EndCombo(); } - ImGui::SameLine(); - - static uint32_t selected_metric = 0; - ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * DROPDOWN_SCALE); - if(ImGui::BeginCombo("Metric", m_metric_views[selected_metric].data())) + if(workloads.count(m_selected_workload_id) > 0) { - for(uint32_t index = 0; index < m_metric_views.size(); index++) + const WorkloadInfo& workload = workloads.at(m_selected_workload_id); + RenderKernelsTable(workload); + + static uint32_t selected_chart_id = 0; + ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * DROPDOWN_SCALE); + if(ImGui::BeginCombo("ChartView", m_chart_views[selected_chart_id].data())) { - const bool is_selected = (selected_metric == index); - if(ImGui::Selectable(m_metric_views[index].data(), is_selected)) + for(uint32_t index = 0; index < m_chart_views.size(); index++) { - selected_metric = index; + const bool is_selected = (selected_chart_id == index); + if(ImGui::Selectable(m_chart_views[index].data(), is_selected)) + { + selected_chart_id = index; + } + + if(is_selected) ImGui::SetItemDefaultFocus(); } + ImGui::EndCombo(); + } + + ImGui::SameLine(); + + static uint32_t selected_metric = 0; + ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * DROPDOWN_SCALE); + if(ImGui::BeginCombo("Metric", m_metric_views[selected_metric].data())) + { + for(uint32_t index = 0; index < m_metric_views.size(); index++) + { + const bool is_selected = (selected_metric == index); + if(ImGui::Selectable(m_metric_views[index].data(), is_selected)) + { + selected_metric = index; + } - if(is_selected) ImGui::SetItemDefaultFocus(); + if(is_selected) ImGui::SetItemDefaultFocus(); + } + ImGui::EndCombo(); } - ImGui::EndCombo(); - } - ImGui::BeginChild("Chart"); - if(selected_chart_id == 0) - RenderPieChart(workload, GetMetricNameByIndex(selected_metric)); - else if(selected_chart_id == 1) - RenderBarChart(workload, GetMetricNameByIndex(selected_metric)); + ImGui::BeginChild("Chart"); + if(selected_chart_id == 0) + RenderPieChart(workload, GetMetricNameByIndex(selected_metric)); + else if(selected_chart_id == 1) + RenderBarChart(workload, GetMetricNameByIndex(selected_metric)); + + ImGui::EndChild(); // Chart + } +} - ImGui::EndChild(); // Chart +void +ComputeSummaryView::RenderKernelsTable(const WorkloadInfo& workload) +{ + ImGui::BeginChild("kernels", ImVec2(0, 0), + ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); + ImGui::Text("Kernels"); + if(ImGui::BeginTable("", 8, + ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | + ImGuiTableFlags_SizingStretchSame)) + { + ImGui::TableSetupColumn("ID"); + ImGui::TableSetupColumn("Name"); + ImGui::TableSetupColumn("Invocation Count"); + ImGui::TableSetupColumn("Total Duration"); + ImGui::TableSetupColumn("Min Duration"); + ImGui::TableSetupColumn("Max Duration"); + ImGui::TableSetupColumn("Mean Duration"); + ImGui::TableSetupColumn("Median Duration"); + ImGui::TableHeadersRow(); + for(const std::pair& kernel : workload.kernels) + { + ImGui::PushID(static_cast(kernel.second.id)); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.id); + ImGui::TableNextColumn(); + ImGui::Text(kernel.second.name.c_str()); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.invocation_count); + ImGui::TableNextColumn(); + ImGui::Text("%llu", kernel.second.duration_total); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_min); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_max); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_mean); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_median); + ImGui::PopID(); + } + ImGui::EndTable(); + } + ImGui::EndChild(); + } KernelMetric -NewComputeSummaryView::GetMetricNameByIndex(uint32_t index) const +ComputeSummaryView::GetMetricNameByIndex(uint32_t index) const { switch (index) { @@ -73,12 +147,12 @@ NewComputeSummaryView::GetMetricNameByIndex(uint32_t index) const case 5: return KernelMetric::DurationMedian; default: assert(false && "Invalid metric index"); - return KernelMetric::InvocationCount; // Default case, should not happen + return KernelMetric::DurationTotal; } } void -NewComputeSummaryView::RenderPieChart(const WorkloadInfo& workload, KernelMetric metric) +ComputeSummaryView::RenderPieChart(const WorkloadInfo& workload, KernelMetric metric) { m_pie_chart.UpdateData( workload.GenerateChartData(metric)); // TODO: Avoid updating each frames, think @@ -87,7 +161,7 @@ NewComputeSummaryView::RenderPieChart(const WorkloadInfo& workload, KernelMetric } void -NewComputeSummaryView::RenderBarChart(const WorkloadInfo& workload, KernelMetric metric) +ComputeSummaryView::RenderBarChart(const WorkloadInfo& workload, KernelMetric metric) { m_bar_chart.UpdateData(workload.GenerateChartData(metric)); m_bar_chart.Render(); diff --git a/src/view/src/compute/rocprofvis_compute_summary_view.h b/src/view/src/compute/rocprofvis_compute_summary_view.h index 574a11cf..d8628c98 100644 --- a/src/view/src/compute/rocprofvis_compute_summary_view.h +++ b/src/view/src/compute/rocprofvis_compute_summary_view.h @@ -4,6 +4,8 @@ #pragma once #include "../model/compute/rocprofvis_compute_model_types.h" #include "../widgets/rocprofvis_charts.h" +#include "rocprofvis_data_provider.h" + #include namespace RocProfVis @@ -11,18 +13,20 @@ namespace RocProfVis namespace View { -class NewComputeSummaryView +class ComputeSummaryView : public RocWidget { public: - NewComputeSummaryView( - std::function kernel_table_renderer) - : m_kernel_table_renderer(kernel_table_renderer) {}; - void RenderSummaryView(const WorkloadInfo& workload); + ComputeSummaryView(DataProvider& data_provider) + : RocWidget() + , m_data_provider(data_provider) + , m_selected_workload_id(0) + {}; + void Render() override; private: + void RenderKernelsTable(const WorkloadInfo& workload); KernelMetric GetMetricNameByIndex(uint32_t metric) const; void RenderPieChart(const WorkloadInfo& workload, KernelMetric metric); void RenderBarChart(const WorkloadInfo& workload, KernelMetric metric); - std::function m_kernel_table_renderer; const std::vector m_chart_views = { "Pie Chart", "Bar Chart" }; const std::vector m_metric_views = { @@ -32,6 +36,9 @@ class NewComputeSummaryView PieChart m_pie_chart; BarChart m_bar_chart; + + DataProvider& m_data_provider; + uint32_t m_selected_workload_id; }; diff --git a/src/view/src/compute/rocprofvis_compute_view.cpp b/src/view/src/compute/rocprofvis_compute_view.cpp index 803a8d8d..d4342580 100644 --- a/src/view/src/compute/rocprofvis_compute_view.cpp +++ b/src/view/src/compute/rocprofvis_compute_view.cpp @@ -219,11 +219,6 @@ ComputeView::RenderWorkloadSelection() } //TODO: move these to their own files -ComputeSummaryView::ComputeSummaryView(DataProvider& data_provider, std::shared_ptr compute_selection) -: RocWidget() -, m_data_provider(data_provider) -, m_compute_selection(compute_selection) -{} ComputeTableView::ComputeTableView(DataProvider& data_provider, std::shared_ptr compute_selection) : RocWidget() @@ -240,10 +235,7 @@ ComputeWorkloadView::ComputeWorkloadView(DataProvider& data_provider, std::share ComputeTester::ComputeTester(DataProvider& data_provider) : m_data_provider(data_provider) , m_selections({ true, 0, {}, {}, SelectionState::FP32, {}, {}, {} }) -, m_summary_view([this](const WorkloadInfo& workload) -{ - this->RenderKernels(workload); -}) +, m_summary_view(data_provider) , m_display_names({ { { kRPVControllerRooflineCeilingComputeVALUI8, "VALU I8" }, @@ -1319,7 +1311,7 @@ ComputeTester::RenderKernelSelectionTable() void ComputeTester::RenderSummaryView(const WorkloadInfo& workload) { - m_summary_view.RenderSummaryView(workload); + m_summary_view.Render(); } } // namespace View diff --git a/src/view/src/compute/rocprofvis_compute_view.h b/src/view/src/compute/rocprofvis_compute_view.h index 47e00af7..2dcebc82 100644 --- a/src/view/src/compute/rocprofvis_compute_view.h +++ b/src/view/src/compute/rocprofvis_compute_view.h @@ -49,16 +49,6 @@ class ComputeView : public RootView //TODO: move these to separate files when they are implemented -class ComputeSummaryView: public RocWidget -{ -public: - ComputeSummaryView(DataProvider& data_provider, std::shared_ptr compute_selection); - ~ComputeSummaryView(){}; - -protected: - DataProvider& m_data_provider; - std::shared_ptr m_compute_selection; -}; class ComputeTableView: public RocWidget { @@ -160,9 +150,7 @@ class ComputeTester : public RocWidget SelectionState m_selections; DisplayStrings m_display_names; - NewComputeSummaryView m_summary_view; - PieChart m_pie_chart; - BarChart m_bar_chart; + ComputeSummaryView m_summary_view; }; } // namespace View From 7b1c1f7b701fa52a2225d16c17b7d4aed9b47b11 Mon Sep 17 00:00:00 2001 From: amokice-amd Date: Thu, 19 Feb 2026 17:13:38 +0000 Subject: [PATCH 4/8] Add adaptive size --- .../rocprofvis_compute_summary_view.cpp | 86 ++++++++++++++++--- .../compute/rocprofvis_compute_summary_view.h | 20 +++-- .../compute/rocprofvis_compute_model_types.h | 6 +- src/view/src/widgets/rocprofvis_charts.cpp | 59 +++++++++---- src/view/src/widgets/rocprofvis_charts.h | 12 +++ 5 files changed, 140 insertions(+), 43 deletions(-) diff --git a/src/view/src/compute/rocprofvis_compute_summary_view.cpp b/src/view/src/compute/rocprofvis_compute_summary_view.cpp index 434d3a78..84ba5179 100644 --- a/src/view/src/compute/rocprofvis_compute_summary_view.cpp +++ b/src/view/src/compute/rocprofvis_compute_summary_view.cpp @@ -10,6 +10,24 @@ namespace RocProfVis { namespace View { +ComputeSummaryView::ComputeSummaryView(DataProvider& data_provider) +: RocWidget() +, m_data_provider(data_provider) +, m_workload_id(0) +{ + CalculateCombosWidth(); + auto font_changed_handler = [this](std::shared_ptr e) { + this->CalculateCombosWidth(); + }; + m_font_changed_token = EventManager::GetInstance()->Subscribe( + static_cast(RocEvents::kFontSizeChanged), font_changed_handler); +} +ComputeSummaryView::~ComputeSummaryView() +{ + EventManager::GetInstance()->Unsubscribe( + static_cast(RocEvents::kFontSizeChanged), m_font_changed_token); +}; + void ComputeSummaryView::Render() { @@ -17,33 +35,33 @@ ComputeSummaryView::Render() m_data_provider.ComputeModel().GetWorkloads(); ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * DROPDOWN_SCALE); if(ImGui::BeginCombo("Workloads", - workloads.count(m_selected_workload_id) > 0 - ? workloads.at(m_selected_workload_id).name.c_str() + workloads.count(m_workload_id) > 0 + ? workloads.at(m_workload_id).name.c_str() : "-")) { - if(ImGui::Selectable("-", m_selected_workload_id == 0)) + if(ImGui::Selectable("-", m_workload_id == 0)) { - m_selected_workload_id = 0; + m_workload_id = 0; } for(const std::pair& workload : workloads) { if(ImGui::Selectable(workload.second.name.c_str(), - m_selected_workload_id == workload.second.id)) + m_workload_id == workload.second.id)) { - m_selected_workload_id = workload.second.id; + m_workload_id = workload.second.id; } } ImGui::EndCombo(); } - if(workloads.count(m_selected_workload_id) > 0) + if(workloads.count(m_workload_id) > 0) { - const WorkloadInfo& workload = workloads.at(m_selected_workload_id); + const WorkloadInfo& workload = workloads.at(m_workload_id); RenderKernelsTable(workload); static uint32_t selected_chart_id = 0; - ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * DROPDOWN_SCALE); - if(ImGui::BeginCombo("ChartView", m_chart_views[selected_chart_id].data())) + ImGui::SetNextItemWidth(m_chart_combo_width); + if(ImGui::BeginCombo("##ChartView", m_chart_views[selected_chart_id].data())) { for(uint32_t index = 0; index < m_chart_views.size(); index++) { @@ -60,9 +78,9 @@ ComputeSummaryView::Render() ImGui::SameLine(); - static uint32_t selected_metric = 0; - ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * DROPDOWN_SCALE); - if(ImGui::BeginCombo("Metric", m_metric_views[selected_metric].data())) + static uint32_t selected_metric = 1; //Set as default metric "duration total" + ImGui::SetNextItemWidth(m_metric_combo_width); + if(ImGui::BeginCombo("##Metric", m_metric_views[selected_metric].data())) { for(uint32_t index = 0; index < m_metric_views.size(); index++) { @@ -87,6 +105,48 @@ ComputeSummaryView::Render() } } +void +ComputeSummaryView::CalculateCombosWidth() +{ + m_chart_combo_width = 0.0f; + m_metric_combo_width = 0.0f; + + ImGuiStyle& style = ImGui::GetStyle(); + + const float frame_padding_lr = style.FramePadding.x * 2.0f; + const float inner_spacing = style.ItemInnerSpacing.x; + const float arrow_area = ImGui::GetFrameHeight(); // approximate arrow / preview area + const float extra_margin_px = 8.0f; // small visual margin + const float min_width_px = 80.0f; // sensible minimum + + float max_chart_text_w = 0.0f; + for(const auto& chart : m_chart_views) + { + const ImVec2 ts = ImGui::CalcTextSize(chart.data()); + if(ts.x > max_chart_text_w) max_chart_text_w = ts.x; + } + + // Compute longest label width for metric views + float max_metric_text_w = 0.0f; + for(const auto& metric : m_metric_views) + { + const ImVec2 ts = ImGui::CalcTextSize(metric.data()); + if(ts.x > max_metric_text_w) max_metric_text_w = ts.x; + } + + // Final widths include padding, spacing, arrow area and a small margin. + float chart_total = max_chart_text_w + frame_padding_lr + inner_spacing + arrow_area + + extra_margin_px; + float metric_total = max_metric_text_w + frame_padding_lr + inner_spacing + + arrow_area + extra_margin_px; + + if(chart_total < min_width_px) chart_total = min_width_px; + if(metric_total < min_width_px) metric_total = min_width_px; + + m_chart_combo_width = chart_total; + m_metric_combo_width = metric_total; +} + void ComputeSummaryView::RenderKernelsTable(const WorkloadInfo& workload) { diff --git a/src/view/src/compute/rocprofvis_compute_summary_view.h b/src/view/src/compute/rocprofvis_compute_summary_view.h index d8628c98..28aaec72 100644 --- a/src/view/src/compute/rocprofvis_compute_summary_view.h +++ b/src/view/src/compute/rocprofvis_compute_summary_view.h @@ -5,6 +5,7 @@ #include "../model/compute/rocprofvis_compute_model_types.h" #include "../widgets/rocprofvis_charts.h" #include "rocprofvis_data_provider.h" +#include "rocprofvis_event_manager.h" #include @@ -16,17 +17,15 @@ namespace View class ComputeSummaryView : public RocWidget { public: - ComputeSummaryView(DataProvider& data_provider) - : RocWidget() - , m_data_provider(data_provider) - , m_selected_workload_id(0) - {}; + ComputeSummaryView(DataProvider& data_provider); + ~ComputeSummaryView(); void Render() override; private: + void CalculateCombosWidth(); void RenderKernelsTable(const WorkloadInfo& workload); KernelMetric GetMetricNameByIndex(uint32_t metric) const; - void RenderPieChart(const WorkloadInfo& workload, KernelMetric metric); - void RenderBarChart(const WorkloadInfo& workload, KernelMetric metric); + void RenderPieChart(const WorkloadInfo& workload, KernelMetric metric); + void RenderBarChart(const WorkloadInfo& workload, KernelMetric metric); const std::vector m_chart_views = { "Pie Chart", "Bar Chart" }; const std::vector m_metric_views = { @@ -38,7 +37,12 @@ class ComputeSummaryView : public RocWidget BarChart m_bar_chart; DataProvider& m_data_provider; - uint32_t m_selected_workload_id; + uint32_t m_workload_id; + float m_chart_combo_width; + float m_metric_combo_width; + + EventManager::SubscriptionToken m_font_changed_token; + }; diff --git a/src/view/src/model/compute/rocprofvis_compute_model_types.h b/src/view/src/model/compute/rocprofvis_compute_model_types.h index 363cf554..211e95d1 100644 --- a/src/view/src/model/compute/rocprofvis_compute_model_types.h +++ b/src/view/src/model/compute/rocprofvis_compute_model_types.h @@ -155,9 +155,7 @@ struct WorkloadInfo total += data.m_x_values.back(); } - data.m_fractions.resize( - data.m_x_values - .size()); // TODO: It need only for PieChart thing how to read of there + data.m_fractions.resize(data.m_x_values.size()); for(size_t i = 0; i < data.m_x_values.size(); ++i) { data.m_fractions[i] = data.m_x_values[i] / total; @@ -166,7 +164,7 @@ struct WorkloadInfo return data; }; - }; +}; struct MetricValue { diff --git a/src/view/src/widgets/rocprofvis_charts.cpp b/src/view/src/widgets/rocprofvis_charts.cpp index 6c9c1212..ce1793ea 100644 --- a/src/view/src/widgets/rocprofvis_charts.cpp +++ b/src/view/src/widgets/rocprofvis_charts.cpp @@ -5,6 +5,7 @@ #include "rocprofvis_charts.h" #include "implot/implot.h" +#include constexpr ImVec2 ITEM_SPACING_DEFAULT = ImVec2(8, 4); @@ -12,8 +13,38 @@ namespace RocProfVis { namespace View { +PieChart::PiePlacement +PieChart::CalculatePiePlacement(float padding_px, float radius_scale) +{ + const ImVec2 plot_pos = ImPlot::GetPlotPos(); + const ImVec2 plot_size = ImPlot::GetPlotSize(); + + const float width = std::max(0.0f, plot_size.x - 2.0f * padding_px); + const float hight = std::max(0.0f, plot_size.y - 2.0f * padding_px); + const float radius_px = 0.5f * std::min(width, hight) * radius_scale; + + const ImVec2 center_px = + ImVec2(plot_pos.x + plot_size.x * 0.5f, plot_pos.y + plot_size.y * 0.5f); + + // Convert center pixel -> plot coordinates + const ImPlotPoint center = ImPlot::PixelsToPlot(center_px); + + // Convert pixel radius -> plot units by measuring delta in plot space + const ImPlotPoint px = + ImPlot::PixelsToPlot(ImVec2(center_px.x + radius_px, center_px.y)); + const ImPlotPoint py = + ImPlot::PixelsToPlot(ImVec2(center_px.x, center_px.y + radius_px)); - PieChart::PieChart() { m_chart_title = "Kernels Pie"; } + const double rx = std::abs(px.x - center.x); + const double ry = std::abs(py.y - center.y); + + const double r_plot = std::min(rx, ry); + + return PiePlacement{ center.x, center.y, r_plot }; +}; + + +PieChart::PieChart() { m_chart_title = "Kernels Pie"; } void ChartBase::UpdateData(ChartData data) @@ -29,35 +60,25 @@ PieChart::Render() ImGui::PopStyleVar(); ImGui::PushID(m_chart_title); - if(ImPlot::BeginPlot(m_chart_title, ImVec2(-1, 0), + const float avail_h = ImGui::GetContentRegionAvail().y; + const ImVec2 plot_size(-1, std::max(80.0f, avail_h)); + if(ImPlot::BeginPlot(m_chart_title, plot_size, ImPlotFlags_Equal | ImPlotFlags_NoInputs)) { ImPlot::SetupAxes(nullptr, nullptr, ImPlotAxisFlags_NoDecorations, ImPlotAxisFlags_NoDecorations); ImPlot::SetupAxesLimits(0, 1, 0, 1); - const ImVec2 plot_size = ImPlot::GetPlotSize(); - const float margin_px = 8.0f; // TODO: move to constants - const float max_radius_px = - 0.5f * (std::min(plot_size.x, plot_size.y)) -margin_px; - const double radius = - 0.08; // TODO: Calculate radius - // std::max(0.0f, max_radius_px) / - // std::min(plot_size.x, plot_size.y); // normalized 0..0.5-ish - - const double cx = 0.5; - const double cy = 0.5; - const double angle0 = 90.0; + auto place = CalculatePiePlacement(); ImPlot::PlotPieChart( m_data.m_labels.data(), m_data.m_fractions.data(), - static_cast(m_data.m_fractions.size()), cx, cy, radius, + static_cast(m_data.m_fractions.size()), place.x, place.y, place.radius, [](double value, char* buff, int size, void*) -> int { if(value > 0.05) return snprintf(buff, size, "%.1f%%", value * 100.0); buff[0] = '\0'; return 0; - }, - nullptr, angle0, ImPlotPieChartFlags_None); + }); ImPlot::EndPlot(); } @@ -88,7 +109,9 @@ BarChart::Render() ImPlot::PushColormap(ImPlotColormap_Plasma); - if(ImPlot::BeginPlot(title, ImVec2(-1, 0), + const float avail_h = ImGui::GetContentRegionAvail().y; + const ImVec2 plot_size(-1, std::max(80.0f, avail_h)); + if(ImPlot::BeginPlot(title, plot_size, ImPlotFlags_NoInputs | ImPlotFlags_NoLegend)) { ImPlot::SetupAxis(ImAxis_X1, "Invocations", diff --git a/src/view/src/widgets/rocprofvis_charts.h b/src/view/src/widgets/rocprofvis_charts.h index 3534b279..eeeed8e3 100644 --- a/src/view/src/widgets/rocprofvis_charts.h +++ b/src/view/src/widgets/rocprofvis_charts.h @@ -10,6 +10,8 @@ namespace RocProfVis namespace View { + + class ChartBase : public RocWidget { public: @@ -29,6 +31,16 @@ class PieChart : public ChartBase PieChart(); ~PieChart() = default; void Render() override; + +private: + struct PiePlacement + { + double x = 0.0; + double y = 0.0; + double radius = 0.0; + }; + inline PiePlacement CalculatePiePlacement(float padding_px = 10.0f, + float radius_scale = 0.95f); }; class BarChart : public ChartBase From 83720164cc2e0f5c8873e77678c34446b5207657 Mon Sep 17 00:00:00 2001 From: amokice-amd Date: Thu, 19 Feb 2026 18:06:58 +0000 Subject: [PATCH 5/8] Add metric names for charts Ready for first look remove compute from cmake Small refactor one more refactor --- CMakeLists.txt | 2 +- .../rocprofvis_compute_summary_view.cpp | 33 +++++------ .../compute/rocprofvis_compute_summary_view.h | 5 +- .../src/compute/rocprofvis_compute_view.cpp | 5 -- .../src/compute/rocprofvis_compute_view.h | 2 - .../compute/rocprofvis_compute_model_types.h | 50 ++++++----------- src/view/src/widgets/rocprofvis_charts.cpp | 56 +++++++++++-------- src/view/src/widgets/rocprofvis_charts.h | 17 +++++- 8 files changed, 83 insertions(+), 87 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 495486bb..48f2aaef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES") -option(COMPUTE_UI_SUPPORT "Build with support for Rocprof Compute .CSVs" ON) +option(COMPUTE_UI_SUPPORT "Build with support for Rocprof Compute .CSVs" OFF) option(ROCPROFVIS_DEVELOPER_MODE "Enable developer mode features" OFF) option(ROCPROFVIS_ENABLE_INTERNAL_BANNER "Show diagonal internal build banner" OFF) option(USE_NATIVE_FILE_DIALOG "Use the OS native file dialog instead of ImGui file dialog" ON) diff --git a/src/view/src/compute/rocprofvis_compute_summary_view.cpp b/src/view/src/compute/rocprofvis_compute_summary_view.cpp index 84ba5179..9516eb74 100644 --- a/src/view/src/compute/rocprofvis_compute_summary_view.cpp +++ b/src/view/src/compute/rocprofvis_compute_summary_view.cpp @@ -14,6 +14,7 @@ ComputeSummaryView::ComputeSummaryView(DataProvider& data_provider) : RocWidget() , m_data_provider(data_provider) , m_workload_id(0) +, m_selected_metric(1) //default metric - duration total { CalculateCombosWidth(); auto font_changed_handler = [this](std::shared_ptr e) { @@ -21,6 +22,7 @@ ComputeSummaryView::ComputeSummaryView(DataProvider& data_provider) }; m_font_changed_token = EventManager::GetInstance()->Subscribe( static_cast(RocEvents::kFontSizeChanged), font_changed_handler); + } ComputeSummaryView::~ComputeSummaryView() { @@ -49,6 +51,7 @@ ComputeSummaryView::Render() m_workload_id == workload.second.id)) { m_workload_id = workload.second.id; + UpdataChartData(workload.second, m_selected_metric); } } ImGui::EndCombo(); @@ -77,17 +80,16 @@ ComputeSummaryView::Render() } ImGui::SameLine(); - - static uint32_t selected_metric = 1; //Set as default metric "duration total" ImGui::SetNextItemWidth(m_metric_combo_width); - if(ImGui::BeginCombo("##Metric", m_metric_views[selected_metric].data())) + if(ImGui::BeginCombo("##Metric", m_metric_views[m_selected_metric].data())) { for(uint32_t index = 0; index < m_metric_views.size(); index++) { - const bool is_selected = (selected_metric == index); + const bool is_selected = (m_selected_metric == index); if(ImGui::Selectable(m_metric_views[index].data(), is_selected)) { - selected_metric = index; + m_selected_metric = index; + UpdataChartData(workload, m_selected_metric); } if(is_selected) ImGui::SetItemDefaultFocus(); @@ -97,9 +99,9 @@ ComputeSummaryView::Render() ImGui::BeginChild("Chart"); if(selected_chart_id == 0) - RenderPieChart(workload, GetMetricNameByIndex(selected_metric)); + m_pie_chart.Render(); else if(selected_chart_id == 1) - RenderBarChart(workload, GetMetricNameByIndex(selected_metric)); + m_bar_chart.Render(); ImGui::EndChild(); // Chart } @@ -212,21 +214,14 @@ ComputeSummaryView::GetMetricNameByIndex(uint32_t index) const } void -ComputeSummaryView::RenderPieChart(const WorkloadInfo& workload, KernelMetric metric) +ComputeSummaryView::UpdataChartData(const WorkloadInfo& workload, uint32_t metric_id) { - m_pie_chart.UpdateData( - workload.GenerateChartData(metric)); // TODO: Avoid updating each frames, think - // how to do it if it changes - m_pie_chart.Render(); -} + ChartData chart_data = + ChartData::GenerateChartData(GetMetricNameByIndex(metric_id), workload); -void -ComputeSummaryView::RenderBarChart(const WorkloadInfo& workload, KernelMetric metric) -{ - m_bar_chart.UpdateData(workload.GenerateChartData(metric)); - m_bar_chart.Render(); + m_pie_chart.UpdateData(chart_data); + m_bar_chart.UpdateData(chart_data); } - } // namespace View } // namespace RocProfVis \ No newline at end of file diff --git a/src/view/src/compute/rocprofvis_compute_summary_view.h b/src/view/src/compute/rocprofvis_compute_summary_view.h index 28aaec72..bebbcd9e 100644 --- a/src/view/src/compute/rocprofvis_compute_summary_view.h +++ b/src/view/src/compute/rocprofvis_compute_summary_view.h @@ -24,8 +24,7 @@ class ComputeSummaryView : public RocWidget void CalculateCombosWidth(); void RenderKernelsTable(const WorkloadInfo& workload); KernelMetric GetMetricNameByIndex(uint32_t metric) const; - void RenderPieChart(const WorkloadInfo& workload, KernelMetric metric); - void RenderBarChart(const WorkloadInfo& workload, KernelMetric metric); + void UpdataChartData(const WorkloadInfo& workload, uint32_t metric_id); const std::vector m_chart_views = { "Pie Chart", "Bar Chart" }; const std::vector m_metric_views = { @@ -40,7 +39,7 @@ class ComputeSummaryView : public RocWidget uint32_t m_workload_id; float m_chart_combo_width; float m_metric_combo_width; - + uint32_t m_selected_metric; EventManager::SubscriptionToken m_font_changed_token; }; diff --git a/src/view/src/compute/rocprofvis_compute_view.cpp b/src/view/src/compute/rocprofvis_compute_view.cpp index d4342580..7bfbaac8 100644 --- a/src/view/src/compute/rocprofvis_compute_view.cpp +++ b/src/view/src/compute/rocprofvis_compute_view.cpp @@ -360,11 +360,6 @@ ComputeTester::RenderSelectedView( break; } case 5: - { - RenderRoofLine(workload); - break; - } - case 6: { RenderSummaryView(workload); break; diff --git a/src/view/src/compute/rocprofvis_compute_view.h b/src/view/src/compute/rocprofvis_compute_view.h index 2dcebc82..1e4add6f 100644 --- a/src/view/src/compute/rocprofvis_compute_view.h +++ b/src/view/src/compute/rocprofvis_compute_view.h @@ -134,14 +134,12 @@ class ComputeTester : public RocWidget void RenderMetrics(const WorkloadInfo& workload); void RenderKernels(const WorkloadInfo& workload); void RenderFetcher(const WorkloadInfo& workload); - void RenderRoofLine(const WorkloadInfo& workload); void RenderSummaryView(const WorkloadInfo& workload); const std::vector m_views = { "System Information", "Profiling Configuration", "Metrics", "Kernels", "Fetcher", - "RoofLine", "Summary View" }; //TODO: figure out better way to store it diff --git a/src/view/src/model/compute/rocprofvis_compute_model_types.h b/src/view/src/model/compute/rocprofvis_compute_model_types.h index 211e95d1..8b771e43 100644 --- a/src/view/src/model/compute/rocprofvis_compute_model_types.h +++ b/src/view/src/model/compute/rocprofvis_compute_model_types.h @@ -75,6 +75,7 @@ struct KernelInfo Intensity> intensities; }; + uint32_t id; std::string name; uint32_t invocation_count; @@ -85,7 +86,9 @@ struct KernelInfo uint32_t duration_median; Roofline roofline; - uint64_t get(KernelMetric metric) const + //TODO: amokichev for future maybe we need more complicated universal class for metric + // that will be contain metric_id represented as enum, readable name and value + uint64_t Get(KernelMetric metric) const { switch(metric) { @@ -98,15 +101,20 @@ struct KernelInfo default: return 0; } }; -}; -struct ChartData -{ - std::vector m_labels; - std::vector m_x_values; - std::vector m_y_values; - std::vector m_fractions; // TODO: needed only for Pie - double m_x_max; // TODO: needed only for BAR + static std::string GetMetricName(KernelMetric metric) + { + switch(metric) + { + case KernelMetric::InvocationCount: return "Invocation Count"; + case KernelMetric::DurationTotal: return "Duration Total"; + case KernelMetric::DurationMin: return "Duration Min"; + case KernelMetric::DurationMax: return "Duration Max"; + case KernelMetric::DurationMean: return "Duration Mean"; + case KernelMetric::DurationMedian: return "Duration Median"; + default: return ""; + } + } }; struct WorkloadInfo @@ -141,29 +149,7 @@ struct WorkloadInfo std::vector> profiling_config; AvailableMetrics available_metrics; std::unordered_map kernels; - Roofline roofline; - ChartData GenerateChartData(KernelMetric metric) const - { - ChartData data; - double total = 0.0; - for(const auto& kernel : kernels) - { - data.m_labels.push_back(kernel.second.name.c_str()); - data.m_x_values.push_back(static_cast(kernel.second.get(metric))); - data.m_y_values.push_back(static_cast(data.m_y_values.size())); - data.m_x_max = std::max(data.m_x_max, data.m_x_values.back()); - total += data.m_x_values.back(); - } - - data.m_fractions.resize(data.m_x_values.size()); - for(size_t i = 0; i < data.m_x_values.size(); ++i) - { - data.m_fractions[i] = data.m_x_values[i] / total; - } - - return data; - }; - + Roofline roofline; }; struct MetricValue diff --git a/src/view/src/widgets/rocprofvis_charts.cpp b/src/view/src/widgets/rocprofvis_charts.cpp index ce1793ea..bdb6e810 100644 --- a/src/view/src/widgets/rocprofvis_charts.cpp +++ b/src/view/src/widgets/rocprofvis_charts.cpp @@ -8,6 +8,7 @@ #include constexpr ImVec2 ITEM_SPACING_DEFAULT = ImVec2(8, 4); +constexpr float MINIMUM_CHART_SIZE = 250.0f; namespace RocProfVis { @@ -43,7 +44,6 @@ PieChart::CalculatePiePlacement(float padding_px, float radius_scale) return PiePlacement{ center.x, center.y, r_plot }; }; - PieChart::PieChart() { m_chart_title = "Kernels Pie"; } void @@ -52,6 +52,31 @@ ChartBase::UpdateData(ChartData data) m_data = std::move(data); } +ChartData +ChartData::GenerateChartData(KernelMetric metric, const WorkloadInfo& workload) +{ + ChartData data; + data.m_y_axis_name = "Kernels"; + data.m_x_axis_name = KernelInfo::GetMetricName(metric); + double total = 0.0; + for(const auto& kernel : workload.kernels) + { + data.m_labels.push_back(kernel.second.name.c_str()); + data.m_x_values.push_back(static_cast(kernel.second.Get(metric))); + data.m_y_values.push_back(static_cast(data.m_y_values.size())); + data.m_x_max = std::max(data.m_x_max, data.m_x_values.back()); + total += data.m_x_values.back(); + } + + data.m_fractions.resize(data.m_x_values.size()); + for(size_t i = 0; i < data.m_x_values.size(); ++i) + { + data.m_fractions[i] = data.m_x_values[i] / total; + } + + return data; +} + void PieChart::Render() { @@ -61,7 +86,7 @@ PieChart::Render() ImGui::PushID(m_chart_title); const float avail_h = ImGui::GetContentRegionAvail().y; - const ImVec2 plot_size(-1, std::max(80.0f, avail_h)); + const ImVec2 plot_size(-1, std::max(MINIMUM_CHART_SIZE, avail_h)); if(ImPlot::BeginPlot(m_chart_title, plot_size, ImPlotFlags_Equal | ImPlotFlags_NoInputs)) { @@ -85,38 +110,25 @@ PieChart::Render() ImGui::PopID(); } -void -ChartBase::ClearData() -{ - m_data.m_labels.clear(); - m_data.m_x_values.clear(); - m_data.m_y_values.clear(); - m_data.m_fractions.clear(); -} - BarChart::BarChart() { m_chart_title = "Kernels Bar"; } void BarChart::Render() { - const char* title = "Kernels Bar"; - ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ITEM_SPACING_DEFAULT); ImGui::Separator(); ImGui::PopStyleVar(); - const double bar_height = 0.7; - ImPlot::PushColormap(ImPlotColormap_Plasma); const float avail_h = ImGui::GetContentRegionAvail().y; - const ImVec2 plot_size(-1, std::max(80.0f, avail_h)); - if(ImPlot::BeginPlot(title, plot_size, + const ImVec2 plot_size(-1, std::max(MINIMUM_CHART_SIZE, avail_h)); + if(ImPlot::BeginPlot(m_chart_title, plot_size, ImPlotFlags_NoInputs | ImPlotFlags_NoLegend)) { - ImPlot::SetupAxis(ImAxis_X1, "Invocations", + ImPlot::SetupAxis(ImAxis_X1, m_data.m_x_axis_name.c_str(), ImPlotAxisFlags_NoSideSwitch | ImPlotAxisFlags_NoHighlight); - ImPlot::SetupAxis(ImAxis_Y1, "Kernels", + ImPlot::SetupAxis(ImAxis_Y1, m_data.m_y_axis_name.c_str(), ImPlotAxisFlags_NoSideSwitch | ImPlotAxisFlags_NoHighlight); ImPlot::SetupAxisTicks(ImAxis_Y1, m_data.m_y_values.data(), @@ -133,9 +145,9 @@ BarChart::Render() for(int i = 0; i < count; ++i) { const double color = - count > 1 ? static_cast(i) / (count - 1) : 0.5; // 0..1 + count > 1 ? static_cast(i) / (count - 1) : 0.5; ImPlot::SetNextFillStyle(ImPlot::SampleColormap(color)); - ImPlot::PlotBars(m_data.m_labels[i], &m_data.m_x_values[i], 1, bar_height, + ImPlot::PlotBars(m_data.m_labels[i], &m_data.m_x_values[i], 1, m_bar_height, static_cast(i), ImPlotBarsFlags_Horizontal); } @@ -144,4 +156,4 @@ BarChart::Render() ImPlot::PopColormap(); } } // namespace View -} // namespace RocProfVis \ No newline at end of file +} // namespace RocProfVis diff --git a/src/view/src/widgets/rocprofvis_charts.h b/src/view/src/widgets/rocprofvis_charts.h index eeeed8e3..ed1beccf 100644 --- a/src/view/src/widgets/rocprofvis_charts.h +++ b/src/view/src/widgets/rocprofvis_charts.h @@ -10,7 +10,18 @@ namespace RocProfVis namespace View { +struct ChartData +{ + std::vector m_labels; + std::vector m_x_values; + std::vector m_y_values; + std::string m_x_axis_name; + std::string m_y_axis_name; + std::vector m_fractions; + double m_x_max; + static ChartData GenerateChartData(KernelMetric metric, const WorkloadInfo& workload); +}; class ChartBase : public RocWidget { @@ -18,9 +29,7 @@ class ChartBase : public RocWidget ChartBase() = default; ~ChartBase() = default; void UpdateData(ChartData data); - protected: - void ClearData(); const char* m_chart_title; ChartData m_data; }; @@ -49,7 +58,9 @@ class BarChart : public ChartBase BarChart(); ~BarChart() = default; void Render() override; +private: + const double m_bar_height = 0.7; }; } // namespace View -} // namespace RocProfVis \ No newline at end of file +} // namespace RocProfVis From aa59221744ba5e03ad1cc935801583102029c775 Mon Sep 17 00:00:00 2001 From: amokice-amd Date: Fri, 20 Feb 2026 16:04:12 +0000 Subject: [PATCH 6/8] Make metric selection smarter litle improvement one more add empty lines in files delete unnecesary file delete Fix cmake --- CMakeLists.txt | 3 +- .../rocprofvis_compute_summary_view.cpp | 55 ++++++++----------- .../compute/rocprofvis_compute_summary_view.h | 31 +++++------ .../ROCPROFVIS_COMPUTE_MODEL_TYPES.CPP | 33 ----------- .../compute/rocprofvis_compute_model_types.h | 22 ++++---- 5 files changed, 51 insertions(+), 93 deletions(-) delete mode 100644 src/view/src/model/compute/ROCPROFVIS_COMPUTE_MODEL_TYPES.CPP diff --git a/CMakeLists.txt b/CMakeLists.txt index 48f2aaef..8b36c5a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,7 +105,6 @@ set(VIEW_FILES src/view/src/rocprofvis_time_to_pixel.cpp src/view/src/rocprofvis_minimap.cpp src/view/src/widgets/rocprofvis_widget.cpp - src/view/src/widgets/rocprofvis_charts.cpp src/view/src/widgets/rocprofvis_split_containers.cpp src/view/src/widgets/rocprofvis_tab_container.cpp src/view/src/widgets/rocprofvis_editable_textfield.cpp @@ -132,6 +131,8 @@ list(APPEND VIEW_FILES src/view/src/compute/rocprofvis_compute_memory_chart.cpp src/view/src/compute/rocprofvis_compute_selection.cpp src/view/src/widgets/rocprofvis_compute_widget.cpp + src/view/src/widgets/rocprofvis_charts.cpp + ) endif(COMPUTE_UI_SUPPORT) diff --git a/src/view/src/compute/rocprofvis_compute_summary_view.cpp b/src/view/src/compute/rocprofvis_compute_summary_view.cpp index 9516eb74..99030ea2 100644 --- a/src/view/src/compute/rocprofvis_compute_summary_view.cpp +++ b/src/view/src/compute/rocprofvis_compute_summary_view.cpp @@ -14,15 +14,17 @@ ComputeSummaryView::ComputeSummaryView(DataProvider& data_provider) : RocWidget() , m_data_provider(data_provider) , m_workload_id(0) -, m_selected_metric(1) //default metric - duration total +, m_selected_metric(KernelInfo::ToIndex(KernelMetric::DurationTotal)) +, m_selected_chart_id(0) { - CalculateCombosWidth(); auto font_changed_handler = [this](std::shared_ptr e) { this->CalculateCombosWidth(); }; m_font_changed_token = EventManager::GetInstance()->Subscribe( static_cast(RocEvents::kFontSizeChanged), font_changed_handler); + UpdateKernelMetrics(); + CalculateCombosWidth(); } ComputeSummaryView::~ComputeSummaryView() { @@ -62,16 +64,15 @@ ComputeSummaryView::Render() const WorkloadInfo& workload = workloads.at(m_workload_id); RenderKernelsTable(workload); - static uint32_t selected_chart_id = 0; ImGui::SetNextItemWidth(m_chart_combo_width); - if(ImGui::BeginCombo("##ChartView", m_chart_views[selected_chart_id].data())) + if(ImGui::BeginCombo("##ChartView", m_chart_views[m_selected_chart_id].data())) { - for(uint32_t index = 0; index < m_chart_views.size(); index++) + for(uint8_t index = 0; index < m_chart_views.size(); index++) { - const bool is_selected = (selected_chart_id == index); + const bool is_selected = (m_selected_chart_id == index); if(ImGui::Selectable(m_chart_views[index].data(), is_selected)) { - selected_chart_id = index; + m_selected_chart_id = index; } if(is_selected) ImGui::SetItemDefaultFocus(); @@ -83,7 +84,7 @@ ComputeSummaryView::Render() ImGui::SetNextItemWidth(m_metric_combo_width); if(ImGui::BeginCombo("##Metric", m_metric_views[m_selected_metric].data())) { - for(uint32_t index = 0; index < m_metric_views.size(); index++) + for(uint8_t index = 0; index < m_metric_views.size(); index++) { const bool is_selected = (m_selected_metric == index); if(ImGui::Selectable(m_metric_views[index].data(), is_selected)) @@ -98,9 +99,9 @@ ComputeSummaryView::Render() } ImGui::BeginChild("Chart"); - if(selected_chart_id == 0) + if(m_selected_chart_id == 0) m_pie_chart.Render(); - else if(selected_chart_id == 1) + else if(m_selected_chart_id == 1) m_bar_chart.Render(); ImGui::EndChild(); // Chart @@ -193,35 +194,27 @@ ComputeSummaryView::RenderKernelsTable(const WorkloadInfo& workload) ImGui::EndTable(); } ImGui::EndChild(); - -} - -KernelMetric -ComputeSummaryView::GetMetricNameByIndex(uint32_t index) const -{ - switch (index) - { - case 0: return KernelMetric::InvocationCount; - case 1: return KernelMetric::DurationTotal; - case 2: return KernelMetric::DurationMin; - case 3: return KernelMetric::DurationMax; - case 4: return KernelMetric::DurationMean; - case 5: return KernelMetric::DurationMedian; - default: - assert(false && "Invalid metric index"); - return KernelMetric::DurationTotal; - } } void -ComputeSummaryView::UpdataChartData(const WorkloadInfo& workload, uint32_t metric_id) +ComputeSummaryView::UpdataChartData(const WorkloadInfo& workload, uint8_t metric_id) { ChartData chart_data = - ChartData::GenerateChartData(GetMetricNameByIndex(metric_id), workload); + ChartData::GenerateChartData(static_cast(metric_id), workload); m_pie_chart.UpdateData(chart_data); m_bar_chart.UpdateData(chart_data); } +void +ComputeSummaryView::UpdateKernelMetrics() +{ + for(uint8_t metric_index = 0; metric_index < KernelInfo::ToIndex(KernelMetric::COUNT); metric_index++) + { + m_metric_views.push_back( + KernelInfo::GetMetricName(static_cast (metric_index))); + } +} + } // namespace View -} // namespace RocProfVis \ No newline at end of file +} // namespace RocProfVis diff --git a/src/view/src/compute/rocprofvis_compute_summary_view.h b/src/view/src/compute/rocprofvis_compute_summary_view.h index bebbcd9e..f32c00af 100644 --- a/src/view/src/compute/rocprofvis_compute_summary_view.h +++ b/src/view/src/compute/rocprofvis_compute_summary_view.h @@ -7,8 +7,6 @@ #include "rocprofvis_data_provider.h" #include "rocprofvis_event_manager.h" -#include - namespace RocProfVis { namespace View @@ -20,30 +18,27 @@ class ComputeSummaryView : public RocWidget ComputeSummaryView(DataProvider& data_provider); ~ComputeSummaryView(); void Render() override; + private: - void CalculateCombosWidth(); - void RenderKernelsTable(const WorkloadInfo& workload); - KernelMetric GetMetricNameByIndex(uint32_t metric) const; - void UpdataChartData(const WorkloadInfo& workload, uint32_t metric_id); + void CalculateCombosWidth(); + void RenderKernelsTable(const WorkloadInfo& workload); + void UpdataChartData(const WorkloadInfo& workload, uint8_t metric_id); + void UpdateKernelMetrics(); const std::vector m_chart_views = { "Pie Chart", "Bar Chart" }; - const std::vector m_metric_views = { - "Invocation Count", "Duration Total", "Duration Min", - "Duration Max", "Duration Mean", "Duration Median" - }; + std::vector m_metric_views; PieChart m_pie_chart; BarChart m_bar_chart; - DataProvider& m_data_provider; - uint32_t m_workload_id; - float m_chart_combo_width; - float m_metric_combo_width; - uint32_t m_selected_metric; + DataProvider& m_data_provider; + uint32_t m_workload_id; + float m_chart_combo_width; + float m_metric_combo_width; + uint8_t m_selected_metric; + uint8_t m_selected_chart_id; EventManager::SubscriptionToken m_font_changed_token; - }; - } // namespace View -} // namespace RocProfVis \ No newline at end of file +} // namespace RocProfVis diff --git a/src/view/src/model/compute/ROCPROFVIS_COMPUTE_MODEL_TYPES.CPP b/src/view/src/model/compute/ROCPROFVIS_COMPUTE_MODEL_TYPES.CPP deleted file mode 100644 index 3f2fa04e..00000000 --- a/src/view/src/model/compute/ROCPROFVIS_COMPUTE_MODEL_TYPES.CPP +++ /dev/null @@ -1,33 +0,0 @@ -#include "rocprofvis_compute_model_types.h" - -namespace RocProfVis -{ -namespace View -{ -ChartData -WorkloadInfo::GenerateChartData() const -{ - ChartData data; - double total = 0.0; - for(const auto& kernel : kernels) - { - data.m_labels.push_back(kernel.second.name.c_str()); - data.m_x_values.push_back(static_cast(kernel.second.duration_total)); - data.m_y_values.push_back(static_cast(data.m_y_values.size())); - data.m_x_max = std::max(data.m_x_max, data.m_x_values.back()); - total += data.m_x_values.back(); - } - - data.m_fractions.resize( - data.m_x_values - .size()); // TODO: It need only for PieChart thing how to read of there - for(size_t i = 0; i < data.m_x_values.size(); ++i) - { - data.m_fractions[i] = data.m_x_values[i] / total; - } - - return data; -}; - -} -} diff --git a/src/view/src/model/compute/rocprofvis_compute_model_types.h b/src/view/src/model/compute/rocprofvis_compute_model_types.h index 8b771e43..ec70e69b 100644 --- a/src/view/src/model/compute/rocprofvis_compute_model_types.h +++ b/src/view/src/model/compute/rocprofvis_compute_model_types.h @@ -33,7 +33,7 @@ struct AvailableMetrics uint32_t id; std::string name; std::unordered_map entries; - std::vector values_names; //TODO + std::vector values_names; }; struct Category { @@ -51,15 +51,15 @@ struct Point double y; }; -enum class KernelMetric : uint64_t +enum class KernelMetric : uint8_t { - InvocationCount, - DurationTotal, - DurationMin, - DurationMax, - DurationMean, - DurationMedian, - COUNT + InvocationCount = 0, + DurationTotal = 1, + DurationMin = 2, + DurationMax = 3, + DurationMean = 4, + DurationMedian = 5, + COUNT = 6 }; struct KernelInfo @@ -102,7 +102,7 @@ struct KernelInfo } }; - static std::string GetMetricName(KernelMetric metric) + static std::string_view GetMetricName(KernelMetric metric) { switch(metric) { @@ -115,6 +115,8 @@ struct KernelInfo default: return ""; } } + + static uint8_t ToIndex(KernelMetric m) { return static_cast(m); } }; struct WorkloadInfo From b924c268dd6b994aadc9752600767f457449545c Mon Sep 17 00:00:00 2001 From: amokice-amd Date: Fri, 20 Feb 2026 19:03:55 +0000 Subject: [PATCH 7/8] Merge fix --- src/view/src/compute/rocprofvis_compute_view.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/view/src/compute/rocprofvis_compute_view.cpp b/src/view/src/compute/rocprofvis_compute_view.cpp index 7bfbaac8..7f1e3d5a 100644 --- a/src/view/src/compute/rocprofvis_compute_view.cpp +++ b/src/view/src/compute/rocprofvis_compute_view.cpp @@ -43,8 +43,6 @@ ComputeView::ComputeView() std::make_shared(client_id, trace_path)); } }); - - } ComputeView::~ComputeView() {} @@ -83,7 +81,7 @@ ComputeView::CreateView() m_compute_selection = std::make_shared(m_data_provider); m_tab_container = std::make_shared(); - m_tab_container->AddTab(TabItem{"Summary View", "compute_summary_view", std::make_shared(m_data_provider, m_compute_selection), false}); + m_tab_container->AddTab(TabItem{"Summary View", "compute_summary_view", std::make_shared(m_data_provider), false}); m_tab_container->AddTab(TabItem{"Kernel Details", "compute_kernel_details_view", std::make_shared(m_data_provider, m_compute_selection), false}); m_tab_container->AddTab(TabItem{"Table View", "compute_table_view", std::make_shared(m_data_provider, m_compute_selection), false}); m_tab_container->AddTab(TabItem{"Workload Details", "compute_workload_view", std::make_shared(m_data_provider, m_compute_selection), false}); From f6b9b612a38fac5ed2c7f97ee1a0ae425eb0029d Mon Sep 17 00:00:00 2001 From: "Chen, Derek" Date: Mon, 23 Feb 2026 13:34:22 -0500 Subject: [PATCH 8/8] Minimum updates for dev compatibility. Minimum updates for dev compatibility. --- CMakeLists.txt | 1 - .../compute/rocprofvis_compute_summary.cpp | 184 ++- .../src/compute/rocprofvis_compute_summary.h | 19 + .../rocprofvis_compute_summary_view.cpp | 220 ---- .../compute/rocprofvis_compute_summary_view.h | 44 - .../src/compute/rocprofvis_compute_view.cpp | 1050 ++++++++--------- .../src/compute/rocprofvis_compute_view.h | 21 +- 7 files changed, 687 insertions(+), 852 deletions(-) delete mode 100644 src/view/src/compute/rocprofvis_compute_summary_view.cpp delete mode 100644 src/view/src/compute/rocprofvis_compute_summary_view.h diff --git a/CMakeLists.txt b/CMakeLists.txt index c1b17ecd..7a95df6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,6 @@ list(APPEND VIEW_FILES src/view/src/model/compute/rocprofvis_compute_data_model.cpp src/view/src/compute/rocprofvis_compute_root.cpp src/view/src/compute/legacy/rocprofvis_compute_summary.cpp - src/view/src/compute/rocprofvis_compute_summary_view.cpp src/view/src/compute/legacy/rocprofvis_compute_block.cpp src/view/src/compute/legacy/rocprofvis_compute_table.cpp src/view/src/compute/rocprofvis_compute_data_provider.cpp diff --git a/src/view/src/compute/rocprofvis_compute_summary.cpp b/src/view/src/compute/rocprofvis_compute_summary.cpp index 9f263adc..80873e0d 100644 --- a/src/view/src/compute/rocprofvis_compute_summary.cpp +++ b/src/view/src/compute/rocprofvis_compute_summary.cpp @@ -7,6 +7,8 @@ #include "rocprofvis_data_provider.h" #include "rocprofvis_event_manager.h" +constexpr float DROPDOWN_SCALE = 15.0f; + namespace RocProfVis { namespace View @@ -19,6 +21,9 @@ ComputeSummaryView::ComputeSummaryView( , m_roofline(nullptr) , m_compute_selection(compute_selection) , m_client_id(IdGenerator::GetInstance().GenerateId()) +, m_workload_id(0) +, m_selected_metric(KernelInfo::ToIndex(KernelMetric::DurationTotal)) +, m_selected_chart_id(0) { auto workload_changed_handler = [this](std::shared_ptr e) { if(auto selection_changed_event = @@ -29,6 +34,13 @@ ComputeSummaryView::ComputeSummaryView( { return; } + m_workload_id = selection_changed_event->GetId(); + if(m_data_provider.ComputeModel().GetWorkloads().count(m_workload_id) > 0) + { + UpdataChartData( + m_data_provider.ComputeModel().GetWorkloads().at(m_workload_id), + m_selected_metric); + } if(m_roofline) { m_roofline->SetWorkload(selection_changed_event->GetId()); @@ -51,20 +63,32 @@ ComputeSummaryView::ComputeSummaryView( } }; + auto font_changed_handler = [this](std::shared_ptr e) { + this->CalculateCombosWidth(); + }; + m_font_changed_token = EventManager::GetInstance()->Subscribe( + static_cast(RocEvents::kFontSizeChanged), font_changed_handler); + m_metrics_fetched_token = EventManager::GetInstance()->Subscribe( static_cast(RocEvents::kComputeMetricsFetched), metrics_fetched_handler); m_roofline = std::make_unique(m_data_provider); + UpdateKernelMetrics(); + CalculateCombosWidth(); + m_widget_name = GenUniqueName("ComputeSummaryView"); } -ComputeSummaryView::~ComputeSummaryView() { +ComputeSummaryView::~ComputeSummaryView() +{ EventManager::GetInstance()->Unsubscribe( static_cast(RocEvents::kComputeWorkloadSelectionChanged), m_workload_selection_changed_token); EventManager::GetInstance()->Unsubscribe( static_cast(RocEvents::kComputeMetricsFetched), m_metrics_fetched_token); + EventManager::GetInstance()->Unsubscribe( + static_cast(RocEvents::kFontSizeChanged), m_font_changed_token); } void @@ -80,6 +104,55 @@ void ComputeSummaryView::Render() { ImGui::BeginChild("summary"); + const std::unordered_map& workloads = + m_data_provider.ComputeModel().GetWorkloads(); + if(workloads.count(m_workload_id) > 0) + { + const WorkloadInfo& workload = workloads.at(m_workload_id); + RenderKernelsTable(workload); + + ImGui::SetNextItemWidth(m_chart_combo_width); + if(ImGui::BeginCombo("##ChartView", m_chart_views[m_selected_chart_id].data())) + { + for(uint8_t index = 0; index < m_chart_views.size(); index++) + { + const bool is_selected = (m_selected_chart_id == index); + if(ImGui::Selectable(m_chart_views[index].data(), is_selected)) + { + m_selected_chart_id = index; + } + + if(is_selected) ImGui::SetItemDefaultFocus(); + } + ImGui::EndCombo(); + } + + ImGui::SameLine(); + ImGui::SetNextItemWidth(m_metric_combo_width); + if(ImGui::BeginCombo("##Metric", m_metric_views[m_selected_metric].data())) + { + for(uint8_t index = 0; index < m_metric_views.size(); index++) + { + const bool is_selected = (m_selected_metric == index); + if(ImGui::Selectable(m_metric_views[index].data(), is_selected)) + { + m_selected_metric = index; + UpdataChartData(workload, m_selected_metric); + } + + if(is_selected) ImGui::SetItemDefaultFocus(); + } + ImGui::EndCombo(); + } + + ImGui::BeginChild("Chart"); + if(m_selected_chart_id == 0) + m_pie_chart.Render(); + else if(m_selected_chart_id == 1) + m_bar_chart.Render(); + + ImGui::EndChild(); // Chart + } if(m_roofline) { m_roofline->Render(); @@ -87,5 +160,114 @@ ComputeSummaryView::Render() ImGui::EndChild(); } +void +ComputeSummaryView::CalculateCombosWidth() +{ + m_chart_combo_width = 0.0f; + m_metric_combo_width = 0.0f; + + ImGuiStyle& style = ImGui::GetStyle(); + + const float frame_padding_lr = style.FramePadding.x * 2.0f; + const float inner_spacing = style.ItemInnerSpacing.x; + const float arrow_area = ImGui::GetFrameHeight(); // approximate arrow / preview area + const float extra_margin_px = 8.0f; // small visual margin + const float min_width_px = 80.0f; // sensible minimum + + float max_chart_text_w = 0.0f; + for(const auto& chart : m_chart_views) + { + const ImVec2 ts = ImGui::CalcTextSize(chart.data()); + if(ts.x > max_chart_text_w) max_chart_text_w = ts.x; + } + + // Compute longest label width for metric views + float max_metric_text_w = 0.0f; + for(const auto& metric : m_metric_views) + { + const ImVec2 ts = ImGui::CalcTextSize(metric.data()); + if(ts.x > max_metric_text_w) max_metric_text_w = ts.x; + } + + // Final widths include padding, spacing, arrow area and a small margin. + float chart_total = max_chart_text_w + frame_padding_lr + inner_spacing + arrow_area + + extra_margin_px; + float metric_total = max_metric_text_w + frame_padding_lr + inner_spacing + + arrow_area + extra_margin_px; + + if(chart_total < min_width_px) chart_total = min_width_px; + if(metric_total < min_width_px) metric_total = min_width_px; + + m_chart_combo_width = chart_total; + m_metric_combo_width = metric_total; +} + +void +ComputeSummaryView::RenderKernelsTable(const WorkloadInfo& workload) +{ + ImGui::BeginChild("kernels", ImVec2(0, 0), + ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); + ImGui::Text("Kernels"); + if(ImGui::BeginTable("", 8, + ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | + ImGuiTableFlags_SizingStretchSame)) + { + ImGui::TableSetupColumn("ID"); + ImGui::TableSetupColumn("Name"); + ImGui::TableSetupColumn("Invocation Count"); + ImGui::TableSetupColumn("Total Duration"); + ImGui::TableSetupColumn("Min Duration"); + ImGui::TableSetupColumn("Max Duration"); + ImGui::TableSetupColumn("Mean Duration"); + ImGui::TableSetupColumn("Median Duration"); + ImGui::TableHeadersRow(); + for(const std::pair& kernel : workload.kernels) + { + ImGui::PushID(static_cast(kernel.second.id)); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.id); + ImGui::TableNextColumn(); + ImGui::Text(kernel.second.name.c_str()); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.invocation_count); + ImGui::TableNextColumn(); + ImGui::Text("%llu", kernel.second.duration_total); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_min); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_max); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_mean); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_median); + ImGui::PopID(); + } + ImGui::EndTable(); + } + ImGui::EndChild(); +} + +void +ComputeSummaryView::UpdataChartData(const WorkloadInfo& workload, uint8_t metric_id) +{ + ChartData chart_data = + ChartData::GenerateChartData(static_cast(metric_id), workload); + + m_pie_chart.UpdateData(chart_data); + m_bar_chart.UpdateData(chart_data); +} + +void +ComputeSummaryView::UpdateKernelMetrics() +{ + for(uint8_t metric_index = 0; metric_index < KernelInfo::ToIndex(KernelMetric::COUNT); + metric_index++) + { + m_metric_views.push_back( + KernelInfo::GetMetricName(static_cast(metric_index))); + } +} + } // namespace View } // namespace RocProfVis diff --git a/src/view/src/compute/rocprofvis_compute_summary.h b/src/view/src/compute/rocprofvis_compute_summary.h index 57121f3b..8acd24ce 100644 --- a/src/view/src/compute/rocprofvis_compute_summary.h +++ b/src/view/src/compute/rocprofvis_compute_summary.h @@ -4,6 +4,7 @@ #pragma once #include "rocprofvis_event_manager.h" #include "widgets/rocprofvis_widget.h" +#include "widgets/rocprofvis_charts.h" namespace RocProfVis { @@ -14,6 +15,8 @@ class DataProvider; class ComputeSelection; class Roofline; +struct WorkloadInfo; + class ComputeSummaryView : public RocWidget { public: @@ -25,15 +28,31 @@ class ComputeSummaryView : public RocWidget void Render() override; private: + void CalculateCombosWidth(); + void RenderKernelsTable(const WorkloadInfo& workload); + void UpdataChartData(const WorkloadInfo& workload, uint8_t metric_id); + void UpdateKernelMetrics(); + DataProvider& m_data_provider; std::shared_ptr m_compute_selection; std::unique_ptr m_roofline; + PieChart m_pie_chart; + BarChart m_bar_chart; + + const std::vector m_chart_views = { "Pie Chart", "Bar Chart" }; + std::vector m_metric_views; + uint32_t m_workload_id; + float m_chart_combo_width; + float m_metric_combo_width; + uint8_t m_selected_metric; + uint8_t m_selected_chart_id; uint64_t m_client_id; EventManager::SubscriptionToken m_workload_selection_changed_token; EventManager::SubscriptionToken m_metrics_fetched_token; + EventManager::SubscriptionToken m_font_changed_token; }; } // namespace View diff --git a/src/view/src/compute/rocprofvis_compute_summary_view.cpp b/src/view/src/compute/rocprofvis_compute_summary_view.cpp deleted file mode 100644 index 99030ea2..00000000 --- a/src/view/src/compute/rocprofvis_compute_summary_view.cpp +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright Advanced Micro Devices, Inc. -// SPDX-License-Identifier: MIT - -#include "rocprofvis_compute_summary_view.h" -#include "implot/implot.h" - -constexpr float DROPDOWN_SCALE = 15.0f; - -namespace RocProfVis -{ -namespace View -{ -ComputeSummaryView::ComputeSummaryView(DataProvider& data_provider) -: RocWidget() -, m_data_provider(data_provider) -, m_workload_id(0) -, m_selected_metric(KernelInfo::ToIndex(KernelMetric::DurationTotal)) -, m_selected_chart_id(0) -{ - auto font_changed_handler = [this](std::shared_ptr e) { - this->CalculateCombosWidth(); - }; - m_font_changed_token = EventManager::GetInstance()->Subscribe( - static_cast(RocEvents::kFontSizeChanged), font_changed_handler); - - UpdateKernelMetrics(); - CalculateCombosWidth(); -} -ComputeSummaryView::~ComputeSummaryView() -{ - EventManager::GetInstance()->Unsubscribe( - static_cast(RocEvents::kFontSizeChanged), m_font_changed_token); -}; - -void -ComputeSummaryView::Render() -{ - const std::unordered_map& workloads = - m_data_provider.ComputeModel().GetWorkloads(); - ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * DROPDOWN_SCALE); - if(ImGui::BeginCombo("Workloads", - workloads.count(m_workload_id) > 0 - ? workloads.at(m_workload_id).name.c_str() - : "-")) - { - if(ImGui::Selectable("-", m_workload_id == 0)) - { - m_workload_id = 0; - } - for(const std::pair& workload : workloads) - { - if(ImGui::Selectable(workload.second.name.c_str(), - m_workload_id == workload.second.id)) - { - m_workload_id = workload.second.id; - UpdataChartData(workload.second, m_selected_metric); - } - } - ImGui::EndCombo(); - } - - if(workloads.count(m_workload_id) > 0) - { - const WorkloadInfo& workload = workloads.at(m_workload_id); - RenderKernelsTable(workload); - - ImGui::SetNextItemWidth(m_chart_combo_width); - if(ImGui::BeginCombo("##ChartView", m_chart_views[m_selected_chart_id].data())) - { - for(uint8_t index = 0; index < m_chart_views.size(); index++) - { - const bool is_selected = (m_selected_chart_id == index); - if(ImGui::Selectable(m_chart_views[index].data(), is_selected)) - { - m_selected_chart_id = index; - } - - if(is_selected) ImGui::SetItemDefaultFocus(); - } - ImGui::EndCombo(); - } - - ImGui::SameLine(); - ImGui::SetNextItemWidth(m_metric_combo_width); - if(ImGui::BeginCombo("##Metric", m_metric_views[m_selected_metric].data())) - { - for(uint8_t index = 0; index < m_metric_views.size(); index++) - { - const bool is_selected = (m_selected_metric == index); - if(ImGui::Selectable(m_metric_views[index].data(), is_selected)) - { - m_selected_metric = index; - UpdataChartData(workload, m_selected_metric); - } - - if(is_selected) ImGui::SetItemDefaultFocus(); - } - ImGui::EndCombo(); - } - - ImGui::BeginChild("Chart"); - if(m_selected_chart_id == 0) - m_pie_chart.Render(); - else if(m_selected_chart_id == 1) - m_bar_chart.Render(); - - ImGui::EndChild(); // Chart - } -} - -void -ComputeSummaryView::CalculateCombosWidth() -{ - m_chart_combo_width = 0.0f; - m_metric_combo_width = 0.0f; - - ImGuiStyle& style = ImGui::GetStyle(); - - const float frame_padding_lr = style.FramePadding.x * 2.0f; - const float inner_spacing = style.ItemInnerSpacing.x; - const float arrow_area = ImGui::GetFrameHeight(); // approximate arrow / preview area - const float extra_margin_px = 8.0f; // small visual margin - const float min_width_px = 80.0f; // sensible minimum - - float max_chart_text_w = 0.0f; - for(const auto& chart : m_chart_views) - { - const ImVec2 ts = ImGui::CalcTextSize(chart.data()); - if(ts.x > max_chart_text_w) max_chart_text_w = ts.x; - } - - // Compute longest label width for metric views - float max_metric_text_w = 0.0f; - for(const auto& metric : m_metric_views) - { - const ImVec2 ts = ImGui::CalcTextSize(metric.data()); - if(ts.x > max_metric_text_w) max_metric_text_w = ts.x; - } - - // Final widths include padding, spacing, arrow area and a small margin. - float chart_total = max_chart_text_w + frame_padding_lr + inner_spacing + arrow_area + - extra_margin_px; - float metric_total = max_metric_text_w + frame_padding_lr + inner_spacing + - arrow_area + extra_margin_px; - - if(chart_total < min_width_px) chart_total = min_width_px; - if(metric_total < min_width_px) metric_total = min_width_px; - - m_chart_combo_width = chart_total; - m_metric_combo_width = metric_total; -} - -void -ComputeSummaryView::RenderKernelsTable(const WorkloadInfo& workload) -{ - ImGui::BeginChild("kernels", ImVec2(0, 0), - ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); - ImGui::Text("Kernels"); - if(ImGui::BeginTable("", 8, - ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | - ImGuiTableFlags_SizingStretchSame)) - { - ImGui::TableSetupColumn("ID"); - ImGui::TableSetupColumn("Name"); - ImGui::TableSetupColumn("Invocation Count"); - ImGui::TableSetupColumn("Total Duration"); - ImGui::TableSetupColumn("Min Duration"); - ImGui::TableSetupColumn("Max Duration"); - ImGui::TableSetupColumn("Mean Duration"); - ImGui::TableSetupColumn("Median Duration"); - ImGui::TableHeadersRow(); - for(const std::pair& kernel : workload.kernels) - { - ImGui::PushID(static_cast(kernel.second.id)); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.id); - ImGui::TableNextColumn(); - ImGui::Text(kernel.second.name.c_str()); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.invocation_count); - ImGui::TableNextColumn(); - ImGui::Text("%llu", kernel.second.duration_total); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.duration_min); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.duration_max); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.duration_mean); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.duration_median); - ImGui::PopID(); - } - ImGui::EndTable(); - } - ImGui::EndChild(); -} - -void -ComputeSummaryView::UpdataChartData(const WorkloadInfo& workload, uint8_t metric_id) -{ - ChartData chart_data = - ChartData::GenerateChartData(static_cast(metric_id), workload); - - m_pie_chart.UpdateData(chart_data); - m_bar_chart.UpdateData(chart_data); -} - -void -ComputeSummaryView::UpdateKernelMetrics() -{ - for(uint8_t metric_index = 0; metric_index < KernelInfo::ToIndex(KernelMetric::COUNT); metric_index++) - { - m_metric_views.push_back( - KernelInfo::GetMetricName(static_cast (metric_index))); - } -} - -} // namespace View -} // namespace RocProfVis diff --git a/src/view/src/compute/rocprofvis_compute_summary_view.h b/src/view/src/compute/rocprofvis_compute_summary_view.h deleted file mode 100644 index f32c00af..00000000 --- a/src/view/src/compute/rocprofvis_compute_summary_view.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright Advanced Micro Devices, Inc. -// SPDX-License-Identifier: MIT - -#pragma once -#include "../model/compute/rocprofvis_compute_model_types.h" -#include "../widgets/rocprofvis_charts.h" -#include "rocprofvis_data_provider.h" -#include "rocprofvis_event_manager.h" - -namespace RocProfVis -{ -namespace View -{ - -class ComputeSummaryView : public RocWidget -{ -public: - ComputeSummaryView(DataProvider& data_provider); - ~ComputeSummaryView(); - void Render() override; - -private: - void CalculateCombosWidth(); - void RenderKernelsTable(const WorkloadInfo& workload); - void UpdataChartData(const WorkloadInfo& workload, uint8_t metric_id); - void UpdateKernelMetrics(); - - const std::vector m_chart_views = { "Pie Chart", "Bar Chart" }; - std::vector m_metric_views; - - PieChart m_pie_chart; - BarChart m_bar_chart; - - DataProvider& m_data_provider; - uint32_t m_workload_id; - float m_chart_combo_width; - float m_metric_combo_width; - uint8_t m_selected_metric; - uint8_t m_selected_chart_id; - EventManager::SubscriptionToken m_font_changed_token; -}; - -} // namespace View -} // namespace RocProfVis diff --git a/src/view/src/compute/rocprofvis_compute_view.cpp b/src/view/src/compute/rocprofvis_compute_view.cpp index 769d4ea7..18489483 100644 --- a/src/view/src/compute/rocprofvis_compute_view.cpp +++ b/src/view/src/compute/rocprofvis_compute_view.cpp @@ -83,7 +83,7 @@ ComputeView::CreateView() m_compute_selection = std::make_shared(m_data_provider); m_tab_container = std::make_shared(); - m_tab_container->AddTab(TabItem{"Summary View", "compute_summary_view", std::make_shared(m_data_provider), false}); + m_tab_container->AddTab(TabItem{"Summary View", "compute_summary_view", std::make_shared(m_data_provider, m_compute_selection), false}); m_tab_container->AddTab(TabItem{"Kernel Details", "compute_kernel_details_view", std::make_shared(m_data_provider, m_compute_selection), false}); m_tab_container->AddTab(TabItem{"Table View", "compute_table_view", std::make_shared(m_data_provider, m_compute_selection), false}); m_tab_container->AddTab(TabItem{"Workload Details", "compute_workload_view", std::make_shared(m_data_provider, m_compute_selection), false}); @@ -234,7 +234,6 @@ ComputeWorkloadView::ComputeWorkloadView(DataProvider& data_provider, std::share ComputeTester::ComputeTester(DataProvider& data_provider) : m_data_provider(data_provider) , m_selections({ true, 0, {}, {}, SelectionState::FP32, {}, {}, {} }) -, m_summary_view(data_provider) , m_display_names({ { { kRPVControllerRooflineCeilingComputeVALUI8, "VALU I8" }, @@ -277,7 +276,7 @@ ComputeTester::Render() { const std::unordered_map& workloads = m_data_provider.ComputeModel().GetWorkloads(); - ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * DROPDOWN_SCALE); + ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * 15.0f); if(ImGui::BeginCombo("Workloads", workloads.count(m_selections.workload_id) > 0 ? workloads.at(m_selections.workload_id).name.c_str() @@ -299,376 +298,301 @@ ComputeTester::Render() } ImGui::EndCombo(); } - - static uint32_t selected_view_id = 0; - ImGui::SameLine(); - ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * DROPDOWN_SCALE); - if(ImGui::BeginCombo("View", m_views[selected_view_id].data())) - { - for(uint32_t index = 0; index < m_views.size(); index++) - { - const bool is_selected = (selected_view_id == index); - if(ImGui::Selectable(m_views[index].data(), is_selected)) - selected_view_id = index; - - if(is_selected) - ImGui::SetItemDefaultFocus(); - } - ImGui::EndCombo(); - } - if(workloads.count(m_selections.workload_id) > 0) { - ImGui::BeginChild("sv"); //What is sv? - RenderSelectedView(workloads, selected_view_id); - ImGui::EndChild(); //Sv - m_selections.init = false; - } -} - -void -ComputeTester::RenderSelectedView( - const std::unordered_map& workloads, uint32_t view_index) -{ - const WorkloadInfo& workload = workloads.at(m_selections.workload_id); - switch(view_index) // TODO: Replace index to something readable - { - case 0: - { - RenderSystemAndConfig(workload); - break; - } - case 1: - { - RenderProfilingConfig(workload); - break; - } - case 2: - { - RenderMetrics(workload); - break; - } - case 3: - { - RenderKernels(workload); - break; - } - case 4: - { - RenderFetcher(workload); - break; - } - case 5: - { - RenderSummaryView(workload); - break; - } - } -} - -void -ComputeTester::RenderSystemAndConfig(const WorkloadInfo& workload) -{ - ImGui::BeginChild("info", ImVec2(0, 0), - ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); - if(workload.system_info.size() == 2 && - workload.system_info[0].size() == workload.system_info[1].size()) - { - ImGui::BeginChild("sys_info", - ImVec2(ImGui::GetContentRegionAvail().x / 2.0f, 0.0f), - ImGuiChildFlags_AutoResizeY); - ImGui::Text("System Information"); - if(ImGui::BeginTable("", static_cast(workload.system_info.size()), - ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders)) + ImGui::BeginChild("sv"); + ImGui::BeginChild("info", ImVec2(0, 0), + ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); + const WorkloadInfo& workload = workloads.at(m_selections.workload_id); + if(workload.system_info.size() == 2 && + workload.system_info[0].size() == workload.system_info[1].size()) { - for(size_t i = 0; i < workload.system_info[0].size(); i++) + ImGui::BeginChild("sys_info", + ImVec2(ImGui::GetContentRegionAvail().x / 2.0f, 0.0f), + ImGuiChildFlags_AutoResizeY); + ImGui::Text("System Information"); + if(ImGui::BeginTable("", static_cast(workload.system_info.size()), + ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders)) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text(workload.system_info[0][i].c_str()); - ImGui::TableNextColumn(); - ImGui::Text(workload.system_info[1][i].c_str()); + for(size_t i = 0; i < workload.system_info[0].size(); i++) + { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text(workload.system_info[0][i].c_str()); + ImGui::TableNextColumn(); + ImGui::Text(workload.system_info[1][i].c_str()); + } + ImGui::EndTable(); } - ImGui::EndTable(); + ImGui::EndChild(); } - ImGui::EndChild(); - } - ImGui::EndChild(); -} - -void -ComputeTester::RenderProfilingConfig(const WorkloadInfo& workload) -{ - if(workload.profiling_config.size() == 2 && - workload.profiling_config[0].size() == workload.profiling_config[1].size()) - { - ImGui::BeginChild("config", ImVec2(0, 0), ImGuiChildFlags_AutoResizeY); - ImGui::Text("Profiling Configuration"); - if(ImGui::BeginTable("", static_cast(workload.profiling_config.size()), - ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders)) + if(workload.profiling_config.size() == 2 && + workload.profiling_config[0].size() == workload.profiling_config[1].size()) { - for(size_t i = 0; i < workload.profiling_config[0].size(); i++) + ImGui::SameLine(); + ImGui::BeginChild("config", ImVec2(0, 0), ImGuiChildFlags_AutoResizeY); + ImGui::Text("Profiling Configuration"); + if(ImGui::BeginTable("", static_cast(workload.profiling_config.size()), + ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders)) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text(workload.profiling_config[0][i].c_str()); - ImGui::TableNextColumn(); - ImGui::Text(workload.profiling_config[1][i].c_str()); + for(size_t i = 0; i < workload.profiling_config[0].size(); i++) + { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text(workload.profiling_config[0][i].c_str()); + ImGui::TableNextColumn(); + ImGui::Text(workload.profiling_config[1][i].c_str()); + } + ImGui::EndTable(); } - ImGui::EndTable(); + ImGui::EndChild(); } ImGui::EndChild(); - } -} - -void -ComputeTester::RenderMetrics(const WorkloadInfo& workload) -{ - ImGui::BeginChild("metrics", ImVec2(0, 0), - ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); - ImGui::Text("Available Metrics"); - for(const std::pair& category : - workload.available_metrics.tree) - { - ImGui::PushID(static_cast(category.first)); - if(ImGui::TreeNodeEx(std::string("[" + std::to_string(category.second.id) + "] " + - category.second.name) - .c_str())) + ImGui::NewLine(); + ImGui::BeginChild("metrics", ImVec2(0, 0), + ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); + ImGui::Text("Available Metrics"); + for(const std::pair& category : + workload.available_metrics.tree) { - for(const std::pair& table : - category.second.tables) + ImGui::PushID(static_cast(category.first)); + if(ImGui::TreeNodeEx(std::string("[" + std::to_string(category.second.id) + + "] " + category.second.name) + .c_str())) { - ImGui::PushID(static_cast(table.first)); - std::string partial_metric_id = std::to_string(category.second.id) + "." + - std::to_string(table.second.id); - bool table_selected = - m_selections.metric_ids.count(category.first) > 0 && - m_selections.metric_ids.at(category.first).count(table.first) > 0 && - m_selections.metric_ids.at(category.first).at(table.first).first; - bool table_selected_changed = ImGui::Selectable("", table_selected); - if(table_selected_changed) + for(const std::pair& table : + category.second.tables) { - if(table_selected) + ImGui::PushID(static_cast(table.first)); + std::string partial_metric_id = std::to_string(category.second.id) + + "." + std::to_string(table.second.id); + bool table_selected = + m_selections.metric_ids.count(category.first) > 0 && + m_selections.metric_ids.at(category.first).count(table.first) > + 0 && + m_selections.metric_ids.at(category.first).at(table.first).first; + bool table_selected_changed = ImGui::Selectable("", table_selected); + if(table_selected_changed) { - if(m_selections.metric_ids.at(category.first).size() == 1) + if(table_selected) { - m_selections.metric_ids.erase(category.first); + if(m_selections.metric_ids.at(category.first).size() == 1) + { + m_selections.metric_ids.erase(category.first); + } + else + { + m_selections.metric_ids.at(category.first) + .erase(table.first); + } } else { - m_selections.metric_ids.at(category.first).erase(table.first); + m_selections.metric_ids[category.first][table.first] = { true, + {} }; } } - else - { - m_selections.metric_ids[category.first][table.first] = { true, - {} }; - } - } - ImGui::SameLine(0.0f); - ImGui::BeginDisabled(table_selected); - if(ImGui::TreeNodeEx( - std::string("[" + partial_metric_id + "] " + table.second.name) - .c_str(), - ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_Bullet)) - { - if(ImGui::BeginTable("", 5, - ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | - ImGuiTableFlags_SizingStretchSame)) + ImGui::SameLine(0.0f); + ImGui::BeginDisabled(table_selected); + if(ImGui::TreeNodeEx( + std::string("[" + partial_metric_id + "] " + table.second.name) + .c_str(), + ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_Bullet)) { - int col = 0; - for(const std::pair& - entry : table.second.entries) + if(ImGui::BeginTable("", 5, + ImGuiTableFlags_RowBg | + ImGuiTableFlags_Borders | + ImGuiTableFlags_SizingStretchSame)) { - if(col % 5 == 0) + int col = 0; + for(const std::pair& + entry : table.second.entries) { - ImGui::TableNextRow(); - } - ImGui::TableNextColumn(); - bool entry_selected = - m_selections.metric_ids.count(category.first) > 0 && - m_selections.metric_ids.at(category.first) - .count(table.first) > 0 && - m_selections.metric_ids.at(category.first) - .at(table.first) - .second.count(entry.first) > 0; - if(ImGui::Selectable( - std::string("[" + partial_metric_id + "." + - std::to_string(entry.second.id) + "] " + - entry.second.name) - .c_str(), - entry_selected)) - { - if(entry_selected) + if(col % 5 == 0) + { + ImGui::TableNextRow(); + } + ImGui::TableNextColumn(); + bool entry_selected = + m_selections.metric_ids.count(category.first) > 0 && + m_selections.metric_ids.at(category.first) + .count(table.first) > 0 && + m_selections.metric_ids.at(category.first) + .at(table.first) + .second.count(entry.first) > 0; + if(ImGui::Selectable( + std::string("[" + partial_metric_id + "." + + std::to_string(entry.second.id) + + "] " + entry.second.name) + .c_str(), + entry_selected)) { - if(m_selections.metric_ids.at(category.first) - .at(table.first) - .second.size() == 1) + if(entry_selected) { if(m_selections.metric_ids.at(category.first) - .size() == 1) + .at(table.first) + .second.size() == 1) { - m_selections.metric_ids.erase(category.first); + if(m_selections.metric_ids.at(category.first) + .size() == 1) + { + m_selections.metric_ids.erase( + category.first); + } + else + { + m_selections.metric_ids.at(category.first) + .erase(table.first); + } } else { m_selections.metric_ids.at(category.first) - .erase(table.first); + .at(table.first) + .second.erase(entry.first); } } else { - m_selections.metric_ids.at(category.first) - .at(table.first) - .second.erase(entry.first); + m_selections + .metric_ids[category.first][table.first] + .second.insert(entry.first); } } - else + if(ImGui::BeginItemTooltip()) { - m_selections.metric_ids[category.first][table.first] - .second.insert(entry.first); + ImGui::PushTextWrapPos(500.0f); + ImGui::Text("Description: "); + ImGui::SameLine(); + ImGui::Text(entry.second.description.c_str()); + ImGui::Text("Unit: "); + ImGui::SameLine(); + ImGui::Text(entry.second.unit.c_str()); + ImGui::PopTextWrapPos(); + ImGui::EndTooltip(); } + col++; } - if(ImGui::BeginItemTooltip()) - { - ImGui::PushTextWrapPos(500.0f); - ImGui::Text("Description: "); - ImGui::SameLine(); - ImGui::Text(entry.second.description.c_str()); - ImGui::Text("Unit: "); - ImGui::SameLine(); - ImGui::Text(entry.second.unit.c_str()); - ImGui::PopTextWrapPos(); - ImGui::EndTooltip(); - } - col++; + ImGui::EndTable(); } - ImGui::EndTable(); + ImGui::TreePop(); } - ImGui::TreePop(); + ImGui::EndDisabled(); + ImGui::PopID(); } - ImGui::EndDisabled(); - ImGui::PopID(); + ImGui::TreePop(); } - ImGui::TreePop(); + ImGui::PopID(); } - ImGui::PopID(); - } - ImGui::EndChild(); -} - -void -ComputeTester::RenderKernels(const WorkloadInfo& workload) -{ - ImGui::BeginChild("kernels", ImVec2(0, 0), - ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); - ImGui::Text("Kernels"); - if(ImGui::BeginTable("", 8, - ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | - ImGuiTableFlags_SizingStretchSame)) - { - ImGui::TableSetupColumn("ID"); - ImGui::TableSetupColumn("Name"); - ImGui::TableSetupColumn("Invocation Count"); - ImGui::TableSetupColumn("Total Duration"); - ImGui::TableSetupColumn("Min Duration"); - ImGui::TableSetupColumn("Max Duration"); - ImGui::TableSetupColumn("Mean Duration"); - ImGui::TableSetupColumn("Median Duration"); - ImGui::TableHeadersRow(); - for(const std::pair& kernel : workload.kernels) + ImGui::EndChild(); + ImGui::NewLine(); + ImGui::BeginChild("kernels", ImVec2(0, 0), + ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); + ImGui::Text("Kernels"); + if(ImGui::BeginTable("", 8, + ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | + ImGuiTableFlags_SizingStretchSame)) { - ImGui::PushID(static_cast(kernel.second.id)); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.id); - ImGui::SameLine(); - bool kernel_selected = m_selections.kernel_ids.count(kernel.second.id) > 0; - if(ImGui::Selectable("", kernel_selected, - ImGuiSelectableFlags_SpanAllColumns)) + ImGui::TableSetupColumn("ID"); + ImGui::TableSetupColumn("Name"); + ImGui::TableSetupColumn("Invocation Count"); + ImGui::TableSetupColumn("Total Duration"); + ImGui::TableSetupColumn("Min Duration"); + ImGui::TableSetupColumn("Max Duration"); + ImGui::TableSetupColumn("Mean Duration"); + ImGui::TableSetupColumn("Median Duration"); + ImGui::TableHeadersRow(); + for(const std::pair& kernel : workload.kernels) { - if(kernel_selected) - { - m_selections.kernel_ids.erase(kernel.second.id); - } - else + ImGui::PushID(static_cast(kernel.second.id)); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.id); + ImGui::SameLine(); + bool kernel_selected = + m_selections.kernel_ids.count(kernel.second.id) > 0; + if(ImGui::Selectable("", kernel_selected, + ImGuiSelectableFlags_SpanAllColumns)) { - m_selections.kernel_ids.insert(kernel.second.id); + if(kernel_selected) + { + m_selections.kernel_ids.erase(kernel.second.id); + } + else + { + m_selections.kernel_ids.insert(kernel.second.id); + } } + ImGui::TableNextColumn(); + ImGui::Text(kernel.second.name.c_str()); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.invocation_count); + ImGui::TableNextColumn(); + ImGui::Text("%llu", kernel.second.duration_total); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_min); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_max); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_mean); + ImGui::TableNextColumn(); + ImGui::Text("%u", kernel.second.duration_median); + ImGui::PopID(); } - ImGui::TableNextColumn(); - ImGui::Text(kernel.second.name.c_str()); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.invocation_count); - ImGui::TableNextColumn(); - ImGui::Text("%llu", kernel.second.duration_total); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.duration_min); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.duration_max); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.duration_mean); - ImGui::TableNextColumn(); - ImGui::Text("%u", kernel.second.duration_median); - ImGui::PopID(); - } - ImGui::EndTable(); - } - ImGui::EndChild(); -} - -void -ComputeTester::RenderFetcher(const WorkloadInfo& workload) -{ - ImGui::BeginChild("fetcher", ImVec2(0, 0), - ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); - ImGui::Text("Fetcher"); - if(ImGui::BeginTable( - "selected_metrics", 1, - ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | - ImGuiTableFlags_SizingStretchSame, - ImVec2((ImGui::GetContentRegionAvail().x - ImGui::CalcTextSize("for").x) / - 2.0f, - 0.0f))) - { - ImGui::TableSetupColumn("Metric ID(s)"); - ImGui::TableHeadersRow(); - if(m_selections.metric_ids.empty()) - { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::TextDisabled("None"); + ImGui::EndTable(); } - else + ImGui::EndChild(); + ImGui::NewLine(); + ImGui::BeginChild("fetcher", ImVec2(0, 0), + ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY); + ImGui::Text("Fetcher"); + if(ImGui::BeginTable( + "selected_metrics", 1, + ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | + ImGuiTableFlags_SizingStretchSame, + ImVec2((ImGui::GetContentRegionAvail().x - ImGui::CalcTextSize("for").x) / + 2.0f, + 0.0f))) { - for(const std::pair< - const uint32_t, - std::unordered_map>>>& - category : m_selections.metric_ids) + ImGui::TableSetupColumn("Metric ID(s)"); + ImGui::TableHeadersRow(); + if(m_selections.metric_ids.empty()) { - for(const std::pair>>& - table : category.second) + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TextDisabled("None"); + } + else + { + for(const std::pair< + const uint32_t, + std::unordered_map< + uint32_t, std::pair>>>& + category : m_selections.metric_ids) { - if(table.second.second.empty()) - { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("%u.%u", category.first, table.first); - } - else + for(const std::pair>>& + table : category.second) { - for(const uint32_t& entry : table.second.second) + if(table.second.second.empty()) { ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::Text("%u.%u.%u", category.first, table.first, entry); + ImGui::Text("%u.%u", category.first, table.first); + } + else + { + for(const uint32_t& entry : table.second.second) + { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("%u.%u.%u", category.first, table.first, + entry); + } } } } } - } ImGui::EndTable(); } @@ -907,97 +831,277 @@ ComputeTester::RenderFetcher(const WorkloadInfo& workload) ImPlot::SetupAxisScale(ImAxis_X1, ImPlotScale_Log10); ImPlot::SetupAxisScale(ImAxis_Y1, ImPlotScale_Log10); - for(const std::pair& kernel : workload.kernels) - { - for(const std::pair< - const rocprofvis_controller_roofline_kernel_intensity_type_t, - KernelInfo::Roofline::Intensity>& intensity : - kernel.second.roofline.intensities) + for(const std::pair& kernel : workload.kernels) { - if(m_selections.intensities.count(kernel.second.id) > 0 && - m_selections.intensities.at(kernel.second.id) - .count(intensity.second.type) > 0) + for(const std::pair< + const rocprofvis_controller_roofline_kernel_intensity_type_t, + KernelInfo::Roofline::Intensity>& intensity : + kernel.second.roofline.intensities) { - ImGui::PushID(i++); - ImPlot::PlotScatter("", &intensity.second.position.x, - &intensity.second.position.y, 1); - ImGui::PopID(); + if(m_selections.intensities.count(kernel.second.id) > 0 && + m_selections.intensities.at(kernel.second.id) + .count(intensity.second.type) > 0) + { + ImGui::PushID(i++); + ImPlot::PlotScatter("", &intensity.second.position.x, + &intensity.second.position.y, 1); + ImGui::PopID(); + } } } - } - for(const auto& compute_it : workload.roofline.ceiling_compute) - { - for(const auto& bandwidth_it : compute_it.second) + for(const auto& compute_it : workload.roofline.ceiling_compute) { - if(m_selections.ceilings_compute.count(compute_it.first) > 0 && - m_selections.ceilings_compute.at(compute_it.first) - .count(bandwidth_it.first) > 0) + for(const auto& bandwidth_it : compute_it.second) { - ImGui::PushID(i++); - ImPlot::PlotLineG( - "", - [](int idx, void* user_data) -> ImPlotPoint { - const WorkloadInfo::Roofline::Line* line = - static_cast( - user_data); - ImPlotPoint point(-1.0, -1.0); - if(line) - { - if(idx == 0) + if(m_selections.ceilings_compute.count(compute_it.first) > 0 && + m_selections.ceilings_compute.at(compute_it.first) + .count(bandwidth_it.first) > 0) + { + ImGui::PushID(i++); + ImPlot::PlotLineG( + "", + [](int idx, void* user_data) -> ImPlotPoint { + const WorkloadInfo::Roofline::Line* line = + static_cast( + user_data); + ImPlotPoint point(-1.0, -1.0); + if(line) { - point.x = line->p1.x; - point.y = line->p1.y; + if(idx == 0) + { + point.x = line->p1.x; + point.y = line->p1.y; + } + else + { + point.x = line->p2.x; + point.y = line->p2.y; + } } - else + return point; + }, + (void*) &bandwidth_it.second.position, 2); + ImGui::PopID(); + } + } + } + for(const auto& bandwidth_it : workload.roofline.ceiling_bandwidth) + { + for(const auto& compute_it : bandwidth_it.second) + { + if(m_selections.ceilings_bandwidth.count(bandwidth_it.first) > 0 && + m_selections.ceilings_bandwidth.at(bandwidth_it.first) + .count(compute_it.first) > 0) + { + ImGui::PushID(i++); + ImPlot::PlotLineG( + "", + [](int idx, void* user_data) -> ImPlotPoint { + const WorkloadInfo::Roofline::Line* line = + static_cast( + user_data); + ImPlotPoint point(-1.0, -1.0); + if(line) { - point.x = line->p2.x; - point.y = line->p2.y; + if(idx == 0) + { + point.x = line->p1.x; + point.y = line->p1.y; + } + else + { + point.x = line->p2.x; + point.y = line->p2.y; + } } - } - return point; - }, - (void*) &bandwidth_it.second.position, 2); - ImGui::PopID(); + return point; + }, + (void*) &compute_it.second.position, 2); + ImGui::PopID(); + } } } + ImPlot::EndPlot(); } - for(const auto& bandwidth_it : workload.roofline.ceiling_bandwidth) + int preset_idx = static_cast(m_selections.roofline_preset); + if(m_selections.init || + ImGui::Combo("Presets", &preset_idx, "FP32\0FP64\0Custom\0\0")) { - for(const auto& compute_it : bandwidth_it.second) + m_selections.roofline_preset = + static_cast(preset_idx); + if(m_selections.roofline_preset == SelectionState::FP32) + { + m_selections.ceilings_compute = { + { kRPVControllerRooflineCeilingComputeMFMAFP32, + { kRPVControllerRooflineCeilingTypeBandwidthLDS } }, + { kRPVControllerRooflineCeilingComputeVALUFP32, + { kRPVControllerRooflineCeilingTypeBandwidthLDS } } + }; + m_selections.ceilings_bandwidth = { + { kRPVControllerRooflineCeilingTypeBandwidthHBM, + { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, + { kRPVControllerRooflineCeilingTypeBandwidthL2, + { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, + { kRPVControllerRooflineCeilingTypeBandwidthL1, + { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, + { kRPVControllerRooflineCeilingTypeBandwidthLDS, + { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, + }; + for(const std::pair& kernel : + workload.kernels) + { + for(const std::pair< + const rocprofvis_controller_roofline_kernel_intensity_type_t, + KernelInfo::Roofline::Intensity>& intensity : + kernel.second.roofline.intensities) + { + m_selections.intensities[kernel.second.id].insert( + intensity.second.type); + } + } + } + else if(m_selections.roofline_preset == SelectionState::FP64) + { + m_selections.ceilings_compute = { + { kRPVControllerRooflineCeilingComputeMFMAFP64, + { kRPVControllerRooflineCeilingTypeBandwidthLDS } }, + { kRPVControllerRooflineCeilingComputeVALUFP64, + { kRPVControllerRooflineCeilingTypeBandwidthLDS } } + }; + m_selections.ceilings_bandwidth = { + { kRPVControllerRooflineCeilingTypeBandwidthHBM, + { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, + { kRPVControllerRooflineCeilingTypeBandwidthL2, + { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, + { kRPVControllerRooflineCeilingTypeBandwidthL1, + { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, + { kRPVControllerRooflineCeilingTypeBandwidthLDS, + { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, + }; + for(const std::pair& kernel : + workload.kernels) + { + for(const std::pair< + const rocprofvis_controller_roofline_kernel_intensity_type_t, + KernelInfo::Roofline::Intensity>& intensity : + kernel.second.roofline.intensities) + { + m_selections.intensities[kernel.second.id].insert( + intensity.second.type); + } + } + } + } + if(m_selections.roofline_preset == SelectionState::Custom && + ImGui::BeginTable("customizer", 2, + ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | + ImGuiTableFlags_SizingStretchSame)) + { + ImGui::TableSetupColumn("Type"); + ImGui::TableSetupColumn("Element"); + ImGui::TableHeadersRow(); + for(const std::pair& kernel : workload.kernels) + { + for(const std::pair< + const rocprofvis_controller_roofline_kernel_intensity_type_t, + KernelInfo::Roofline::Intensity>& intensity : + kernel.second.roofline.intensities) + { + ImGui::PushID(i++); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("Kernel Intensity"); + ImGui::SameLine(); + bool show = m_selections.intensities.count(kernel.second.id) > 0 && + m_selections.intensities.at(kernel.second.id) + .count(intensity.second.type) > 0; + if(ImGui::Selectable("", show, ImGuiSelectableFlags_SpanAllColumns)) + { + if(show) + { + m_selections.intensities.at(kernel.second.id) + .erase(intensity.second.type); + } + else + { + m_selections.intensities[kernel.second.id].insert( + intensity.second.type); + } + } + ImGui::TableNextColumn(); + ImGui::Text("ID:%u - %s", kernel.second.id, + m_display_names.intensity.at(intensity.second.type)); + ImGui::PopID(); + } + } + for(const auto& compute_it : workload.roofline.ceiling_compute) { - if(m_selections.ceilings_bandwidth.count(bandwidth_it.first) > 0 && - m_selections.ceilings_bandwidth.at(bandwidth_it.first) - .count(compute_it.first) > 0) + for(const auto& bandwidth_it : compute_it.second) { ImGui::PushID(i++); - ImPlot::PlotLineG( - "", - [](int idx, void* user_data) -> ImPlotPoint { - const WorkloadInfo::Roofline::Line* line = - static_cast( - user_data); - ImPlotPoint point(-1.0, -1.0); - if(line) - { - if(idx == 0) - { - point.x = line->p1.x; - point.y = line->p1.y; - } - else - { - point.x = line->p2.x; - point.y = line->p2.y; - } - } - return point; - }, - (void*) &compute_it.second.position, 2); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("Compute Ceiling"); + ImGui::SameLine(); + bool show = + m_selections.ceilings_compute.count(compute_it.first) > 0 && + m_selections.ceilings_compute.at(compute_it.first) + .count(bandwidth_it.first) > 0; + if(ImGui::Selectable("", show, ImGuiSelectableFlags_SpanAllColumns)) + { + if(show) + { + m_selections.ceilings_compute.at(compute_it.first) + .erase(bandwidth_it.first); + } + else + { + m_selections.ceilings_compute[compute_it.first].insert( + bandwidth_it.first); + } + } + ImGui::TableNextColumn(); + ImGui::Text("%s-%s", + m_display_names.ceiling_compute.at(compute_it.first), + m_display_names.ceiling_bandwidth.at(bandwidth_it.first)); ImGui::PopID(); } } + for(const auto& bandwidth_it : workload.roofline.ceiling_bandwidth) + { + for(const auto& compute_it : bandwidth_it.second) + { + ImGui::PushID(i++); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("Bandwidth Ceiling"); + ImGui::SameLine(); + bool show = + m_selections.ceilings_bandwidth.count(bandwidth_it.first) > 0 && + m_selections.ceilings_bandwidth.at(bandwidth_it.first) + .count(compute_it.first) > 0; + if(ImGui::Selectable("", show, ImGuiSelectableFlags_SpanAllColumns)) + { + if(show) + { + m_selections.ceilings_bandwidth.at(bandwidth_it.first) + .erase(compute_it.first); + } + else + { + m_selections.ceilings_bandwidth[bandwidth_it.first].insert( + compute_it.first); + } + } + ImGui::TableNextColumn(); + ImGui::Text("%s-%s", + m_display_names.ceiling_bandwidth.at(bandwidth_it.first), + m_display_names.ceiling_compute.at(compute_it.first)); + ImGui::PopID(); + } + } + ImGui::EndTable(); } - ImPlot::EndPlot(); ImGui::EndChild(); ImGui::NewLine(); ImGui::BeginChild("value_names_lookup", ImVec2(0, 0), @@ -1076,186 +1180,6 @@ ComputeTester::RenderFetcher(const WorkloadInfo& workload) m_selections.init = false; } - int preset_idx = static_cast(m_selections.roofline_preset); - if(m_selections.init || - ImGui::Combo("Presets", &preset_idx, "FP32\0FP64\0Custom\0\0")) - { - m_selections.roofline_preset = - static_cast(preset_idx); - if(m_selections.roofline_preset == SelectionState::FP32) - { - m_selections.ceilings_compute = { - { kRPVControllerRooflineCeilingComputeMFMAFP32, - { kRPVControllerRooflineCeilingTypeBandwidthLDS } }, - { kRPVControllerRooflineCeilingComputeVALUFP32, - { kRPVControllerRooflineCeilingTypeBandwidthLDS } } - }; - m_selections.ceilings_bandwidth = { - { kRPVControllerRooflineCeilingTypeBandwidthHBM, - { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, - { kRPVControllerRooflineCeilingTypeBandwidthL2, - { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, - { kRPVControllerRooflineCeilingTypeBandwidthL1, - { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, - { kRPVControllerRooflineCeilingTypeBandwidthLDS, - { kRPVControllerRooflineCeilingComputeMFMAFP32 } }, - }; - for(const std::pair& kernel : workload.kernels) - { - for(const std::pair< - const rocprofvis_controller_roofline_kernel_intensity_type_t, - KernelInfo::Roofline::Intensity>& intensity : - kernel.second.roofline.intensities) - { - m_selections.intensities[kernel.second.id].insert( - intensity.second.type); - } - } - } - else if(m_selections.roofline_preset == SelectionState::FP64) - { - m_selections.ceilings_compute = { - { kRPVControllerRooflineCeilingComputeMFMAFP64, - { kRPVControllerRooflineCeilingTypeBandwidthLDS } }, - { kRPVControllerRooflineCeilingComputeVALUFP64, - { kRPVControllerRooflineCeilingTypeBandwidthLDS } } - }; - m_selections.ceilings_bandwidth = { - { kRPVControllerRooflineCeilingTypeBandwidthHBM, - { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, - { kRPVControllerRooflineCeilingTypeBandwidthL2, - { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, - { kRPVControllerRooflineCeilingTypeBandwidthL1, - { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, - { kRPVControllerRooflineCeilingTypeBandwidthLDS, - { kRPVControllerRooflineCeilingComputeMFMAFP64 } }, - }; - for(const std::pair& kernel : workload.kernels) - { - for(const std::pair< - const rocprofvis_controller_roofline_kernel_intensity_type_t, - KernelInfo::Roofline::Intensity>& intensity : - kernel.second.roofline.intensities) - { - m_selections.intensities[kernel.second.id].insert( - intensity.second.type); - } - } - } - } - - if(m_selections.roofline_preset == SelectionState::Custom && - ImGui::BeginTable("customizer", 2, - ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders | - ImGuiTableFlags_SizingStretchSame)) - { - ImGui::TableSetupColumn("Type"); - ImGui::TableSetupColumn("Element"); - ImGui::TableHeadersRow(); - for(const std::pair& kernel : workload.kernels) - { - for(const std::pair< - const rocprofvis_controller_roofline_kernel_intensity_type_t, - KernelInfo::Roofline::Intensity>& intensity : - kernel.second.roofline.intensities) - { - ImGui::PushID(i++); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("Kernel Intensity"); - ImGui::SameLine(); - bool show = m_selections.intensities.count(kernel.second.id) > 0 && - m_selections.intensities.at(kernel.second.id) - .count(intensity.second.type) > 0; - if(ImGui::Selectable("", show, ImGuiSelectableFlags_SpanAllColumns)) - { - if(show) - { - m_selections.intensities.at(kernel.second.id) - .erase(intensity.second.type); - } - else - { - m_selections.intensities[kernel.second.id].insert( - intensity.second.type); - } - } - ImGui::TableNextColumn(); - ImGui::Text("ID:%u - %s", kernel.second.id, - m_display_names.intensity.at(intensity.second.type)); - ImGui::PopID(); - } - } - for(const auto& compute_it : workload.roofline.ceiling_compute) - { - for(const auto& bandwidth_it : compute_it.second) - { - ImGui::PushID(i++); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("Compute Ceiling"); - ImGui::SameLine(); - bool show = m_selections.ceilings_compute.count(compute_it.first) > 0 && - m_selections.ceilings_compute.at(compute_it.first) - .count(bandwidth_it.first) > 0; - if(ImGui::Selectable("", show, ImGuiSelectableFlags_SpanAllColumns)) - { - if(show) - { - m_selections.ceilings_compute.at(compute_it.first) - .erase(bandwidth_it.first); - } - else - { - m_selections.ceilings_compute[compute_it.first].insert( - bandwidth_it.first); - } - } - ImGui::TableNextColumn(); - ImGui::Text("%s-%s", m_display_names.ceiling_compute.at(compute_it.first), - m_display_names.ceiling_bandwidth.at(bandwidth_it.first)); - ImGui::PopID(); - } - } - for(const auto& bandwidth_it : workload.roofline.ceiling_bandwidth) - { - for(const auto& compute_it : bandwidth_it.second) - { - ImGui::PushID(i++); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("Bandwidth Ceiling"); - ImGui::SameLine(); - bool show = - m_selections.ceilings_bandwidth.count(bandwidth_it.first) > 0 && - m_selections.ceilings_bandwidth.at(bandwidth_it.first) - .count(compute_it.first) > 0; - if(ImGui::Selectable("", show, ImGuiSelectableFlags_SpanAllColumns)) - { - if(show) - { - m_selections.ceilings_bandwidth.at(bandwidth_it.first) - .erase(compute_it.first); - } - else - { - m_selections.ceilings_bandwidth[bandwidth_it.first].insert( - compute_it.first); - } - } - ImGui::TableNextColumn(); - ImGui::Text("%s-%s", - m_display_names.ceiling_bandwidth.at(bandwidth_it.first), - m_display_names.ceiling_compute.at(compute_it.first)); - ImGui::PopID(); - } - } - ImGui::EndTable(); - } - - ImGui::EndChild(); - m_selections.init = false; - RenderKernelSelectionTable(); } @@ -1378,11 +1302,5 @@ ComputeTester::RenderKernelSelectionTable() } } -void -ComputeTester::RenderSummaryView(const WorkloadInfo& workload) -{ - m_summary_view.Render(); -} - } // namespace View } // namespace RocProfVis diff --git a/src/view/src/compute/rocprofvis_compute_view.h b/src/view/src/compute/rocprofvis_compute_view.h index 90804976..eb9f6171 100644 --- a/src/view/src/compute/rocprofvis_compute_view.h +++ b/src/view/src/compute/rocprofvis_compute_view.h @@ -6,7 +6,6 @@ #include "rocprofvis_root_view.h" #include "widgets/rocprofvis_tab_container.h" #include "rocprofvis_compute_selection.h" -#include "rocprofvis_compute_summary_view.h" namespace RocProfVis { @@ -124,30 +123,12 @@ class ComputeTester : public RocWidget std::unordered_map intensity; - }; - - void RenderSelectedView(const std::unordered_map& workloads, - uint32_t view_index); - void RenderSystemAndConfig(const WorkloadInfo& workload); - void RenderProfilingConfig(const WorkloadInfo& workload); - void RenderMetrics(const WorkloadInfo& workload); - void RenderKernels(const WorkloadInfo& workload); - void RenderFetcher(const WorkloadInfo& workload); - void RenderSummaryView(const WorkloadInfo& workload); - - const std::vector m_views = { "System Information", - "Profiling Configuration", "Metrics", - "Kernels", - "Fetcher", - "Summary View" }; //TODO: figure out better way to store it - - + }; DataProvider& m_data_provider; SelectionState m_selections; DisplayStrings m_display_names; - ComputeSummaryView m_summary_view; char m_value_names_input[64] = "3.1.2"; };