-
Notifications
You must be signed in to change notification settings - Fork 65
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
830 compilation with clang #831
base: main
Are you sure you want to change the base?
Conversation
I think these are unwanted whitespace changes in RewriteToCallKernelOpPass.cpp? I'm not sure which editor you use but the |
IMO the changes should be squashed into a single commit. I think the C++20 commit should be a separate commit/PR outside of this PR and merged before if necessary for |
I noticed the file with the big formatting changes and thought that was due to clang-format kicking in. But I didn't check tbh. I'm using CLion. |
The commits are on the same topic but tackle distinct problems. As I read frequently in reviews to separate this and that into separate commits I thought this is the right thing to do here. |
Maybe it's not been automatically enabled by CLion? |
The C++20 change is in a separate commit for the same reason. Can be cherry picked to main before handling the PR if you want ;-) |
That's what I thought would happen if the .clang-format file is there 🤔 |
FYI: I've formatted the code with |
634c25a
to
aadab8b
Compare
aadab8b
to
d286eff
Compare
This commit enables compiling DAPHNE with Clang (tested version 18.1.3 from Ubuntu 24 LTS). Below is the collected change log of the pre-squash commits: [DAPHNE-daphne-eu#830] Fix duplicate symbol linker issue Compiling with Clang/LLD complains about duplicate symbols of supportsUnaryOp and supportsBinaryOp. The definition of supportsBinaryOp would need to be declared static if left i the BinaryOpCode.h header which is included in several places. Since this definition is not allowed and there is only one use, it is moved to its own file. [DAPHNE-daphne-eu#830] Replace lambda function using invalid C++ with local static template function std::pair<bool, auto> was used as a convenience function in DaphneDSLVisitor.cpp. According to [1] this is invalid and only works with GCC. Replacing it with a templated local function makes Clang compile it too. Further improvements to this file will be considered in future commit. [1] https://stackoverflow.com/questions/59578575/stdpairauto-auto-return-type [DAPHNE-daphne-eu#830] Fix anonymous namespace issue when compiling with Clang When compiling with clang, there is a issue at runtime (LLVM complaining about anonymous namespaces not allowed in various places). These are hereby replaced with a non-anonymous namespace. For the lack of creativity these are all called "file_local". [DAPHNE-daphne-eu#830] Fix compilation error (with clang) in json dependency The use of EOF in our json dependency makes compilation fail with Clang. Patch is based on nlohmannjson version 3.11.3 [DAPHNE-daphne-eu#830] Silence warning when using LLD With this new CMake configuration, we silence a lot of warnings when using the LLD linker in combination with clang: ``clang++: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]`` A CMake version bump to 3.29 is necessary for this config option. Ubuntu 24 users need to switch to the snap version of CMake. The Docker images already provide CMake 3.30 [DAPHNE-daphne-eu#830] Clang option for build.sh This commit adds the convenience option to build with Clang to the build.sh script Resolves daphne-eu#830, Closes daphne-eu#831
d286eff
to
f2f983c
Compare
This commit enables compiling DAPHNE with Clang (tested version 18.1.3 from Ubuntu 24 LTS). Below is the collected change log of the pre-squash commits: [DAPHNE-daphne-eu#830] Fix duplicate symbol linker issue Compiling with Clang/LLD complains about duplicate symbols of supportsUnaryOp and supportsBinaryOp. The definition of supportsBinaryOp would need to be declared static if left i the BinaryOpCode.h header which is included in several places. Since this definition is not allowed and there is only one use, it is moved to its own file. [DAPHNE-daphne-eu#830] Replace lambda function using invalid C++ with local static template function std::pair<bool, auto> was used as a convenience function in DaphneDSLVisitor.cpp. According to [1] this is invalid and only works with GCC. Replacing it with a templated local function makes Clang compile it too. Further improvements to this file will be considered in future commit. [1] https://stackoverflow.com/questions/59578575/stdpairauto-auto-return-type [DAPHNE-daphne-eu#830] Fix anonymous namespace issue when compiling with Clang When compiling with clang, there is a issue at runtime (LLVM complaining about anonymous namespaces not allowed in various places). These are hereby replaced with a non-anonymous namespace. For the lack of creativity these are all called "file_local". [DAPHNE-daphne-eu#830] Fix compilation error (with clang) in json dependency The use of EOF in our json dependency makes compilation fail with Clang. Patch is based on nlohmannjson version 3.11.3 [DAPHNE-daphne-eu#830] Silence warning when using LLD With this new CMake configuration, we silence a lot of warnings when using the LLD linker in combination with clang: ``clang++: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]`` A CMake version bump to 3.29 is necessary for this config option. Ubuntu 24 users need to switch to the snap version of CMake. The Docker images already provide CMake 3.30 [DAPHNE-daphne-eu#830] Clang option for build.sh This commit adds the convenience option to build with Clang to the build.sh script Resolves daphne-eu#830, Closes daphne-eu#831
f2f983c
to
5a16ecc
Compare
Thanks for this patch @corepointer . Few questions:
|
👍
Version 18.1.3 - mentioned in the commit message ☝️
Tons of warnings. Besides numerous from our code(which I started to fix here and there in minor commits), there are quite many originating from our LLVM/MLIR snapshot and from the JSON library we use.
No, you need to remove the current build files (either |
The commits contained in this PR fix compilation with Clang (tested version 18) and also the LLVM runtime issues with anonymous name spaces.
I tried to form the commits per problem, although they are related to the same issue, so squashing them might be inappropriate imho 🤔
ToDo: