13 Commits

Author SHA1 Message Date
Connector Switch
c875bb8eef
[flang] Minor revision of the getting started guide. (#149632)
- C++17 is now the default, no need to specify explicitly.

b3c9ed151f/flang/CMakeLists.txt (L13)

- The current recommended way to set up OpenMP is as a runtime, not as a
project.

b3c9ed151f/llvm/CMakeLists.txt (L209-L214)
2025-07-19 13:41:07 +08:00
Michael Kruse
b55f7512a7
[Flang] LLVM_ENABLE_RUNTIMES=flang-rt (#110217)
Extract Flang's runtime library to use the LLVM_ENABLE_RUNTIME
mechanism. It will only become active when
`LLVM_ENABLE_RUNTIMES=flang-rt` is used, which also changes the
`FLANG_INCLUDE_RUNTIME` to `OFF` so the old runtime build rules do not
conflict. This also means that unless `LLVM_ENABLE_RUNTIMES=flang-rt` is
passed, nothing changes with the current build process.

Motivation:
* Consistency with LLVM's other runtime libraries (compiler-rt, libc,
libcxx, openmp offload, ...)
* Allows compiling the runtime for multiple targets at once using the
LLVM_RUNTIME_TARGETS configuration options
* Installs the runtime into the compiler's per-target resource directory
so it can be automatically found even when cross-compiling

Also see RFC discussion at
https://discourse.llvm.org/t/rfc-use-llvm-enable-runtimes-for-flangs-runtime/80826
2025-02-16 15:39:52 +01:00
Michael Kruse
5c8c2b3db5
[Flang] Rename libFortranRuntime.a to libflang_rt.runtime.a (#122341)
Following the conclusion of the
[RFC](https://discourse.llvm.org/t/rfc-names-for-flang-rt-libraries/84321),
rename Flang's runtime libraries as follows:

 * libFortranRuntime.(a|so) to libflang_rt.runtime.(a|so)
 * libFortranFloat128Math.a to libflang_rt.quadmath.a
* libCufRuntime_cuda_${CUDAToolkit_VERSION_MAJOR}.(a|so) to
libflang_rt.cuda_${CUDAToolkit_VERSION_MAJOR}.(a|so)

This follows the same naming scheme as Compiler-RT libraries
(`libclang_rt.${component}.(a|so)`). It provides some consistency
between Flang's runtime libraries for current and potential future
library components.
2025-02-08 18:02:54 +01:00
Slava Zakharin
25ebbe3851
[flang][doc] Added information about REAL(16) math intrinsics support. (#87710) 2024-04-05 12:14:55 -07:00
Leandro Lupori
7775375003 [flang][doc] Correct spelling of CMake 2024-01-10 09:28:11 -03:00
Leandro Lupori
205aa3fb89
[flang] Document DEFAULT_SYSROOT usage on Darwin (#77353) 2024-01-10 09:15:33 -03:00
Kiran Chandramohan
d7b8ea63b3
[Flang][Docs] Fix GettingStarted.md with correct depth for in-tree build section (#72268)
Just a minor fix for the section depth for the patch in
https://reviews.llvm.org/D155029.
2023-11-15 04:53:21 +00:00
Aiden Fox Ivey
7df9b0c5b3
Fix typos and formatting in GettingStarted.md (#68537)
Not too much to change here. Just found some issues with the flang
GettingStarted.md file and wanted to sort it out.
2023-10-21 10:48:33 +05:30
Pete Steinfeld
d0663005a8
[flang] Update instructions for a standalone flang build (#68361)
I added instructions for setting the environment variable ROOT_DIR.
2023-10-06 06:49:48 -07:00
cor3ntin
b7ff03206d
[Documentation] Replace recommonmark by myst-parser (#65664)
Recommonmark has been deprecated, then archived last year. This was
tracked by: https://github.com/llvm/llvm-iwg/issues/30

See https://github.com/readthedocs/recommonmark

This patch migrates all our doc to use myst

Additional details for bot maintainers: https://discourse.llvm.org/t/maintenance-required-on-sphinx-build-bots/73612
2023-09-25 14:02:39 +02:00
Slava Zakharin
9a53afd2c6 [flang][runtime] Support in-tree device build of Flang runtime.
I changed the set of files that are built for experimental CUDA/OMP
builds, i.e. the files with enabled device support are built
as such and the rest of the files are built just for the host target.
With this change we can build Flang runtime library that is fully functional
on the host target, so in-tree targets like check-flang become operational.

Reviewed By: klausler, PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D155029
2023-07-13 11:58:39 -07:00
Slava Zakharin
3212051c91 [RFC][flang] Experimental device build of Flang runtime.
These are initial changes to experiment with building the Fortran runtime
as a CUDA or OpenMP target offload library.

The initial patch defines a set of macros that have to be used consistently
in Flang runtime source code so that it can be built for different
offload devices using different programming models (CUDA, HIP, OpenMP target
offload). Currently supported modes are:
* CUDA: Flang runtime may be built as a fatlib for the host and a set
  of CUDA architectures specified during the build. The packaging
  of the device code is done by the CUDA toolchain and may differ
  from toolchan to toolchain.
* OpenMP offload:
  - host_device mode: Flang runtime may be built as a fatlib for the host
    and a set of OpenMP offload architectures. The packaging
    of the device code is done by the OpenMP offload compiler and may differ
    from compiler to compiler.

OpenMP offload 'nohost' mode is a TODO to match the build setup
of libomptarget/DeviceRTL. Flang runtime will be built as LLVM Bitcode
library using Clang/LLVM toolchain. The host part of the library
will be "empty", so there will be two distributable object: the host
Flang runtime and dummy host library with device Flang runtime pieces
packaged using clang-offload-packager and clang.

In all supported modes, enabling parts of Flang runtime for the device
compilation can be done iteratively to make the patches observable.
Note that at any point in time the resulting library may have unresolved
references to not yet enabled parts of Flang runtime.

Example cmake/make commands for building with Clang for NVPTX target:
cmake \
-DFLANG_EXPERIMENTAL_CUDA_RUNTIME=ON \
-DCMAKE_CUDA_ARCHITECTURES=80 \
-DCMAKE_C_COMPILER=/clang_nvptx/bin/clang \
-DCMAKE_CXX_COMPILER=/clang_nvptx/bin/clang++ \
-DCMAKE_CUDA_COMPILER=/clang_nvptx/bin/clang \
/llvm-project/flang/runtime/
make -j FortranRuntime

Example cmake/make commands for building with Clang OpenMP offload:
cmake \
-DFLANG_EXPERIMENTAL_OMP_OFFLOAD_BUILD="host_device" \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DFLANG_OMP_DEVICE_ARCHITECTURES="sm_80" \
../flang/runtime/
make -j FortranRuntime

Differential Revision: https://reviews.llvm.org/D151173
2023-06-27 17:38:01 -07:00
Shivam Gupta
85057c1b43 [Flang][Docs] Add a GettingStarted.md for build instructions
This patch fix first point of https://github.com/llvm/llvm-project/issues/60730.
https://flang.llvm.org/docs/ has no build instructions. This doc page is just
a copy of README page so that it can be accessible from website.

Differential Revision: https://reviews.llvm.org/D148070
2023-04-12 23:33:48 +05:30