Skip to content

[flang][runtime] compilation error on the flang-rt for cuda #160534

@Nir-Cohen-2003

Description

@Nir-Cohen-2003

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 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions