[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:
muh-bot
2026-08-03 12:39:26 +00:00
parent a2a5dd8f00
commit 24ef6a91b5
5439 changed files with 0 additions and 719516 deletions

View File

@@ -1,219 +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) 2024 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#pragma once
#include <cuda/std/__exception/exception_macros.h>
#include <cuda/std/__utility/typeid.h>
#include <cuda/std/string_view> // IWYU pragma: keep
#include <cuda/std/type_traits>
#include <cuda/experimental/execution.cuh>
#include <exception>
#include "testing.cuh"
namespace
{
template <class... Values>
struct checked_value_receiver
{
using receiver_concept = cudax_async::receiver_t;
_CCCL_HOST_DEVICE checked_value_receiver(Values... values)
: _values{values...}
{}
_CCCL_HOST_DEVICE checked_value_receiver(checked_value_receiver&& other) noexcept
: _called{::cuda::std::exchange(other._called, true)}
, _values{::cuda::std::move(other._values)}
{}
_CCCL_HOST_DEVICE ~checked_value_receiver()
{
CHECK(_called);
}
// This overload is needed to avoid an nvcc compiler bug where a variadic
// pack is not visible within the scope of a lambda.
_CCCL_HOST_DEVICE void set_value() && noexcept
{
if constexpr (!::cuda::std::is_same_v<::cuda::std::__type_list<Values...>, ::cuda::std::__type_list<>>)
{
FAIL("expected a value completion; got no values");
}
else
{
_called = true;
}
}
template <class... As>
_CCCL_HOST_DEVICE void set_value(As... as) && noexcept
{
_called = true;
if constexpr (::cuda::std::is_same_v<::cuda::std::__type_list<Values...>, ::cuda::std::__type_list<As...>>)
{
::cuda::std::__apply(
[&](auto const&... vs) {
CHECK(((vs == as) && ...));
},
_values);
}
else
{
FAIL("expected a value completion; got a different value");
}
}
template <class Error>
_CCCL_HOST_DEVICE void set_error(Error) && noexcept
{
_called = true;
FAIL("expected a value completion; got an error");
}
_CCCL_HOST_DEVICE void set_stopped() && noexcept
{
_called = true;
FAIL("expected a value completion; got stopped");
}
bool _called = false;
::cuda::std::__tuple<Values...> _values;
};
template <class... Values>
_CCCL_DEDUCTION_GUIDE_ATTRIBUTES checked_value_receiver(Values...) -> checked_value_receiver<Values...>;
template <class Error = cudax::execution::exception_ptr>
struct checked_error_receiver
{
using receiver_concept = cudax_async::receiver_t;
template <class... As>
_CCCL_HOST_DEVICE void set_value(As...) && noexcept
{
FAIL("expected an error completion; got a value");
}
template <class Ty>
_CCCL_HOST_DEVICE void set_error(Ty ty) && noexcept
{
if constexpr (::cuda::std::is_same_v<Error, Ty>)
{
if (!::cuda::std::is_same_v<Error, cudax::execution::exception_ptr>)
{
CHECK(ty == _error);
}
}
else
{
FAIL("expected an error completion; got a different error");
}
}
_CCCL_HOST_DEVICE void set_error(cudax::execution::exception_ptr eptr) && noexcept
{
_CCCL_TRY
{
cudax::execution::rethrow_exception(eptr);
}
_CCCL_CATCH (Error & e)
{
if constexpr (cuda::std::derived_from<Error, ::std::exception>)
{
CHECK(cuda::std::string_view{e.what()} == _error.what());
}
else
{
SUCCEED();
}
}
_CCCL_CATCH (::std::exception & e)
{
#if defined(_CCCL_NO_TYPEID)
INFO("expected an error completion; got a different error. what: " << e.what());
#else
INFO("expected an error completion; got a different error. what: " << e.what() << ", type: " << typeid(e).name());
#endif
CHECK(false);
}
_CCCL_CATCH_ALL
{
INFO("expected an error completion; got a different error");
CHECK(false);
}
}
_CCCL_HOST_DEVICE void set_stopped() && noexcept
{
FAIL("expected a value completion; got stopped");
}
Error _error;
};
template <class Error>
_CCCL_DEDUCTION_GUIDE_ATTRIBUTES checked_error_receiver(Error) -> checked_error_receiver<Error>;
struct checked_stopped_receiver
{
using receiver_concept = cudax_async::receiver_t;
template <class... As>
_CCCL_HOST_DEVICE void set_value(As...) && noexcept
{
FAIL("expected a stopped completion; got a value");
}
template <class Ty>
_CCCL_HOST_DEVICE void set_error(Ty) && noexcept
{
FAIL("expected an stopped completion; got an error");
}
_CCCL_HOST_DEVICE void set_stopped() && noexcept {}
};
template <class Ty>
struct proxy_value_receiver
{
using receiver_concept = cudax_async::receiver_t;
template <class... As>
_CCCL_HOST_DEVICE void set_value(As...) && noexcept
{
FAIL("expected a value completion; got a different value");
}
_CCCL_HOST_DEVICE void set_value(Ty value) && noexcept
{
_value = value;
}
template <class Error>
_CCCL_HOST_DEVICE void set_error(Error) && noexcept
{
FAIL("expected a value completion; got an error");
}
_CCCL_HOST_DEVICE void set_stopped() && noexcept
{
FAIL("expected a value completion; got stopped");
}
Ty& _value;
};
template <class Ty>
_CCCL_DEDUCTION_GUIDE_ATTRIBUTES proxy_value_receiver(Ty&) -> proxy_value_receiver<Ty>;
} // namespace