Gui external heatmaps#10005
Gui external heatmaps#10005openroad-ci wants to merge 11 commits intoThe-OpenROAD-Project:masterfrom
Conversation
Signed-off-by: osamahammad21 <osama21@aucegypt.edu>
Signed-off-by: osamahammad21 <osama21@aucegypt.edu>
…nal-heatmaps Signed-off-by: osamahammad21 <osama21@aucegypt.edu>
Signed-off-by: osamahammad21 <osama21@aucegypt.edu>
Signed-off-by: Osama <osama21@aucegypt.edu>
Signed-off-by: Osama <osama21@aucegypt.edu>
There was a problem hiding this comment.
Code Review
This pull request adds support for loading external heatmaps from CSV files. It introduces the ExternalHeatMapDataSource class to handle coordinate-based data and a CsvParser utility for reading the input files. Review feedback highlights a potential crash when processing root chips in hierarchical designs, suggests pre-allocating memory for data entries to improve performance, and notes that the current CSV parsing logic lacks support for quoted fields or escaped characters.
| auto* unfolded_chip | ||
| = db_->getUnfoldedModel()->findUnfoldedChip(chiplet_name); | ||
| if (unfolded_chip != nullptr) { | ||
| chip = unfolded_chip->chip_inst_path.back()->getMasterChip(); |
There was a problem hiding this comment.
Accessing unfolded_chip->chip_inst_path.back() without checking if the path is empty can lead to a crash if chiplet_name refers to the top-level chip in an unfolded model. Hierarchical designs typically have an empty path for the root chip.
if (unfolded_chip->chip_inst_path.empty()) {
chip = db_->getChip();
} else {
chip = unfolded_chip->chip_inst_path.back()->getMasterChip();
}| } | ||
| chiplet_name = csv_rows[0][0]; | ||
| heatmap_name = csv_rows[0][1]; | ||
| std::vector<ExternalHeatMapDataSource::Entry> data; |
| while (std::getline(ss, cell, delimiter)) { | ||
| cells.push_back(trim(cell)); | ||
| } |
There was a problem hiding this comment.
The current CSV parsing logic using std::getline with a delimiter is very basic and does not handle standard CSV features like quoted fields (which may contain the delimiter or newlines) or escaped characters. While sufficient for simple numeric data, consider using a more robust parser if this utility is intended for general use within the utl namespace.
| } | ||
| const std::string short_name | ||
| = "External_" + std::to_string(owned_heat_maps_.size() + 1); | ||
| auto source = std::make_shared<ExternalHeatMapDataSource>( |
There was a problem hiding this comment.
warning: no header providing "gui::ExternalHeatMapDataSource" is directly included [misc-include-cleaner]
auto source = std::make_shared<ExternalHeatMapDataSource>(
^| source->setTransform(transform); | ||
| registerHeatMap(source.get()); | ||
| owned_heat_maps_.push_back(std::move(source)); | ||
| return short_name; |
There was a problem hiding this comment.
warning: constness of 'short_name' prevents automatic move [performance-no-automatic-move]
return short_name;
^
src/gui/src/heatMap.cpp
Outdated
| #include <map> | ||
| #include <memory> | ||
| #include <optional> | ||
| #include <sstream> |
There was a problem hiding this comment.
warning: included header optional is not used directly [misc-include-cleaner]
| #include <sstream> | |
| #include <sstream> |
| #include <memory> | ||
| #include <optional> | ||
| #include <sstream> | ||
| #include <string> |
There was a problem hiding this comment.
warning: included header sstream is not used directly [misc-include-cleaner]
| #include <string> | |
| #include <string> |
| #include "heatMapSetup.h" | ||
| #include "odb/db.h" | ||
| #include "utl/Logger.h" | ||
|
|
There was a problem hiding this comment.
warning: included header Logger.h is not used directly [misc-include-cleaner]
|
|
||
| namespace { | ||
|
|
||
| static std::string trim(const std::string& s) |
There was a problem hiding this comment.
warning: no header providing "std::string" is directly included [misc-include-cleaner]
src/utl/src/CsvParser.cpp:7:
+ #include <string>|
|
||
| } // namespace | ||
|
|
||
| std::vector<std::vector<std::string>> readCsv(const std::string& file_path, |
There was a problem hiding this comment.
warning: no header providing "std::vector" is directly included [misc-include-cleaner]
src/utl/src/CsvParser.cpp:7:
+ #include <vector>|
|
||
| std::vector<std::vector<std::string>> rows; | ||
| std::string line; | ||
| while (std::getline(in, line)) { |
There was a problem hiding this comment.
warning: no header providing "std::getline" is directly included [misc-include-cleaner]
while (std::getline(in, line)) {
^| std::vector<std::string> cells; | ||
| std::stringstream ss(line); | ||
| std::string cell; | ||
| while (std::getline(ss, cell, delimiter)) { |
There was a problem hiding this comment.
warning: no header providing "std::getline" is directly included [misc-include-cleaner]
while (std::getline(ss, cell, delimiter)) {
^| while (std::getline(ss, cell, delimiter)) { | ||
| cells.push_back(trim(cell)); | ||
| } | ||
| rows.push_back(std::move(cells)); |
There was a problem hiding this comment.
warning: no header providing "std::move" is directly included [misc-include-cleaner]
src/utl/src/CsvParser.cpp:7:
+ #include <utility>Signed-off-by: Osama <osama21@aucegypt.edu>
| file_path, | ||
| csv_rows[0].size()); | ||
| } | ||
| const std::string chiplet_name = csv_rows[0][0]; |
There was a problem hiding this comment.
why is chiplet_name here? that seems somewhat specific
There was a problem hiding this comment.
To support 3D designs. When you have multiple chiplets in a system, the chiplet name is needed to apply the correct transformation per chiplet.
| gui->dumpHeatMap(name, file); | ||
| } | ||
|
|
||
| std::string load_external_heatmap(const std::string& file_path) |
There was a problem hiding this comment.
no tcl command, maybe call this load_heatmap (unless it's specific to the chiplet, in which case that should be clear from the name
|
|
||
| namespace { | ||
|
|
||
| static std::string trim(const std::string& s) |
|
@vvbandeira @sombraSoft macOS build is failing while the bazel build in the CI is passing. Is this normal? |
|
Mac is running with --//:platform=gui but the regular build is not (yet). The error is in gui so it only appears there but is probably not mac specific. |
Summary
Type of Change
Impact
None of the current designs should be affected by this change.
Verification
./etc/Build.sh).Related Issues
NA