1
1
add_custom_target (libc-gpu-math-benchmarks )
2
2
3
- if (CUDAToolkit_FOUND )
4
- set (libdevice_path ${CUDAToolkit_BIN_DIR} /../nvvm/libdevice/libdevice.10.bc )
5
- if (EXISTS ${libdevice_path} )
6
- set (nvptx_bitcode_link_flags
3
+ set (math_benchmark_flags "" )
4
+ if (LIBC_TARGET_ARCHITECTURE_IS_NVPTX )
5
+ if (CUDAToolkit_FOUND )
6
+ set (libdevice_path ${CUDAToolkit_BIN_DIR} /../nvvm/libdevice/libdevice.10.bc )
7
+ if (EXISTS ${libdevice_path} )
8
+ list (APPEND math_benchmark_flags
7
9
"SHELL:-Xclang -mlink-builtin-bitcode -Xclang ${libdevice_path} " )
8
- # Compile definition needed so the benchmark knows to register
9
- # NVPTX benchmarks.
10
- set (nvptx_math_found "-DNVPTX_MATH_FOUND=1" )
10
+ # Compile definition needed so the benchmark knows to register
11
+ # NVPTX benchmarks.
12
+ list (APPEND math_benchmark_flags "-DNVPTX_MATH_FOUND=1" )
13
+ endif ()
11
14
endif ()
12
15
endif ()
13
16
14
- find_package (AMDDeviceLibs QUIET HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm )
15
- if (AMDDeviceLibs_FOUND )
16
- get_target_property (ocml_path ocml IMPORTED_LOCATION )
17
- set (amdgpu_bitcode_link_flags
18
- "SHELL:-Xclang -mlink-builtin-bitcode -Xclang ${ocml_path} " )
19
- set (amdgpu_math_found "-DAMDGPU_MATH_FOUND=1" )
17
+ if (LIBC_TARGET_ARCHITECTURE_IS_AMDGPU )
18
+ find_package (AMDDeviceLibs QUIET HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm )
19
+ if (AMDDeviceLibs_FOUND )
20
+ get_target_property (ocml_path ocml IMPORTED_LOCATION )
21
+ list (APPEND math_benchmark_flags
22
+ "SHELL:-Xclang -mlink-builtin-bitcode -Xclang ${ocml_path} " )
23
+ list (APPEND math_benchmark_flags "-DAMDGPU_MATH_FOUND=1" )
24
+ endif ()
20
25
endif ()
21
26
22
27
add_benchmark (
@@ -33,10 +38,7 @@ add_benchmark(
33
38
libc.src.__support.CPP.bit
34
39
libc.src.__support.CPP.array
35
40
COMPILE_OPTIONS
36
- ${nvptx_math_found}
37
- ${nvptx_bitcode_link_flags}
38
- ${amdgpu_math_found}
39
- ${amdgpu_bitcode_link_flags}
41
+ ${math_benchmark_flags}
40
42
LOADER_ARGS
41
43
--threads 64
42
44
)
0 commit comments