6
6
7
7
-->
8
8
9
- # Fortran Runtime (flang-rt )
9
+ # Fortran Runtime (Flang-RT )
10
10
11
- Flang-rt is the runtime library for code emitted by the Flang compiler
11
+ Flang-RT is the runtime library for code emitted by the Flang compiler
12
12
(https://flang.llvm.org ).
13
13
14
14
15
15
## Getting Started
16
16
17
- There are two build modes for the flang-rt . The bootstrap build, also
17
+ There are two build modes for the Flang-RT . The bootstrap build, also
18
18
called the in-tree build, and the runtime-only build, also called the
19
19
out-of-tree build.
20
20
Not to be confused with the terms
@@ -34,31 +34,31 @@ Requirements:
34
34
### Bootstrap/In-Tree Build
35
35
36
36
The bootstrap build will first build Clang and Flang, then use these compilers
37
- to compile flang-rt . CMake will create a secondary build tree in
38
- configured with these just-built compilers. The secondary build will reuse the
39
- same build options (Flags, Debug/Release, ...) as the primary build. It will
40
- also ensure that once built, flang-rt is found by Flang from either
37
+ to compile Flang-RT . CMake will create a secondary build tree
38
+ configured to use these just-built compilers. The secondary build will reuse
39
+ the same build options (Flags, Debug/Release, ...) as the primary build.
40
+ It will also ensure that once built, Flang-RT is found by Flang from either
41
41
the build- or install-prefix. To enable, add ` flang-rt ` to
42
42
` LLVM_ENABLE_RUNTIMES ` :
43
43
44
44
``` bash
45
- cmake -S < path-to-llvm-project> /llvm \
46
- -DNinja \
47
- -DLLVM_ENABLE_PROJECTS=flang \
48
- -DLLVM_ENABLE_RUNTIMES=flang-rt \
45
+ cmake -S < path-to-llvm-project-source > /llvm \
46
+ -GNinja \
47
+ -DLLVM_ENABLE_PROJECTS=" clang; flang" \
48
+ -DLLVM_ENABLE_RUNTIMES=flang-rt \
49
49
...
50
50
```
51
51
52
- It is recommended to enable building OpenMP alongside Flang and flang-rt
52
+ It is recommended to enable building OpenMP alongside Flang and Flang-RT
53
53
as well. This will build ` omp_lib.mod ` required to use OpenMP from Fortran.
54
54
Building Compiler-RT may also be required, particularly on platforms that do
55
55
not provide all C-ABI functionality (such as Windows).
56
56
57
57
``` bash
58
- cmake -S < path-to-llvm-project> /llvm \
59
- -DNinja \
60
- -DCMAKE_BUILD_TYPE=Release \
61
- -DLLVM_ENABLE_PROJECTS=" flang;openmp" \
58
+ cmake -S < path-to-llvm-project-source > /llvm \
59
+ -GNinja \
60
+ -DCMAKE_BUILD_TYPE=Release \
61
+ -DLLVM_ENABLE_PROJECTS=" clang; flang;openmp" \
62
62
-DLLVM_ENABLE_RUNTIMES=" compiler-rt;flang-rt" \
63
63
...
64
64
```
@@ -85,16 +85,16 @@ CMake's environment introspection to find a C, C++, and Fortran compiler. The
85
85
compiler to be used can be controlled using CMake's standard mechanisms such as
86
86
` CMAKE_CXX_COMPILER ` , ` CMAKE_CXX_COMPILER ` , and ` CMAKE_Fortran_COMPILER ` .
87
87
` CMAKE_Fortran_COMPILER ` must be ` flang ` built from the same Git commit as
88
- flang-rt to ensure they are using the same ABI. The C and C++ compiler
88
+ Flang-RT to ensure they are using the same ABI. The C and C++ compiler
89
89
can be any compiler supporting the same ABI.
90
90
91
91
In addition to the compiler, the build be able to find LLVM development tools
92
- such as ` lit ` and ` FileCheck ` that are not found in an LLVM's install directory.
93
- Use ` CMAKE_BINARY_DIR ` to point to directory where LLVM has been built.
94
- A simple build configuration might look like the following:
92
+ such as ` lit ` and ` FileCheck ` that are not found in an LLVM's install
93
+ directory. Use ` CMAKE_BINARY_DIR ` to point to directory where LLVM has
94
+ been built. A simple build configuration might look like the following:
95
95
96
96
``` bash
97
- cmake -S < path-to-llvm-project> /runtimes \
97
+ cmake -S < path-to-llvm-project-source > /runtimes \
98
98
-GNinja \
99
99
-DLLVM_BINARY_DIR=< path-to-llvm-builddir> \
100
100
-DCMAKE_Fortran_COMPILER=< path-to-llvm-builddir> /bin/flang \
@@ -107,16 +107,16 @@ The `CMAKE_Fortran_COMPILER_WORKS` parameter must be set because otherwise CMake
107
107
will test whether the Fortran compiler can compile and link programs which will
108
108
obviously fail without a runtime library available yet.
109
109
110
- Building flang-rt for cross-compilation triple, the target triple can
110
+ Building Flang-RT for cross-compilation triple, the target triple can
111
111
be selected using ` LLVM_DEFAULT_TARGET_TRIPLE ` AND ` LLVM_RUNTIMES_TARGET ` .
112
- Of course, flang-rt can be built multiple times with different build
112
+ Of course, Flang-RT can be built multiple times with different build
113
113
configurations, but have to be located manually when using with the Flang
114
114
driver using the ` -L ` option.
115
115
116
116
A more complete build configuration could be the following:
117
117
118
118
``` bash
119
- cmake -S < path-to-llvm-project> /runtimes \
119
+ cmake -S < path-to-llvm-project-source > /runtimes \
120
120
-GNinja \
121
121
-DCMAKE_BUILD_TYPE=Release \
122
122
-DCMAKE_INSTALL_PREFIX=" ${HOME} /local" \
@@ -134,7 +134,7 @@ cmake -S <path-to-llvm-project>/runtimes \
134
134
135
135
## Configuration Option Reference
136
136
137
- Flang-rt has the followign configuration options. This is in
137
+ Flang-RT has the followign configuration options. This is in
138
138
addition to the build options the LLVM_ENABLE_RUNTIMES mechanism and
139
139
CMake itself provide.
140
140
@@ -153,11 +153,11 @@ CMake itself provide.
153
153
154
154
* ` FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT ` (values: ` "CUDA" ` ,` "OpenMP" ` , ` "" ` default: ` "" ` )
155
155
156
- When set to ` CUDA ` , builds flang-rt with experimental support for GPU
156
+ When set to ` CUDA ` , builds Flang-RT with experimental support for GPU
157
157
accelerators using CUDA. ` CMAKE_CUDA_COMPILER ` must be set if not
158
158
automatically detected by CMake. ` nvcc ` as well as ` clang ` are supported.
159
159
160
- When set to ` OpenMP ` , builds flang-rt with experimental support for
160
+ When set to ` OpenMP ` , builds Flang-RT with experimental support for
161
161
GPU accelerators using OpenMP offloading. Only Clang is supported for
162
162
` CMAKE_C_COMPILER ` and ` CMAKE_CXX_COMPILER ` .
163
163
@@ -170,7 +170,7 @@ CMake itself provide.
170
170
(no ` CMAKE_CUDA_COMPILER ` ).
171
171
172
172
173
- ### CUDA Support
173
+ ### Exprimental CUDA Support
174
174
175
175
With ` -DFLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT=CUDA ` , the following
176
176
additional configuration options become available.
@@ -186,13 +186,13 @@ additional configuration options become available.
186
186
default.
187
187
188
188
189
- ### OpenMP Offload Support
189
+ ### Exprimental OpenMP Offload Support
190
190
191
191
With ` -DFLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT=OpenMP ` , the following
192
192
additional configuration options become available.
193
193
194
194
* ` FLANG_RT_DEVICE_ARCHITECTURES ` (default: ` "all" ` )
195
195
196
- A list of device architectures that flang-rt is supporting .
196
+ A list of device architectures that Flang-RT is going to support .
197
197
If ` "all" ` uses a pre-defined list of architectures. Same purpose as
198
198
` LIBOMPTARGET_DEVICE_ARCHITECTURES ` from liboffload.
0 commit comments