Skip to content

PERF: Inline return code checks in cuda_core - #2608

Merged
mdboom merged 1 commit into
NVIDIA:mainfrom
mdboom:inline-handle-return
Aug 13, 2026
Merged

PERF: Inline return code checks in cuda_core#2608
mdboom merged 1 commit into
NVIDIA:mainfrom
mdboom:inline-handle-return

Conversation

@mdboom

@mdboom mdboom commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

This takes ~20ns off of every CUDA API call made in cuda-core using a trick that has existed in cuda_bindings for a few months.

The idea is to inline the check (the comparison to zero) at every call site, and only make a function call to handle raising an exception if you need to.

To avoid making any changes, this is literally just a move of these functions to inline (in the .pxd file) and a few declarations to make them work in that context.

@mdboom mdboom added P1 Medium priority - Should do cuda.core Everything related to the cuda.core module performance labels Aug 12, 2026
@mdboom
mdboom requested a review from Andy-Jost August 12, 2026 18:54
@mdboom mdboom added this to the cuda.core 1.2.0 milestone Aug 12, 2026
@mdboom mdboom self-assigned this Aug 12, 2026

@Andy-Jost Andy-Jost 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.

Inlining for the win!

@github-actions

Copy link
Copy Markdown

@mdboom
mdboom enabled auto-merge (squash) August 13, 2026 15:09
@mdboom
mdboom merged commit b448d2f into NVIDIA:main Aug 13, 2026
244 of 276 checks passed
github-actions Bot pushed a commit that referenced this pull request Aug 14, 2026
Removed preview folders for the following PRs:
- PR #2463
- PR #2474
- PR #2479
- PR #2522
- PR #2551
- PR #2601
- PR #2608
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.core Everything related to the cuda.core module P1 Medium priority - Should do performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants