Skip to content

odb: impl 3dblox parser path asserstions#10055

Open
openroad-ci wants to merge 2 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:feat/3dblox-checker-pathAssertions
Open

odb: impl 3dblox parser path asserstions#10055
openroad-ci wants to merge 2 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:feat/3dblox-checker-pathAssertions

Conversation

@openroad-ci
Copy link
Copy Markdown
Collaborator

Summary

Add path assertion checking to the 3DBlox checker. Path assertions (parsed from .3dbx files) specify must-touch and do-not-touch region constraints. The checker validates these by building a CSR routing graph from the unfolded model and running BFS connectivity queries to detect violations.

Key changes:

  • Expose PathAssertionEntry/PathAssertion structs in the public header with a region_inst field resolved at parse time
  • Add getPathAssertions()/setPathAssertions() API on ThreeDBlox
  • Implement checkPathAssertions in the checker using a CSR routing graph + BFS
  • Add dbChip::setIsBlackbox()/isBlackbox() so blackbox chips get intra-chip clique edges in the routing graph
  • New routingGraph.cpp/h for O(V+E) CSR graph construction
  • 6 new checker tests and 2 new parser tests

Type of Change

  • New feature

Impact

  • ThreeDBlox::check() now validates path assertions in addition to existing checks (logical connectivity, floating chips, overlaps, etc.)
  • Chips without a DEF file are marked as blackbox, causing all their regions to be treated as mutually reachable in the routing graph
  • New schema revision (129) for the blackbox_ field on dbChip; backward-compatible with schema 128 databases

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have signed my commits (DCO).

Related Issues

Closes: #9300

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 implements path assertion validation within the 3DBlox checker. It introduces a 'blackbox' attribute for chips to handle components without detailed routing and adds a CSR-based RoutingGraph to model design connectivity. The checker now utilizes a BFS-based algorithm to verify reachability constraints defined in path assertions. Feedback was provided regarding the use of magic numbers for buffer capacities in the BFS state.

Comment thread src/odb/src/3dblox/checker.cpp Outdated
Comment on lines +119 to +121
queue.reserve(std::min<uint32_t>(n, 4096u));
dirty_blocked.reserve(64);
dirty_target.reserve(64);
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 values 4096u and 64 are magic numbers. To improve readability and maintainability, they should be defined as named constants. This also aligns with the general rule to avoid hardcoded magic numbers for tunable parameters.

For example, you could add them to the BfsState struct:

struct BfsState
{
  static constexpr uint32_t kInitialBfsQueueCapacity = 4096u;
  static constexpr uint32_t kInitialDirtyListCapacity = 64u;
  std::vector<uint8_t> is_blocked;
  // ...

  explicit BfsState(uint32_t n)
      : is_blocked(n, 0), is_target(n, 0), visited(n, 0)
  {
    queue.reserve(std::min<uint32_t>(n, kInitialBfsQueueCapacity));
    dirty_blocked.reserve(kInitialDirtyListCapacity);
    dirty_target.reserve(kInitialDirtyListCapacity);
  }
  // ...
};
References
  1. Define tunable parameters as named constants instead of using hardcoded magic numbers.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 4, 2026

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

@ahmed532 ahmed532 requested a review from osamahammad21 April 4, 2026 20:34
Copy link
Copy Markdown
Member

@osamahammad21 osamahammad21 left a comment

Choose a reason for hiding this comment

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

Still review BFSstate

Comment on lines +203 to +216
static std::vector<std::string> splitPath(const std::string& path)
{
std::vector<std::string> parts;
std::istringstream stream(path);
std::string part;

while (std::getline(stream, part, '/')) {
if (!part.empty()) {
parts.push_back(part);
}
}

return parts;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

use boost::split

Comment thread src/odb/src/3dblox/routingGraph.h Outdated
@@ -0,0 +1,33 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2023-2026, The OpenROAD Authors
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

2026 only

Comment thread src/odb/src/3dblox/routingGraph.cpp Outdated
@@ -0,0 +1,133 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2023-2026, The OpenROAD Authors
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

2026

Comment thread src/odb/src/3dblox/routingGraph.cpp Outdated
Comment on lines +77 to +79
if (!conn.top_region || !conn.bottom_region) {
continue; // Virtual (ground) connection — no region-to-region edge.
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we should check if top_region is null because that looks like a fail safe. At this point, top_region should never be null, right?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm not sure if top or bottom are what we expect to be connected to ground. I think defensive programming is better. If you know that top must not be null tell me and I'll check and error.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

According to the standard, only the bottom region is allowed to be ~ (virtual plane). So the top cannot null. In general, I am against defensive programming because it leads to having major issues unnoticed. I would rather a crashing program than a silently wrong one.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I agree with "I would rather a crashing program than a silently wrong one" as I said I'll error in the bad case. I won't continue.

Comment on lines +82 to +84
if (it_top == region_to_idx.end() || it_bot == region_to_idx.end()) {
continue;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Another fail safe that shouldn't happen. A connection should never hold a region that is not defined already in the unfolded model.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You're right, this should be an error (assert) not continue.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

assert is sufficient if you think it is needed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Asserts might be dropped out in a release build. I think we should error.

Comment thread src/odb/src/3dblox/routingGraph.cpp Outdated
Comment on lines +104 to +107
const auto it_b = region_to_idx.find(&regions[b]);
if (it_b == region_to_idx.end()) {
continue;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ditto

Comment thread src/odb/src/3dblox/routingGraph.cpp Outdated
Comment on lines +110 to +112
edges.push_back({u, v});
g.offsets[u + 1]++;
g.offsets[v + 1]++;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually, even in blackbox, connecting all regions is not correct according to the standard.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

From the spec: "During the blackbox stage, all intra-chiplet regions are assumed to be internally connected".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It depends on the chiplet type and whether it is TSV or not.

Comment thread src/odb/include/odb/db.h
Comment on lines +7265 to +7268
void setBlackbox(bool blackbox);

bool isBlackbox() const;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think that the blackbox state should be user defined. It should be inferred from the current state of the chiplet. From looking at the code, I can see that you set it once and never change it again even if the netlist is added later with routing.
For now let's remove it and assume that the path assertions are in the scope of the blockbox state only.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agreed, I did not mean for this to be used by a user. I wanted the system to change it. Do you think there is a better mechanism to track what stage the system is in? I'll check if we have something already.

#include "objects.h"
#include "odb/db.h"
#include "utl/Logger.h"
#include "yaml-cpp/yaml.h"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why?

Comment thread src/odb/src/3dblox/routingGraph.h Outdated
Comment on lines +19 to +24
struct RoutingGraph
{
std::vector<uint32_t> offsets; // size num_nodes+1; CSR row pointers
std::vector<uint32_t> neighbors; // all adjacency lists concatenated
uint32_t num_nodes = 0;
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

use boost::compressed_sparse_row_graph

Ahmed R. Mohamed added 2 commits May 13, 2026 19:24
Signed-off-by: Ahmed R. Mohamed <ahmed@precisioninno.com>
Use boost graph library
Implement all spec region connection rules.

Signed-off-by: Ahmed R. Mohamed <ahmed@precisioninno.com>
@openroad-ci openroad-ci force-pushed the feat/3dblox-checker-pathAssertions branch from 5fadd7d to 1ffe304 Compare May 14, 2026 01:45
@openroad-ci openroad-ci requested a review from a team as a code owner May 14, 2026 01:45
@openroad-ci openroad-ci requested a review from maliberty May 14, 2026 01:45
@github-actions
Copy link
Copy Markdown
Contributor

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

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.

3DBlox: Path Assertion

3 participants