[INFRA] Import NVIDIA/CCCL upstream as optimization reference library

CCCL (CUDA C++ Core Libraries) provides:
- CUB: device/block/warp-level GPU primitives (reduce, scan, sort, topk)
- Thrust: high-level parallel algorithms (transform_reduce, sort, scan)
- libcudacxx: CUDA C++ standard library (atomics, barriers, memory)
- cudax: experimental features (memory resources, allocators)
- Tuning policies: per-SM hardware-specific algorithm parameters

Competition optimization vectors mapped to CCCL:
- Output TPS (83% weight): warp_reduce, block_reduce, device_topk
- Input TPS (14% weight): device_scan, block_load, prefetch
- Cache TPS (3% weight): prefix caching strategy patterns
- Memory (0.9 util): pooled/cached/buddy allocators

Source: https://github.com/NVIDIA/cccl (shallow clone, HEAD only)
License: Apache-2.0
This commit is contained in:
EngineX CI
2026-07-30 09:35:51 +00:00
parent b4d01f481e
commit 56fd68e7dd
8871 changed files with 1454674 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
#===----------------------------------------------------------------------===##
#
# Part of CUDA Experimental in CUDA C++ Core Libraries,
# 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) 2026 NVIDIA CORPORATION & AFFILIATES.
#
#===----------------------------------------------------------------------===##
file(GLOB test_srcs LIST_DIRECTORIES FALSE CONFIGURE_DEPENDS *.cu *.cpp)
foreach (src IN LISTS test_srcs)
cudax_add_multi_gpu_test("concepts" test_target "${src}")
endforeach()

View File

