File tree Expand file tree Collapse file tree 5 files changed +21
-3
lines changed Expand file tree Collapse file tree 5 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -278,7 +278,9 @@ function(_build_gpu_objects fq_target_name internal_target_name)
278278 target_compile_options (${internal_target_name} BEFORE PRIVATE
279279 ${common_compile_options} --target =${LIBC_GPU_TARGET_TRIPLE} )
280280 if (LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
281- target_compile_options (${internal_target_name} PRIVATE -mcpu=${LIBC_GPU_TARGET_ARCHITECTURE} -flto)
281+ target_compile_options (${internal_target_name} PRIVATE
282+ "SHELL:-Xclang -mcode-object-version=none"
283+ -mcpu=${LIBC_GPU_TARGET_ARCHITECTURE} -flto)
282284 elseif (LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
283285 get_nvptx_compile_options(nvptx_options ${LIBC_GPU_TARGET_ARCHITECTURE} )
284286 target_compile_options (${internal_target_name} PRIVATE ${nvptx_options} )
Original file line number Diff line number Diff line change @@ -528,7 +528,8 @@ function(add_integration_test test_name)
528528 if (LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
529529 target_compile_options (${fq_build_target_name} PRIVATE
530530 -nogpulib -mcpu=${LIBC_GPU_TARGET_ARCHITECTURE}
531- -flto --target =${LIBC_GPU_TARGET_TRIPLE} )
531+ -flto --target =${LIBC_GPU_TARGET_TRIPLE}
532+ -mcode-object-version =${LIBC_GPU_CODE_OBJECT_VERSION} )
532533 elseif (LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
533534 get_nvptx_compile_options(nvptx_options ${LIBC_GPU_TARGET_ARCHITECTURE} )
534535 target_compile_options (${fq_build_target_name} PRIVATE
@@ -578,7 +579,9 @@ set(LIBC_HERMETIC_TEST_COMPILE_OPTIONS ${LIBC_COMPILE_OPTIONS_DEFAULT}
578579# The GPU build requires overriding the default CMake triple and architecture.
579580if (LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
580581 list (APPEND LIBC_HERMETIC_TEST_COMPILE_OPTIONS
581- -nogpulib -mcpu=${LIBC_GPU_TARGET_ARCHITECTURE} -flto --target =${LIBC_GPU_TARGET_TRIPLE} )
582+ -nogpulib -mcpu=${LIBC_GPU_TARGET_ARCHITECTURE} -flto
583+ --target =${LIBC_GPU_TARGET_TRIPLE}
584+ -mcode-object-version =${LIBC_GPU_CODE_OBJECT_VERSION} )
582585elseif (LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
583586 get_nvptx_compile_options(nvptx_options ${LIBC_GPU_TARGET_ARCHITECTURE} )
584587 list (APPEND LIBC_HERMETIC_TEST_COMPILE_OPTIONS
Original file line number Diff line number Diff line change @@ -115,3 +115,13 @@ if(LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
115115 get_filename_component (LIBC_CUDA_ROOT "${CUDAToolkit_BIN_DIR} " DIRECTORY ABSOLUTE )
116116 endif ()
117117endif ()
118+
119+ if (LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
120+ # The AMDGPU environment uses different code objects to encode the ABI for
121+ # kernel calls and intrinsic functions. We want to specify this manually to
122+ # conform to whatever the test suite was built to handle.
123+ # FIXME: The test suite currently hangs when compiled targeting version five.
124+ # This occurrs during traversal of the callback array in the startup code. We
125+ # deliberately use version four until this can be addressed.
126+ set (LIBC_GPU_CODE_OBJECT_VERSION 4)
127+ endif ()
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ add_startup_object(
1313 -nogpulib # Do not include any GPU vendor libraries.
1414 -mcpu=${LIBC_GPU_TARGET_ARCHITECTURE}
1515 -emit-llvm # AMDGPU's intermediate object file format is bitcode.
16+ -mcode-object-version =${LIBC_GPU_CODE_OBJECT_VERSION} # Manually set the ABI.
1617 --target =${LIBC_GPU_TARGET_TRIPLE}
1718 NO_GPU_BUNDLE # Compile this file directly without special GPU handling.
1819)
@@ -26,4 +27,5 @@ target_link_libraries(
2627 "--target=${LIBC_GPU_TARGET_TRIPLE} "
2728 "-flto"
2829 "-Wl,-mllvm,-amdgpu-lower-global-ctor-dtor=0"
30+ "-Wl,-mllvm,-amdhsa-code-object-version=${LIBC_GPU_CODE_OBJECT_VERSION} "
2931)
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ if(LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
33 -mcpu=${LIBC_GPU_TARGET_ARCHITECTURE}
44 -emit-llvm # AMDGPU's intermediate object file format is bitcode.
55 --target =${LIBC_GPU_TARGET_TRIPLE}
6+ -mcode-object-version =${LIBC_GPU_CODE_OBJECT_VERSION} # Manually set the ABI.
67 )
78elseif (LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
89 set (TEST_COMPILE_FLAGS
You can’t perform that action at this time.
0 commit comments