Skip to content

[libcu++] Use static call operator when possible - #10711

Open
miscco wants to merge 1 commit into
NVIDIA:mainfrom
miscco:static_call_operator
Open

[libcu++] Use static call operator when possible#10711
miscco wants to merge 1 commit into
NVIDIA:mainfrom
miscco:static_call_operator

Conversation

@miscco

@miscco miscco commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

We have the issue that our CPOs are not tile accessible objects

However, we actually never need that because their call operator could be static.

So make it so that it is always static if used like this

@miscco
miscco requested a review from a team as a code owner August 7, 2026 10:28
@miscco
miscco requested a review from griwes August 7, 2026 10:28
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Aug 7, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Summary by CodeRabbit

  • Compatibility

    • Improved support for modern CUDA compilation modes, including device tile compilation.
    • Improved compatibility for callable operations across ranges, algorithms, iterators, views, containers, and parallel algorithms.
  • Bug Fixes

    • Standardized range access through public size, data, begin, end, distance, and iterator operations.
    • Preserved existing behavior for buffers, memory resources, views, and containers.
  • Tests

    • Updated coverage for ranges, iterators, views, and tile compilation scenarios.

Walkthrough

The change adds static call-operator support for tile compilation, replaces internal CPO calls with public ranges APIs, updates library components and CUDA PSTL dispatchers, and adjusts range tests and compatibility annotations.

Changes

Ranges CPO migration

Layer / File(s) Summary
Static call-operator foundation
libcudacxx/include/cuda/std/__cccl/dialect.h, libcudacxx/include/cuda/**
Callable objects use _CCCL_STATIC_CALL_OPERATOR. Diagnostic suppression covers earlier language modes and NVHPC diagnostics.
Iterator and swap CPO migration
libcudacxx/include/cuda/std/__iterator/**, libcudacxx/include/cuda/std/__concepts/swappable.h, libcudacxx/include/cuda/__iterator/**
Iterator access, movement, swapping, advancement, distance, and reverse access use public ranges customization points.
PSTL and range-view integration
libcudacxx/include/cuda/std/__pstl/**, libcudacxx/include/cuda/std/__ranges/**
CUDA PSTL dispatchers and range views use static call operators and public range access, size, movement, and adaptor APIs.
Library adoption and validation
libcudacxx/include/cuda/__container/**, libcudacxx/include/cuda/std/{__memory,__simd,__utility}, libcudacxx/test/libcudacxx/**
Containers and library utilities use public ranges APIs. Tests replace internal CPO calls and adjust tile-compilation annotations and guards.

Possibly related PRs

  • NVIDIA/cccl#10687: Both PRs modify cuda::std::constant_wrapper; this change updates call operators, while the related PR backports its C++17 implementation.
  • NVIDIA/cccl#10709: Both PRs modify cuda::std::__utility::constant_wrapper; this change updates static call-operator syntax, while the related PR addresses NVRTC access and warning suppression.

Suggested reviewers: griwes, srinivasyadav18


Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (1)
libcudacxx/include/cuda/std/__iterator/iter_swap.h (1)

75-75: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

suggestion: Replace each annotated branch comment with _CCCL_HAS_NOEXCEPT_MANGLING(). Lines 75 and 99 also include the negated condition. Line 109 only includes the negated condition. As per coding guidelines, an annotated #else or #endif comment must repeat the exact #if condition and must not use an inverted form.

Also applies to: 99-99, 109-109

Sources: Coding guidelines, Learnings


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 39b955af-4017-4301-a9aa-ecb66fb0b129

📥 Commits

Reviewing files that changed from the base of the PR and between 10d2278 and 839c710.

📒 Files selected for processing (143)
  • libcudacxx/include/cuda/__container/buffer.h
  • libcudacxx/include/cuda/__functional/always_true_false.h
  • libcudacxx/include/cuda/__functional/call_or.h
  • libcudacxx/include/cuda/__functional/lazy_call_or.h
  • libcudacxx/include/cuda/__functional/maximum.h
  • libcudacxx/include/cuda/__functional/minimum.h
  • libcudacxx/include/cuda/__iterator/zip_common.h
  • libcudacxx/include/cuda/__iterator/zip_iterator.h
  • libcudacxx/include/cuda/__memory_resource/get_memory_resource.h
  • libcudacxx/include/cuda/__stream/get_stream.h
  • libcudacxx/include/cuda/std/__algorithm/comp.h
  • libcudacxx/include/cuda/std/__algorithm/iter_swap.h
  • libcudacxx/include/cuda/std/__algorithm/iterator_operations.h
  • libcudacxx/include/cuda/std/__algorithm/ranges_find_if.h
  • libcudacxx/include/cuda/std/__algorithm/ranges_find_if_not.h
  • libcudacxx/include/cuda/std/__algorithm/ranges_for_each.h
  • libcudacxx/include/cuda/std/__algorithm/ranges_for_each_n.h
  • libcudacxx/include/cuda/std/__algorithm/ranges_min.h
  • libcudacxx/include/cuda/std/__algorithm/ranges_min_element.h
  • libcudacxx/include/cuda/std/__algorithm/unwrap_range.h
  • libcudacxx/include/cuda/std/__cccl/dialect.h
  • libcudacxx/include/cuda/std/__concepts/swappable.h
  • libcudacxx/include/cuda/std/__expected/expected_base.h
  • libcudacxx/include/cuda/std/__format/format_spec_parser.h
  • libcudacxx/include/cuda/std/__format/output_utils.h
  • libcudacxx/include/cuda/std/__functional/bind_back.h
  • libcudacxx/include/cuda/std/__functional/bind_front.h
  • libcudacxx/include/cuda/std/__functional/compose.h
  • libcudacxx/include/cuda/std/__functional/identity.h
  • libcudacxx/include/cuda/std/__functional/operations.h
  • libcudacxx/include/cuda/std/__functional/ranges_operations.h
  • libcudacxx/include/cuda/std/__iterator/access.h
  • libcudacxx/include/cuda/std/__iterator/advance.h
  • libcudacxx/include/cuda/std/__iterator/common_iterator.h
  • libcudacxx/include/cuda/std/__iterator/concepts.h
  • libcudacxx/include/cuda/std/__iterator/counted_iterator.h
  • libcudacxx/include/cuda/std/__iterator/distance.h
  • libcudacxx/include/cuda/std/__iterator/iter_move.h
  • libcudacxx/include/cuda/std/__iterator/iter_swap.h
  • libcudacxx/include/cuda/std/__iterator/move_iterator.h
  • libcudacxx/include/cuda/std/__iterator/next.h
  • libcudacxx/include/cuda/std/__iterator/prev.h
  • libcudacxx/include/cuda/std/__iterator/reverse_access.h
  • libcudacxx/include/cuda/std/__iterator/reverse_iterator.h
  • libcudacxx/include/cuda/std/__iterator/variant_like.h
  • libcudacxx/include/cuda/std/__linalg/conj_if_needed.h
  • libcudacxx/include/cuda/std/__memory/construct_at.h
  • libcudacxx/include/cuda/std/__memory/temporary_buffer.h
  • libcudacxx/include/cuda/std/__memory/uninitialized_algorithms.h
  • libcudacxx/include/cuda/std/__memory/unique_ptr.h
  • libcudacxx/include/cuda/std/__optional/hash.h
  • libcudacxx/include/cuda/std/__pstl/cuda/adjacent_difference.h
  • libcudacxx/include/cuda/std/__pstl/cuda/copy_if.h
  • libcudacxx/include/cuda/std/__pstl/cuda/copy_n.h
  • libcudacxx/include/cuda/std/__pstl/cuda/exclusive_scan.h
  • libcudacxx/include/cuda/std/__pstl/cuda/find_if.h
  • libcudacxx/include/cuda/std/__pstl/cuda/for_each_n.h
  • libcudacxx/include/cuda/std/__pstl/cuda/generate_n.h
  • libcudacxx/include/cuda/std/__pstl/cuda/inclusive_scan.h
  • libcudacxx/include/cuda/std/__pstl/cuda/max_element.h
  • libcudacxx/include/cuda/std/__pstl/cuda/merge.h
  • libcudacxx/include/cuda/std/__pstl/cuda/min_element.h
  • libcudacxx/include/cuda/std/__pstl/cuda/partition.h
  • libcudacxx/include/cuda/std/__pstl/cuda/partition_copy.h
  • libcudacxx/include/cuda/std/__pstl/cuda/reduce.h
  • libcudacxx/include/cuda/std/__pstl/cuda/remove_if.h
  • libcudacxx/include/cuda/std/__pstl/cuda/rotate.h
  • libcudacxx/include/cuda/std/__pstl/cuda/rotate_copy.h
  • libcudacxx/include/cuda/std/__pstl/cuda/shift_left.h
  • libcudacxx/include/cuda/std/__pstl/cuda/shift_right.h
  • libcudacxx/include/cuda/std/__pstl/cuda/sort.h
  • libcudacxx/include/cuda/std/__pstl/cuda/stable_partition.h
  • libcudacxx/include/cuda/std/__pstl/cuda/transform.h
  • libcudacxx/include/cuda/std/__pstl/cuda/transform_reduce.h
  • libcudacxx/include/cuda/std/__pstl/cuda/unique.h
  • libcudacxx/include/cuda/std/__pstl/cuda/unique_copy.h
  • libcudacxx/include/cuda/std/__pstl/reverse.h
  • libcudacxx/include/cuda/std/__pstl/swap_ranges.h
  • libcudacxx/include/cuda/std/__ranges/access.h
  • libcudacxx/include/cuda/std/__ranges/all.h
  • libcudacxx/include/cuda/std/__ranges/common_view.h
  • libcudacxx/include/cuda/std/__ranges/concepts.h
  • libcudacxx/include/cuda/std/__ranges/counted.h
  • libcudacxx/include/cuda/std/__ranges/data.h
  • libcudacxx/include/cuda/std/__ranges/drop_view.h
  • libcudacxx/include/cuda/std/__ranges/drop_while_view.h
  • libcudacxx/include/cuda/std/__ranges/empty.h
  • libcudacxx/include/cuda/std/__ranges/filter_view.h
  • libcudacxx/include/cuda/std/__ranges/iota_view.h
  • libcudacxx/include/cuda/std/__ranges/owning_view.h
  • libcudacxx/include/cuda/std/__ranges/rbegin.h
  • libcudacxx/include/cuda/std/__ranges/ref_view.h
  • libcudacxx/include/cuda/std/__ranges/rend.h
  • libcudacxx/include/cuda/std/__ranges/repeat_view.h
  • libcudacxx/include/cuda/std/__ranges/reverse_view.h
  • libcudacxx/include/cuda/std/__ranges/single_view.h
  • libcudacxx/include/cuda/std/__ranges/size.h
  • libcudacxx/include/cuda/std/__ranges/subrange.h
  • libcudacxx/include/cuda/std/__ranges/take_view.h
  • libcudacxx/include/cuda/std/__ranges/take_while_view.h
  • libcudacxx/include/cuda/std/__ranges/transform_view.h
  • libcudacxx/include/cuda/std/__ranges/unwrap_end.h
  • libcudacxx/include/cuda/std/__ranges/view_interface.h
  • libcudacxx/include/cuda/std/__ranges/zip_view.h
  • libcudacxx/include/cuda/std/__simd/basic_vec.h
  • libcudacxx/include/cuda/std/__simd/complex_math.h
  • libcudacxx/include/cuda/std/__string/helper_functions.h
  • libcudacxx/include/cuda/std/__tuple_dir/tuple_cat.h
  • libcudacxx/include/cuda/std/__type_traits/integral_constant.h
  • libcudacxx/include/cuda/std/__type_traits/type_list.h
  • libcudacxx/include/cuda/std/__utility/constant_wrapper.h
  • libcudacxx/include/cuda/std/__utility/monostate.h
  • libcudacxx/include/cuda/std/__variant/comparison.h
  • libcudacxx/include/cuda/std/__variant/hash.h
  • libcudacxx/include/cuda/std/__variant/variant_base.h
  • libcudacxx/include/cuda/std/__variant/variant_match.h
  • libcudacxx/include/cuda/std/bitset
  • libcudacxx/include/cuda/std/inplace_vector
  • libcudacxx/include/cuda/std/span
  • libcudacxx/include/cuda/std/string_view
  • libcudacxx/test/libcudacxx/cuda/iterators/zip_iterator/iter_move.pass.cpp
  • libcudacxx/test/libcudacxx/cuda/iterators/zip_iterator/iter_swap.pass.cpp
  • libcudacxx/test/libcudacxx/std/algorithms/alg.modifying/alg.rotate/rotate_copy.pass.cpp
  • libcudacxx/test/libcudacxx/std/containers/sequences/array/iterators.pass.cpp
  • libcudacxx/test/libcudacxx/std/iterators/stream.iterators/iterator.range/begin_array.pass.cpp
  • libcudacxx/test/libcudacxx/std/iterators/stream.iterators/iterator.range/begin_const.pass.cpp
  • libcudacxx/test/libcudacxx/std/iterators/stream.iterators/iterator.range/begin_non_const.pass.cpp
  • libcudacxx/test/libcudacxx/std/iterators/stream.iterators/iterator.range/end_array.pass.cpp
  • libcudacxx/test/libcudacxx/std/iterators/stream.iterators/iterator.range/end_const.pass.cpp
  • libcudacxx/test/libcudacxx/std/iterators/stream.iterators/iterator.range/end_non_const.pass.cpp
  • libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.common.view/adaptor.pass.cpp
  • libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.drop.while/adaptor.pass.cpp
  • libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.drop.while/begin.pass.cpp
  • libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.filter/adaptor.pass.cpp
  • libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.filter/ctor.default.pass.cpp
  • libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.filter/iterator/decrement.pass.cpp
  • libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.filter/iterator/iter_swap.pass.cpp
  • libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.reverse/adaptor.pass.cpp
  • libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.take.while/adaptor.pass.cpp
  • libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.take.while/general.pass.cpp
  • libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.take/adaptor.pass.cpp
  • libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.zip/iterator/iter_move.pass.cpp
  • libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.zip/iterator/iter_swap.pass.cpp
💤 Files with no reviewable changes (1)
  • libcudacxx/test/libcudacxx/std/ranges/range.adaptors/range.zip/iterator/iter_move.pass.cpp

Comment thread libcudacxx/include/cuda/std/__ranges/drop_view.h Outdated
Comment thread libcudacxx/include/cuda/std/__ranges/repeat_view.h
Comment thread libcudacxx/include/cuda/std/__ranges/take_view.h
Comment thread libcudacxx/include/cuda/std/__type_traits/integral_constant.h
Comment thread libcudacxx/include/cuda/std/inplace_vector Outdated
@miscco
miscco force-pushed the static_call_operator branch from 839c710 to 5da0023 Compare August 7, 2026 10:44
@github-actions

This comment has been minimized.

@miscco
miscco force-pushed the static_call_operator branch from 5da0023 to 904fe41 Compare August 7, 2026 12:11

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
libcudacxx/include/cuda/std/bitset (1)

972-975: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

suggestion: Add [[nodiscard]] to the hash call operator.

Line 972 returns the only value produced by this side-effect-free function. The repository C++ guideline requires [[nodiscard]] for most non-void functions without known side effects. Add the attribute before _CCCL_API.

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 334db880-0995-4298-b258-b796b6d8e3aa

📥 Commits

Reviewing files that changed from the base of the PR and between 5da0023 and 904fe41.

📒 Files selected for processing (10)
  • libcudacxx/include/cuda/std/__algorithm/iterator_operations.h
  • libcudacxx/include/cuda/std/__iterator/concepts.h
  • libcudacxx/include/cuda/std/__memory/construct_at.h
  • libcudacxx/include/cuda/std/__memory/uninitialized_algorithms.h
  • libcudacxx/include/cuda/std/__ranges/drop_view.h
  • libcudacxx/include/cuda/std/__ranges/repeat_view.h
  • libcudacxx/include/cuda/std/__ranges/reverse_view.h
  • libcudacxx/include/cuda/std/bitset
  • libcudacxx/include/cuda/std/inplace_vector
  • libcudacxx/test/libcudacxx/std/containers/sequences/array/iterators.pass.cpp
🚧 Files skipped from review as they are similar to previous changes (8)
  • libcudacxx/include/cuda/std/__ranges/repeat_view.h
  • libcudacxx/include/cuda/std/__memory/construct_at.h
  • libcudacxx/include/cuda/std/inplace_vector
  • libcudacxx/include/cuda/std/__ranges/drop_view.h
  • libcudacxx/include/cuda/std/__memory/uninitialized_algorithms.h
  • libcudacxx/test/libcudacxx/std/containers/sequences/array/iterators.pass.cpp
  • libcudacxx/include/cuda/std/__ranges/reverse_view.h
  • libcudacxx/include/cuda/std/__iterator/concepts.h

@miscco
miscco force-pushed the static_call_operator branch from 904fe41 to 3d2194f Compare August 7, 2026 12:35
@miscco
miscco requested a review from a team as a code owner August 7, 2026 12:35
@miscco
miscco requested a review from srinivasyadav18 August 7, 2026 12:35
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@miscco
miscco force-pushed the static_call_operator branch from 3d2194f to e7fef78 Compare August 7, 2026 14:26
@github-actions

This comment has been minimized.

We want to avoid having to take the address of the global object because that gives us a lot of grief both on device and tile
@miscco
miscco force-pushed the static_call_operator branch from e7fef78 to 4d9cf17 Compare August 7, 2026 16:12
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⏱️ CCCL compile-time benchmark comparison: Public headers compile-time bench

Result: 1 regression row(s), 7 improvement row(s) above threshold.

Run Value
Config public-headers-gcc13
Baseline origin/main
Preset all-dev
Targets cub.headers.base, thrust.cpp.cuda.headers.base, libcudacxx.test.public_headers
GPU / launch args rtx2080 / --cuda 13.3 --host gcc13

Artifacts: reports and traces

Direct file processing

-f file-processing exclusive --sort total

🔴 Direct file processing — Regressions
Rank Regression impact Selected Δ Baseline Current Event Matched traces
1 0.211194 0.211194 1.265594 1.476788 Processing Header File: cub/cub/thread/thread_simd.cuh 137
🟢 Direct file processing — Improvements
Rank Improvement impact Selected Δ Baseline Current Event Matched traces
1 1.558987 -1.558987 9.976319 8.417332 Processing Header File: libcudacxx/include/cuda/std/__cccl/prologue.h 550
2 0.541672 -0.541672 3.419770 2.878098 Processing Header File: libcudacxx/include/cuda/std/__cccl/epilogue.h 550
3 0.260691 -0.260691 11.149174 10.888483 Processing Header File: libcudacxx/include/cuda/std/__iterator/concepts.h 437
4 0.240405 -0.240405 5.793217 5.552812 Processing Header File: libcudacxx/include/cuda/std/__iterator/iterator_traits.h 464
5 0.219517 -0.219517 2.845976 2.626459 Processing Header File: libcudacxx/include/cuda/std/__atomic/functions/cuda_ptx_generated.h 57
6 0.215807 -0.215807 6.130266 5.914459 Processing Header File: libcudacxx/include/cuda/std/__tuple_dir/vector_types.h 238
7 0.215287 -0.215287 11.594507 11.379220 Processing Header File: libcudacxx/include/cuda/std/__type_traits/type_list.h 477

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

😬 CI Workflow Results

🟥 Finished in 3h 17m: Pass: 84%/325 | Total: 4d 10h | Max: 3h 17m | Hits: 61%/940245

See results here.

AI failure analysis

1. Static call-operator refactor breaks NVCC registration of wrapped execution constants · 32 jobs

Explanation: All 32 CUB/MSVC matrix jobs fail while compiling top-k tests because NVCC-generated registration stubs pass `__constant_wrapper` objects where the CUDA runtime expects raw variable addresses. This prevents every CUB launch-mode configuration from building.

Evidence:

CUB nvcc MSVC / [CTK12.0 MSVC14.29 C++17] BuildDeviceLaunch(amd64), step 4

2026-08-07T16:30:49.4983391Z C:\Users\ContainerAdministrator\AppData\Local\Temp\sccache\nvcc\.tmptjEiZbNuJ8nOdpnn\catch2_test_device_segmented_topk_keys.compute_90.cudafe1.stub.c(2429,1): error C2440: 'type cast': cannot convert from 'cuda::std::__4::__constant_wrapper<& value,const _Tp *>' to 'char *'
2026-08-07T16:30:49.5003898Z C:\Users\ContainerAdministrator\AppData\Local\Temp\sccache\nvcc\.tmptjEiZbNuJ8nOdpnn\catch2_test_device_segmented_topk_keys.compute_90.cudafe1.stub.c(2429,1): error C2660: '__cudaRegisterVar': function does not take 7 arguments
2026-08-07T16:30:49.4948534Z FAILED: [code=2] cub/test/CMakeFiles/cub.test.device.segmented_topk_keys.lid_1.types_1.dir/catch2_test_device_segmented_topk_keys.cu.obj

Root cause: The PR converts `__constant_wrapper::operator()` and many callable objects to `_CCCL_STATIC_CALL_OPERATOR`; under NVCC/MSVC this changes device-code generation around wrapped global execution constants such as `output_ordering::sorted`, producing invalid `__cudaRegisterVar` calls. The logs do not contain a minimized compilation that proves which individual conversion triggers the compiler behavior, so the exact compatibility guard still needs narrow verification. Sources: libcudacxx/include/cuda/std/__utility/constant_wrapper.h:374, libcudacxx/include/cuda/std/__cccl/dialect.h:150, libcudacxx/include/cuda/__execution/output_ordering.h:70.

Suggested next steps: Reproduce with `& "./ci/windows/build_cub.ps1" -lid1 -std "17"` or first build only `cub.test.device.batched_topk_api.lid_0`. Restore the explicit member/static implementation in `__constant_wrapper` or add an NVCC/MSVC compatibility guard, then verify one CUDA 12.x and one CUDA 13.x matrix entry before rerunning the full CUB matrix.

Copy this prompt into a coding agent
Repository: https://github.com/NVIDIA/cccl
Workflow run: https://github.com/NVIDIA/cccl/actions/runs/31196467251
Failure group: Static call-operator refactor breaks NVCC registration of wrapped execution constants
Affected jobs:
- CUB nvcc MSVC / [CTK12.0 MSVC14.29 C++17] BuildDeviceLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358001
- CUB nvcc MSVC / [CTK12.0 MSVC14.29 C++17] BuildGraphCapture(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358012
- CUB nvcc MSVC / [CTK12.0 MSVC14.39 C++17] BuildGraphCapture(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358016
- CUB nvcc MSVC / [CTK12.9 MSVC14.29 C++17] BuildGraphCapture(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358054
- CUB nvcc MSVC / [CTK12.0 MSVC14.39 C++17] BuildDeviceLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358074
- CUB nvcc MSVC / [CTK12.0 MSVC14.39 C++17] BuildNoLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358075
- CUB nvcc MSVC / [CTK12.0 MSVC14.29 C++17] BuildHostLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358081
- CUB nvcc MSVC / [CTK12.9 MSVC14.44 C++17] BuildGraphCapture(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358083
- CUB nvcc MSVC / [CTK12.9 MSVC14.29 C++17] BuildNoLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358099
- CUB nvcc MSVC / [CTK12.9 MSVC14.44 C++17] BuildDeviceLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358114
- CUB nvcc MSVC / [CTK12.9 MSVC14.44 C++17] BuildHostLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358165
- CUB nvcc MSVC / [CTK13.0 MSVC14.29 C++17] BuildHostLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358167
- CUB nvcc MSVC / [CTK13.0 MSVC14.29 C++17] BuildDeviceLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358174
- CUB nvcc MSVC / [CTK13.0 MSVC14.29 C++17] BuildNoLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358181
- CUB nvcc MSVC / [CTK13.0 MSVC14.44 C++17] BuildHostLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358197
- CUB nvcc MSVC / [CTK12.9 MSVC14.29 C++17] BuildHostLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358209
- CUB nvcc MSVC / [CTK13.0 MSVC14.44 C++17] BuildGraphCapture(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358210
- CUB nvcc MSVC / [CTK12.0 MSVC14.39 C++17] BuildHostLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358217
- CUB nvcc MSVC / [CTK13.0 MSVC14.44 C++17] BuildDeviceLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358232
- CUB nvcc MSVC / [CTK12.0 MSVC14.29 C++17] BuildNoLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358287
- CUB nvcc MSVC / [CTK13.0 MSVC14.44 C++17] BuildNoLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358289
- CUB nvcc MSVC / [CTK13.3 MSVC14.29 C++17] BuildNoLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358361
- CUB nvcc MSVC / [CTK13.3 MSVC14.29 C++17] BuildGraphCapture(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358368
- CUB nvcc MSVC / [CTK13.0 MSVC14.29 C++17] BuildGraphCapture(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358390
- CUB nvcc MSVC / [CTK12.9 MSVC14.29 C++17] BuildDeviceLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358393
- CUB nvcc MSVC / [CTK13.3 MSVC14.29 C++17] BuildHostLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358399
- CUB nvcc MSVC / [CTK13.3 MSVC14.50 C++17] BuildGraphCapture(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358425
- CUB nvcc MSVC / [CTK13.3 MSVC14.50 C++17] BuildDeviceLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358431
- CUB nvcc MSVC / [CTK13.3 MSVC14.50 C++17] BuildHostLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358470
- CUB nvcc MSVC / [CTK12.9 MSVC14.44 C++17] BuildNoLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358511
- CUB nvcc MSVC / [CTK13.3 MSVC14.50 C++17] BuildNoLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358544
- CUB nvcc MSVC / [CTK13.3 MSVC14.29 C++17] BuildDeviceLaunch(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926358613

Investigate the NVCC/MSVC CUB compilation regression introduced by the static call-operator refactor. Reproduce narrowly with `& "./ci/windows/build_cub.ps1" -lid1 -std "17"` or the `cub.test.device.batched_topk_api.lid_0` target, and confirm why generated cudafe stubs attempt to register `cuda::std::__constant_wrapper<&value, const T*>` for `cuda::execution::output_ordering` constants. Focus on `libcudacxx/include/cuda/std/__utility/constant_wrapper.h` and `_CCCL_STATIC_CALL_OPERATOR` in `libcudacxx/include/cuda/std/__cccl/dialect.h`; try restoring the prior explicit `_CCCL_HAS_STATIC_CALL_OPERATOR()` branches for `__constant_wrapper::operator()` or introduce the smallest NVCC/MSVC compatibility guard. Implement the verified fix without disabling the static operator feature globally, then run focused CUB builds on representative CUDA 12.x and CUDA 13.x/MSVC configurations.

Jobs:

2. Static default deleter leaves conversion-test variable unused under warnings-as-errors · 16 jobs

Explanation: All 16 libcu++ jobs fail the same `default_delete` conversion test because `d1(p)` invokes a newly static call operator and therefore no longer counts as using the `d1` object. NVCC promotes the resulting unused-variable warning to an error.

Evidence:

libcu++ nvcc Clang / [CTK13.3 Clang17 C++20] Build(amd64), step 4

2026-08-07T16:26:50.0962814Z FAIL: libcu++ :: std/utilities/memory/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp (2897 of 3787)
2026-08-07T16:26:50.0990675Z /home/coder/cccl/libcudacxx/test/libcudacxx/std/utilities/memory/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp(32): error #550-D: variable "d1" was set but never used

Root cause: The PR changes `default_delete::operator()` from a const member function to `_CCCL_STATIC_CALL_OPERATOR`. The test still constructs `d1` to verify the converting constructor, but calling the static operator through `d1` does not constitute an object use, triggering diagnostic 550-D under `-Werror=all-warnings`. Sources: libcudacxx/include/cuda/std/__memory/unique_ptr.h:77, libcudacxx/test/libcudacxx/std/utilities/memory/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp:32.

Suggested next steps: Explicitly consume the converted object in the test, for example by adding `(void) d1;` after its construction, while retaining `d1(p)` to test invocation. Run `./ci/build_libcudacxx.sh -std 20` or the single `convert_ctor.pass.cpp` lit test to verify the warning is gone.

Copy this prompt into a coding agent
Repository: https://github.com/NVIDIA/cccl
Workflow run: https://github.com/NVIDIA/cccl/actions/runs/31196467251
Failure group: Static default deleter leaves conversion-test variable unused under warnings-as-errors
Affected jobs:
- libcu++ nvcc NVHPC / [CTK13.2 NVHPC26.5 C++20] Build(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926356595
- libcu++ nvcc Clang / [CTK13.3 Clang17 C++20] Build(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926356873
- libcu++ nvcc Clang / [CTK13.0 Clang20 C++20] Build(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926356877
- libcu++ nvcc Clang / [CTK13.3 Clang18 C++20] Build(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926356907
- libcu++ nvcc Clang / [CTK13.3 Clang20 C++20] Build(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926356910
- libcu++ nvcc Clang / [CTK12.9 Clang19 C++20] Build(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926356934
- libcu++ nvcc Clang / [CTK13.3 Clang21 C++20] Build(arm64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926356935
- libcu++ nvcc Clang / [CTK13.3 Clang16 C++20] Build(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926356938
- libcu++ nvcc Clang / [CTK13.3 Clang19 C++20] Build(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926356939
- libcu++ nvcc GCC / [CTK13.0 GCC15 C++20] Build(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926357012
- libcu++ nvcc GCC / [CTK13.3 GCC14 C++20] Build(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926357063
- libcu++ nvcc GCC / [CTK13.3 GCC15 C++20] Build(arm64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926357084
- libcu++ nvcc GCC / [CTK13.3 GCC13 C++20] Build(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926357127
- libcu++ nvcc Clang / RA / [CTK13.3 Clang21 C++20] Build(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926360999
- libcu++ nvcc GCC / Sc / [CTK13.3 GCC15 C++20] Build(amd64): https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926362030
- libcu++ nvcc GCC / Ss / [CTK13.3 GCC15 C++20] Build(amd64): sm{90}: https://github.com/NVIDIA/cccl/actions/runs/31196467251/job/92926362262

Fix the libcu++ `default_delete` converting-constructor test after `default_delete::operator()` became static. Reproduce narrowly with the `std/utilities/memory/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp` lit test under NVCC with warnings as errors. In that test, explicitly mark the converted `d1` object as used—prefer the minimal `(void) d1;` immediately after `cuda::std::default_delete<A> d1 = d2;`—while preserving `d1(p)` and the allocation-count assertions. Verify the focused test and then run `./ci/build_libcudacxx.sh -std 20` on one representative compiler configuration.

Jobs:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

1 participant