@@ -0,0 +1,66 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in CUDA C++ Core Libraries,
// 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) 2026 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#ifndef _CUDAX_TEST_MULTI_GPU_COLLECTIVE_CONCEPTS_COMMON_CUH
#define _CUDAX_TEST_MULTI_GPU_COLLECTIVE_CONCEPTS_COMMON_CUH
#include <cuda/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
#include "concepts_common.cuh"
namespace cudax_multi_gpu_concepts
{
struct collective_communicator_model : communicator_model
{
template <class Tp, class Op>
void reduce(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, Op, ::cuda::std::int32_t, ::cuda::stream_ref);
template <class Tp, class Op>
void all_reduce(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, Op, ::cuda::stream_ref);
template <class Tp>
void gather(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
template <class Tp>
void gather_v(
group_guard_type&,
Tp*,
::cuda::std::size_t,
Tp*,
const ::cuda::std::size_t*,
const ::cuda::std::size_t*,
::cuda::std::int32_t,
::cuda::stream_ref);
template <class Tp>
void all_gather(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::stream_ref);
template <class Tp>
void broadcast(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
template <class Tp>
void all_to_all(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::stream_ref);
template <class Tp>
void all_to_all_v(
group_guard_type&,
Tp*,
const ::cuda::std::size_t*,
const ::cuda::std::size_t*,
Tp*,
const ::cuda::std::size_t*,
const ::cuda::std::size_t*,
::cuda::stream_ref);
};
} // namespace cudax_multi_gpu_concepts
#endif // _CUDAX_TEST_MULTI_GPU_COLLECTIVE_CONCEPTS_COMMON_CUH

View File

@@ -0,0 +1,44 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in CUDA C++ Core Libraries,
// 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) 2026 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct no_send : types::basic_communicator_model
{
template <class Tp>
void recv(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
struct no_recv : types::basic_communicator_model
{
template <class Tp>
void send(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("communicator concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__communicator<types::communicator_model>);
STATIC_REQUIRE(!cudax::__communicator<no_send>);
STATIC_REQUIRE(!cudax::__communicator<no_recv>);
}

View File

@@ -0,0 +1,43 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in CUDA C++ Core Libraries,
// 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) 2026 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#ifndef _CUDAX_TEST_MULTI_GPU_CONCEPTS_COMMON_CUH
#define _CUDAX_TEST_MULTI_GPU_CONCEPTS_COMMON_CUH
#include <cuda/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
namespace cudax_multi_gpu_concepts
{
struct group_guard
{};
struct basic_communicator_model
{
using native_handle_type = int;
using group_guard_type = group_guard;
native_handle_type native_handle() noexcept;
::cuda::std::int32_t rank() noexcept;
::cuda::std::int32_t size() noexcept;
group_guard_type group_guard();
};
struct communicator_model : basic_communicator_model
{
template <class Tp>
void send(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
template <class Tp>
void recv(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
} // namespace cudax_multi_gpu_concepts
#endif // _CUDAX_TEST_MULTI_GPU_CONCEPTS_COMMON_CUH

View File

@@ -0,0 +1,43 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in CUDA C++ Core Libraries,
// 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) 2026 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#include <cuda/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct all_gather_returns_int : types::communicator_model
{
template <class Tp>
int all_gather(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_all_gather concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_all_gather<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_all_gather<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_all_gather<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_all_gather<all_gather_returns_int>);
}

View File

@@ -0,0 +1,53 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in CUDA C++ Core Libraries,
// 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) 2026 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#include <cuda/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/__type_traits/enable_if.h>
#include <cuda/std/__type_traits/is_void.h>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct all_reduce_rejects_void : types::communicator_model
{
template <class Tp, class Op, ::cuda::std::enable_if_t<!::cuda::std::is_void_v<Tp>, int> = 0>
void all_reduce(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, Op, ::cuda::stream_ref);
};
struct all_reduce_returns_int : types::communicator_model
{
template <class Tp, class Op>
int all_reduce(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, Op, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_all_reduce concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_all_reduce<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_all_reduce<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_all_reduce<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_all_reduce<all_reduce_returns_int>);
STATIC_REQUIRE(cudax::__has_all_reduce<all_reduce_rejects_void, int*>);
STATIC_REQUIRE(!cudax::__has_all_reduce<all_reduce_rejects_void, void*>);
}

View File

@@ -0,0 +1,43 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in CUDA C++ Core Libraries,
// 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) 2026 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#include <cuda/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct all_to_all_returns_int : types::communicator_model
{
template <class Tp>
int all_to_all(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_all_to_all concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_all_to_all<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_all_to_all<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_all_to_all<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_all_to_all<all_to_all_returns_int>);
}

View File

@@ -0,0 +1,51 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in CUDA C++ Core Libraries,
// 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) 2026 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#include <cuda/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct all_to_all_v_returns_int : types::communicator_model
{
template <class Tp>
int all_to_all_v(
group_guard_type&,
Tp*,
const ::cuda::std::size_t*,
const ::cuda::std::size_t*,
Tp*,
const ::cuda::std::size_t*,
const ::cuda::std::size_t*,
::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_all_to_all_v concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_all_to_all_v<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_all_to_all_v<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_all_to_all_v<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_all_to_all_v<all_to_all_v_returns_int>);
}

View File

@@ -0,0 +1,44 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in CUDA C++ Core Libraries,
// 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) 2026 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#include <cuda/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct broadcast_returns_int : types::communicator_model
{
template <class Tp>
int broadcast(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_broadcast concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_broadcast<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_broadcast<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_broadcast<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_broadcast<broadcast_returns_int>);
}

View File

@@ -0,0 +1,44 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in CUDA C++ Core Libraries,
// 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) 2026 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#include <cuda/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct gather_returns_int : types::communicator_model
{
template <class Tp>
int gather(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_gather concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_gather<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_gather<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_gather<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_gather<gather_returns_int>);
}

View File

@@ -0,0 +1,51 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in CUDA C++ Core Libraries,
// 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) 2026 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#include <cuda/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct gather_v_returns_int : types::communicator_model
{
template <class Tp>
int gather_v(group_guard_type&,
Tp*,
::cuda::std::size_t,
Tp*,
const ::cuda::std::size_t*,
const ::cuda::std::size_t*,
::cuda::std::int32_t,
::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_gather_v concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_gather_v<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_gather_v<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_gather_v<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_gather_v<gather_v_returns_int>);
}

View File

@@ -0,0 +1,50 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in CUDA C++ Core Libraries,
// 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) 2026 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#include <cuda/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct recv_returns_int : types::basic_communicator_model
{
template <class Tp>
int recv(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
struct no_recv : types::basic_communicator_model
{
template <class Tp>
void send(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_recv concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_recv<types::communicator_model>);
STATIC_REQUIRE(cudax::__has_recv<types::communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_recv<no_recv>);
STATIC_REQUIRE(!cudax::__has_recv<recv_returns_int>);
}

View File

@@ -0,0 +1,44 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in CUDA C++ Core Libraries,
// 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) 2026 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#include <cuda/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "collective_concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct reduce_returns_int : types::communicator_model
{
template <class Tp, class Op>
int reduce(group_guard_type&, Tp*, Tp*, ::cuda::std::size_t, Op, ::cuda::std::int32_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_reduce concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_reduce<types::collective_communicator_model>);
STATIC_REQUIRE(cudax::__has_reduce<types::collective_communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_reduce<types::communicator_model>);
STATIC_REQUIRE(!cudax::__has_reduce<reduce_returns_int>);
}

View File

@@ -0,0 +1,50 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDA Experimental in CUDA C++ Core Libraries,
// 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) 2026 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#include <cuda/__stream/stream_ref.h>
#include <cuda/std/__cstddef/types.h>
#include <cuda/std/cstdint>
#include <cuda/experimental/__multi_gpu/concepts.h>
#include <testing.cuh>
#include "concepts_common.cuh"
namespace
{
namespace types = cudax_multi_gpu_concepts;
// nvcc ignores [[maybe_unused]] entirely
_CCCL_BEGIN_NV_DIAG_SUPPRESS(177)
struct no_send : types::basic_communicator_model
{
template <class Tp>
void send_sync(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t);
};
struct send_returns_int : no_send
{
template <class Tp>
int send(group_guard_type&, Tp*, ::cuda::std::size_t, ::cuda::std::int32_t, ::cuda::stream_ref);
};
_CCCL_END_NV_DIAG_SUPPRESS()
} // namespace
C2H_TEST("__has_send concept", "[multi_gpu][concepts]")
{
STATIC_REQUIRE(cudax::__has_send<types::communicator_model>);
STATIC_REQUIRE(cudax::__has_send<types::communicator_model, long*>);
STATIC_REQUIRE(!cudax::__has_send<no_send>);
STATIC_REQUIRE(!cudax::__has_send<send_returns_int>);
}