hip-config only adds compile and link options to C++#2190
hip-config only adds compile and link options to C++#2190robertmaynard wants to merge 1 commit intoROCm:developfrom robertmaynard:cmake_hip_module_restrict_to_cxx
Conversation
|
Thanks this is affecting my AMD GPU port of the GENE fusion code, which is mixed Fortran and C++. |
Previous to these any target that has mixed languages ( C++ && Fortran ) would break as the HIP specific flags such as '-x hip' would be past to the Fortran compiler.
yxsamliu
left a comment
There was a problem hiding this comment.
LGTM. This is to limit some compile and link options to C++ files only. Since users may have Fortran programs. Without this fix, some options are applied to Fortran programs.
|
@yxsamliu @pfultz2 @aaronenyeshi is there a way to get this merged? This also affects ECP AMReX and its dependent application projects. |
| # Add support for __fp16 and _Float16, explicitly link with compiler-rt | ||
| set_property(TARGET hip::host APPEND PROPERTY | ||
| INTERFACE_LINK_LIBRARIES -L${HIP_CLANG_INCLUDE_PATH}/../lib/linux -lclang_rt.builtins-x86_64 | ||
| INTERFACE_LINK_LIBRARIES "$<$<LINK_LANGUAGE:CXX>:${HIP_CLANG_INCLUDE_PATH}/lib/linux/libclang_rt.builtins-x86_64.a>" |
There was a problem hiding this comment.
Doesn't this need to be ${HIP_CLANG_INCLUDE_PATH}/../lib and not ${HIP_CLANG_INCLUDE_PATH}/lib?
There was a problem hiding this comment.
@TomSang Are you able to make this change to the PR before merging?
There was a problem hiding this comment.
ping @TomSang
this is a blocker for a set of Exascale apps for OLCF's Spock/Frontier.
There was a problem hiding this comment.
I'm working on this. But maybe I need you help test after it's done.
There was a problem hiding this comment.
Sounds great, we could share code on ECP Tulip or OLCF Spock, if you have access to that.
(Or you could give me instructions how to install this stack manually.)
Alternatively, we can write a small reproducer for a C++/Fortran project.
There was a problem hiding this comment.
I cannot fix the issue under Robert account, so I created #2280 to cover the fix .
You may install the stack in terms of https://github.com/ROCm-Developer-Tools/HIP.
There was a problem hiding this comment.
Hi @TomSang, I created a reproducer for you under
https://github.com/ax3l/hip_cxxf_cmake
Simply build with:
CXX=$(which clang++) FC=$(which gfortran) cmake -S . -B build
cmake --build build
The error that you see is:
gfortran: error: unrecognized command line option ‘-mllvm’
clang-12: warning: argument unused during compilation: '-amdgpu-function-calls=false' [-Wunused-command-line-argument]
gfortran: error: unrecognized command line option ‘-amdgpu-early-inline-all=true’
gfortran: error: unrecognized command line option ‘-amdgpu-function-calls=false’
gfortran: error: unrecognized command line option ‘--offload-arch=gfx900’; did you mean ‘--offload-abi=ilp32’?
gfortran: error: unrecognized command line option ‘--offload-arch=gfx906’; did you mean ‘--offload-abi=ilp32’?
gfortran: error: unrecognized command line option ‘--offload-arch=gfx908’; did you mean ‘--offload-abi=ilp32’?
That will likely be way faster than me pulling the stack.
## Summary By now (HIP 4.5), we should be able to link also against Fortran targets. Let's remove work-arounds and ditch old HIP releases, so improve maintainability and avoid surprises. ## Additional background X-ref: - ROCm/hip#2280 (ROCm/hip#2190) - ROCm/hip#2275
Previous to these any target that has mixed languages ( C++ && Fortran )
would break as the HIP specific flags such as '-x hip' would be past
to the Fortran compiler.