Skip to content

Commit

Permalink
[skip-tests] Fix benchmark build with MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
gevtushenko committed Oct 13, 2023
1 parent fcbe255 commit 8b3d11f
Show file tree
Hide file tree
Showing 17 changed files with 161 additions and 19 deletions.
10 changes: 9 additions & 1 deletion cub/benchmarks/bench/merge_sort/pairs.cu
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,15 @@ using key_types = all_types;
#ifdef TUNE_ValueT
using value_types = nvbench::type_list<TUNE_ValueT>;
#else // !defined(TUNE_ValueT)
using value_types = nvbench::type_list<int8_t, int16_t, int32_t, int64_t, int128_t>;
using value_types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t
#if NVBENCH_HELPER_HAS_I128
,
int128_t
#endif
>;
#endif // TUNE_ValueT

NVBENCH_BENCH_TYPES(pairs, NVBENCH_TYPE_AXES(key_types, value_types, offset_types))
Expand Down
10 changes: 9 additions & 1 deletion cub/benchmarks/bench/radix_sort/pairs.cu
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,15 @@ using key_types = fundamental_types;
#ifdef TUNE_ValueT
using value_types = nvbench::type_list<TUNE_ValueT>;
#else // !defined(Tune_ValueT)
using value_types = nvbench::type_list<int8_t, int16_t, int32_t, int64_t, int128_t>;
using value_types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t
#if NVBENCH_HELPER_HAS_I128
,
int128_t
#endif
>;
#endif // TUNE_ValueT

NVBENCH_BENCH_TYPES(radix_sort_values, NVBENCH_TYPE_AXES(key_types, value_types, offset_types))
Expand Down
10 changes: 9 additions & 1 deletion cub/benchmarks/bench/reduce/by_key.cu
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,15 @@ using some_offset_types = nvbench::type_list<nvbench::int32_t>;
#ifdef TUNE_KeyT
using key_types = nvbench::type_list<TUNE_KeyT>;
#else // !defined(TUNE_KeyT)
using key_types = nvbench::type_list<int8_t, int16_t, int32_t, int64_t, int128_t>;
using key_types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t
#if NVBENCH_HELPER_HAS_I128
,
int128_t
#endif
>;
#endif // TUNE_KeyT

#ifdef TUNE_ValueT
Expand Down
10 changes: 9 additions & 1 deletion cub/benchmarks/bench/scan/exclusive/by_key.cu
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,15 @@ using key_types = all_types;
#ifdef TUNE_ValueT
using value_types = nvbench::type_list<TUNE_ValueT>;
#else // !defined(TUNE_ValueT)
using value_types = nvbench::type_list<int8_t, int16_t, int32_t, int64_t, int128_t>;
using value_types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t
#if NVBENCH_HELPER_HAS_I128
,
int128_t
#endif
>;
#endif // TUNE_ValueT

NVBENCH_BENCH_TYPES(scan, NVBENCH_TYPE_AXES(key_types, value_types, some_offset_types))
Expand Down
10 changes: 9 additions & 1 deletion cub/benchmarks/bench/select/unique_by_key.cu
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,15 @@ using some_offset_types = nvbench::type_list<nvbench::int32_t>;
#ifdef TUNE_KeyT
using key_types = nvbench::type_list<TUNE_KeyT>;
#else // !defined(TUNE_KeyT)
using key_types = nvbench::type_list<int8_t, int16_t, int32_t, int64_t, int128_t>;
using key_types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t
#if NVBENCH_HELPER_HAS_I128
,
int128_t
#endif
>;
#endif // TUNE_KeyT

#ifdef TUNE_ValueT
Expand Down
10 changes: 8 additions & 2 deletions cub/benchmarks/nvbench_helper/nvbench_helper/nvbench_helper.cu
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,10 @@ void gen_power_law_segment_offsets_device(seed_t seed,
generator_t{}.power_law_segment_offsets<T>(executor::device, seed, segment_offsets, elements);
}

