-
Notifications
You must be signed in to change notification settings - Fork 643
0_RootFS: Build LLVM with flang #10502
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
Open
eschnett
wants to merge
2
commits into
JuliaPackaging:master
Choose a base branch
from
eschnett:eschnett/rootfs-llvm-flang
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
IMO we shouldn't be building this flang frontend before LLVM 20. Before then,
flangmeant the classic flang, and theflang-newfrontend was only renamed toflangin LLVM 20. At that point is when upstream LLVM felt it was ready to be used publicly outside of the development effort.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.
Building
flangfor LLVM 18 means buildingflang-new, which is what we want. I've been using it, and I think it's ready for us to experiment.I'm not suggesting that we should switch to using
flanginstead ofgfortranright away. That switch-over will need to be well thought-out. I'm saying flang is ready for us to experiment, and without building it we cannot.Uh oh!
There was an error while loading. Please reload this page.
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 wasn't suggesting switching from gfortran (flang only pass 80% of the gfortran tests, doesn't have complete support for Fortran 2008+ features, and also doesn't support OpenMP standards above 2.5-ish right now). I was more saying that according to LLVM upstream, they didn't see flang as being suitable for users before LLVM 20 (the rename occurred because they decided it was suitable for wider testing/use now).
Additionally, I think there are still some issues/loose-ends to be worked out upstream with how they handle flang being used as a cross-compiler. For instance, a common theme I have been reading on the LLVM discourse board is that the Fortran runtime is still a bit too closely coupled to the OS/arch that the compiler was built on. There is work to reduce that coupling and make it more suitable for cross-compilation (e.g., https://discourse.llvm.org/t/buildbot-changes-with-llvm-enable-runtimes-flang-rt/83571), but I don't know if that will make it into LLVM 20. So actually, it looks like we will need to do some additional processing to handle the fortran runtime here - which might be a bit cumbersome right now.
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, last time I looked at flang (but that was a few years ago) my understanding was that it statically links a runtime (contrary to gfortran which dynamically links libgfortran), but as I said above we don't have the runtime libraries for llvm-based compilers (there should be an issue somewhere opened by Valentin about this).
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 looks like it does statically link the runtime (there is a reference to
libFortranRuntime.ain https://discourse.llvm.org/t/rfc-use-llvm-enable-runtimes-for-flangs-runtime/80826). It also looks like some bootstrapping might be needed to actually build the Fortran runtime.Don't we already have the Clang ones? I thought that was in the
LLVMCompilerRTpackage (which apparently hasn't been rebuilt since LLVM 17 though).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, but as external packages, not as full part of the compiler toolchain (CompilerSupportLibraries_jll is a runtime package only, the GCC toolchains we use come with their own proper runtime libraries used during compilation, and we carefully make sure to use those during build rather than the CSL ones)
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.
Here is more discussion about cross-compilation not working, this time for the intrinsic modules that are provided with the compiler: https://discourse.llvm.org/t/rfc-building-flangs-builtin-mod-files/84626 (it also discusses the interplay with the openmp target). So I think that upstream really needs to fix all the cross-compilation stuff before we can reliably start packaging flang in a usable state in Ygg.
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.
Ah, it wasn't an issue but a PR, that's why I couldn't find it before: #1681