Skip to content

web: hierarchy browser in static reports, search race fix, module coloring fixes#10288

Merged
maliberty merged 6 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:web-static-hier-browser
Apr 28, 2026
Merged

web: hierarchy browser in static reports, search race fix, module coloring fixes#10288
maliberty merged 6 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:web-static-hier-browser

Conversation

@openroad-ci
Copy link
Copy Markdown
Collaborator

Summary

  • Fix race condition in search R-tree queries that caused segfaults on -web startup
  • Add hierarchy browser support to static HTML reports (web_save_report)
  • Fix module coloring: keep leaf instances colored when parent is expanded, skip fill cells

Type of Change

  • Bug fix
  • New feature
  • Refactoring

Impact

Search race fix: Six search methods returned lazy R-tree iterators without holding a lock. When the background eagerInit thread was concurrently building R-trees, tile requests could iterate partially-constructed trees, causing a segfault. Now all search methods eagerly materialize results under a shared_lock, matching the existing pattern used by searchInsts and searchFills.

Static hierarchy browser: The static HTML report now embeds module hierarchy data and pre-rendered _modules layer tiles. The hierarchy browser auto-loads in static mode. The 31-color palette is consolidated into a single module_color_palette.h (previously duplicated in JS and C++). The server assigns colors in HierarchyReport::getReport() and the JS client reads them from the response.

Module coloring fixes: Expanded modules with child modules are no longer excluded from the color map — their direct leaf instances retain color since the tile renderer looks up each instance's direct module. Fill cells (CORE_SPACER) are skipped in the _modules layer to reduce visual noise.

Verification

  • I have verified that the local build succeeds.
  • I have run the relevant tests and they pass (bazel test //src/web/test/... — 23/23 pass).
  • My code follows the repository's formatting guidelines.
  • I have signed my commits (DCO).

Six search methods (searchBoxShapes, searchSNetViaShapes,
searchSNetShapes, searchBlockages, searchObstructions, searchRows)
returned lazy R-tree iterators without holding a lock.  When the
background eagerInit thread was concurrently building R-trees, a
tile request could iterate a partially-constructed or destroyed
R-tree, causing a segfault.

Fix: hold a shared_lock on the init mutex and eagerly materialize
results into a vector before returning, matching the existing
pattern used by searchInsts and searchFills.

Signed-off-by: Matt Liberty <mliberty@eng.ucsd.edu>
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
Add module hierarchy data and colored _modules tiles to the static
HTML report so the hierarchy browser works in offline mode.

Server-side changes:
- New module_color_palette.h: shared 31-color palette (single source
  of truth, previously duplicated in JS and Qt GUI).
- HierarchyReport::getReport() assigns palette colors to MODULE nodes.
- New serializeHierarchyResult() and computeDefaultModuleColors()
  shared helpers in hierarchy_report.cpp, used by both the WebSocket
  handler and saveReport().
- saveReport() embeds module_hierarchy JSON in the static cache and
  pre-renders _modules layer tiles with default module colors.

Client-side changes:
- hierarchy-browser.js reads server-assigned colors instead of
  maintaining a local palette copy.  Removes MODULE_COLORS constant
  and _assignColors(); adds _readServerColors().
- Auto-loads hierarchy data in static mode.
- websocket-manager.js: set_module_colors is a no-op in static mode
  (tiles are pre-rendered); module_hierarchy served from JSON cache.

Signed-off-by: Matt Liberty <mliberty@eng.ucsd.edu>
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
…cells

Two fixes to the _modules layer coloring:

- Always include expanded modules in the color map. Previously,
  expanded modules with child modules were excluded, causing their
  direct leaf instances to lose color. The tile renderer looks up
  each instance's direct module, so parent and child colors never
  conflict.

- Skip fill cells (CORE_SPACER) in the _modules layer rendering.
  These are physical-only cells that add visual noise to the module
  color overlay.

Signed-off-by: Matt Liberty <mliberty@eng.ucsd.edu>
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
Use designated initializers for Color in hierarchy_report.h, and
NOLINT the palette data table in module_color_palette.h where
designated initializers would obscure the color data.

Signed-off-by: Matt Liberty <mliberty@eng.ucsd.edu>
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
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 module hierarchy reporting and visualization support, including a color palette for modules, server-side serialization, and integration into the static report generation. Additionally, it improves thread safety in the search module by replacing lazy R-tree iterators with eager collection under shared locks. The review comments suggest refactoring the repetitive mutex locking and R-tree access logic into helper functions to improve maintainability and reduce code duplication.

Comment thread src/web/src/search.cpp
Comment thread src/web/src/search.cpp
Comment thread src/web/src/search.cpp
Comment thread src/web/src/search.cpp
Comment thread src/web/src/search.cpp
Comment thread src/web/src/search.cpp
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Comment thread src/web/src/hierarchy_report.cpp
Comment thread src/web/src/hierarchy_report.cpp
@maliberty
Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
@github-actions
Copy link
Copy Markdown
Contributor

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

@maliberty maliberty merged commit bf0b749 into The-OpenROAD-Project:master Apr 28, 2026
15 of 16 checks passed
@maliberty maliberty deleted the web-static-hier-browser branch April 28, 2026 21:13
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.

2 participants