Skip to content

Add __lazy_call_or#8767

Open
Jacobfaib wants to merge 2 commits intoNVIDIA:mainfrom
Jacobfaib:jacobf/2026-04-30/lazy-call-or
Open

Add __lazy_call_or#8767
Jacobfaib wants to merge 2 commits intoNVIDIA:mainfrom
Jacobfaib:jacobf/2026-04-30/lazy-call-or

Conversation

@Jacobfaib
Copy link
Copy Markdown
Contributor

@Jacobfaib Jacobfaib commented Apr 30, 2026

Description

Add cuda::__lazy_call_or, which acts like cuda::__call_or except that the default value is lazily computed.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Summary by CodeRabbit

  • New Features

    • Added conditional callable invocation utility with lazy fallback evaluation support, enabling deferred callable selection based on runtime conditions.
  • Tests

    • Added comprehensive test suite validating the new utility's behavior, including noexcept correctness, constexpr compatibility, and lazy evaluation semantics.

@Jacobfaib Jacobfaib self-assigned this Apr 30, 2026
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Apr 30, 2026
@copy-pr-bot
Copy link
Copy Markdown
Contributor

copy-pr-bot Bot commented Apr 30, 2026

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Progress in CCCL Apr 30, 2026
@Jacobfaib
Copy link
Copy Markdown
Contributor Author

/ok to test

2 similar comments
@Jacobfaib
Copy link
Copy Markdown
Contributor Author

/ok to test

@Jacobfaib
Copy link
Copy Markdown
Contributor Author

/ok to test

@github-actions

This comment has been minimized.

@Jacobfaib Jacobfaib marked this pull request as ready for review May 1, 2026 12:48
@Jacobfaib Jacobfaib requested a review from a team as a code owner May 1, 2026 12:48
@Jacobfaib Jacobfaib requested a review from griwes May 1, 2026 12:48
@cccl-authenticator-app cccl-authenticator-app Bot moved this from In Progress to In Review in CCCL May 1, 2026
@Jacobfaib Jacobfaib changed the title Add __lazy_call_or Add __lazy_call_or May 1, 2026
@Jacobfaib Jacobfaib force-pushed the jacobf/2026-04-30/lazy-call-or branch 2 times, most recently from 086fddd to 38b90b3 Compare May 1, 2026 15:44
@github-actions

This comment has been minimized.

Comment thread libcudacxx/include/cuda/__functional/lazy_call_or.h
Comment thread libcudacxx/test/libcudacxx/cuda/functional/lazy_call_or.pass.cpp Outdated
@Jacobfaib Jacobfaib force-pushed the jacobf/2026-04-30/lazy-call-or branch from 38b90b3 to 41c0a78 Compare May 4, 2026 16:00
@Jacobfaib Jacobfaib requested a review from miscco May 4, 2026 16:00
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

🥳 CI Workflow Results

🟩 Finished in 3h 36m: Pass: 100%/110 | Total: 3d 18h | Max: 3h 36m | Hits: 72%/317059

See results here.

@jrhemstad
Copy link
Copy Markdown
Collaborator

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: e9de7de1-ac13-4c98-9f40-dbc0e404bdc1

📥 Commits

Reviewing files that changed from the base of the PR and between c251a2d and 41c0a78.

📒 Files selected for processing (2)
  • libcudacxx/include/cuda/__functional/lazy_call_or.h
  • libcudacxx/test/libcudacxx/cuda/functional/lazy_call_or.pass.cpp

Walkthrough

Adds a new CUDA C++ customization point object __lazy_call_or that conditionally invokes a primary callable with forwarded arguments, or falls back to invoking a zero-argument fallback callable. Includes a companion result type alias __lazy_call_result_or_t and comprehensive test coverage validating result types, noexcept propagation, constexpr evaluation, lazy fallback evaluation, and value category forwarding.

Changes

Lazy Conditional Call CPO

Layer / File(s) Summary
Core CPO Implementation
libcudacxx/include/cuda/__functional/lazy_call_or.h
Defines __lazy_call_or CPO with two operator() overloads: one forwards args... to the primary callable, another ignores the primary and invokes fallback_callable() with zero arguments. Includes __lazy_call_result_or_t alias for return type deduction.
Comprehensive Test Suite
libcudacxx/test/libcudacxx/cuda/functional/lazy_call_or.pass.cpp
Tests result type correctness, noexcept propagation for callable and fallback paths, constexpr evaluation, lazy evaluation (fallback not invoked unless selected), and value category forwarding for lvalue/rvalue arguments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A lazy call hops both ways—
Primary path or fallback plays,
Zero-arg hops deferred with care,
Forwarded args float through the air,
Whiskers twitch at noexcept praise!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add __lazy_call_or' accurately describes the main change—introducing a new CUDA C++ CPO for lazy fallback evaluation. It is concise, specific, and directly related to the primary contribution.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Timed out fetching pipeline failures after 30000ms

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

@Jacobfaib Jacobfaib requested a review from bernhardmgruber May 7, 2026 14:31
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.

3 participants