File tree 5 files changed +21
-3
lines changed
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)
278
278
target_compile_options (${internal_target_name} BEFORE PRIVATE
279
279
${common_compile_options} --target =${LIBC_GPU_TARGET_TRIPLE} )
280
280
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)
282
284
elseif (LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
283
285
get_nvptx_compile_options(nvptx_options ${LIBC_GPU_TARGET_ARCHITECTURE} )
284
286
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)
528
528
if (LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
529
529
target_compile_options (${fq_build_target_name} PRIVATE
530
530
-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} )
532
533
elseif (LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
533
534
get_nvptx_compile_options(nvptx_options ${LIBC_GPU_TARGET_ARCHITECTURE} )
534
535
target_compile_options (${fq_build_target_name} PRIVATE
@@ -578,7 +579,9 @@ set(LIBC_HERMETIC_TEST_COMPILE_OPTIONS ${LIBC_COMPILE_OPTIONS_DEFAULT}
578
579
# The GPU build requires overriding the default CMake triple and architecture.
579
580
if (LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
580
581
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} )
582
585
elseif (LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
583
586
get_nvptx_compile_options(nvptx_options ${LIBC_GPU_TARGET_ARCHITECTURE} )
584
587
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)
115
115
get_filename_component (LIBC_CUDA_ROOT "${CUDAToolkit_BIN_DIR} " DIRECTORY ABSOLUTE )
116
116
endif ()
117
117
endif ()
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(
13
13
-nogpulib # Do not include any GPU vendor libraries.
14
14
-mcpu=${LIBC_GPU_TARGET_ARCHITECTURE}
15
15
-emit-llvm # AMDGPU's intermediate object file format is bitcode.
16
+ -mcode-object-version =${LIBC_GPU_CODE_OBJECT_VERSION} # Manually set the ABI.
16
17
--target =${LIBC_GPU_TARGET_TRIPLE}
17
18
NO_GPU_BUNDLE # Compile this file directly without special GPU handling.
18
19
)
@@ -26,4 +27,5 @@ target_link_libraries(
26
27
"--target=${LIBC_GPU_TARGET_TRIPLE} "
27
28
"-flto"
28
29
"-Wl,-mllvm,-amdgpu-lower-global-ctor-dtor=0"
30
+ "-Wl,-mllvm,-amdhsa-code-object-version=${LIBC_GPU_CODE_OBJECT_VERSION} "
29
31
)
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ if(LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
3
3
-mcpu=${LIBC_GPU_TARGET_ARCHITECTURE}
4
4
-emit-llvm # AMDGPU's intermediate object file format is bitcode.
5
5
--target =${LIBC_GPU_TARGET_TRIPLE}
6
+ -mcode-object-version =${LIBC_GPU_CODE_OBJECT_VERSION} # Manually set the ABI.
6
7
)
7
8
elseif (LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
8
9
set (TEST_COMPILE_FLAGS
You can’t perform that action at this time.
0 commit comments