Skip to content

Commit 5446030

Browse files
committed
Cleanups + fix macro check failures
1 parent bc0d725 commit 5446030

File tree

2 files changed

+21
-28
lines changed

2 files changed

+21
-28
lines changed

cmake/header_testing.cmake

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,18 @@
2020
# .inl files are not globbed for, because they are not supposed to be used as public
2121
# entrypoints.
2222

23-
# Meta target for all header builds:
2423
add_custom_target(cuco.all.headers)
2524

2625
function(cuco_add_header_test label definitions)
2726
set(config_prefix "cuco")
2827

29-
# GLOB ALL THE THINGS - similar to Thrust's approach, including detail headers
30-
# Use GLOB_RECURSE to find all headers recursively
3128
file(GLOB_RECURSE headers
3229
RELATIVE "${CUCO_SOURCE_DIR}/include"
3330
CONFIGURE_DEPENDS
3431
"${CUCO_SOURCE_DIR}/include/cuco/*.cuh"
3532
"${CUCO_SOURCE_DIR}/include/cuco/*.hpp"
3633
)
3734

38-
# Debug: Print found headers
3935
list(LENGTH headers headers_count)
4036
message(STATUS "Found ${headers_count} headers for testing: ${headers}")
4137

@@ -50,10 +46,9 @@ function(cuco_add_header_test label definitions)
5046
list(REMOVE_ITEM headers ${excluded_headers})
5147
endif()
5248

53-
# Only test with CUDA compiler since cuco is device-only
5449
set(headertest_target ${config_prefix}.headers.${label})
5550

56-
# Generate header test sources (simple approach since CCCL utilities aren't available)
51+
# Generate header test sources
5752
set(header_srcs)
5853
foreach (header IN LISTS headers)
5954
set(header_src "${CMAKE_CURRENT_BINARY_DIR}/headers/${headertest_target}/${header}.cu")
@@ -79,9 +74,7 @@ function(cuco_add_header_test label definitions)
7974
$<$<COMPILE_LANGUAGE:CUDA>:--expt-extended-lambda>
8075
)
8176

82-
# Disable macro checks for now since cuco has known issues with 'I' identifier
83-
# This should be removed once the macro collision issues are fixed
84-
target_compile_definitions(${headertest_target} PRIVATE CUCO_IGNORE_HEADER_MACRO_CHECKS)
77+
# Macro collision checks are enabled to ensure cuco headers don't conflict with system headers
8578

8679
add_dependencies(cuco.all.headers ${headertest_target})
8780
endfunction()

include/cuco/detail/pair/tuple_helpers.inl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, NVIDIA CORPORATION.
2+
* Copyright (c) 2023-2025, NVIDIA CORPORATION.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,8 +26,8 @@ struct tuple_size<volatile cuco::pair<T1, T2>> : tuple_size<cuco::pair<T1, T2>>
2626
template <typename T1, typename T2>
2727
struct tuple_size<const volatile cuco::pair<T1, T2>> : tuple_size<cuco::pair<T1, T2>> {};
2828

29-
template <std::size_t I, typename T1, typename T2>
30-
struct tuple_element<I, cuco::pair<T1, T2>> {
29+
template <std::size_t Index, typename T1, typename T2>
30+
struct tuple_element<Index, cuco::pair<T1, T2>> {
3131
using type = void;
3232
};
3333

@@ -61,48 +61,48 @@ template <typename T1, typename T2>
6161
struct tuple_element<1, const volatile cuco::pair<T1, T2>> : tuple_element<1, cuco::pair<T1, T2>> {
6262
};
6363

64-
template <std::size_t I, typename T1, typename T2>
64+
template <std::size_t Index, typename T1, typename T2>
6565
__host__ __device__ constexpr auto get(cuco::pair<T1, T2>& p) ->
66-
typename tuple_element<I, cuco::pair<T1, T2>>::type&
66+
typename tuple_element<Index, cuco::pair<T1, T2>>::type&
6767
{
68-
static_assert(I < 2);
69-
if constexpr (I == 0) {
68+
static_assert(Index < 2);
69+
if constexpr (Index == 0) {
7070
return p.first;
7171
} else {
7272
return p.second;
7373
}
7474
}
7575

76-
template <std::size_t I, typename T1, typename T2>
76+
template <std::size_t Index, typename T1, typename T2>
7777
__host__ __device__ constexpr auto get(cuco::pair<T1, T2>&& p) ->
78-
typename tuple_element<I, cuco::pair<T1, T2>>::type&&
78+
typename tuple_element<Index, cuco::pair<T1, T2>>::type&&
7979
{
80-
static_assert(I < 2);
81-
if constexpr (I == 0) {
80+
static_assert(Index < 2);
81+
if constexpr (Index == 0) {
8282
return cuda::std::move(p.first);
8383
} else {
8484
return cuda::std::move(p.second);
8585
}
8686
}
8787

88-
template <std::size_t I, typename T1, typename T2>
88+
template <std::size_t Index, typename T1, typename T2>
8989
__host__ __device__ constexpr auto get(cuco::pair<T1, T2> const& p) ->
90-
typename tuple_element<I, cuco::pair<T1, T2>>::type const&
90+
typename tuple_element<Index, cuco::pair<T1, T2>>::type const&
9191
{
92-
static_assert(I < 2);
93-
if constexpr (I == 0) {
92+
static_assert(Index < 2);
93+
if constexpr (Index == 0) {
9494
return p.first;
9595
} else {
9696
return p.second;
9797
}
9898
}
9999

100-
template <std::size_t I, typename T1, typename T2>
100+
template <std::size_t Index, typename T1, typename T2>
101101
__host__ __device__ constexpr auto get(cuco::pair<T1, T2> const&& p) ->
102-
typename tuple_element<I, cuco::pair<T1, T2>>::type const&&
102+
typename tuple_element<Index, cuco::pair<T1, T2>>::type const&&
103103
{
104-
static_assert(I < 2);
105-
if constexpr (I == 0) {
104+
static_assert(Index < 2);
105+
if constexpr (Index == 0) {
106106
return cuda::std::move(p.first);
107107
} else {
108108
return cuda::std::move(p.second);

0 commit comments

Comments
 (0)