Skip to content

utl: add ServiceRegistry and port parasitics/pin-access callbacks#10168

Merged
maliberty merged 7 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:utl-service-registry
Apr 17, 2026
Merged

utl: add ServiceRegistry and port parasitics/pin-access callbacks#10168
maliberty merged 7 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:utl-service-registry

Conversation

@openroad-ci
Copy link
Copy Markdown
Collaborator

Summary

Introduces utl::ServiceRegistry, a type-indexed single-provider service locator, and migrates the two fixed-method callbacks on utl::CallBackHandler to it. est::ParasiticsService and drt::PinAccessService are now abstract interfaces discovered via the registry, removing the need for utl::CallBack/utl::CallBackHandler entirely.

Motivation: the previous CallBack base class required every new cross-module event to be added as a virtual method, which does not scale. With the registry, modules publish small abstract interfaces in their own include/<module>/ directories and consumers look them up by type. No shared base class, no central edits when a new capability appears.

Four commits, each independently buildable:

  • b7976f0 Add utl::ServiceRegistry (header + unit test) and thread it through module constructors.
  • 1c57d06 Port parasitics: introduce est::ParasiticsService, register from EstimateParasitics, switch grt::FastRouteCore and grt::CUGR to look it up. Delete EstimateParasiticsCallBack.
  • 2687bff Port pin access: drt::PinAccessService, registered from TritonRoute, consumed by GlobalRouter::updateDirtyRoutes. Delete PACallBack and the entire CallBack/CallBackHandler infrastructure (now unused).
  • 3637b13 Rename to the Service suffix convention (documented in docs/agents/coding.md).

Type of Change

  • Refactoring
  • Documentation update

Impact

No functional change. Callers preserve fire-if-registered semantics (registry find<> returns nullptr if absent; require<> would error). Logger IDs UTL 201-203 are newly defined for the registry.

Public API: ord::OpenRoad::getCallBackHandler() is removed (no in-tree users). ord::OpenRoad::getServiceRegistry() is added. Module constructors that previously took utl::CallBackHandler* now take utl::ServiceRegistry* instead.

Net diff direction is subtractive: ~344 lines deleted, ~463 added, with the largest additions being the registry, its gtest suite, and two small interface headers.

Verification

  • I have verified that the local build succeeds (bazel build //src/utl //src/drt //src/grt //src/est //:openroad).
  • I have run the relevant tests and they pass: //src/utl/test:TestServiceRegistry (8/8), //src/rsz/test:TestBufRem1, //src/rsz/test:TestBufferRemoval2, //src/rsz/test:TestBufferRemoval3, //src/gpl/test:mbff_test.
  • My code follows the repository's formatting guidelines.
  • I have signed my commits (DCO).

Related Issues

None.

Introduces a type-indexed service registry that lets modules publish
abstract interfaces and lets consumers look them up without a shared
base class or a hard link-time dependency on the provider. Single
provider per interface; duplicate provide<I>() is reported as an error.

Threads a ServiceRegistry* through drt::TritonRoute, est::EstimateParasitics,
grt::GlobalRouter, grt::FastRouteCore, and grt::CUGR alongside the existing
CallBackHandler*. Nothing consumes the registry yet -- the next step is to
port est and drt to publish ParasiticsEstimator and PinAccessProvider
interfaces and remove the fixed-method callbacks from utl::CallBack.

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
Introduces est::ParasiticsEstimator as an abstract service interface
(new header, header-only bazel target and CMake-side include-path dep).
est::EstimateParasitics now implements the interface and publishes
itself via utl::ServiceRegistry in its constructor.

grt::FastRouteCore and grt::CUGR replace their
callback_handler_->triggerOnEstimateParasiticsRequired() calls with a
registry lookup and call estimateAllGlobalRouteParasitics() on the
interface -- preserving the existing fire-if-registered semantics.

Deletes EstimateParasiticsCallBack and the now-dead
onEstimateParasiticsRequired / triggerOnEstimateParasiticsRequired
methods on utl::CallBack and utl::CallBackHandler. The CallBack
infrastructure remains for pin-access, which will migrate next.

Also drops the callback_handler parameter from EstimateParasitics since
it is no longer needed there.

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
Introduces drt::PinAccessProvider as an abstract service interface.
drt::TritonRoute implements it and publishes itself via
utl::ServiceRegistry. grt::GlobalRouter::updateDirtyRoutes replaces its
callback_handler_->triggerOnPinAccessUpdateRequired() call with a
registry lookup that preserves the prior fire-if-registered semantics.

With parasitics already ported, the CallBack/CallBackHandler
infrastructure has no remaining users. This commit deletes
utl::CallBack, utl::CallBackHandler, drt::PACallBack, and
ord::OpenRoad::getCallBackHandler, and removes the now-dead
callback_handler_ members and parameters from TritonRoute,
GlobalRouter, FastRouteCore, and CUGR.

Test fixtures (tst::IntegratedFixture, rsz TestBufferRemoval{,2},
gpl mbff_test) drop the callback_handler_ they constructed for their
module instances.

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
Introduces a Service suffix as the standard convention for abstract
interfaces published through utl::ServiceRegistry. Renames the two
existing interfaces:

  est::ParasiticsEstimator  -> est::ParasiticsService
  drt::PinAccessProvider    -> drt::PinAccessService

The Service suffix pairs with the registry name (ServiceRegistry) and
distinguishes registry-backed cross-module interfaces from the existing
Abstract* renderer classes, which serve a different role (test/headless
swapping). Bazel targets follow the same rename:
parasitics_estimator -> parasitics_service and
pin_access_provider -> pin_access_service. Header filenames are renamed
via git mv to preserve history.

The convention is documented in docs/agents/coding.md. No functional
change.

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
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 replaces the utl::CallBackHandler mechanism with a new utl::ServiceRegistry to manage inter-module communication. It introduces abstract service interfaces, such as PinAccessService and ParasiticsService, to decouple modules like grt, drt, and est. The ServiceRegistry allows modules to publish and look up these interfaces at runtime, reducing direct link-time dependencies. The changes also include the removal of the old callback classes and the addition of unit tests for the new registry. A review comment points out that the unit tests for ServiceRegistry should use EXPECT_DEATH instead of EXPECT_THROW, as the project's logger is expected to terminate the program on error.

Comment thread src/utl/test/cpp/TestServiceRegistry.cpp
@maliberty
Copy link
Copy Markdown
Member

@osamahammad21 @eder-matheus @QuantamHD the service locator we discussed a long time back.

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/est/src/EstimateParasitics.cpp
Comment thread src/utl/src/ServiceRegistry.cpp
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
@maliberty
Copy link
Copy Markdown
Member

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fe0e14ccc4

ℹ️ 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".

Comment thread src/est/src/EstimateParasitics.cpp Outdated
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
@maliberty maliberty enabled auto-merge April 17, 2026 14:33
@github-actions
Copy link
Copy Markdown
Contributor

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

@maliberty maliberty merged commit f27380c into The-OpenROAD-Project:master Apr 17, 2026
16 checks passed
@maliberty maliberty deleted the utl-service-registry branch April 17, 2026 15:11
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