//===----------------------------------------------------------------------===// // // Part of libcu++, the C++ Standard Library for your entire system, // under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. // //===----------------------------------------------------------------------===// // UNSUPPORTED: pre-sm-70 // TODO: Remove pointless comparison suppression when compiler fixes short-circuiting #include #include #include "test_macros.h" TEST_NV_DIAG_SUPPRESS(186) // pointless comparison of unsigned integer with zero template struct single_thread_test_group { __host__ __device__ void sync() const {} __host__ __device__ T_size size() const { return 1; } __host__ __device__ T_thread_rank thread_rank() const { return 0; } }; template __host__ __device__ void test_fully_specialized() { auto group = single_thread_test_group{}; cuda::pipeline_shared_state shared_state; auto pipe_partitioned_implicit = make_pipeline(group, &shared_state, 1); auto pipe_partitioned_explicit_consumer = make_pipeline(group, &shared_state, cuda::pipeline_role::consumer); auto pipe_partitioned_explicit_producer = make_pipeline(group, &shared_state, cuda::pipeline_role::producer); auto pipe_unified = make_pipeline(group, &shared_state); char src[2] = {1, 2}; char dst[2] = {0, 0}; pipe_unified.producer_acquire(); memcpy_async(group, &dst[0], &src[0], 1, pipe_unified); memcpy_async(group, &dst[1], &src[1], cuda::aligned_size_t<1>(1), pipe_unified); pipe_unified.producer_commit(); pipe_unified.consumer_wait(); assert(dst[0] == 1); assert(dst[1] == 2); pipe_unified.consumer_release(); } template __host__ __device__ void test_select_thread_rank_type() { test_fully_specialized(); test_fully_specialized(); test_fully_specialized(); test_fully_specialized(); test_fully_specialized(); test_fully_specialized(); test_fully_specialized(); test_fully_specialized(); test_fully_specialized(); } template __host__ __device__ void test_select_size_type() { test_select_thread_rank_type(); test_select_thread_rank_type(); test_select_thread_rank_type(); test_select_thread_rank_type(); test_select_thread_rank_type(); test_select_thread_rank_type(); test_select_thread_rank_type(); test_select_thread_rank_type(); test_select_thread_rank_type(); }