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

hip-6.0.0 clang/ld.lld compilation fails with: ld.lld: error: version script assignment of 'hip_4.2' to symbol 'hipExtModuleLaunchKernel' failed: symbol not defined #3382

Open
AngryLoki opened this issue Jan 1, 2024 · 3 comments

Comments

@AngryLoki
Copy link

Since LLD 16, llvm/lld builds code with --no-undefined-version (https://maskray.me/blog/2020-11-15-explain-gnu-linker-options#no-undefined-version) by default, detecting missing symbols and failing during compilation with:

FAILED: hipamd/lib/libamdhip64.so.6.0.32830 
: && /usr/lib/llvm/17/bin/clang++-17 -fPIC -march=native -O2 -pipe -flto=thin -Werror=odr -Werror=strict-aliasing -ggdb3  -Wl,-O1 -Wl,--as-needed -Wl,-O2 -Wl,--as-needed -fuse-ld=lld   -pthread -shared -Wl,-soname,libamdhip64.so.6 -o hipamd/lib/libamdhip64.so.6.0.32830 hip_pch.o hipamd/src/CMakeFiles/amdhip64.dir/fixme.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_activity.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_code_object.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_context.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_device_runtime.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_device.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_error.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_event.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_event_ipc.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_fatbin.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_global.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_graph_internal.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_graph.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_hmm.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_intercept.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_memory.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_mempool.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_mempool_impl.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_module.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_peer.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_platform.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_profile.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_stream_ops.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_stream.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_surface.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_texture.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_gl.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hip_vm.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hiprtc/hiprtc.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hiprtc/hiprtcComgrHelper.cpp.o hipamd/src/CMakeFiles/amdhip64.dir/hiprtc/hiprtcInternal.cpp.o  -Wl,--version-script=/var/tmp/portage/dev-util/hip-6.0.0/work/clr-rocm-6.0.0/hipamd/src/hip_hcc.map.in  -ldl  rocclr/librocclr.a  hipamd/src/hiprtc/hip_rtc_gen/hipRTC_header.o  -lrt  /usr/lib64/libamd_comgr.so.2.6  /usr/lib64/libhsa-runtime64.so.1.11.0  /usr/lib64/libnuma.so && :
ld.lld: error: version script assignment of 'hip_4.2' to symbol 'hipExtModuleLaunchKernel' failed: symbol not defined
ld.lld: error: version script assignment of 'hip_4.2' to symbol 'hipTexRefGetArray' failed: symbol not defined
ld.lld: error: version script assignment of 'hip_4.2' to symbol 'hipTexRefGetBorderColor' failed: symbol not defined
ld.lld: error: version script assignment of 'hip_4.2' to symbol 'hipTexRefGetMipmappedArray' failed: symbol not defined
ld.lld: warning: attempt to reassign symbol 'hipMemcpy2DToArray_spt' of version 'hip_5.2' to version 'hip_5.3'
clang++-17: error: linker command failed with exit code 1 (use -v to see invocation)

Related report/PR in Gentoo: https://bugs.gentoo.org/921171 / gentoo/gentoo#34595

If some dependencies defining versioned symbols are optional, consider moving them into a separate version script and specifying --version-script= with more than one file.

@AngryLoki
Copy link
Author

Looks like this commit - ef2b5f1 by @iassiour - effectively solves the 'hipExtModuleLaunchKernel' failed: symbol not defined part in develop branch, but for other symbols the issue probably still exists (I tried only 6.0.0 branch).

@ppanchad-amd
Copy link

@AngryLoki Can you please test with latest ROCm 6.1.0 (HIP 6.1)? If resolved, please close ticket. Thanks!

@AngryLoki
Copy link
Author

AngryLoki commented May 22, 2024

@ppanchad-amd , some previous symbols were fixed, but problem still exists and now there are more not defined symbols:

ld.lld: error: version script assignment of 'hip_4.2' to symbol 'hipTexRefGetArray' failed: symbol not defined
ld.lld: error: version script assignment of 'hip_4.2' to symbol 'hipTexRefGetBorderColor' failed: symbol not defined
ld.lld: warning: attempt to reassign symbol 'hipMemcpy2DToArray_spt' of version 'hip_5.2' to version 'hip_5.3'
ld.lld: error: version script assignment of 'hip_5.3' to symbol 'hipGraphAddExternalSemaphoresSignalNode' failed: symbol not defined
ld.lld: error: version script assignment of 'hip_5.3' to symbol 'hipGraphAddExternalSemaphoresWaitNode' failed: symbol not defined
ld.lld: error: version script assignment of 'hip_5.3' to symbol 'hipGraphExternalSemaphoresSignalNodeSetParams' failed: symbol not defined
ld.lld: error: version script assignment of 'hip_5.3' to symbol 'hipGraphExternalSemaphoresSignalNodeGetParams' failed: symbol not defined
ld.lld: error: version script assignment of 'hip_5.3' to symbol 'hipGraphExternalSemaphoresWaitNodeSetParams' failed: symbol not defined
ld.lld: error: version script assignment of 'hip_5.3' to symbol 'hipGraphExternalSemaphoresWaitNodeGetParams' failed: symbol not defined
ld.lld: error: version script assignment of 'hip_5.3' to symbol 'hipGraphExecExternalSemaphoresSignalNodeSetParams' failed: symbol not defined
ld.lld: error: version script assignment of 'hip_5.3' to symbol 'hipGraphExecExternalSemaphoresWaitNodeSetParams' failed: symbol not defined
ld.lld: error: version script assignment of 'hip_6.0' to symbol 'hipExtGetLastError' failed: symbol not defined

Checked with rocm-6.1.1 branch.

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

2 participants