utl: add ServiceRegistry and port parasitics/pin-access callbacks#10168
Conversation
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>
There was a problem hiding this comment.
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.
|
@osamahammad21 @eder-matheus @QuantamHD the service locator we discussed a long time back. |
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
|
@codex review |
There was a problem hiding this comment.
💡 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".
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
|
clang-tidy review says "All clean, LGTM! 👍" |
Summary
Introduces
utl::ServiceRegistry, a type-indexed single-provider service locator, and migrates the two fixed-method callbacks onutl::CallBackHandlerto it.est::ParasiticsServiceanddrt::PinAccessServiceare now abstract interfaces discovered via the registry, removing the need forutl::CallBack/utl::CallBackHandlerentirely.Motivation: the previous
CallBackbase 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 owninclude/<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:
b7976f0Addutl::ServiceRegistry(header + unit test) and thread it through module constructors.1c57d06Port parasitics: introduceest::ParasiticsService, register fromEstimateParasitics, switchgrt::FastRouteCoreandgrt::CUGRto look it up. DeleteEstimateParasiticsCallBack.2687bffPort pin access:drt::PinAccessService, registered fromTritonRoute, consumed byGlobalRouter::updateDirtyRoutes. DeletePACallBackand the entireCallBack/CallBackHandlerinfrastructure (now unused).3637b13Rename to theServicesuffix convention (documented indocs/agents/coding.md).Type of Change
Impact
No functional change. Callers preserve fire-if-registered semantics (registry
find<>returnsnullptrif absent;require<>would error). Logger IDsUTL 201-203are 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 tookutl::CallBackHandler*now takeutl::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
bazel build //src/utl //src/drt //src/grt //src/est //:openroad).//src/utl/test:TestServiceRegistry(8/8),//src/rsz/test:TestBufRem1,//src/rsz/test:TestBufferRemoval2,//src/rsz/test:TestBufferRemoval3,//src/gpl/test:mbff_test.Related Issues
None.