void do_not_optimize(const void *ptr) { asm volatile("" : : "r"(ptr) : "memory"); }
void do_not_optimize(const void *ptr)
{
(void)ptr;
}

} // namespace detail

Expand Down Expand Up @@ -882,13 +885,16 @@ INSTANTIATE(uint8_t);
INSTANTIATE(uint16_t);
INSTANTIATE(uint32_t);
INSTANTIATE(uint64_t);
INSTANTIATE(uint128_t);

INSTANTIATE(int8_t);
INSTANTIATE(int16_t);
INSTANTIATE(int32_t);
INSTANTIATE(int64_t);

#if NVBENCH_HELPER_HAS_I128
INSTANTIATE(int128_t);
INSTANTIATE(uint128_t);
#endif

INSTANTIATE(float);
INSTANTIATE(double);
Expand Down
16 changes: 15 additions & 1 deletion cub/benchmarks/nvbench_helper/nvbench_helper/nvbench_helper.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@
#include <nvbench/nvbench.cuh>
#include <cuda/std/span>

using complex = cuda::std::complex<float>;
#if defined(_MSC_VER)
#define NVBENCH_HELPER_HAS_I128 0
#else
#define NVBENCH_HELPER_HAS_I128 1
#endif

#if NVBENCH_HELPER_HAS_I128
using int128_t = __int128_t;
using uint128_t = __uint128_t;

NVBENCH_DECLARE_TYPE_STRINGS(int128_t, "I128", "int128_t");
NVBENCH_DECLARE_TYPE_STRINGS(uint128_t, "U128", "uint128_t");
#endif

using complex = cuda::std::complex<float>;

NVBENCH_DECLARE_TYPE_STRINGS(complex, "C64", "complex");

namespace detail
Expand Down Expand Up @@ -50,15 +60,19 @@ using fundamental_types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t,
#if NVBENCH_HELPER_HAS_I128
int128_t,
#endif
float,
double>;

using all_types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t,
#if NVBENCH_HELPER_HAS_I128
int128_t,
#endif
float,
double,
complex>;
Expand Down
10 changes: 9 additions & 1 deletion cub/benchmarks/nvbench_helper/test/gen_range.cu
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@
#include <catch2/catch.hpp>
#include <nvbench_helper.cuh>

using types = nvbench::type_list<int8_t, int16_t, int32_t, int64_t, int128_t, float, double>;
using types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t,
#if NVBENCH_HELPER_HAS_I128
int128_t,
#endif
float,
double>;

TEMPLATE_LIST_TEST_CASE("Generators produce data within specified range", "[gen]", types)
{
Expand Down
13 changes: 11 additions & 2 deletions cub/benchmarks/nvbench_helper/test/gen_seed.cu
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,17 @@
#include <catch2/catch.hpp>
#include <nvbench_helper.cuh>

using types =
nvbench::type_list<bool, int8_t, int16_t, int32_t, int64_t, int128_t, float, double, complex>;
using types = nvbench::type_list<bool,
int8_t,
int16_t,
int32_t,
int64_t,
#if NVBENCH_HELPER_HAS_I128
int128_t,
#endif
float,
double,
complex>;

TEMPLATE_LIST_TEST_CASE("Generator seeds the data", "[gen]", types)
{
Expand Down
10 changes: 9 additions & 1 deletion cub/benchmarks/nvbench_helper/test/gen_uniform_distribution.cu
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,15 @@ bool is_uniform(thrust::host_vector<T> data, T min, T max)
return chi_square <= critical_value;
}

using types = nvbench::type_list<int8_t, int16_t, int32_t, int64_t, int128_t, float, double>;
using types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t,
#if NVBENCH_HELPER_HAS_I128
int128_t,
#endif
float,
double>;

TEMPLATE_LIST_TEST_CASE("Generators produce uniformly distributed data", "[gen][uniform]", types)
{
Expand Down
11 changes: 10 additions & 1 deletion thrust/benchmarks/bench/reduce/by_key.cu
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,16 @@ static void basic(nvbench::state &state, nvbench::type_list<KeyT, ValueT>)
});
}

