Skip to content

Commit 60d7a7c

Browse files
committed
doc: Add notes on how to speed-up VTR edit-compile-debug cycle
In particular document different ways of speeding up compilation.
1 parent f4e9a92 commit 60d7a7c

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

README.developers.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,69 @@ where ``$VTR_ROOT`` should be replaced with the root of the VTR source tree on y
930930
[RR](https://rr-project.org/) extends GDB with the ability to to record a run of a tool and then re-run it to reproduce any observed issues.
931931
RR also enables efficient reverse execution (!) which can be *extremely helpful* when tracking down the source of a bug.
932932
933+
# Speeding up the edit-compile-test cycle
934+
Rapid iteration through the edit-compile-test/debug cycle is very helpful when making code changes to VTR.
935+
936+
The following is some guidance on techniques to reduce the time required.
937+
938+
# Speeding Compilation
939+
940+
1. Parallel compilation
941+
942+
For instance when [building VTR](BUILDING.md) using make, you can specify the `-j N` option to compile the code base with N parallel jobs:
943+
```
944+
$ make -j N
945+
```
946+
947+
A reasonable value for `N` is equal to the number of threads you system can run. For instance, if your system has 4 cores with HyperThreading (i.e. 2-way SMT) you could run:
948+
```
949+
$ make -j8
950+
```
951+
952+
2. Building only a subset of VTR
953+
954+
If you know your changes only effect a specific tool in VTR, you can request that only that tool is rebuilt.
955+
For instance, if you only wanted to re-compile VPR you could run:
956+
```
957+
$ make vpr
958+
```
959+
which would avoid re-building other tools (e.g. ODIN, ABC).
960+
961+
3. Use ccache
962+
963+
[ccache](https://ccache.dev/) is a program which caches previous compilation results.
964+
This can save significant time, for instance, when switching back and forth between release and debug builds.
965+
966+
VTR's cmake configuration should automatically detect and make use of ccache once it is installed.
967+
968+
For instance on Ubuntu/Debian systems you can install ccache with:
969+
```
970+
$ sudo apt install ccache
971+
```
972+
This only needs to be done once on your development system.
973+
974+
4. Disable Interprocedural Optimizatiaons (IPO)
975+
976+
IPO re-optimizes an entire executable at link time, and is automatically enabled by VTR if a supporting compiler is found.
977+
This can notably improve performance (e.g. ~10-20% faster), but can significantly increase compilation time (e.g. >2x in some cases).
978+
When frequently re-compiling and debugging the extra execution speed may not be worth the longer compilation times.
979+
In such cases you can manually disable IPO by setting the cmake parameter `VTR_IPO_BUILD=off`.
980+
981+
For instance using the wrapper Makefile:
982+
```
983+
$ make CMAKE_PARAMS="-DVTR_IPO_BUILD=off"
984+
```
985+
Note that this option is sticky, so subsequent calls to make don't need to keep specifying VTR_IPO_BUILD, until you want to re-enable it.
986+
987+
This setting can also be changed with the ccmake tool (i.e. `ccmake build`).
988+
989+
All of these option can be used in combination.
990+
For example, the following will re-build only VPR using 8 parallel jobs with IPO disabled:
991+
```
992+
make CMAKE_PARAMS="-DVTR_IPO_BUILD=off" -j8 vpr
993+
```
994+
995+
933996
# External Subtrees
934997
VTR includes some code which is developed in external repositories, and is integrated into the VTR source tree using [git subtrees](https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree).
935998

0 commit comments

Comments
 (0)