-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
[Flang] LLVM_ENABLE_RUNTIMES=flang-rt #110217
base: users/meinersbur/flang_runtime_move-files
Are you sure you want to change the base?
[Flang] LLVM_ENABLE_RUNTIMES=flang-rt #110217
Conversation
You can test this locally with the following command:darker --check --diff -r d65a4bcf0d76932e2f6078a7fc7db6ab922fd3fb...02b4731a1b8e02ed600cfb4ba523af836c98e3e8 flang-rt/test/NonGtestUnit/lit.cfg.py flang-rt/test/Unit/lit.cfg.py flang-rt/test/lit.cfg.py flang/test/lit.cfg.py View the diff from darker here.--- flang-rt/test/lit.cfg.py 2025-01-02 15:54:24.000000 +0000
+++ flang-rt/test/lit.cfg.py 2025-01-02 18:07:01.586322 +0000
@@ -78,23 +78,21 @@
"%clang",
command=FindTool("clang"),
extra_args=isysroot_flag,
unresolved="fatal",
),
- ToolSubst("%cc",
- command=config.cc,
- extra_args=isysroot_flag,
- unresolved="fatal"
- ),
+ ToolSubst("%cc", command=config.cc, extra_args=isysroot_flag, unresolved="fatal"),
]
llvm_config.add_tool_substitutions(tools)
# Let tests find LLVM's standard tools (FileCheck, split-file, not, ...)
llvm_config.with_environment("PATH", config.llvm_tools_dir, append_path=True)
# Include path for C headers that define Flang's Fortran ABI.
-config.substitutions.append(("%include", os.path.join(config.flang_source_dir, "include")))
+config.substitutions.append(
+ ("%include", os.path.join(config.flang_source_dir, "include"))
+)
# Library path of libflang_rt.a (for lib search path when using non-Flang driver for linking)
config.substitutions.append(("%libdir", config.flang_rt_output_resource_lib_dir))
# Additional library depedendencies the that Flang driver does not add itself.
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
I reverted the change that moved flowchart TB
subgraph Flang
direction TB
flang-new
check-flang
end
subgraph FortranRuntime
direction TB
iso_fortran_env_impl("iso_fortran_env_impl.f90")
lib("libFortranRuntime.a")
module_files
check-FortranRuntime
end
flang-new --> iso_fortran_env_impl --> lib --> check-FortranRuntime
flang-new --> module_files --> check-flang
flang-new --> check-flang
flang-new --> check-FortranRuntime
Except the PPC modules, the mod files are not target-specific and hence would not profit from compiling multiple targets from a bootstrap build anyway. However, they are products of the Flang compiler and therefore IMHO logically fits better to the runtime. Also, it would have been nice to make use of CMake's dependency resolution rather than hardcoding Into the CMakeLists.txt. I think it is best to keep that decision out of the current patch. |
Due to missing lit.cfg, will only be executing again after #110217.
) | ||
|
||
enable_cuda_compilation(FortranRuntime "${supported_files}") | ||
enable_omp_offload_compilation("${supported_files}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just removed or moved somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had expected that I moved those to add_fortranruntime_library
but apparently I didn't. I re-added it with the latest push, including some build fixes since it doesn't even work with the trunk version. Even flang-new
doesn't compile with the error:
ld.lld: error: undefined symbol: __cudaRegisterLinkedBinary_9067bd07_21_binary_to_decimal_cpp_c17d0b68
>>> referenced by tmpxft_00002a72_00000000-6_binary-to-decimal.cudafe1.cpp
>>> binary-to-decimal.cpp.o:(__sti____cudaRegisterAll()) in archive lib/libFortranDecimal.a
This is because libFortranDecimal is compiled as CUDA source (but not libFortranCommon) and needed for flang-new
. libFortranDecimal for FortranRuntime and Flang should really be compiled independently of each other, as this PR does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this CUDA build actually used? I'm interested in removing it if possible and just building this on top of my other GPU libraries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have plan to use it in CUDA Fortran implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that going to be supported upstream? clang
is a CUDA compiler so flang
can be as well, but since offloading in flang
is already using my driver code (AFAIK) it might be easier to just make it common.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it 's gonna be supported upstream. We are actively working on all the pieces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, any changes I make probably won't impact this since it'll be a separate build. But I would greatly prefer if we stop having many different ways of doing things in the LLVM offloading space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the global setting of flags is the last comment I have from the perspective of "integration with the runtimes build". I haven't reviewed anything else inside flang-rt/
though.
I tested this locally and it appears that it requires are more modern CMake version than what was installed ( |
Overall I think the patch is fine pending some naming nits, my one concern is the |
edit: My -DLLVM_DIR was incorrect, never mind. |
Introduce cuf.sync_descriptor to be used to sync device global descriptor after pointer association. Also move CUFCommon so it can be used in FIRBuilder lib as well.
Convert the op to a new entry point in the runtime `CUFSyncGlobalDescriptor`
#121292) This extension adds 12 instructions that conditionally load an immediate value. The current spec can be found at: https://github.com/quic/riscv-unified-db/releases/latest This patch adds assembler only support.
R_RISCV_{ADD*/SUB*} relocations are kept only when feature relax enabled. So it is better to add relax to the test, so that relocs can be reserved for processing by the jitlink. That's what this test really wants to test.
Change the global variable reference to a member access of another variable `ctx`. In the future, we may pass through `ctx` to functions to eliminate global variables. Pull Request: #119835
Failed buildbot after #121524
Reverts #120864 because it broke building compiler-rt on Mac. https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-mac-arm64/b8726812736235038609/overview
Fix #88650 In addition, delete the unneeded comment. https://sourceware.org/gnu-gabi/program-loading-and-dynamic-linking.txt
The commit 22b7b84 made the symbols provided by shared libraries "defined", and thus effectively made it impossible to generate non-pie dynamically linked executables using --unresolved-symbols=import-dynamic. This commit, based on #109249, fixes it by checking sym->isShared() explictly. (as a bonus, you don't need to rely on --unresolved-symbols=import-dynamic anymore.) Fixes #107387
Code sequence for tls-desc in large code model is not expected to be scheduled according to psABI 2.30. A later commit will fix it.
This ensures these classes are visible only to the appropriate translation unit and allows for more optimizations.
The debug section map was using MachO section names (with the "__" prefix), but DWARFContext expects section names with the object format prefix stripped off. This was preventing DWARFContext from accessing the debug_str section, resulting in bogus source name strings.
It wraps the body of namespace with additional newlines, turning this code: ``` namespace N { int function(); } ``` into the following: ``` namespace N { int function(); } ``` --------- Co-authored-by: Owen Pan <owenpiano@gmail.com>
This optimization was introduced by #70469. Like AArch64, we allow tail expansions for 3 on RV32 and 3/5/6 on RV64. This can simplify the comparison and reduce the number of blocks.
Similar to a9e75b1: During MachOPlatform bootstrap we need to defer actions until essential platform functionality has been loaded, but the platform itself may be loaded under a concurrent dispatcher so we have to guard against the deferred actions vector being accessed concurrently. This fixes a probablistic failure in the ORC runtime regression tests on Darwin/x86-64 that was spotted after edca1d9 (which turned on concurrent linking by default in llvm-jitlink).
The gcov version is set to 11.1 (compatible with gcov 9) even if `-Xclang -coverage-version=` specified version is less than 11.1. Therefore, we can drop producer support for version < 11.1.
`RegisterClassInfo::getRegPressureSetLimit` is a wrapper of `TargetRegisterInfo::getRegPressureSetLimit` with some logics to adjust the limit by removing reserved registers. It seems that we shouldn't use `TargetRegisterInfo::getRegPressureSetLimit` directly, just like the comment "This limit must be adjusted dynamically for reserved registers" said. Separate from #118787
All the sources of `llvm-min-tblgen` are also used for `llvm-tblgen`, with identical compilation flags. Reuse the object files of `llvm-min-tblgen` for `llvm-tblgen` by applying the usual source structure of an executable: One file per executable which named after the executable name containing the (in this case trivial) main function, which just calls the tblgen_main in TableGen.cpp. This should also clear up any confusion (including mine) of where each executable's main function is. While this slightly reduces build time, the main motivation is ccache. Using the hard_link option, building the object files for `llvm-tblgen` will result in a hard link to the same object file already used for `llvm-min-tblgen`. To signal the build system that the file is new, ccache will update the file's time stamp. Unfortunately, time stamps are shared between all hard-linked files s.t. this will indirectly also update the time stamps for the object files used for `llvm-tblgen`. At the next run, Ninja will recognize this time stamp discrepancy to the expected stamp recorded in `.ninja_log` and rebuild those object files for `llvm-min-tblgen`, which again will also update the stamp for the `llvm-tblgen`... . This is especially annoying for tablegen because it means Ninja will re-run all tablegenning in every build. I am using the hard_link option because it reduces the cost of having multiple build-trees of the LLVM sources and reduces the wear to the SSD they are stored on.
…s/meinersbur/flang_runtime
Extract Flang's runtime library to use the LLVM_ENABLE_RUNTIME mechanism.
Motivation:
Potential future directions:
libomp.mod
when openmp is availableREAL(16)
supportSee RFC discussion at https://discourse.llvm.org/t/rfc-use-llvm-enable-runtimes-for-flangs-runtime/80826
Patch series:
Patch for lab.llvm.org buildbots: