Skip to content
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

hipcc compiler doesn't accept arguments to LLVM plugin for .cpp files, but it does for .c files #2561

Closed
sameershende opened this issue Mar 17, 2022 · 8 comments
Assignees

Comments

@sameershende
Copy link

sameershende commented Mar 17, 2022

In ROCm 5.0.2 (and earlier versions), the hipcc script gives an error while passing an argument to an LLVM plugin (loaded using the legacy pass manger) to a C++ file. The exact same command works for C files. Here is an example with the TAU Performance System passing a selective instrumentation file with exclude/include list of functions to a compiler-based instrumentation plugin for LLVM using the -flegacy-pass-manager compiler option:

sameer@:~/tau2/examples/mm> /opt/rocm-5.0.2/bin/hipcc -c matmult.c -g -DPROFILING_ON -DTAU_DOT_H_LESS_HEADERS -fPIC -DTAU_MPI -DTAU_UNIFY -DTAU_MPI_THREADED -DTAU_LINUX_TIMERS -DTAU_MPIGREQUEST -DTAU_MPIDATAREP -DTAU_MPIERRHANDLER -DTAU_CRAYCNL -DTAU_AT_FORK -DTAU_MPICONSTCHAR -DTAU_MPIATTRFUNCTION -DTAU_MPITYPEEX -DTAU_MPIADDERROR -DTAU_LARGEFILE -D_LARGEFILE64_SOURCE -DTAU_BFD -DTAU_MPIFILE -DHAVE_GNU_DEMANGLE -DHAVE_TR1_HASH_MAP -DTAU_SS_ALLOC_SUPPORT -DEBS_CLOCK_RES=1 -DTAU_STRSIGNAL_OK -DTAU_TRACK_LD_LOADER -DTAU_MPICH3 -DTAU_MPI_EXTENSIONS -DTAU_SUPPRESS_PTHREAD_CREATE_WRAPPER -DTAU_ELF_BFD -I/ccs/home/sameer/tau2/include -I/opt/cray/pe/mpich/8.1.12/ofi/amd/4.4/include -g -flegacy-pass-manager -fplugin=/ccs/home/sameer/tau2/craycnl/lib/shared-amd-clang-mpi/plugins/lib/TAU_Profiling_CXX.so -mllvm -tau-input-file=s.tau -o matmult.o 
Included functions: 
Include function: main
Include function: compute_interchange
Instrument compute_interchange
Adding instrumentation in compute_interchange
Instrument main
Adding instrumentation in main
	main function: adding init
sameer@crusher134:~/tau2/examples/mm> cat s.tau
BEGIN_INCLUDE_LIST
main
compute_interchange
END_INCLUDE_LIST
sameer@:~/tau2/examples/mm> cp matmult.c matmult.cpp 
sameer@:~/tau2/examples/mm> /opt/rocm-5.0.2/bin/hipcc -c matmult.cpp  -g -DPROFILING_ON -DTAU_DOT_H_LESS_HEADERS -fPIC -DTAU_MPI -DTAU_UNIFY -DTAU_MPI_THREADED -DTAU_LINUX_TIMERS -DTAU_MPIGREQUEST -DTAU_MPIDATAREP -DTAU_MPIERRHANDLER -DTAU_CRAYCNL -DTAU_AT_FORK -DTAU_MPICONSTCHAR -DTAU_MPIATTRFUNCTION -DTAU_MPITYPEEX -DTAU_MPIADDERROR -DTAU_LARGEFILE -D_LARGEFILE64_SOURCE -DTAU_BFD -DTAU_MPIFILE -DHAVE_GNU_DEMANGLE -DHAVE_TR1_HASH_MAP -DTAU_SS_ALLOC_SUPPORT -DEBS_CLOCK_RES=1 -DTAU_STRSIGNAL_OK -DTAU_TRACK_LD_LOADER -DTAU_MPICH3 -DTAU_MPI_EXTENSIONS -DTAU_SUPPRESS_PTHREAD_CREATE_WRAPPER -DTAU_ELF_BFD -I/ccs/home/sameer/tau2/include -I/opt/cray/pe/mpich/8.1.12/ofi/amd/4.4/include -g -flegacy-pass-manager -fplugin=/ccs/home/sameer/tau2/craycnl/lib/shared-amd-clang-mpi/plugins/lib/TAU_Profiling_CXX.so -mllvm -tau-input-file=s.tau -o matmult.o 
Included functions: 
Include function: main
Include function: compute_interchange
lld: error: -plugin-opt=-: lld: Unknown command line argument '-tau-input-file=s.tau'.  Try: '/opt/rocm-4.5.0/llvm/bin/lld --help'
lld: Did you mean '--info-output-file=s.tau'?
clang-13: error: amdgcn-link command failed with exit code 1 (use -v to see invocation)
sameer@crusher134:~/tau2/examples/mm> 

With the -v option enabled: 


sameer@crusher134:~/tau2/examples/mm> /opt/rocm-5.0.2/bin/hipcc -c matmult.cpp  -g -DPROFILING_ON -DTAU_DOT_H_LESS_HEADERS -fPIC -DTAU_MPI -DTAU_UNIFY -DTAU_MPI_THREADED -DTAU_LINUX_TIMERS -DTAU_MPIGREQUEST -DTAU_MPIDATAREP -DTAU_MPIERRHANDLER -DTAU_CRAYCNL -DTAU_AT_FORK -DTAU_MPICONSTCHAR -DTAU_MPIATTRFUNCTION -DTAU_MPITYPEEX -DTAU_MPIADDERROR -DTAU_LARGEFILE -D_LARGEFILE64_SOURCE -DTAU_BFD -DTAU_MPIFILE -DHAVE_GNU_DEMANGLE -DHAVE_TR1_HASH_MAP -DTAU_SS_ALLOC_SUPPORT -DEBS_CLOCK_RES=1 -DTAU_STRSIGNAL_OK -DTAU_TRACK_LD_LOADER -DTAU_MPICH3 -DTAU_MPI_EXTENSIONS -DTAU_SUPPRESS_PTHREAD_CREATE_WRAPPER -DTAU_ELF_BFD -I/ccs/home/sameer/tau2/include -I/opt/cray/pe/mpich/8.1.12/ofi/amd/4.4/include -g -flegacy-pass-manager -fplugin=/ccs/home/sameer/tau2/craycnl/lib/shared-amd-clang-mpi/plugins/lib/TAU_Profiling_CXX.so -mllvm -tau-input-file=s.tau -o matmult.o -v 
AMD clang version 13.0.0 (https://github.com/RadeonOpenCompute/llvm-project roc-4.5.0 21422 e2489b0d7ede612d6586c61728db321047833ed8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/rocm-4.5.0/llvm/bin
Found candidate GCC installation: /usr/lib64/gcc/x86_64-suse-linux/7
Selected GCC installation: /usr/lib64/gcc/x86_64-suse-linux/7
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found HIP installation: /opt/rocm-4.5.0, version 4.4.21401
 "/opt/rocm-4.5.0/llvm/bin/clang-13" -cc1 -mllvm --amdhsa-code-object-version=4 -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -emit-obj --mrelax-relocations -disable-free -disable-llvm-verifier -discard-value-names -main-file-name matmult.cpp -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fno-rounding-math -aux-target-cpu x86-64 -fcuda-is-device -mllvm -amdgpu-internalize-symbols -fcuda-allow-variadic-functions -fvisibility hidden -fapply-global-visibility-to-externs -mlink-builtin-bitcode /opt/rocm-4.5.0/amdgcn/bitcode/hip.bc -mlink-builtin-bitcode /opt/rocm-4.5.0/amdgcn/bitcode/ocml.bc -mlink-builtin-bitcode /opt/rocm-4.5.0/amdgcn/bitcode/ockl.bc -mlink-builtin-bitcode /opt/rocm-4.5.0/amdgcn/bitcode/oclc_daz_opt_off.bc -mlink-builtin-bitcode /opt/rocm-4.5.0/amdgcn/bitcode/oclc_unsafe_math_off.bc -mlink-builtin-bitcode /opt/rocm-4.5.0/amdgcn/bitcode/oclc_finite_only_off.bc -mlink-builtin-bitcode /opt/rocm-4.5.0/amdgcn/bitcode/oclc_correctly_rounded_sqrt_on.bc -mlink-builtin-bitcode /opt/rocm-4.5.0/amdgcn/bitcode/oclc_wavefrontsize64_on.bc -mlink-builtin-bitcode /opt/rocm-4.5.0/amdgcn/bitcode/oclc_isa_version_90a.bc -target-cpu gfx90a -debug-info-kind=limited -dwarf-version=5 -debugger-tuning=gdb -v -resource-dir /opt/rocm-4.5.0/llvm/lib/clang/13.0.0 -internal-isystem /opt/rocm-4.5.0/llvm/lib/clang/13.0.0/include/cuda_wrappers -internal-isystem /opt/rocm-4.5.0/include -include __clang_hip_runtime_wrapper.h -isystem /opt/rocm-4.5.0/llvm/lib/clang/13.0.0/include/.. -isystem /opt/rocm-4.5.0/hsa/include -isystem /opt/rocm-4.5.0/hip/include -D PROFILING_ON -D TAU_DOT_H_LESS_HEADERS -D TAU_MPI -D TAU_UNIFY -D TAU_MPI_THREADED -D TAU_LINUX_TIMERS -D TAU_MPIGREQUEST -D TAU_MPIDATAREP -D TAU_MPIERRHANDLER -D TAU_CRAYCNL -D TAU_AT_FORK -D TAU_MPICONSTCHAR -D TAU_MPIATTRFUNCTION -D TAU_MPITYPEEX -D TAU_MPIADDERROR -D TAU_LARGEFILE -D _LARGEFILE64_SOURCE -D TAU_BFD -D TAU_MPIFILE -D HAVE_GNU_DEMANGLE -D HAVE_TR1_HASH_MAP -D TAU_SS_ALLOC_SUPPORT -D EBS_CLOCK_RES=1 -D TAU_STRSIGNAL_OK -D TAU_TRACK_LD_LOADER -D TAU_MPICH3 -D TAU_MPI_EXTENSIONS -D TAU_SUPPRESS_PTHREAD_CREATE_WRAPPER -D TAU_ELF_BFD -I /ccs/home/sameer/tau2/include -I /opt/cray/pe/mpich/8.1.12/ofi/amd/4.4/include -c-isystem /opt/rocm-4.5.0/llvm/include -cxx-isystem /opt/rocm-4.5.0/llvm/include -internal-isystem /usr/lib64/gcc/x86_64-suse-linux/7/../../../../include/c++/7 -internal-isystem /usr/lib64/gcc/x86_64-suse-linux/7/../../../../include/c++/7/x86_64-suse-linux -internal-isystem /usr/lib64/gcc/x86_64-suse-linux/7/../../../../include/c++/7/backward -internal-isystem /usr/lib64/gcc/x86_64-suse-linux/7/../../../../include/c++/7 -internal-isystem /usr/lib64/gcc/x86_64-suse-linux/7/../../../../include/c++/7/x86_64-suse-linux -internal-isystem /usr/lib64/gcc/x86_64-suse-linux/7/../../../../include/c++/7/backward -internal-isystem /opt/rocm-4.5.0/llvm/lib/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -internal-isystem /opt/rocm-4.5.0/llvm/lib/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -std=c++11 -fdeprecated-macro -fno-autolink -fdebug-compilation-dir=/ccs/home/sameer/tau2/examples/mm -ferror-limit 19 -fhip-new-launch-api -fgnuc-version=4.2.1 -flegacy-pass-manager -fcxx-exceptions -fexceptions -fcolor-diagnostics -vectorize-loops -vectorize-slp -load /ccs/home/sameer/tau2/craycnl/lib/shared-amd-clang-mpi/plugins/lib/TAU_Profiling_CXX.so -mllvm -amdgpu-early-inline-all=true -mllvm -amdgpu-function-calls=false -mllvm -tau-input-file=s.tau -cuid=8e258982dd29a27d -fcuda-allow-variadic-functions -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/matmult-gfx90a-15c360.o -x hip matmult.cpp
clang -cc1 version 13.0.0 based upon LLVM 13.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
ignoring nonexistent directory "/include"
ignoring duplicate directory "/usr/lib64/gcc/x86_64-suse-linux/7/../../../../include/c++/7"
ignoring duplicate directory "/usr/lib64/gcc/x86_64-suse-linux/7/../../../../include/c++/7/x86_64-suse-linux"
ignoring duplicate directory "/usr/lib64/gcc/x86_64-suse-linux/7/../../../../include/c++/7/backward"
ignoring duplicate directory "/opt/rocm-4.5.0/llvm/lib/clang/13.0.0/include"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include"
ignoring duplicate directory "/usr/include"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/opt/rocm-4.5.0/llvm/lib/clang/13.0.0/include"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /ccs/home/sameer/tau2/include
 /opt/cray/pe/mpich/8.1.12/ofi/amd/4.4/include
 /opt/rocm-4.5.0/llvm/lib/clang/13.0.0/include/..
 /opt/rocm-4.5.0/hsa/include
 /opt/rocm-4.5.0/hip/include
 /opt/rocm-4.5.0/llvm/include
 /opt/rocm-4.5.0/llvm/lib/clang/13.0.0/include/cuda_wrappers
 /opt/rocm-4.5.0/include
 /usr/lib64/gcc/x86_64-suse-linux/7/../../../../include/c++/7
 /usr/lib64/gcc/x86_64-suse-linux/7/../../../../include/c++/7/x86_64-suse-linux
 /usr/lib64/gcc/x86_64-suse-linux/7/../../../../include/c++/7/backward
 /opt/rocm-4.5.0/llvm/lib/clang/13.0.0/include
 /usr/local/include
 /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include
 /usr/include
End of search list.
Included functions: 
Include function: main
Include function: compute_interchange
 "/opt/rocm-4.5.0/llvm/bin/lld" -flavor gnu --no-undefined -shared -plugin-opt=-amdgpu-internalize-symbols -plugin-opt=mcpu=gfx90a -plugin-opt=O3 -plugin-opt=legacy-pass-manager -plugin-opt=-amdgpu-early-inline-all=true -plugin-opt=-amdgpu-function-calls=false -plugin-opt=-tau-input-file=s.tau -o /tmp/matmult-gfx90a-c61712.out /tmp/matmult-gfx90a-15c360.o
lld: error: -plugin-opt=-: lld: Unknown command line argument '-tau-input-file=s.tau'.  Try: '/opt/rocm-4.5.0/llvm/bin/lld --help'
lld: Did you mean '--info-output-file=s.tau'?
clang-13: error: amdgcn-link command failed with exit code 1 (use -v to see invocation)
sameer@crusher134:~/tau2/examples/mm> /opt/rocm-5.0.2/bin/hipcc -c matmult.c  -g -DPROFILING_ON -DTAU_DOT_H_LESS_HEADERS -fPIC -DTAU_MPI -DTAU_UNIFY -DTAU_MPI_THREADED -DTAU_LINUX_TIMERS -DTAU_MPIGREQUEST -DTAU_MPIDATAREP -DTAU_MPIERRHANDLER -DTAU_CRAYCNL -DTAU_AT_FORK -DTAU_MPICONSTCHAR -DTAU_MPIATTRFUNCTION -DTAU_MPITYPEEX -DTAU_MPIADDERROR -DTAU_LARGEFILE -D_LARGEFILE64_SOURCE -DTAU_BFD -DTAU_MPIFILE -DHAVE_GNU_DEMANGLE -DHAVE_TR1_HASH_MAP -DTAU_SS_ALLOC_SUPPORT -DEBS_CLOCK_RES=1 -DTAU_STRSIGNAL_OK -DTAU_TRACK_LD_LOADER -DTAU_MPICH3 -DTAU_MPI_EXTENSIONS -DTAU_SUPPRESS_PTHREAD_CREATE_WRAPPER -DTAU_ELF_BFD -I/ccs/home/sameer/tau2/include -I/opt/cray/pe/mpich/8.1.12/ofi/amd/4.4/include -g -flegacy-pass-manager -fplugin=/ccs/home/sameer/tau2/craycnl/lib/shared-amd-clang-mpi/plugins/lib/TAU_Profiling_CXX.so -mllvm -tau-input-file=s.tau -o matmult.o -v 
AMD clang version 13.0.0 (https://github.com/RadeonOpenCompute/llvm-project roc-4.5.0 21422 e2489b0d7ede612d6586c61728db321047833ed8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/rocm-4.5.0/llvm/bin
Found candidate GCC installation: /usr/lib64/gcc/x86_64-suse-linux/7
Selected GCC installation: /usr/lib64/gcc/x86_64-suse-linux/7
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found HIP installation: /opt/rocm-4.5.0, version 4.4.21401
 (in-process)
 "/opt/rocm-4.5.0/llvm/bin/clang-13" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj --mrelax-relocations -disable-free -disable-llvm-verifier -discard-value-names -main-file-name matmult.c -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -v -fcoverage-compilation-dir=/ccs/home/sameer/tau2/examples/mm -resource-dir /opt/rocm-4.5.0/llvm/lib/clang/13.0.0 -isystem /opt/rocm-4.5.0/llvm/lib/clang/13.0.0/include/.. -isystem /opt/rocm-4.5.0/hsa/include -isystem /opt/rocm-4.5.0/hip/include -D PROFILING_ON -D TAU_DOT_H_LESS_HEADERS -D TAU_MPI -D TAU_UNIFY -D TAU_MPI_THREADED -D TAU_LINUX_TIMERS -D TAU_MPIGREQUEST -D TAU_MPIDATAREP -D TAU_MPIERRHANDLER -D TAU_CRAYCNL -D TAU_AT_FORK -D TAU_MPICONSTCHAR -D TAU_MPIATTRFUNCTION -D TAU_MPITYPEEX -D TAU_MPIADDERROR -D TAU_LARGEFILE -D _LARGEFILE64_SOURCE -D TAU_BFD -D TAU_MPIFILE -D HAVE_GNU_DEMANGLE -D HAVE_TR1_HASH_MAP -D TAU_SS_ALLOC_SUPPORT -D EBS_CLOCK_RES=1 -D TAU_STRSIGNAL_OK -D TAU_TRACK_LD_LOADER -D TAU_MPICH3 -D TAU_MPI_EXTENSIONS -D TAU_SUPPRESS_PTHREAD_CREATE_WRAPPER -D TAU_ELF_BFD -I /ccs/home/sameer/tau2/include -I /opt/cray/pe/mpich/8.1.12/ofi/amd/4.4/include -c-isystem /opt/rocm-4.5.0/llvm/include -cxx-isystem /opt/rocm-4.5.0/llvm/include -internal-isystem /opt/rocm-4.5.0/llvm/lib/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir=/ccs/home/sameer/tau2/examples/mm -ferror-limit 19 -fgnuc-version=4.2.1 -flegacy-pass-manager -fcolor-diagnostics -vectorize-loops -vectorize-slp -load /ccs/home/sameer/tau2/craycnl/lib/shared-amd-clang-mpi/plugins/lib/TAU_Profiling_CXX.so -mllvm -tau-input-file=s.tau -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o matmult.o -x c matmult.c
clang -cc1 version 13.0.0 based upon LLVM 13.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /ccs/home/sameer/tau2/include
 /opt/cray/pe/mpich/8.1.12/ofi/amd/4.4/include
 /opt/rocm-4.5.0/llvm/lib/clang/13.0.0/include/..
 /opt/rocm-4.5.0/hsa/include
 /opt/rocm-4.5.0/hip/include
 /opt/rocm-4.5.0/llvm/include
 /opt/rocm-4.5.0/llvm/lib/clang/13.0.0/include
 /usr/local/include
 /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include
 /usr/include
End of search list.
Included functions: 
Include function: main
Include function: compute_interchange
Instrument compute_interchange
Adding instrumentation in compute_interchange
Instrument main
Adding instrumentation in main
	main function: adding init
sameer@:~/tau2/examples/mm> 
@searlmc1
Copy link
Contributor

Thank you for reporting this issue; we are looking into it.

Mark

@david-salinas
Copy link

Hi @sameershende I'm having difficulty reproducing this error with ROCm 5.0.2. I was able to get a copy of your TAU plugin .so, but when I call hipcc (with either a C or C++ file) clang cannot load the plugin because there is an undefined LLVM symbol in the .so. I attribute this kind of error to there being a mismatch between levels of LLVM in clang and the plugin .so. Are you still encountering this issue with ROCm 5.0.2 ?

@coti
Copy link

coti commented Apr 15, 2022

Hi @david-salinas, how do you compile the TAU plugin? Which symbol is undefined?
Thanks!

@david-salinas
Copy link

This is my compile command:

/opt/rocm-5.0.2/bin/hipcc -c matmult.c -g -DPROFILING_ON -DTAU_DOT_H_LESS_HEADERS -fPIC -DTAU_MPI -DTAU_UNIFY -DTAU_MPI_THREADED -DTAU_LINUX_TIMERS -DTAU_MPIGREQUEST -DTAU_MPIDATAREP -DTAU_MPIERRHANDLER -DTAU_CRAYCNL -DTAU_AT_FORK -DTAU_MPICONSTCHAR -DTAU_MPIATTRFUNCTION -DTAU_MPITYPEEX -DTAU_MPIADDERROR -DTAU_LARGEFILE -D_LARGEFILE64_SOURCE -DTAU_BFD -DTAU_MPIFILE -DHAVE_GNU_DEMANGLE -DHAVE_TR1_HASH_MAP -DTAU_SS_ALLOC_SUPPORT -DEBS_CLOCK_RES=1 -DTAU_STRSIGNAL_OK -DTAU_TRACK_LD_LOADER -DTAU_MPICH3 -DTAU_MPI_EXTENSIONS -DTAU_SUPPRESS_PTHREAD_CREATE_WRAPPER -DTAU_ELF_BFD -I/ccs/home/sameer/tau2/include -I/opt/cray/pe/mpich/8.1.12/ofi/amd/4.4/include -g -flegacy-pass-manager -fplugin=/home/dsalinas/work/swdev-328441/submit/TAU_Profiling_CXX.so -mllvm -tau-input-file=s.tau -o matmult.o -v

And this is the error:

error: unable to load plugin '/home/dsalinas/work/swdev-328441/submit/TAU_Profiling_CXX.so': '/home/dsalinas/work/swdev-328441/submit/TAU_Profiling_CXX.so: undefined symbol: _ZN4llvm2cl15GeneralCategoryE'

Though maybe the issue is I'm missing some of your headers?

I noticed in the description of this ticket that you're calling /opt/rocm-5.0.2/bin/hipcc, but in the output from -v I see "/opt/rocm-4.5.0". I'm wondering if you may have an issue with how you installed ROCm 5.0.2.

@coti
Copy link

coti commented Apr 15, 2022

Hi David,

Yes, it looks like an incompatibility between the LLVM framework used as a base layer for hipcc and the one expected by the plugin.

I have never seen this specific symbol causing trouble, but one thing we need to be careful about is that the compiler used to compile the plugin needs to be more or less the same as used to compile the compiler. So if your hipcc framework and compiler has been compiled with LLVM, then you need to compile the plugin using clang++, otherwise if it was compiled with gcc, then you need to compile the plugin using a "close enough" version of gcc.

@david-salinas
Copy link

@sameershende I think there are two issues here: 1) hipcc does not behave the same with C source versus C++ source, and 2) hipcc is not handling the -fplugin arguments as expected (for C++ source). For issue 1) this behaviour is inherent in that HIP is a C++ API and Kernel language, and C source files are not HIP source files. The hipcc command/script invokes Clang specially for C++/HIP source files, but not for C source files. For issue 2), I think this is a duplicate of the other issue you opened: #2453 , where hipcc is not handling the plugin arguments as expected. I'd like to close this issue as a duplicate of #2543 .

@sameershende
Copy link
Author

Sounds good. Please close it.

@david-salinas
Copy link

closing as a duplicate of #2543

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants