[flang][runtime] compilation error on the flang-rt for cuda
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
I'm facing problems with compiling the flang-rt for cuda.
I'm working on version 21.1.2, though the most recent commit had the same problems.
I'm working based on the instructions here [https://flang.llvm.org/docs/GettingStarted.html#cuda-build](url) and building "out of tree" (though building "in tree" had the same error messages). building clang and flang went without errors, as did building the flang-rt for cpus, but the cuda version gives me errors such as:
```
/work/nircoh/libraries_for_parsec/llvm/source/llvm-project-21.1.2.src/flang-rt/lib/runtime/matmul-transpose.cpp:345:83: error:
expected '>'
345 | return DoMatmulTranspose< IS_ALLOCATING, {GetResultType(XCAT, XKIND, YCAT, YKIND)}->first, {GetResultType(XCAT, XKIND, YCAT...
| ^
/work/nircoh/libraries_for_parsec/llvm/source/llvm-project-21.1.2.src/flang-rt/lib/runtime/matmul-transpose.cpp:345:25: note:
to match this '<'
345 | return DoMatmulTranspose< IS_ALLOCATING, {GetResultType(XCAT, XKIND, YCAT, YKIND)}->first, {GetResultType(XCAT, XKIND, YCAT...
| ^
1 error generated.
make[3]: *** [flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/build.make:545: flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/matmul-transpose.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
/work/nircoh/libraries_for_parsec/llvm/source/llvm-project-21.1.2.src/flang-rt/lib/runtime/matmul.cpp:445:74: error:
expected '>'
445 | return DoMatmul< IS_ALLOCATING, {GetResultType(XCAT, XKIND, YCAT, YKIND)}->first, {GetResultType(XCAT, XKIND, YCAT, YKIND)}...
| ^
/work/nircoh/libraries_for_parsec/llvm/source/llvm-project-21.1.2.src/flang-rt/lib/runtime/matmul.cpp:445:16: note:
to match this '<'
445 | return DoMatmul< IS_ALLOCATING, {GetResultType(XCAT, XKIND, YCAT, YKIND)}->first, {GetResultType(XCAT, XKIND, YCAT, YKIND)}...
| ^
1 error generated.
```
in the matmul.cpp and matmul-transpose.cpp files under flang-rt/lib/runtime/
I've tried also using clang as the cuda compiler, but it errors because of host function beign called by host/device functions, which i wasn't able to find the flag to turn off (unlike in nvcc).
Any advice or useful stuff to try?
Additional info:
My cuda toolkit is 12.6, and when using nvcc I've disabled the warning about a host compiler mismatch from nvidia, as the needed flang+cuda support doesn't exist in llvm 18, which is the most up to date version nvidia says is supported.
This is all being done on my university cluster, which runs redhat linux.
Contributor guide
Research direction
Start with the Flang CUDA build instructions linked in the issue and reproduce the failure in flang-rt/lib/runtime/matmul.cpp and matmul-transpose.cpp. Compare the CUDA compiler configuration with the reported CUDA 12.6 environment and investigate the template parsing and host/device diagnostics. Done means the CUDA flang runtime builds successfully from an out-of-tree configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100