Skip to content

Fix GUI crash rendering when Acess Points or Gcell grid is enabled #9684

Merged
maliberty merged 1 commit intoThe-OpenROAD-Project:masterfrom
alokkumardalei-wq:fix-gui-chiplets
Mar 10, 2026
Merged

Fix GUI crash rendering when Acess Points or Gcell grid is enabled #9684
maliberty merged 1 commit intoThe-OpenROAD-Project:masterfrom
alokkumardalei-wq:fix-gui-chiplets

Conversation

@alokkumardalei-wq
Copy link
Contributor

@alokkumardalei-wq alokkumardalei-wq commented Mar 7, 2026

What does this PR resolves?

Fixes #8927

Resolves GUI crash that occurred when enabling Access Points or GCell grid display options after reading a 3DBX chiplet design.

What have caused this issue?

The rendering functions drawTracks, drawManufacturingGrid, and drawGCellGrid used viewer_->getBlock(), which returns the top-level HIER chip's block (nullptr in 3DBX designs) instead of the per-chiplet block being rendered. This caused null pointer dereference crashes.

Additionally, drawAccessPoints and drawChip lacked nullptr guards for block->getTech() before iterating technology layers.

Changes made to resolve this

  • renderThread.h / renderThread.cpp:
    • Added odb::dbBlock* block parameter to drawTracks, drawManufacturingGrid, and drawGCellGrid
    • Replaced all viewer_->getBlock() calls with the passed-in block parameter
    • Added nullptr guards for block and block->getTech() before dereferencing
    • Wrapped layer iteration in drawChip with if (tech != nullptr) check

Copy link
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 effectively resolves GUI crashes in 3DBX designs by addressing null pointer dereferences. While it introduces necessary nullptr checks, it also introduces a new potential null pointer dereference in the drawChip function when handling child blocks with missing technology information. Additionally, I've provided suggestions for minor performance optimizations by reordering checks to fail-fast when a block is outside the visible area.

Comment on lines +1251 to +1258
dbTech* child_tech = child->getTech();
if (child_tech != tech) {
child_techs.insert(child_tech);
}
}

for (dbTech* child_tech : child_techs) {
for (dbTechLayer* layer : child_tech->getLayers()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

security-high high

In RenderThread::drawChip, the code iterates over child blocks and collects their technologies into the child_techs set. If a child block does not have an associated technology (child->getTech() returns nullptr), this nullptr is added to the set (since tech is guaranteed to be non-null at this point). Subsequently, the loop at line 1257 iterates over child_techs and dereferences child_tech at line 1258 by calling getLayers(), which will cause a crash if child_tech is nullptr.

Comment on lines +329 to 337
dbTrackGrid* grid = block->findTrackGrid(layer);
if (!grid) {
return;
}

Rect block_bounds = viewer_->getBlock()->getDieArea();
Rect block_bounds = block->getDieArea();
if (!block_bounds.intersects(bounds)) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For a minor optimization, you could check if the block's die area intersects with the drawing bounds before searching for the track grid. This avoids the potentially more expensive findTrackGrid call if the block is not in the visible area.

  Rect block_bounds = block->getDieArea();
  if (!block_bounds.intersects(bounds)) {
    return;
  }

  dbTrackGrid* grid = block->findTrackGrid(layer);
  if (!grid) {
    return;
  }

@alokkumardalei-wq alokkumardalei-wq changed the title Fix GUI crash rendering when Acess Points or Gcell grid is enabled by… Fix GUI crash rendering when Acess Points or Gcell grid is enabled Mar 7, 2026
alokkumardalei-wq added a commit to alokkumardalei-wq/OpenROAD that referenced this pull request Mar 7, 2026
…ze drawTracks

- Add nullptr guard for child->getTech() before inserting into child_techs set

- Reorder bounds check before findTrackGrid lookup in drawTracks for efficiency

Addresses review comments from Gemini bot on PR The-OpenROAD-Project#9684

Signed-off-by: alokkumardalei-wq <alokkumardalei2@gmail.com>
… adding nullptr guard

Signed-off-by: alokkumardalei-wq <alokkumardalei2@gmail.com>
@maliberty
Copy link
Member

Did you reproduce the crash and master and verify that this fixes it?

@alokkumardalei-wq
Copy link
Contributor Author

alokkumardalei-wq commented Mar 9, 2026

Hi @maliberty, I verified the fix at the code level but not at gui level— I
traced the crash through renderThread.cpp
and confirmed that block->getTech() can r
eturn nullptr for chiplet container blocks in 3
DBX designs, causing the naked dereference crash.

Also you can check the code level logic implemented in this commit
1191ec8 and please let me know if it is correct or not or there are any other suitable and alternative approach for this.

Unfortunately, I don't have access to an
actual 3DBX chiplet design dataset to trigger t
he crash at runtime, and @LucasYuki didn't include one in #8927.
I should have asked for it earlier — apologies for not doing so.

If you could share a chiplet dataset (or point me to one), I would be happy to do a full GUI-level runtime test to confirm both the crash on master and the fix on this branch. Alternatively, let me know if there's another testing approach you prefer.

Thank you so much for time and looking forward for any kind of feedback further.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

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

@maliberty maliberty merged commit e88557c into The-OpenROAD-Project:master Mar 10, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GUI: Chiplets gui crashing

2 participants