[CCCL] 瘦身 + 补全: 移除 cudax/python/libcudacxx-tests 冗余文件, 新增 c2h 测试助手 + cmake 构建系统 + 8 个 CUDA thrust examples
变更摘要:
- 删除: cudax/ (783 files, 7.2M) — 实验性组件,竞赛不需要
- 删除: python/ (226 files, 2.0M) — Python 绑定,竞赛不需要
- 删除: libcudacxx/{test,benchmarks,codegen,cmake,share} (4432 files, 31M)
保留: libcudacxx/include/ (1463 headers, cuda::std 编译依赖)
- 新增: c2h/ (27 files) — CUB Catch2 测试辅助头文件,编译 243 个测试必需
- 新增: cmake/ (29 files) — CCCL 原生 CMake 构建系统
- 新增: thrust/examples/cuda/ (7 files) + cpp_integration/ (1 file)
async_reduce, custom_temporary_allocation, explicit_cuda_stream,
global_device_vector, range_view, unwrap_pointer, wrap_pointer, device
结果: cccl_upstream 从 74M→35M (瘦身 53%), 核心内容 100% 保留:
27/27 tuning headers, 78 benchmarks, 243 tests,
60 thrust examples, 18 CUB examples, 全部编译头文件
This commit is contained in:
@@ -1,140 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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) 2025 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Include this first
|
||||
#include <cuda/experimental/execution.cuh>
|
||||
|
||||
// Then include the test helpers
|
||||
#include "testing.cuh" // IWYU pragma: keep
|
||||
|
||||
// NOLINTBEGIN(misc-unused-using-decls)
|
||||
using cuda::experimental::execution::completion_signatures;
|
||||
using cuda::experimental::execution::set_error;
|
||||
using cuda::experimental::execution::set_error_t;
|
||||
using cuda::experimental::execution::set_stopped;
|
||||
using cuda::experimental::execution::set_stopped_t;
|
||||
using cuda::experimental::execution::set_value;
|
||||
using cuda::experimental::execution::set_value_t;
|
||||
// NOLINTEND(misc-unused-using-decls)
|
||||
|
||||
namespace
|
||||
{
|
||||
C2H_TEST("", "[utilities][completion_signatures]")
|
||||
{
|
||||
STATIC_REQUIRE(completion_signatures{} == completion_signatures{});
|
||||
STATIC_REQUIRE_FALSE(completion_signatures{} != completion_signatures{});
|
||||
}
|
||||
|
||||
// Additional tests for completion_signatures
|
||||
C2H_TEST("completion_signatures_basic", "[utilities][completion_signatures]")
|
||||
{
|
||||
constexpr auto cs_empty = completion_signatures<>{};
|
||||
constexpr auto cs_value = completion_signatures<set_value_t(int)>{};
|
||||
constexpr auto cs_error = completion_signatures<set_error_t(float)>{};
|
||||
constexpr auto cs_stopped = completion_signatures<set_stopped_t()>{};
|
||||
constexpr auto cs_all = completion_signatures<set_value_t(int), set_error_t(float), set_stopped_t()>{};
|
||||
|
||||
// Test size
|
||||
STATIC_REQUIRE(cs_empty.size() == 0);
|
||||
STATIC_REQUIRE(cs_value.size() == 1);
|
||||
STATIC_REQUIRE(cs_all.size() == 3);
|
||||
|
||||
// Test contains
|
||||
STATIC_REQUIRE(cs_value.contains(static_cast<set_value_t (*)(int)>(nullptr)));
|
||||
STATIC_REQUIRE_FALSE(cs_value.contains(static_cast<set_error_t (*)(float)>(nullptr)));
|
||||
STATIC_REQUIRE(cs_all.contains(static_cast<set_stopped_t (*)()>(nullptr)));
|
||||
|
||||
// Test count
|
||||
STATIC_REQUIRE(cs_all.count(set_value) == 1);
|
||||
STATIC_REQUIRE(cs_all.count(set_error) == 1);
|
||||
STATIC_REQUIRE(cs_all.count(set_stopped) == 1);
|
||||
|
||||
// Test operator==
|
||||
STATIC_REQUIRE(cs_value == cs_value);
|
||||
STATIC_REQUIRE_FALSE(cs_value == cs_error);
|
||||
STATIC_REQUIRE(cs_empty == cs_empty);
|
||||
STATIC_REQUIRE(cs_all == cs_all);
|
||||
STATIC_REQUIRE(completion_signatures<set_value_t(int), set_error_t(float)>{}
|
||||
== completion_signatures<set_error_t(float), set_value_t(int)>{});
|
||||
|
||||
// Test operator!=
|
||||
STATIC_REQUIRE(cs_value != cs_error);
|
||||
STATIC_REQUIRE_FALSE(cs_all != cs_all);
|
||||
|
||||
// Test operator+
|
||||
STATIC_REQUIRE((cs_value + cs_error) == completion_signatures<set_value_t(int), set_error_t(float)>{});
|
||||
STATIC_REQUIRE((cs_empty + cs_value) == cs_value);
|
||||
STATIC_REQUIRE((cs_value + cs_empty) == cs_value);
|
||||
|
||||
// Test operator-
|
||||
STATIC_REQUIRE((cs_all - cs_value) == completion_signatures<set_error_t(float), set_stopped_t()>{});
|
||||
STATIC_REQUIRE((cs_all - cs_error) == completion_signatures<set_value_t(int), set_stopped_t()>{});
|
||||
STATIC_REQUIRE((cs_all - cs_stopped) == completion_signatures<set_value_t(int), set_error_t(float)>{});
|
||||
STATIC_REQUIRE((cs_all - cs_all) == completion_signatures<>{});
|
||||
STATIC_REQUIRE((cs_value - cs_error) == cs_value);
|
||||
}
|
||||
|
||||
// Test select
|
||||
C2H_TEST("completion_signatures_select", "[utilities][completion_signatures]")
|
||||
{
|
||||
constexpr auto cs = completion_signatures<set_value_t(int), set_error_t(float), set_stopped_t()>{};
|
||||
|
||||
// select(set_value) should return only set_value_t(int)
|
||||
constexpr auto v = cs.select(set_value);
|
||||
STATIC_REQUIRE(v.size() == 1);
|
||||
STATIC_REQUIRE(v.contains<set_value_t(int)>());
|
||||
|
||||
// select(set_error) should return only set_error_t(float)
|
||||
constexpr auto e = cs.select(set_error);
|
||||
STATIC_REQUIRE(e.size() == 1);
|
||||
STATIC_REQUIRE(e.contains<set_error_t(float)>());
|
||||
|
||||
// select(set_stopped) should return only set_stopped_t()
|
||||
constexpr auto s = cs.select(set_stopped);
|
||||
STATIC_REQUIRE(s.size() == 1);
|
||||
STATIC_REQUIRE(s.contains<set_stopped_t()>());
|
||||
}
|
||||
|
||||
// Test filter
|
||||
struct filter_value_only
|
||||
{
|
||||
template <class Sig>
|
||||
constexpr bool operator()(Sig*) const noexcept
|
||||
{
|
||||
return cuda::experimental::execution::__detail::__signature_disposition<Sig>
|
||||
== cuda::experimental::execution::__disposition::__value;
|
||||
}
|
||||
};
|
||||
|
||||
C2H_TEST("completion_signatures_filter", "[utilities][completion_signatures]")
|
||||
{
|
||||
constexpr auto cs = completion_signatures<set_value_t(int), set_error_t(float), set_stopped_t()>{};
|
||||
constexpr auto filtered = cs.filter(filter_value_only{});
|
||||
STATIC_REQUIRE(filtered.size() == 1);
|
||||
STATIC_REQUIRE(filtered.contains<set_value_t(int)>());
|
||||
}
|
||||
|
||||
// Test apply
|
||||
struct count_signatures
|
||||
{
|
||||
template <class... Sigs>
|
||||
constexpr int operator()(Sigs*...) const noexcept
|
||||
{
|
||||
return sizeof...(Sigs);
|
||||
}
|
||||
};
|
||||
|
||||
C2H_TEST("completion_signatures_apply", "[utilities][completion_signatures]")
|
||||
{
|
||||
constexpr auto cs = completion_signatures<set_value_t(int), set_error_t(float), set_stopped_t()>{};
|
||||
constexpr int count = cs.apply(count_signatures{});
|
||||
STATIC_REQUIRE(count == 3);
|
||||
}
|
||||
} // namespace
|
||||
Reference in New Issue
Block a user