xref: /llvm-project/libc/benchmarks/gpu/CMakeLists.txt (revision db6b7a84e6e4949569e756f46357d9f54ad16a03)
1add_subdirectory(timing)
2
3add_custom_target(gpu-benchmark)
4
5function(add_benchmark benchmark_name)
6  cmake_parse_arguments(
7    "BENCHMARK"
8    "" # Optional arguments
9    "" # Single value arguments
10    "LINK_LIBRARIES;DEPENDS" # Multi-value arguments
11    ${ARGN}
12  )
13
14  if(NOT libc.src.time.clock IN_LIST TARGET_LLVMLIBC_ENTRYPOINTS)
15    message(FATAL_ERROR "target does not support clock")
16  endif()
17  add_libc_hermetic(
18    ${benchmark_name}
19    IS_GPU_BENCHMARK
20    LINK_LIBRARIES
21      LibcGpuBenchmark.hermetic
22      ${BENCHMARK_LINK_LIBRARIES}
23    DEPENDS
24      libc.src.stdio.printf
25      libc.src.stdlib.srand
26      libc.src.stdlib.rand
27      ${BENCHMARK_DEPENDS}
28    ${BENCHMARK_UNPARSED_ARGUMENTS}
29    COMPILE_OPTIONS
30      -flto
31  )
32  get_fq_target_name(${benchmark_name} fq_target_name)
33  set(fq_build_target_name ${fq_target_name}.__build__)
34
35  add_dependencies(gpu-benchmark ${fq_target_name})
36endfunction(add_benchmark)
37
38add_unittest_framework_library(
39  LibcGpuBenchmark
40  SRCS
41    LibcGpuBenchmark.cpp
42    LibcGpuBenchmarkMain.cpp
43    BenchmarkLogger.cpp
44  HDRS
45    LibcGpuBenchmark.h
46    BenchmarkLogger.h
47  DEPENDS
48    libc.src.__support.big_int
49    libc.src.__support.c_string
50    libc.src.__support.CPP.string
51    libc.src.__support.CPP.string_view
52    libc.src.__support.CPP.type_traits
53    libc.src.__support.CPP.functional
54    libc.src.__support.CPP.limits
55    libc.src.__support.CPP.algorithm
56    libc.src.__support.CPP.atomic
57    libc.src.__support.CPP.array
58    libc.src.__support.fixed_point.fx_rep
59    libc.src.__support.macros.properties.types
60    libc.src.__support.OSUtil.osutil
61    libc.src.__support.uint128
62    libc.src.__support.FPUtil.fp_bits
63    libc.src.__support.FPUtil.sqrt
64    libc.src.__support.fixedvector
65    libc.src.time.clock
66    libc.src.stdlib.rand
67    libc.src.stdlib.srand
68    libc.benchmarks.gpu.timing.timing
69    libc.src.stdio.printf
70)
71
72add_subdirectory(src)
73