You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During the linking of object files that were compiled with reallocatable_device_code set to true, undefined reference to __hip_fatbin error was produced. -rdc=true (or --relocatable-device-code=true) flag needs to be explicitly added during linking in order to link successfully, but CUDA's nvcc doesn't require it (it links successfully without the -rdc=true flag). Please see the below reproducer for more details:
[Reproducer]
Have the following three files, main.cu, function.hpp, and function.cu:
Compile the main.cu and function.cu with the following commands (these should compile fine with the newly added -dc flag support): nvcc -dc -o main.o main.cu nvcc -dc -o function.o function.cu
Then, link the object files: nvcc -o main main.o function.o
The following error should appear:
/usr/bin/ld: main.o:(.hipFatBinSegment+0x8): undefined reference to `__hip_fatbin'
/usr/bin/ld: function.o:(.hipFatBinSegment+0x8): undefined reference to `__hip_fatbin'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
failed to execute:/home/tsaini.chen/install/llvm/17.0/bin/clang++ -include /home/tsaini.chen/install/chipStar/add_flag/include/hip/spirv_fixups.h -I//home/tsaini.chen/install/chipStar/add_flag/include -isystem /home/tsaini.chen/install/chipStar/add_flag/include/cuspv -include /home/tsaini.chen/install/chipStar/add_flag/include/cuspv/cuda_runtime.h -D__NVCC__ -D__CHIP_CUDA_COMPATIBILITY__ main.o function.o -o main -L/home/tsaini.chen/install/chipStar/add_flag/lib -lCHIP -no-hip-rt -Wl,-rpath,/home/tsaini.chen/install/chipStar/add_flag/lib
The text was updated successfully, but these errors were encountered:
During the linking of object files that were compiled with
reallocatable_device_code
set to true,undefined reference to __hip_fatbin
error was produced.-rdc=true
(or--relocatable-device-code=true
) flag needs to be explicitly added during linking in order to link successfully, but CUDA's nvcc doesn't require it (it links successfully without the-rdc=true
flag). Please see the below reproducer for more details:[Reproducer]
Have the following three files, main.cu, function.hpp, and function.cu:
main.cu
function.hpp
function.cu
Compile the main.cu and function.cu with the following commands (these should compile fine with the newly added -dc flag support):
nvcc -dc -o main.o main.cu
nvcc -dc -o function.o function.cu
Then, link the object files:
nvcc -o main main.o function.o
The following error should appear:
The text was updated successfully, but these errors were encountered: