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

Fanout cells inserted during global placement #6643

Open
kareefardi opened this issue Feb 5, 2025 · 11 comments
Open

Fanout cells inserted during global placement #6643

kareefardi opened this issue Feb 5, 2025 · 11 comments
Assignees
Labels
gpl Global Placement rsz Resizer

Comments

@kareefardi
Copy link
Contributor

Describe the bug

This is new behavior and there is nothing in the documentation which suggests that this is intentional. I also believe that global placement shouldn't manipulate the design at all.

Expected Behavior

Clarification if this is a bug or intentional.

Environment

Git commit: 6f4c5c592f3f5f2e0ee5d4a91b86622deedb57b5
kernel: Linux 6.11.10-1-liquorix-amd64
os: Ubuntu 22.04.5 LTS (Jammy Jellyfish)
cmake version 3.25.1
-- The CXX compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- OpenROAD version: v2.0-18783-g6f4c5c592
-- System name: Linux
-- Compiler: GNU 11.4.0
-- Build type: RELEASE
-- Install prefix: /usr/local
-- C++ Standard: 17
-- C++ Standard Required: ON
-- C++ Extensions: OFF
-- The C compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test C_COMPILER_SUPPORTS__-Wall
-- Performing Test C_COMPILER_SUPPORTS__-Wall - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wall
-- Performing Test CXX_COMPILER_SUPPORTS__-Wall - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-array-bounds
-- Performing Test C_COMPILER_SUPPORTS__-Wno-array-bounds - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-array-bounds
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-array-bounds - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-nonnull
-- Performing Test C_COMPILER_SUPPORTS__-Wno-nonnull - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-nonnull
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-nonnull - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-maybe-uninitialized
-- Performing Test C_COMPILER_SUPPORTS__-Wno-maybe-uninitialized - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-maybe-uninitialized
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-maybe-uninitialized - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-format-overflow
-- Performing Test C_COMPILER_SUPPORTS__-Wno-format-overflow - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-format-overflow
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-format-overflow - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-unused-variable
-- Performing Test C_COMPILER_SUPPORTS__-Wno-unused-variable - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-unused-variable
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-unused-variable - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-unused-function
-- Performing Test C_COMPILER_SUPPORTS__-Wno-unused-function - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-unused-function
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-unused-function - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-write-strings
-- Performing Test C_COMPILER_SUPPORTS__-Wno-write-strings - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-write-strings
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-write-strings - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-sign-compare
-- Performing Test C_COMPILER_SUPPORTS__-Wno-sign-compare - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-sign-compare
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-sign-compare - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-deprecated
-- Performing Test C_COMPILER_SUPPORTS__-Wno-deprecated - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-deprecated
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-deprecated - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-c++11-narrowing
-- Performing Test C_COMPILER_SUPPORTS__-Wno-c++11-narrowing - Failed
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-c++11-narrowing
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-c++11-narrowing - Failed
-- Performing Test C_COMPILER_SUPPORTS__-Wno-register
-- Performing Test C_COMPILER_SUPPORTS__-Wno-register - Failed
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-register
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-register - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-format
-- Performing Test C_COMPILER_SUPPORTS__-Wno-format - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-format
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-format - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-reserved-user-defined-literal
-- Performing Test C_COMPILER_SUPPORTS__-Wno-reserved-user-defined-literal - Failed
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-reserved-user-defined-literal
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-reserved-user-defined-literal - Failed
-- Performing Test C_COMPILER_SUPPORTS__-fpermissive
-- Performing Test C_COMPILER_SUPPORTS__-fpermissive - Failed
-- Performing Test CXX_COMPILER_SUPPORTS__-fpermissive
-- Performing Test CXX_COMPILER_SUPPORTS__-fpermissive - Success
-- Performing Test C_COMPILER_SUPPORTS__-x
-- Performing Test C_COMPILER_SUPPORTS__-x - Failed
-- Performing Test CXX_COMPILER_SUPPORTS__-x
-- Performing Test CXX_COMPILER_SUPPORTS__-x - Failed
-- Performing Test C_COMPILER_SUPPORTS__c++
-- Performing Test C_COMPILER_SUPPORTS__c++ - Failed
-- Performing Test CXX_COMPILER_SUPPORTS__c++
-- Performing Test CXX_COMPILER_SUPPORTS__c++ - Failed
-- Performing Test C_COMPILER_SUPPORTS__-std=c++17
-- Performing Test C_COMPILER_SUPPORTS__-std=c++17 - Failed
-- Performing Test CXX_COMPILER_SUPPORTS__-std=c++17
-- Performing Test CXX_COMPILER_SUPPORTS__-std=c++17 - Success
-- Performing Test C_COMPILER_SUPPORTS__-fno-exceptions
-- Performing Test C_COMPILER_SUPPORTS__-fno-exceptions - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-fno-exceptions
-- Performing Test CXX_COMPILER_SUPPORTS__-fno-exceptions - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-unused-but-set-variable
-- Performing Test C_COMPILER_SUPPORTS__-Wno-unused-but-set-variable - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-unused-but-set-variable
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-unused-but-set-variable - Success
-- Found Python3: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- TCL library: /usr/lib/x86_64-linux-gnu/libtcl.so
-- TCL header: /usr/include/tcl/tcl.h
-- TCL readline library: /usr/lib/x86_64-linux-gnu/libtclreadline.so
-- TCL readline header: /usr/include/x86_64-linux-gnu
-- Found SWIG: /usr/bin/swig4.0 (found suitable version "4.0.2", minimum required is "4.0")  
-- Found Boost: /usr/local/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found version "1.81.0")  
-- boost: 1.81.0
-- Found GTest: /home/karim/.local/lib/cmake/GTest/GTestConfig.cmake (found version "1.14.0")  
-- GTest: 1.14.0
-- Found Python3: /usr/include/python3.10 (found version "3.10.12") found components: Development Development.Module Development.Embed 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- spdlog: 1.8.1
-- Found BISON: /usr/bin/bison (found version "3.8.2") 
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- STA version: 2.6.0
-- STA git sha: 2c5df8ccbc09a98bd39af206339505754cbee339
-- System name: Linux
-- Compiler: GNU 11.4.0
-- Build type: RELEASE
-- Build CXX_FLAGS: -O3 -DNDEBUG
-- Install prefix: /usr/local
-- Found FLEX: /usr/bin/flex (found version "2.6.4") 
-- TCL library: /usr/lib/x86_64-linux-gnu/libtcl.so
-- TCL header: /usr/include/tcl/tcl.h
-- TCL readline library: /usr/lib/x86_64-linux-gnu/libtclreadline.so
-- TCL readline header: /usr/include/x86_64-linux-gnu/tclreadline.h
-- CUDD library: /usr/local/lib/libcudd.a
-- CUDD header: /usr/local/include/cudd.h
-- SSTA: 0
-- Found SWIG: /usr/bin/swig4.0 (found suitable version "4.0.2", minimum required is "3.0")  
-- STA executable: /home/karim/work/OpenROAD/src/sta/app/sta
-- Found re2: /home/karim/Downloads/or-tools_x86_64_Ubuntu-22.10_cpp_v9.5.2237/lib/cmake/re2/re2Config.cmake (found version "9.0.0") 
-- Found Clp: /home/karim/Downloads/or-tools_x86_64_Ubuntu-22.10_cpp_v9.5.2237/lib/cmake/Clp/ClpConfig.cmake (found version "1.17.7") 
-- Found Cbc: /home/karim/Downloads/or-tools_x86_64_Ubuntu-22.10_cpp_v9.5.2237/lib/cmake/Cbc/CbcConfig.cmake (found version "2.10.7") 
-- Found SCIP: /home/karim/Downloads/or-tools_x86_64_Ubuntu-22.10_cpp_v9.5.2237/lib/cmake/scip/scip-config.cmake (found version "8.0.1") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- Found OR-Tools: /home/karim/Downloads/or-tools_x86_64_Ubuntu-22.10_cpp_v9.5.2237/lib/cmake/ortools (version: 9.5.2237)
-- TCL library: /usr/lib/x86_64-linux-gnu/libtcl.so
-- TCL header: /usr/include/tcl/tcl.h
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- Found OpenMP: TRUE (found version "4.5")  
-- GUI is not enabled
-- Found Boost: /usr/local/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found version "1.81.0") found components: serialization 
-- Could NOT find VTune (missing: VTune_LIBRARIES VTune_INCLUDE_DIRS) 
-- Found Boost: /usr/local/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found suitable version "1.81.0", minimum required is "1.78")  
-- TCL library: /usr/lib/x86_64-linux-gnu/libtcl.so
-- TCL header: /usr/include/tcl/tcl.h
-- Found Boost: /usr/local/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found version "1.81.0") found components: serialization system thread 
-- Found Boost: /usr/local/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found version "1.81.0")  
-- Found Eigen3: /usr/share/eigen3/cmake/Eigen3Config.cmake (found version "3.4.0") 
-- TCL readline enabled
-- Tcl Extended disabled
-- Python3 enabled
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/tmp.HaJYYKtx67

To Reproduce

This is an openlane2 reproducible. If a simpler test case is needed please let me know. To run: extract and cd into the extracted directory and run run.sh.

reproducible.tar.gz

Relevant log output

Cell type report:                       Count       Area
  Buffer                                   40     160.15
  Inverter                                 70     262.75
  Sequential cell                        1596   33947.56
  Multi-Input combinational cell         5038   54407.18
  Total                                  6744   88777.64
..
Cell type report:                       Count       Area
  Buffer                                   40     183.93
  Timing Repair Buffer                   1612   11360.90
  Inverter                                 70     267.76
  Sequential cell                        1596   32349.78
  Multi-Input combinational cell         5038   52237.60
  Total                                  8356   96399.96

Screenshots

No response

Additional Context

Using report_cell_usage before and after global placement shows additional Timing Repair Buffer

@eder-matheus
Copy link
Contributor

@kareefardi Recently we've enabled non-virtual runs of repair_design during global placement. It means that the modifications made during timing-driven global placement are preserved during the gpl flow, in order to achieve better correlation regarding placement density in the different stages.

@gudeh can give more details of this new feature.

@gudeh
Copy link
Contributor

gudeh commented Feb 5, 2025

Hi @kareefardi, indeed it is not gpl itself that modifies the design. What happens is that gpl makes calls to rsz repair_design if gpl timing_driven option is enabled (which is by default).

On gpl initial iterations we do virtual calls to repair_design meaning we undo all of rsz modifications, and we maintain only some internal weights for gpl calculations. On later gpl iterations we maintain whatever changes rsz made, meaning we have new cells inserted in the middle of placement execution. Further info available here: #6165, on the PR where we added this feature. Prior to this change all timing-driven iterations by gpl were purely virtual, so there was no changes to the design.

So in summary, gpl modifications to cells could seem unintentional, but they are because we make calls to rsz repair_design, which does modify the design with cell resizings and buffer insertions.

I do not have a deep understanding of all the repair_design modifications, do you think any of its modifications are incorrect somehow?

@maliberty
Copy link
Member

It is intentional to add optimization to gpl as it allows for the placer to account for the added area from optimization. If you really don't want it the -keep_resize_below_overflow would allow you to avoid it but you may get worse timing results in the total flow.

@kareefardi
Copy link
Contributor Author

Thanks for you replies.

I don't believe the modification done are incorrect but it was surprising behavior to me at least.

I think a proposed action here is to first add this to the documentation. I was also thinking global placement log should somehow be more verbose about this for example it might print the number of fanout violations it attempted to fix (similar to repair_design output)

Finally, would using -keep_resize_below_overflow completely match the old behavior or running reszier virtually?

@QuantamHD
Copy link
Collaborator

-keep_resize_below_overflow set to 0 would return to the old behavior, but IMO this generally improves the openroad placement result. I wouldn't disable it by default unless you see degradation in your flow, and is similar to the off the shelf tools you can buy.

@gudeh
Copy link
Contributor

gudeh commented Feb 5, 2025

There is some explanation about timing-driven mode and the -keep_resize_below_overflow on gpl README. Let me know if you find it unclear.

Currently gpl reports the change in area due to repair_design changes.

@maliberty
Copy link
Member

Think of it as a fused placement + optimization approach. Over time I expect more of optimization will be fused (eg repair_timing as well as repair_design).

@kareefardi
Copy link
Contributor Author

kareefardi commented Feb 6, 2025

Ok I understand the fused placement + optimization approach and setting keep_resize_below_overflow to 0 does prevent resizer from retaining the changes. I do have a couple of comments:

  • The documentation states that the default value for keep_resize_below_overflow is 0 but given the test case, it seems the default is a non-zero value. Perhaps its this
    keepResizeBelowOverflow_ = 0.3;
  • I do think it is better if gpl also reports the number of cells (fanout, max cap, etc.) added instead of just the area change with each iteration

Side note:
While using search in readthedocs this gpl document came up as well and it appears to be an outdated gpl document.
https://openroad.readthedocs.io/en/latest/src/test/translator.html

@gudeh gudeh self-assigned this Feb 6, 2025
@gudeh gudeh added gpl Global Placement rsz Resizer labels Feb 6, 2025
@gudeh
Copy link
Contributor

gudeh commented Feb 6, 2025

I believe the suggestion of reporting the cells added is pertinent. I tried doing that when the integration was implemented but the rsz repair_design API for gpl is a little awkward considering the way it counts inserted cells, I shall have a look at that again.

@gadfort
Copy link
Collaborator

gadfort commented Feb 7, 2025

I would second the reporting the changes, I think it would provide some useful feedback as well.

@gudeh
Copy link
Contributor

gudeh commented Feb 19, 2025

The recently merged PR #6732 (comment) modifies RSZ verbose behavior and introduces more information to GPL repair design calls. We changed the RSZ default verbosity to false for repair design and timing in OR, it now always shows the first and last iterations for the progression messages.

I am going to look into the specific requested print for fan out violations and other messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gpl Global Placement rsz Resizer
Projects
None yet
Development

No branches or pull requests

6 participants