Skip to content

odb: impl 3dblox parser path asserstions#10055

Open
openroad-ci wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:feat/3dblox-checker-pathAssertions
Open

odb: impl 3dblox parser path asserstions#10055
openroad-ci wants to merge 1 commit intoThe-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

Signed-off-by: Ahmed R. Mohamed <ahmed@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 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 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

@@ -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

@@ -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 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?

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.

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 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.

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.

#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 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

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.

3DBlox: Path Assertion

3 participants