Skip to content

[libcu++] Reformulate tuple constraints to reduce memory consumption#9703

Open
miscco wants to merge 6 commits into
NVIDIA:mainfrom
miscco:tuple_constraints_struct
Open

[libcu++] Reformulate tuple constraints to reduce memory consumption#9703
miscco wants to merge 6 commits into
NVIDIA:mainfrom
miscco:tuple_constraints_struct

Conversation

@miscco

@miscco miscco commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

We are experiencing memory consumption issues recently. One of the major changes was a rewrite of tuple constraints to support the new tuple like constructors.

This refactors the machinery to be closer to what we had previously in hopes it reduces the memory consumption

@miscco miscco requested a review from a team as a code owner July 3, 2026 09:43
@miscco miscco requested a review from griwes July 3, 2026 09:43
@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
@miscco miscco force-pushed the tuple_constraints_struct branch from 1658ed7 to 337de0d Compare July 3, 2026 09:47
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a8ec03eb-9305-426f-97aa-ecc9a3d933ee

📥 Commits

Reviewing files that changed from the base of the PR and between 22ac0e7 and 9b4360e.

📒 Files selected for processing (1)
  • libcudacxx/include/cuda/std/__tuple_dir/tuple.h
🚧 Files skipped from review as they are similar to previous changes (1)
  • libcudacxx/include/cuda/std/__tuple_dir/tuple.h

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Improved how cuda::std::tuple and cuda::std::pair decide which constructors and assignment operators are enabled or deleted.
    • Centralized tuple constraint-based overload selection for default/copy/move, forwarding/variadic, and tuple-like operations, preserving the same enablement and deleted/explicit behavior.
    • Updated tuple comparison constraints so equality and ordering operators compute comparability/no-throw directly from the centralized selectors, with updated operator template signatures.

Walkthrough

Refactors cuda::std::tuple and pair to route constructor, assignment, and comparison constraint selection through __tuple_constraints<_Types...>, replacing prior free-standing helpers and _v trait forms.

Changes

Constraint helper consolidation

Layer / File(s) Summary
New __tuple_constraints struct definition
libcudacxx/include/cuda/std/__tuple_dir/tuple_constraints.h
Adds __tuple_constraints<_Types...> static selection functions for constructor, tuple-like, assignment, and comparison constraints.
tuple constructor constraint wiring
libcudacxx/include/cuda/std/__tuple_dir/tuple.h
Adds a local __constraints alias in tuple<_Tp...> and rewrites constructor and tuple-like construction trait selection to use __tuple_constraints members.
tuple assignment and comparison wiring
libcudacxx/include/cuda/std/__tuple_dir/tuple.h
Updates tuple<_Tp...> assignment trait selection and rewrites equality and ordering operators to use the new comparison booleans and helper.
pair constructor constraint wiring
libcudacxx/include/cuda/std/__utility/pair.h
Adds a __constraints alias in __pair_base and pair, and rewrites default, copy, and variadic forwarding constructor trait selection to use __tuple_constraints members.

Possibly related PRs

  • NVIDIA/cccl#9683: Both modify tuple_constraints.h constructor selection logic, including the variadic-constructible selection machinery.

Suggested reviewers: jrhemstad, Jacobfaib


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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4c466d95-6165-453f-b6a7-3687fce8e2cf

📥 Commits

Reviewing files that changed from the base of the PR and between 174a652 and 337de0d.

📒 Files selected for processing (3)
  • libcudacxx/include/cuda/std/__tuple_dir/tuple.h
  • libcudacxx/include/cuda/std/__tuple_dir/tuple_constraints.h
  • libcudacxx/include/cuda/std/__utility/pair.h

Comment thread libcudacxx/include/cuda/std/__tuple_dir/tuple_constraints.h Outdated
We are experiencing memory consumption issues recently. One of the major changes was a rewrite of tuple constraints to support the new tuple like constructors.

This refactors the machinery to be closer to what we had previously in hopes it reduces the memory consumption
@miscco miscco force-pushed the tuple_constraints_struct branch from 337de0d to e5c252f Compare July 3, 2026 10:49
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

😬 CI Workflow Results

🟥 Finished in 4h 31m: Pass: 67%/120 | Total: 6d 16h | Max: 4h 30m | Hits: 39%/1303459

See results here.

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