Skip to content

Fix headless gui::dump_heatmap#10366

Open
naveenvenk17 wants to merge 6 commits into
The-OpenROAD-Project:masterfrom
naveenvenk17:worker7/fix-headless-dump-heatmap-5897
Open

Fix headless gui::dump_heatmap#10366
naveenvenk17 wants to merge 6 commits into
The-OpenROAD-Project:masterfrom
naveenvenk17:worker7/fix-headless-dump-heatmap-5897

Conversation

@naveenvenk17
Copy link
Copy Markdown
Contributor

Summary

  • Fix gui::dump_heatmap in console/headless sessions by syncing built-in heatmap sources with the current database chip when no Qt MainWindow is active.
  • Add a regression that loads Nangate45 gcd_nangate45.def without -gui and dumps the Placement heatmap CSV.

Type of Change

  • Bug fix

Impact

Headless GUI Tcl heatmap commands can populate maps after read_def/read_db; Qt GUI behavior is unchanged because the main window still owns block/chip updates while active.

Verification

  • I have verified that the local build succeeds (./etc/Build.sh). Not run: this Windows/WSL worker does not have the OpenROAD build toolchain (cmake/bazel/compiler) available.
  • I have run the relevant tests and they pass. Full regression not run for the same toolchain reason.
  • My code follows the repository's formatting guidelines. (git diff --cached --check before commit; no whitespace errors)
  • I have included tests to prevent regressions.
  • I have signed my commits (DCO).

Additional local checks:

  • Reproduced the original GUI-0072 failure on installed WSL OpenROAD v2.0-17598-ga008522d8 with the same headless gui::dump_heatmap Placement flow.
  • Parsed/exercised the new Tcl regression logic under tclsh with stubbed OpenROAD commands.

Related Issues

Fixes #5897

Signed-off-by: naveenvenk17 <naveenvenkat1711@gmail.com>
@github-actions github-actions Bot added the size/S label May 9, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a syncHeatMapChips method to ensure heatmap data sources are synchronized with the current database chip during headless or console sessions. This method is called within getHeatMap to maintain data integrity when the UI is not present. Additionally, a new integration test, dump_heatmap_headless, has been added to verify heatmap generation in these environments. Feedback suggests extending this synchronization logic to the getHeatMaps() method to ensure consistent behavior across the API.

Comment thread src/gui/src/gui.cpp
Comment on lines +1021 to +1033
if (hasUI() || db_ == nullptr) {
return;
}

// Console and headless sessions do not receive MainWindow::setBlock().
auto* chip = db_->getChip();
for (auto* heat_map : heat_maps_) {
if (heat_map->getChip() != chip) {
heat_map->setChip(chip);
heat_map->destroyMap();
}
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The syncHeatMapChips method correctly handles the synchronization of heatmap data sources with the current database chip in headless mode. However, for better API consistency and to ensure that any code iterating over all heatmaps (via getHeatMaps()) also sees the updated state, consider moving the implementation of getHeatMaps() from the header to the .cpp file and calling syncHeatMapChips() there as well.

Signed-off-by: naveenvenk17 <naveenvenkat1711@gmail.com>
@naveenvenk17
Copy link
Copy Markdown
Contributor Author

Addressed Gemini's heatmap enumeration feedback in follow-up commit 66f1357 by moving getHeatMaps() out of the header and syncing chips there as well.

Signed-off-by: naveenvenk17 <naveenvenkat1711@gmail.com>
Signed-off-by: naveenvenk17 <naveenvenkat1711@gmail.com>
@maliberty
Copy link
Copy Markdown
Member

bazelisk test //src/gui/test:dump_heatmap_headless-tcl_test passes even if I comment out the code changes. This isn't properly testing this fix.`

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Signed-off-by: naveenvenk17 <naveenvenkat1711@gmail.com>
@github-actions github-actions Bot added size/M and removed size/S labels May 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@naveenvenk17
Copy link
Copy Markdown
Contributor Author

Agreed. I pushed 56720db to make the regression exercise the real fix: it adds a C++ test against //src/gui:gui_qt_headless that initializes heatmaps before a chip exists, creates the chip, and verifies headless lookup syncs every source to the current chip. I also removed the misleading Bazel Tcl coverage that only used the stub GUI, while keeping the Tcl regression for CMake GUI builds.

Signed-off-by: naveenvenk17 <naveenvenkat1711@gmail.com>
@naveenvenk17
Copy link
Copy Markdown
Contributor Author

Follow-up: Clang-Format caught the include ordering in the new C++ regression. Fixed in ba6d2b9.

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@maliberty
Copy link
Copy Markdown
Member

Across the board build failures

@maliberty
Copy link
Copy Markdown
Member

Orphaned
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gui::dump_heatmap fails in console mode [ERROR GUI-0072] "Placement Density" is not populated with data.

2 participants