using key_types = nvbench::type_list<int8_t, int16_t, int32_t, int64_t, int128_t>;
using key_types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t
#if NVBENCH_HELPER_HAS_I128
,
int128_t
#endif
>;

using value_types = all_types;

NVBENCH_BENCH_TYPES(basic, NVBENCH_TYPE_AXES(key_types, value_types))
Expand Down
10 changes: 9 additions & 1 deletion thrust/benchmarks/bench/scan/exclusive/by_key.cu
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ static void scan(nvbench::state &state, nvbench::type_list<KeyT, ValueT>)
}

using key_types = all_types;
using value_types = nvbench::type_list<int8_t, int16_t, int32_t, int64_t, int128_t>;
using value_types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t
#if NVBENCH_HELPER_HAS_I128
,
int128_t
#endif
>;

NVBENCH_BENCH_TYPES(scan, NVBENCH_TYPE_AXES(key_types, value_types))
.set_name("base")
Expand Down
10 changes: 9 additions & 1 deletion thrust/benchmarks/bench/scan/inclusive/by_key.cu
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ static void scan(nvbench::state &state, nvbench::type_list<KeyT, ValueT>)
}

using key_types = all_types;
using value_types = nvbench::type_list<int8_t, int16_t, int32_t, int64_t, int128_t>;
using value_types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t
#if NVBENCH_HELPER_HAS_I128
,
int128_t
#endif
>;

NVBENCH_BENCH_TYPES(scan, NVBENCH_TYPE_AXES(key_types, value_types))
.set_name("base")
Expand Down
10 changes: 9 additions & 1 deletion thrust/benchmarks/bench/shuffle/basic.cu
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,15 @@ static void basic(nvbench::state &state, nvbench::type_list<T>)
}
}

using types = nvbench::type_list<int8_t, int16_t, int32_t, int64_t, int128_t>;
using types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t
#if NVBENCH_HELPER_HAS_I128
,
int128_t
#endif
>;

NVBENCH_BENCH_TYPES(basic, NVBENCH_TYPE_AXES(types))
.set_name("base")
Expand Down
10 changes: 9 additions & 1 deletion thrust/benchmarks/bench/sort/pairs.cu
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@ static void basic(nvbench::state &state, nvbench::type_list<KeyT, ValueT>)
}

using key_types = fundamental_types;
using value_types = nvbench::type_list<int8_t, int16_t, int32_t, int64_t, int128_t>;
using value_types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t
#if NVBENCH_HELPER_HAS_I128
,
int128_t
#endif
>;

NVBENCH_BENCH_TYPES(basic, NVBENCH_TYPE_AXES(key_types, value_types))
.set_name("base")
Expand Down
10 changes: 9 additions & 1 deletion thrust/benchmarks/bench/sort/pairs_custom.cu
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@ static void basic(nvbench::state &state, nvbench::type_list<KeyT, ValueT>)
}

using key_types = fundamental_types;
using value_types = nvbench::type_list<int8_t, int16_t, int32_t, int64_t, int128_t>;
using value_types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t
#if NVBENCH_HELPER_HAS_I128
,
int128_t
#endif
>;

NVBENCH_BENCH_TYPES(basic, NVBENCH_TYPE_AXES(key_types, value_types))
.set_name("base")
Expand Down
10 changes: 9 additions & 1 deletion thrust/benchmarks/bench/unique/by_key.cu
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,15 @@ static void basic(nvbench::state &state, nvbench::type_list<KeyT, ValueT>)
});
}

using key_types = nvbench::type_list<int8_t, int16_t, int32_t, int64_t, int128_t>;
using key_types = nvbench::type_list<int8_t,
int16_t,
int32_t,
int64_t
#if NVBENCH_HELPER_HAS_I128
,
int128_t
#endif
>;
using value_types = all_types;

NVBENCH_BENCH_TYPES(basic, NVBENCH_TYPE_AXES(key_types, value_types))
Expand Down

0 comments on commit 8b3d11f

Please sign in to comment.