Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRT integration with GRT include issue #6532

Open
bnmfw opened this issue Jan 15, 2025 · 8 comments · Fixed by #6534
Open

DRT integration with GRT include issue #6532

bnmfw opened this issue Jan 15, 2025 · 8 comments · Fixed by #6534
Assignees
Labels
drt Detailed Routing grt Global Routing

Comments

@bnmfw
Copy link
Contributor

bnmfw commented Jan 15, 2025

Description

For #5867 to be possible, it is essential for the GRT to have access to the DRT interface. During the attempts to make all the includes to allow for this to happen many issues arose. @eder-matheus mentioned that there have been previous attempts to implement this integration which lead to the same problems. The goal is, in any function of GlobalRouter.cpp, to be able to call drt_->anyPublicFunction().

Main Attempted Changes Diff:

drt/CMakeLists.txt:

--- a/src/grt/CMakeLists.txt
+++ b/src/grt/CMakeLists.txt
@@ -88,6 +88,7 @@ target_link_libraries(grt_lib
     dbSta_lib
     stt_lib
     rsz_lib
+    drt
     OpenSTA
     Boost::boost
     OpenMP::OpenMP_CXX
@@ -103,6 +104,7 @@ target_link_libraries(grt
     gui
     stt
     rsz
+    drt
     OpenSTA
     Boost::boost
     OpenMP::OpenMP_CXX
@@ -131,6 +133,7 @@ if (Python3_FOUND AND BUILD_PYTHON)
       dbSta
       gui
       stt
+      drt
       OpenSTA
       Boost::boost
   )

GlobalRouter.cpp:

--- a/src/grt/src/GlobalRouter.cpp
+++ b/src/grt/src/GlobalRouter.cpp
@@ -69,6 +69,7 @@
 #include "odb/wOrder.h"
 #include "rsz/Resizer.hh"
 #include "rsz/SpefWriter.hh"
+#include "triton_route/TritonRoute.h"
 #include "sta/Clock.hh"
 #include "sta/MinMax.hh"
 #include "sta/Parasitics.hh"

Suggested Solution

No response

Additional Context

No response

@bnmfw bnmfw added drt Detailed Routing grt Global Routing labels Jan 15, 2025
@bnmfw
Copy link
Contributor Author

bnmfw commented Jan 15, 2025

@maliberty eder mentioned that you might have some ideas on how to tackle this.

@maliberty
Copy link
Member

What are the issues you are facing?

@maliberty
Copy link
Member

I tried the above and it looks like a simple linking issue. I've got a PR coming.

openroad-ci pushed a commit to The-OpenROAD-Project-staging/OpenROAD that referenced this issue Jan 15, 2025
Fixes The-OpenROAD-Project#6532

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
@bnmfw
Copy link
Contributor Author

bnmfw commented Jan 15, 2025

@maliberty I merged your PR but seems like the issue still persists. I can make a separate "PR" just with the code changes needed to reproduce my problem. Whenever I get to [ 95%] Linking CXX executable TestBufRem1 during linking it goes wild, some problems on drt/grt linking itself but linking problems with the gui and ord as well. Here is the full output I get, it seems to only fully happen when trying to access a drt function on grt (I've rebuild the whole build directory):


/usr/bin/ld: ../../../drt/drt.a(TritonRoute.cpp.o): in function `drt::TritonRoute::getDRCMarkers(std::__cxx11::list<std::unique_ptr<drt::frMarker, std::default_delete<drt::frMarker> >, std::allocator<std::unique_ptr<drt::frMarker, std::default_delete<drt::frMarker> > > >&, odb::Rect const&)':
TritonRoute.cpp:(.text+0x4399): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: TritonRoute.cpp:(.text+0x43a1): undefined reference to `ord::OpenRoad::getThreadCount()'
/usr/bin/ld: ../../../drt/drt.a(TritonRoute.cpp.o): in function `drt::TritonRoute::updateDesign(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)':
TritonRoute.cpp:(.text+0x6e1b): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: TritonRoute.cpp:(.text+0x6e23): undefined reference to `ord::OpenRoad::getThreadCount()'
/usr/bin/ld: ../../../drt/drt.a(TritonRoute.cpp.o): in function `drt::TritonRoute::resetDb(char const*)':
TritonRoute.cpp:(.text+0x8f85): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: TritonRoute.cpp:(.text+0x8f99): undefined reference to `ord::OpenRoad::readDb(char const*, bool)'
/usr/bin/ld: ../../../drt/drt.a(TritonRoute.cpp.o): in function `drt::TritonRoute::updateDesign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
TritonRoute.cpp:(.text+0x95cc): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: TritonRoute.cpp:(.text+0x95d4): undefined reference to `ord::OpenRoad::getThreadCount()'
/usr/bin/ld: ../../../drt/drt.a(TritonRoute.cpp.o): in function `drt::TritonRoute::sendDesignDist()':
TritonRoute.cpp:(.text+0xa32c): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: TritonRoute.cpp:(.text+0xa33c): undefined reference to `ord::OpenRoad::writeDb(char const*)'
/usr/bin/ld: ../../../drt/drt.a(TritonRoute.cpp.o): in function `drt::TritonRoute::pinAccess(std::vector<odb::dbInst*, std::allocator<odb::dbInst*> > const&)':
TritonRoute.cpp:(.text+0xaa10): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: TritonRoute.cpp:(.text+0xaa18): undefined reference to `ord::OpenRoad::getThreadCount()'
/usr/bin/ld: ../../../drt/drt.a(TritonRoute.cpp.o): in function `drt::RoutingCallBack::onPinAccessJobReceived(dst::JobMessage&, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>&)':
TritonRoute.cpp:(.text._ZN3drt15RoutingCallBack22onPinAccessJobReceivedERN3dst10JobMessageERN5boost4asio19basic_stream_socketINS5_2ip3tcpENS5_15any_io_executorEEE[_ZN3drt15RoutingCallBack22onPinAccessJobReceivedERN3dst10JobMessageERN5boost4asio19basic_stream_socketINS5_2ip3tcpENS5_15any_io_executorEEE]+0x6bc): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: TritonRoute.cpp:(.text._ZN3drt15RoutingCallBack22onPinAccessJobReceivedERN3dst10JobMessageERN5boost4asio19basic_stream_socketINS5_2ip3tcpENS5_15any_io_executorEEE[_ZN3drt15RoutingCallBack22onPinAccessJobReceivedERN3dst10JobMessageERN5boost4asio19basic_stream_socketINS5_2ip3tcpENS5_15any_io_executorEEE]+0x6c4): undefined reference to `ord::OpenRoad::getThreadCount()'
/usr/bin/ld: ../../../drt/drt.a(TritonRoute.cpp.o): in function `drt::RoutingCallBack::onRoutingJobReceived(dst::JobMessage&, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>&)':
TritonRoute.cpp:(.text._ZN3drt15RoutingCallBack20onRoutingJobReceivedERN3dst10JobMessageERN5boost4asio19basic_stream_socketINS5_2ip3tcpENS5_15any_io_executorEEE[_ZN3drt15RoutingCallBack20onRoutingJobReceivedERN3dst10JobMessageERN5boost4asio19basic_stream_socketINS5_2ip3tcpENS5_15any_io_executorEEE]+0x285): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: TritonRoute.cpp:(.text._ZN3drt15RoutingCallBack20onRoutingJobReceivedERN3dst10JobMessageERN5boost4asio19basic_stream_socketINS5_2ip3tcpENS5_15any_io_executorEEE[_ZN3drt15RoutingCallBack20onRoutingJobReceivedERN3dst10JobMessageERN5boost4asio19basic_stream_socketINS5_2ip3tcpENS5_15any_io_executorEEE]+0x28d): undefined reference to `ord::OpenRoad::getThreadCount()'
/usr/bin/ld: ../../../drt/drt.a(TritonRoute.cpp.o): in function `drt::TritonRoute::main()':
TritonRoute.cpp:(.text.startup+0xe9): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: TritonRoute.cpp:(.text.startup+0xf1): undefined reference to `ord::OpenRoad::getThreadCount()'
/usr/bin/ld: TritonRoute.cpp:(.text.startup+0x399): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: TritonRoute.cpp:(.text.startup+0x3ee): undefined reference to `ord::OpenRoad::writeDb(char const*)'
/usr/bin/ld: ../../../drt/drt.a(TritonRouteTCL_wrap.cxx.o): in function `detailed_route_num_drvs()':
TritonRouteTCL_wrap.cxx:(.text+0x1af9): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../drt/drt.a(TritonRouteTCL_wrap.cxx.o): in function `detailed_route_distributed(char const*, unsigned short, char const*, unsigned int)':
TritonRouteTCL_wrap.cxx:(.text+0x1b3c): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../drt/drt.a(TritonRouteTCL_wrap.cxx.o): in function `detailed_route_set_default_via(char const*)':
TritonRouteTCL_wrap.cxx:(.text+0x1c87): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../drt/drt.a(TritonRouteTCL_wrap.cxx.o): in function `detailed_route_set_unidirectional_layer(char const*)':
TritonRouteTCL_wrap.cxx:(.text+0x1da7): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../drt/drt.a(TritonRouteTCL_wrap.cxx.o): in function `detailed_route_cmd(char const*, char const*, char const*, char const*, char const*, bool, int, char const*, char const*, int, double, char const*, char const*, int, bool, bool, bool, int, bool, char const*, int)':
TritonRouteTCL_wrap.cxx:(.text+0x1f90): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../drt/drt.a(TritonRouteTCL_wrap.cxx.o):TritonRouteTCL_wrap.cxx:(.text+0x29c9): more undefined references to `ord::OpenRoad::openRoad()' follow
/usr/bin/ld: ../../../drt/drt.a(FlexDR.cpp.o): in function `drt::FlexDR::getLonelyVias(drt::frLayer*, int, int)':
FlexDR.cpp:(.text+0x7d7a): undefined reference to `ord::OpenRoad::getThreadCount()'
/usr/bin/ld: ../../../drt/drt.a(FlexDR.cpp.o): in function `drt::FlexDR::main()':
FlexDR.cpp:(.text.startup+0x30c): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: FlexDR.cpp:(.text.startup+0x352): undefined reference to `ord::OpenRoad::writeDb(char const*)'
/usr/bin/ld: ../../../dst/dst.a(DistributedTCL_wrap.cxx.o): in function `run_worker_cmd(char const*, unsigned short, bool)':
DistributedTCL_wrap.cxx:(.text+0x1b00): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../dst/dst.a(DistributedTCL_wrap.cxx.o): in function `run_load_balancer(char const*, unsigned short, char const*)':
DistributedTCL_wrap.cxx:(.text+0x1b31): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../dst/dst.a(DistributedTCL_wrap.cxx.o): in function `add_worker_address(char const*, unsigned short)':
DistributedTCL_wrap.cxx:(.text+0x1b60): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../dst/dst.a(DistributedTCL_wrap.cxx.o): in function `_wrap_add_worker_address':
DistributedTCL_wrap.cxx:(.text+0x1c53): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../dst/dst.a(DistributedTCL_wrap.cxx.o): in function `_wrap_run_load_balancer':
DistributedTCL_wrap.cxx:(.text+0x1eb4): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../dst/dst.a(DistributedTCL_wrap.cxx.o):DistributedTCL_wrap.cxx:(.text+0x215b): more undefined references to `ord::OpenRoad::openRoad()' follow
/usr/bin/ld: ../../../gui/gui.a(gui.cpp.o): in function `std::_Function_handler<void (), gui::startGui(int&, char**, Tcl_Interp*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool, bool)::{lambda()#1}>::_M_invoke(std::_Any_data const&)':
gui.cpp:(.text+0xa3): undefined reference to `ord::OpenRoad::getDocsPath[abi:cxx11]() const'
/usr/bin/ld: ../../../gui/gui.a(gui.cpp.o): in function `gui::startGui(int&, char**, Tcl_Interp*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool, bool)':
gui.cpp:(.text+0x5cc3): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: gui.cpp:(.text+0x5d5f): undefined reference to `ord::OpenRoad::addObserver(ord::OpenRoadObserver*)'
/usr/bin/ld: gui.cpp:(.text+0x624b): undefined reference to `ord::OpenRoad::removeObserver(ord::OpenRoadObserver*)'
/usr/bin/ld: ../../../gui/gui.a(gui.cpp.o): in function `gui::message_handler(QtMsgType, QMessageLogContext const&, QString const&)':
gui.cpp:(.text+0x9b74): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../gui/gui.a(gui.cpp.o): in function `gui::Gui::showGui(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool)':
gui.cpp:(.text+0xa739): undefined reference to `cmd_argv'
/usr/bin/ld: gui.cpp:(.text+0xa747): undefined reference to `cmd_argc'
/usr/bin/ld: ../../../gui/gui.a(guiTCL_wrap.cxx.o): in function `get_heatmap_bool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
guiTCL_wrap.cxx:(.text+0x4277): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../gui/gui.a(guiTCL_wrap.cxx.o): in function `get_heatmap_int(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
guiTCL_wrap.cxx:(.text+0x4336): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../gui/gui.a(guiTCL_wrap.cxx.o): in function `get_heatmap_double(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
guiTCL_wrap.cxx:(.text+0x43f8): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../gui/gui.a(guiTCL_wrap.cxx.o): in function `get_heatmap_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
guiTCL_wrap.cxx:(.text+0x4564): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../gui/gui.a(guiTCL_wrap.cxx.o): in function `get_block()':
guiTCL_wrap.cxx:(.text+0x45dc): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../gui/gui.a(guiTCL_wrap.cxx.o):guiTCL_wrap.cxx:(.text+0x45e5): more undefined references to `ord::OpenRoad::openRoad()' follow
/usr/bin/ld: ../../../gui/gui.a(guiTCL_wrap.cxx.o): in function `design_created()':
guiTCL_wrap.cxx:(.text+0x512d): undefined reference to `ord::OpenRoad::designCreated()'
/usr/bin/ld: ../../../gui/gui.a(guiTCL_wrap.cxx.o): in function `_wrap_set_title.cold':
guiTCL_wrap.cxx:(.text.unlikely+0x962): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../gui/gui.a(guiTCL_wrap.cxx.o): in function `_wrap_update_timing_report.cold':
guiTCL_wrap.cxx:(.text.unlikely+0xb4d): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../gui/gui.a(guiTCL_wrap.cxx.o): in function `_wrap_select_chart.cold':
guiTCL_wrap.cxx:(.text.unlikely+0xd51): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../gui/gui.a(guiTCL_wrap.cxx.o): in function `_wrap_show_help.cold':
guiTCL_wrap.cxx:(.text.unlikely+0xf51): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../gui/gui.a(guiTCL_wrap.cxx.o): in function `_wrap_unminimize.cold':
guiTCL_wrap.cxx:(.text.unlikely+0x1151): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: ../../../gui/gui.a(guiTCL_wrap.cxx.o):guiTCL_wrap.cxx:(.text.unlikely+0x1355): more undefined references to `ord::OpenRoad::openRoad()' follow
/usr/bin/ld: ../../../gui/gui.a(mainWindow.cpp.o): in function `gui::MainWindow::saveDesign()':
mainWindow.cpp:(.text+0x2a73): undefined reference to `ord::OpenRoad::writeDb(char const*)'
/usr/bin/ld: ../../../gui/gui.a(mainWindow.cpp.o): in function `gui::MainWindow::openDesign()':
mainWindow.cpp:(.text+0x88a5): undefined reference to `ord::OpenRoad::openRoad()'
/usr/bin/ld: mainWindow.cpp:(.text+0x8938): undefined reference to `ord::OpenRoad::readDb(char const*, bool)'
/usr/bin/ld: ../../../gui/gui.a(tclCmdInputWidget.cpp.o): in function `gui::TclCmdInputWidget::setTclInterp(Tcl_Interp*, bool, std::function<void ()> const&)':
tclCmdInputWidget.cpp:(.text+0x765f): undefined reference to `ord::tclInit(Tcl_Interp*)'
collect2: error: ld returned 1 exit status

@bnmfw bnmfw reopened this Jan 15, 2025
@maliberty
Copy link
Member

Please make a small reproducer on a branch or PR

@bnmfw
Copy link
Contributor Author

bnmfw commented Jan 15, 2025

I have the branch here, it uses a dummy function to call drt

@maliberty
Copy link
Member

On your branch I can build openroad (I had to comment out the declared but undefined deletePinAccess).

The problem in test executables is that refer to drt (through grt) and it is not clean. The main problem is that a number of places do ord::OpenRoad::openRoad() which they shouldn't. The singleton should only be accessed in the .i file and not from .cpp.

Also this module need the split between drt and drt_lib that you see in most other modules. @QuantamHD made that change in many other places and can give guidance. grt should only depend on drt_lib once it exists.

@QuantamHD
Copy link
Collaborator

QuantamHD commented Jan 16, 2025

Largely the thing you need to do is decouple the openroad singleton from drt

What that boils down to in practice is a bunch of calls to the gui
If you look at the resizer this requires you creating an abstract class that encapsulates the gui behavior and injecting that abstract class into the drt object

https://github.com/The-OpenROAD-Project/OpenROAD/blob/master/src/rsz/src/MakeResizer.cc#L64-L82

You also need to seperate the MakeResizer and swig libraries from drt target into drt_lib which should contain most of the drt code, and the drt which should include drt_lib to the MakeDrt.cc + any other openroad app specific junk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
drt Detailed Routing grt Global Routing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants