-
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
Extract Flang's runtime library to use the LLVM_ENABLE_RUNTIME mechanism.
…einersbur/flang_runtime
Move modules back to flang Fix check-flang Build fixes and cleanup Test fix Solve mscrt lib choice clang_rt.builtins workaround via CMAake clang_rt.builtins workaround via Clang Revert "clang_rt.builtins workaround via Clang" This reverts commit 2678d0c9a0ca86cfada9351d3328119388a35609. Fix search for libclang_rt.builtins move magic-numbers.h to common files
You can test this locally with the following command:darker --check --diff -r b58bd1ffc06f04755e7611f1f160bcf4d1d21bce...4b65d4bda6c1020928bab6c001924204d5920d70 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-10 01:11:38.647483 +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. |
…einersbur/flang_runtime
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.
Created #122152 I don't expect anything come out of it, I think moving to |
…einersbur/flang_runtime
If If |
Not used by compiler-rt either
e92a529
to
301af7f
Compare
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.
saw some minor merge damage
…einersbur/flang_runtime
…einersbur/flang_runtime
…einersbur/flang_runtime
Both I then tried shifting
I don't mind patching clang/flang/whatever for that to be the case, but I'd really like to avoid rebuilding |
…einersbur/flang_runtime
We are mixing up the Windows issue of finding the right Windows name of clang_rt.builtins
It also needs to be built, i.e.
Can you confirm that it is there?
I don't get your setup. Why is it compiling libcxx if it is not in LLVM_ENABLE_RUNTIMES? How are you using GCC on Windows? According to https://llvm.org/docs/GettingStarted.html, LLVM does not support being built on Windows using GCC.
This should do it (untested): diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 9f174fbda398..b77cbb72e7ec 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -773,7 +773,7 @@ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
buildCompilerRTBasename(Args, Component, Type, /*AddArch=*/true);
SmallString<128> OldPath(getCompilerRTPath());
llvm::sys::path::append(OldPath, CRTBasename);
- if (Path.empty() || getVFS().exists(OldPath))
+ if (Path.empty() || getVFS().exists(OldPath) || getTriple().isWindowsMSVCEnvironment())
return std::string(OldPath);
// If none is found, use a file name from the new layout, which may get Non-Windows install location of libflang_rt.a
I have no idea what could be going on. Would you mind adding some printf so I can see the result?
|
# for all files of Flang-RT. | ||
if (EXISTS "${FLANG_RT_LIBCUDACXX_PATH}/include") | ||
target_include_directories(obj.${name}PTX AFTER PRIVATE "${FLANG_RT_LIBCUDACXX_PATH}/include") | ||
target_compile_definitions(obj.${name}PTX PRIVATE RT_USE_LIBCUDACXX=1) |
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.
Also need:
target_include_directories(${name} AFTER PRIVATE "${FLANG_RT_LIBCUDACXX_PATH}/include")
target_compile_definitions(${name} PRIVATE RT_USE_LIBCUDACXX=1)
Because the flang_rt.a library itself is also built with CUDA.
Sorry for not catching it earlier, I missed the build warnings from this and only caught this while doing some end to end.
#===------------------------------------------------------------------------===# | ||
|
||
|
||
add_flangrt_library(CufRuntime STATIC |
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.
Why the change to STATIC only here?
We also currently build and test the share version in our current CUDA Fortran feature development (@clementval).
Can you add SHARED in #121782?
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: