Skip to content

Use if in _CCCL_TRY_CUDA_API#9985

Open
Jacobfaib wants to merge 1 commit into
NVIDIA:mainfrom
Jacobfaib:jacobf/2026-07-16/cuda-try-no-switch
Open

Use if in _CCCL_TRY_CUDA_API#9985
Jacobfaib wants to merge 1 commit into
NVIDIA:mainfrom
Jacobfaib:jacobf/2026-07-16/cuda-try-no-switch

Conversation

@Jacobfaib

@Jacobfaib Jacobfaib commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Description

Use a simple if in _CCCL_TRY_CUDA_API instead of the switch abomination.

Also get rid of unused include, terminate() is called by the throw macros but they already include the header for us.

Checklist

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

@Jacobfaib Jacobfaib self-assigned this Jul 16, 2026
@Jacobfaib
Jacobfaib requested a review from a team as a code owner July 16, 2026 21:17
@Jacobfaib
Jacobfaib requested a review from griwes July 16, 2026 21:17
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Jul 16, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Jul 16, 2026
@Jacobfaib
Jacobfaib requested review from fbusato and removed request for griwes July 16, 2026 21:17
@coderabbitai

coderabbitai Bot commented Jul 16, 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: 95335840-a127-4c90-a69d-cb21d9d9efbe

📥 Commits

Reviewing files that changed from the base of the PR and between 05d669b and aa97154.

📒 Files selected for processing (1)
  • libcudacxx/include/cuda/__runtime/api_wrapper.h

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of CUDA API errors, ensuring failures consistently clear the CUDA error state and report the appropriate error.
  • Refactor
    • Simplified internal CUDA status checking without changing the public API.

Walkthrough

The CUDA API wrapper replaces switch-based status handling with an explicit cudaSuccess check, while preserving CUDA error-state clearing and exception construction on failure.

Changes

CUDA API error handling

Layer / File(s) Summary
Refactor CUDA status checking
libcudacxx/include/cuda/__runtime/api_wrapper.h
_CCCL_TRY_CUDA_API uses an if condition for non-success statuses and retains the existing cudaGetLastError() and cuda_error throw behavior.

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

@fbusato fbusato 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.

looks good. Probably the initial intention was to handle more cases

@Jacobfaib
Jacobfaib enabled auto-merge (squash) July 16, 2026 21:37
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

😬 CI Workflow Results

🟥 Finished in 16h 22m: Pass: 99%/120 | Total: 3d 18h | Max: 2h 26m | Hits: 55%/689556

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.

4 participants