Skip to content

[libcu++] Implement P4206R0 Revert string support in std::constant_wrapper - #9702

Merged
davebayer merged 1 commit into
NVIDIA:mainfrom
davebayer:constant_wrapper_value
Aug 6, 2026
Merged

[libcu++] Implement P4206R0 Revert string support in std::constant_wrapper#9702
davebayer merged 1 commit into
NVIDIA:mainfrom
davebayer:constant_wrapper_value

Conversation

@davebayer

@davebayer davebayer commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

This paper simplifies the implementation a lot, potentially making it useful even in C++17

@davebayer
davebayer requested a review from a team as a code owner July 3, 2026 07:37
@davebayer
davebayer requested a review from ericniebler July 3, 2026 07:37
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Jul 3, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 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

Walkthrough

__constant_wrapper now uses an auto NTTP-based value model with rewritten operator plumbing, the feature-test comment is updated, and const.wrap.class tests adjust compiler gating plus expected conversion, indexing, type, and kernel-parameter behavior.

Changes

constant_wrapper implementation and tests

Layer / File(s) Summary
Wrapper representation and operators
libcudacxx/include/cuda/std/__utility/constant_wrapper.h
Adds auto_cast support, changes __constant_wrapper and __cw to use auto NTTPs, rewrites constexpr-parameter detection, and updates operator, callable, subscript, assignment, conversion, and pseudo-mutator result typing to use _LIBCUDACXX_AUTO_CAST.
Feature-test version text
libcudacxx/include/cuda/std/version
Updates the commented __cccl_lib_constant_wrapper version literal.
Compiler gating updates
libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/adl.compile.pass.cpp, assign.pass.cpp, binary_ops.pass.cpp, call.pass.cpp, comma.pass.cpp, comp.pass.cpp, convert.pass.cpp, cw.pass.cpp, general.pass.cpp, mem_ptr.pass.cpp, pseudo_mutators.pass.cpp, subscript.pass.cpp, types.compile.pass.cpp, unary_ops.pass.cpp
Removes GCC 10/11 unsupported notes, changes mem_ptr.pass.cpp to nvcc-12.0, and keeps the remaining nvcc and nvrtc exclusions unchanged.
Test expectation changes
libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/convert.pass.cpp, cw.pass.cpp, subscript.pass.cpp, types.compile.pass.cpp, unary_ops.pass.cpp, kernel_parameter.array.pass.cpp, kernel_parameter.pass.cpp, cw_fixed.array.ctor.pass.cpp, cw_fixed.ctor.pass.cpp, ctad.compile.pass.cpp
Updates conversion, array, object, subscript, kernel parameter, and type assertions for the new __constant_wrapper value model, and removes obsolete fixed-value, CTAD, and string-literal coverage.

Related PRs: None specified
Suggested labels: libcudacxx, needs-review
Suggested reviewers: miscco, jrhemstad


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: 1

🧹 Nitpick comments (1)
libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/convert.pass.cpp (1)

43-46: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

suggestion: identity check dropped for scalar conversion. The struct case below (Line 55) still asserts &result == &cws.value to confirm the reference returned by operator const _Tp&() aliases the static storage. The scalar case now only checks the copied value, losing that coverage for the by-value/by-reference contract on scalars. Not blocking since int conversion via copy is still exercised.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 63919e06-2744-4992-b9dc-4e94cc7d4d85

📥 Commits

Reviewing files that changed from the base of the PR and between 5d12ea0 and d361c13.

📒 Files selected for processing (19)
  • libcudacxx/include/cuda/std/__utility/constant_wrapper.h
  • libcudacxx/include/cuda/std/version
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/adl.compile.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/assign.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/binary_ops.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/call.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/comma.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/comp.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/convert.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/ctad.compile.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/cw.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/cw_fixed.array.ctor.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/cw_fixed.ctor.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/general.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/mem_ptr.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/pseudo_mutators.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/subscript.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/types.compile.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/unary_ops.pass.cpp
💤 Files with no reviewable changes (14)
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/assign.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/unary_ops.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/cw_fixed.array.ctor.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/cw_fixed.ctor.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/general.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/ctad.compile.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/binary_ops.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/comp.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/comma.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/adl.compile.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/mem_ptr.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/call.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/subscript.pass.cpp
  • libcudacxx/test/libcudacxx/std/utilities/const.wrap.class/pseudo_mutators.pass.cpp

Comment thread libcudacxx/include/cuda/std/__utility/constant_wrapper.h Outdated
@davebayer
davebayer force-pushed the constant_wrapper_value branch from d361c13 to 836cd4a Compare July 3, 2026 07:47
@davebayer
davebayer enabled auto-merge (squash) July 3, 2026 07:51
@davebayer
davebayer force-pushed the constant_wrapper_value branch 2 times, most recently from dc47375 to f24cb3f Compare July 3, 2026 14:47
@github-actions

This comment has been minimized.

@davebayer
davebayer force-pushed the constant_wrapper_value branch from f24cb3f to 14c4ae8 Compare August 3, 2026 07:27
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@davebayer
davebayer force-pushed the constant_wrapper_value branch from 97e67b9 to d1a44f8 Compare August 4, 2026 10:24
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@davebayer
davebayer force-pushed the constant_wrapper_value branch from 7efdf1c to 921b086 Compare August 6, 2026 06:26
@github-actions

This comment has been minimized.

@davebayer
davebayer force-pushed the constant_wrapper_value branch from 921b086 to 8f1dd2f Compare August 6, 2026 06:38
@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

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

Result: 4 regression row(s), 1 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 1.440989 1.440989 19.433520 20.874509 Processing Header File: libcudacxx/include/cuda/__device/physical_device.h 94
2 0.284245 0.284245 1.900187 2.184432 Processing Header File: cub/cub/device/dispatch/tuning/tuning_scan.cuh 68
3 0.280132 0.280132 1.826128 2.106260 Processing Header File: libcudacxx/include/cuda/std/string_view 98
4 0.268395 0.268395 7.608120 7.876515 Processing Header File: cub/cub/util_type.cuh 279
🟢 Direct file processing — Improvements
Rank Improvement impact Selected Δ Baseline Current Event Matched traces
1 1.101654 -1.101654 9.609696 8.508042 Processing Header File: libcudacxx/include/cuda/std/__cccl/prologue.h 550

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 3h 25m: Pass: 100%/115 | Total: 4d 06h | Max: 3h 25m | Hits: 56%/940169

See results here.

@davebayer
davebayer merged commit fef5a52 into NVIDIA:main Aug 6, 2026
141 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[FEA]: P4206R0 Reverting string literal support in std::constant_wrapper

2 participants