Skip to content

Commit 3dcf188

Browse files
authored
[docs] Extract flags for quicker builds from "in-tree" section (#4149)
1 parent eaf87f3 commit 3dcf188

File tree

1 file changed

+21
-35
lines changed

1 file changed

+21
-35
lines changed

docs/development.md

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -97,41 +97,9 @@ sudo apt install clang ccache lld
9797

9898
Two setups are possible to build: in-tree and out-of-tree. The in-tree setup is the most straightforward, as it will build LLVM dependencies as well.
9999

100-
##### ...with LLVM "in-tree" using...
100+
##### ...with LLVM "in-tree"
101101

102-
The following commands generate configuration files to build the project *in-tree*, that is, using llvm/llvm-project as the main build. This will build LLVM as well as torch-mlir and its subprojects.
103-
104-
###### ...Base + Optimization Options
105-
106-
If you do anticipate needing to frequently rebuild LLVM "in-tree", run:
107-
108-
```shell
109-
cmake -GNinja -Bbuild \
110-
`# Enables "--debug" and "--debug-only" flags for the "torch-mlir-opt" tool` \
111-
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
112-
-DLLVM_ENABLE_ASSERTIONS=ON \
113-
-DPython3_FIND_VIRTUALENV=ONLY \
114-
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
115-
-DLLVM_TARGETS_TO_BUILD=host \
116-
`# For building LLVM "in-tree"` \
117-
externals/llvm-project/llvm \
118-
-DLLVM_ENABLE_PROJECTS=mlir \
119-
-DLLVM_EXTERNAL_PROJECTS="torch-mlir" \
120-
-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$PWD" \
121-
`# use clang`\
122-
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
123-
`# use ccache to cache build results` \
124-
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
125-
`# use LLD to link in seconds, rather than minutes` \
126-
-DCMAKE_LINKER_TYPE=lld
127-
```
128-
129-
- This requires [the enablement mentioned earlier](#optional-enable-quicker-builds).
130-
- If you encounter issues when you run this, try the [simplified build command](#base-options) instead.
131-
132-
###### ...Base Options
133-
134-
If you don't anticipate needing to frequently rebuild LLVM "in-tree", run:
102+
The following command generates configuration files to build the project *in-tree*, that is, using llvm/llvm-project as the main build. This will build LLVM as well as torch-mlir and its subprojects.
135103

136104
```shell
137105
cmake -GNinja -Bbuild \
@@ -167,12 +135,30 @@ cmake -GNinja -Bbuild \
167135
.
168136
```
169137

170-
- The same QoL CMake flags can be used to enable clang, ccache, and lld.
171138
- Be sure to have built LLVM with `-DLLVM_ENABLE_PROJECTS=mlir`.
172139
- Be aware that the installed version of LLVM needs in general to match the committed version in `externals/llvm-project`. Using a different version may or may not work.
173140

174141
###### [About MLIR debugging](https://mlir.llvm.org/getting_started/Debugging/)
175142

143+
##### (Optional) Flags for leveraging quicker builds
144+
145+
If you anticipate needing to frequently rebuild LLVM, append:
146+
147+
```shell
148+
\
149+
`# use clang`\
150+
-DCMAKE_C_COMPILER=clang \
151+
-DCMAKE_CXX_COMPILER=clang++ \
152+
`# use ccache to cache build results` \
153+
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
154+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
155+
`# use LLD to link in seconds, rather than minutes` \
156+
-DCMAKE_LINKER_TYPE=lld
157+
```
158+
159+
- This requires [the enablement mentioned earlier](#optional-enable-quicker-builds).
160+
- If these flags cause issues, just skip them for now.
161+
176162
##### (Optional) Flags for enabling end-to-end tests
177163

178164
To enable local end-to-end tests, append:

0 commit comments

Comments
 (0)