From 3f5b5410464bbeb8bc90f4f71b2adc3fcf9eef99 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 17:01:48 +0000 Subject: [PATCH] [pre-commit.ci] auto code formatting --- .../libcudacxx/heterogeneous/atomic.pass.cpp | 15 ++-- .../heterogeneous/atomic_ref.pass.cpp | 5 +- .../libcudacxx/heterogeneous/barrier.pass.cpp | 2 +- .../test/libcudacxx/heterogeneous/helpers.h | 84 ++++++++++++------- .../libcudacxx/heterogeneous/latch.pass.cpp | 4 +- .../heterogeneous/latch_abi_v2.pass.cpp | 2 +- .../test/libcudacxx/heterogeneous/meta.h | 71 +++++++++------- 7 files changed, 106 insertions(+), 77 deletions(-) diff --git a/libcudacxx/test/libcudacxx/heterogeneous/atomic.pass.cpp b/libcudacxx/test/libcudacxx/heterogeneous/atomic.pass.cpp index 704bff13582..1c79130f483 100644 --- a/libcudacxx/test/libcudacxx/heterogeneous/atomic.pass.cpp +++ b/libcudacxx/test/libcudacxx/heterogeneous/atomic.pass.cpp @@ -145,18 +145,15 @@ using basic_testers = exchange_tester<-12, 17>>; using arithmetic_atomic_testers = - append, - fetch_sub_tester<30, 21, 9>, - fetch_sub_tester<9, 17, -8>>; + append, fetch_sub_tester<30, 21, 9>, fetch_sub_tester<9, 17, -8>>; using bitwise_atomic_testers = append, - fetch_or_tester<2, 13, 15>, - fetch_and_tester<15, 8, 8>, - fetch_and_tester<8, 13, 8>, - fetch_xor_tester<8, 12, 4>>; + fetch_add_tester<-8, 10, 2>, + fetch_or_tester<2, 13, 15>, + fetch_and_tester<15, 8, 8>, + fetch_and_tester<8, 13, 8>, + fetch_xor_tester<8, 12, 4>>; class big_not_lockfree_type { diff --git a/libcudacxx/test/libcudacxx/heterogeneous/atomic_ref.pass.cpp b/libcudacxx/test/libcudacxx/heterogeneous/atomic_ref.pass.cpp index dd98d04e8a4..435d641d528 100644 --- a/libcudacxx/test/libcudacxx/heterogeneous/atomic_ref.pass.cpp +++ b/libcudacxx/test/libcudacxx/heterogeneous/atomic_ref.pass.cpp @@ -155,10 +155,7 @@ using basic_testers = exchange_tester<-12, 17>>; using arithmetic_atomic_testers = - append, - fetch_sub_tester<30, 21, 9>, - fetch_sub_tester<9, 17, -8>>; + append, fetch_sub_tester<30, 21, 9>, fetch_sub_tester<9, 17, -8>>; using bitwise_atomic_testers = append #include +#include #include "helpers.h" diff --git a/libcudacxx/test/libcudacxx/heterogeneous/helpers.h b/libcudacxx/test/libcudacxx/heterogeneous/helpers.h index 7c7cbcec296..94c0cf34f53 100644 --- a/libcudacxx/test/libcudacxx/heterogeneous/helpers.h +++ b/libcudacxx/test/libcudacxx/heterogeneous/helpers.h @@ -41,9 +41,11 @@ DEFINE_ASYNC_TRAIT(_validate) #undef DEFINE_ASYNC_TRAIT template -struct has_threadcount : std::false_type { }; +struct has_threadcount : std::false_type +{}; template -struct has_threadcount : std::true_type {}; +struct has_threadcount : std::true_type +{}; template ::value> struct threadcount_trait_impl @@ -196,7 +198,8 @@ void device_destroy(T* object) HETEROGENEOUS_SAFE_CALL(cudaDeviceSynchronize()); } template -void device_launch_async(Fn& launcher) { +void device_launch_async(Fn& launcher) +{ auto streamManager = [launcher]() { cudaStream_t stream; HETEROGENEOUS_SAFE_CALL(cudaStreamCreate(&stream)); @@ -221,7 +224,7 @@ void device_initialize(T& object) auto kernel_launcher = [&object](cudaStream_t stream) { constexpr auto tc = threadcount_trait::value; #ifdef DEBUG_TESTERS - printf("%i device init threads launched\r\n", (int)tc); + printf("%i device init threads launched\r\n", (int) tc); fflush(stdout); #endif initialization_kernel<<<1, tc, 0, stream>>>(object); @@ -251,7 +254,7 @@ void device_validate(T& object) auto kernel_launcher = [&object](cudaStream_t stream) { constexpr auto tc = threadcount_trait::value; #ifdef DEBUG_TESTERS - printf("%i device validate threads launched\r\n", (int)tc); + printf("%i device validate threads launched\r\n", (int) tc); fflush(stdout); #endif validation_kernel<<<1, tc, 0, stream>>>(object); @@ -280,11 +283,12 @@ void host_initialize(T& object) constexpr auto tc = threadcount_trait::value; #ifdef DEBUG_TESTERS - printf("%i host init threads launched\r\n", (int)tc); + printf("%i host init threads launched\r\n", (int) tc); fflush(stdout); #endif - for (size_t i = 0; i < tc; i++) { + for (size_t i = 0; i < tc; i++) + { host_threads().emplace_back([&] { initialize(object); }); @@ -311,11 +315,12 @@ void host_validate(T& object) constexpr auto tc = threadcount_trait::value; #ifdef DEBUG_TESTERS - printf("%i host validate threads launched\r\n", (int)tc); - fflush(stdout); + printf("%i host validate threads launched\r\n", (int) tc); + fflush(stdout); #endif - for (size_t i = 0; i < tc; i++) { + for (size_t i = 0; i < tc; i++) + { host_threads().emplace_back([&] { validate(object); }); @@ -339,28 +344,34 @@ template using performer = void (*)(T&); template -struct initializer_validator { +struct initializer_validator +{ performer initializer; performer validator; }; -struct host_launcher { +struct host_launcher +{ template - static initializer_validator get_exec() { + static initializer_validator get_exec() + { return initializer_validator{host_initialize, host_validate}; } }; -struct device_launcher { +struct device_launcher +{ template - static initializer_validator get_exec() { + static initializer_validator get_exec() + { return initializer_validator{device_initialize, device_validate}; } }; -template -void do_heterogeneous_test(type_list, type_list, Args... args) { - void *pointer = nullptr; +template +void do_heterogeneous_test(type_list, type_list, Args... args) +{ + void* pointer = nullptr; HETEROGENEOUS_SAFE_CALL(cudaMallocHost(&pointer, sizeof(T))); T& object = *device_construct(pointer, args...); @@ -382,25 +393,38 @@ void do_heterogeneous_test(type_list, type_list, Args. } template -using enable_if_permutations_remain = typename std::enable_if::type; +using enable_if_permutations_remain = typename std::enable_if::type; template -using enable_if_no_permutations_remain = typename std::enable_if::type; +using enable_if_no_permutations_remain = typename std::enable_if::type; -template = 0> -void permute_tests(type_list, type_list, Args... args) { +template = 0> +void permute_tests(type_list, type_list, Args... args) +{ #ifdef DEBUG_TESTERS printf("Testing permutation %zu of %zu\r\n", Idx, sizeof...(Testers)); fflush(stdout); #endif do_heterogeneous_test(type_list{}, type_list{}, args...); - permute_tests(type_list{}, rotl{}, args...); + permute_tests(type_list{}, rotl{}, args...); } -template = 0> -void permute_tests(type_list, type_list, Args... args) {} +template = 0> +void permute_tests(type_list, type_list, Args... args) +{} -template -void permute_tests(type_list, type_list, Args... args) { +template +void permute_tests(type_list, type_list, Args... args) +{ permute_tests(type_list{}, type_list{}, args...); } @@ -408,7 +432,7 @@ template void validate_device_dynamic(tester_list, Args... args) { // ex: type_list - using initial_launcher_list = append_n, host_launcher>; + using initial_launcher_list = append_n, host_launcher>; permute_tests(type_list{}, initial_launcher_list{}, args...); } @@ -638,7 +662,7 @@ struct performer_adapter using async_initialize = async_trait; using async_validate = async_trait; - static constexpr auto threadcount = threadcount_trait::value; + static constexpr auto threadcount = threadcount_trait::value; template __host__ __device__ static void initialize(T& t) @@ -653,7 +677,7 @@ struct performer_adapter using async_initialize = async_trait; using async_validate = async_trait; - static constexpr auto threadcount = threadcount_trait::value; + static constexpr auto threadcount = threadcount_trait::value; template __host__ __device__ static void initialize(T&) diff --git a/libcudacxx/test/libcudacxx/heterogeneous/latch.pass.cpp b/libcudacxx/test/libcudacxx/heterogeneous/latch.pass.cpp index 60fcffff7d0..b869f74d797 100644 --- a/libcudacxx/test/libcudacxx/heterogeneous/latch.pass.cpp +++ b/libcudacxx/test/libcudacxx/heterogeneous/latch.pass.cpp @@ -11,8 +11,8 @@ // uncomment for a really verbose output detailing what test steps are being launched // #define DEBUG_TESTERS -#include #include +#include #include "helpers.h" @@ -31,7 +31,7 @@ struct count_down template struct arrive_and_wait { - using async = cuda::std::true_type; + using async = cuda::std::true_type; static constexpr size_t threadcount = N; template diff --git a/libcudacxx/test/libcudacxx/heterogeneous/latch_abi_v2.pass.cpp b/libcudacxx/test/libcudacxx/heterogeneous/latch_abi_v2.pass.cpp index 11b621b555e..bf5cb06278b 100644 --- a/libcudacxx/test/libcudacxx/heterogeneous/latch_abi_v2.pass.cpp +++ b/libcudacxx/test/libcudacxx/heterogeneous/latch_abi_v2.pass.cpp @@ -13,8 +13,8 @@ #define _LIBCUDACXX_CUDA_ABI_VERSION 2 -#include #include +#include #include "helpers.h" diff --git a/libcudacxx/test/libcudacxx/heterogeneous/meta.h b/libcudacxx/test/libcudacxx/heterogeneous/meta.h index e5a777c400b..bfd6b8049da 100644 --- a/libcudacxx/test/libcudacxx/heterogeneous/meta.h +++ b/libcudacxx/test/libcudacxx/heterogeneous/meta.h @@ -17,41 +17,48 @@ #ifndef HETEROGENEOUS_META_H #define HETEROGENEOUS_META_H -template -struct type_list{}; +template +struct type_list +{}; // Rotates the typelist by removing the head and moving it to the tail -template -struct rotl_impl { - // Empty or 1 element case - using type = type_list; +template +struct rotl_impl +{ + // Empty or 1 element case + using type = type_list; }; -template -struct rotl_impl { - using type = type_list; +template +struct rotl_impl +{ + using type = type_list; }; -template -struct rotl_impl> { - using type = typename rotl_impl::type; +template +struct rotl_impl> +{ + using type = typename rotl_impl::type; }; -template +template using rotl = typename rotl_impl::type; // static_assert(std::is_same, type_list>(), ""); // static_assert(std::is_same, type_list>(), ""); template typename Fn> -struct for_n_impl { - using type = typename for_n_impl, Fn>::type; +struct for_n_impl +{ + using type = typename for_n_impl, Fn>::type; }; template typename Fn> -struct for_n_impl<1, T, Fn> { - using type = Fn; +struct for_n_impl<1, T, Fn> +{ + using type = Fn; }; template typename Fn> -struct for_n_impl<0, T, Fn> { - using type = T; +struct for_n_impl<0, T, Fn> +{ + using type = T; }; template typename Fn> @@ -61,14 +68,16 @@ using for_n = typename for_n_impl::type; // static_assert(std::is_same, rotl>, type_list>(), ""); template