190 lines · plain
1add_custom_target(libc-gpu-math-benchmarks)2 3set(math_benchmark_flags "")4if(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_flags9 "SHELL:-Xclang -mlink-builtin-bitcode -Xclang ${libdevice_path}")10 # Compile definition needed so the benchmark knows to register11 # NVPTX benchmarks.12 list(APPEND math_benchmark_flags "-DNVPTX_MATH_FOUND=1")13 endif()14 endif()15endif()16 17if(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_flags22 "SHELL:-Xclang -mlink-builtin-bitcode -Xclang ${ocml_path}")23 list(APPEND math_benchmark_flags "-DAMDGPU_MATH_FOUND=1")24 endif()25endif()26 27add_benchmark(28 atan2_benchmark29 SUITE30 libc-gpu-math-benchmarks31 SRCS32 atan2_benchmark.cpp33 HDRS34 platform.h35 DEPENDS36 libc.hdr.stdint_proxy37 libc.src.__support.macros.attributes38 libc.src.__support.macros.config39 libc.src.__support.macros.properties.types40 libc.src.math.atan241 COMPILE_OPTIONS42 ${math_benchmark_flags}43 LOADER_ARGS44 --threads 6445)46 47add_benchmark(48 exp_benchmark49 SUITE50 libc-gpu-math-benchmarks51 SRCS52 exp_benchmark.cpp53 HDRS54 platform.h55 DEPENDS56 libc.hdr.stdint_proxy57 libc.src.__support.macros.attributes58 libc.src.__support.macros.config59 libc.src.__support.macros.properties.types60 libc.src.math.exp61 COMPILE_OPTIONS62 ${math_benchmark_flags}63 LOADER_ARGS64 --threads 6465)66 67add_benchmark(68 expf_benchmark69 SUITE70 libc-gpu-math-benchmarks71 SRCS72 expf_benchmark.cpp73 HDRS74 platform.h75 DEPENDS76 libc.hdr.stdint_proxy77 libc.src.__support.macros.attributes78 libc.src.__support.macros.config79 libc.src.__support.macros.properties.types80 libc.src.math.expf81 COMPILE_OPTIONS82 ${math_benchmark_flags}83 LOADER_ARGS84 --threads 6485)86 87add_benchmark(88 expf16_benchmark89 SUITE90 libc-gpu-math-benchmarks91 SRCS92 expf16_benchmark.cpp93 HDRS94 platform.h95 DEPENDS96 libc.hdr.stdint_proxy97 libc.src.__support.macros.attributes98 libc.src.__support.macros.config99 libc.src.__support.macros.properties.types100 libc.src.math.expf16101 COMPILE_OPTIONS102 ${math_benchmark_flags}103 LOADER_ARGS104 --threads 64105)106 107add_benchmark(108 log_benchmark109 SUITE110 libc-gpu-math-benchmarks111 SRCS112 log_benchmark.cpp113 HDRS114 platform.h115 DEPENDS116 libc.hdr.stdint_proxy117 libc.src.__support.macros.attributes118 libc.src.__support.macros.config119 libc.src.__support.macros.properties.types120 libc.src.__support.sign121 libc.src.math.log122 COMPILE_OPTIONS123 ${math_benchmark_flags}124 LOADER_ARGS125 --threads 64126)127 128add_benchmark(129 logf_benchmark130 SUITE131 libc-gpu-math-benchmarks132 SRCS133 logf_benchmark.cpp134 HDRS135 platform.h136 DEPENDS137 libc.hdr.stdint_proxy138 libc.src.__support.macros.attributes139 libc.src.__support.macros.config140 libc.src.__support.macros.properties.types141 libc.src.__support.sign142 libc.src.math.logf143 COMPILE_OPTIONS144 ${math_benchmark_flags}145 LOADER_ARGS146 --threads 64147)148 149add_benchmark(150 logf16_benchmark151 SUITE152 libc-gpu-math-benchmarks153 SRCS154 logf16_benchmark.cpp155 HDRS156 platform.h157 DEPENDS158 libc.hdr.stdint_proxy159 libc.src.__support.macros.attributes160 libc.src.__support.macros.config161 libc.src.__support.macros.properties.types162 libc.src.__support.sign163 libc.src.math.logf16164 COMPILE_OPTIONS165 ${math_benchmark_flags}166 LOADER_ARGS167 --threads 64168)169 170add_benchmark(171 sin_benchmark172 SUITE173 libc-gpu-math-benchmarks174 SRCS175 sin_benchmark.cpp176 HDRS177 platform.h178 DEPENDS179 libc.hdr.stdint_proxy180 libc.src.__support.macros.attributes181 libc.src.__support.macros.config182 libc.src.__support.macros.properties.types183 libc.src.math.sin184 libc.src.math.sinf185 COMPILE_OPTIONS186 ${math_benchmark_flags}187 LOADER_ARGS188 --threads 64189)190