Skip to content

performance-noexcept-swap#8303

Merged
Jacobfaib merged 1 commit intoNVIDIA:mainfrom
Jacobfaib:jacobf/2026-04-07/performance-noexcept-swap
Apr 9, 2026
Merged

performance-noexcept-swap#8303
Jacobfaib merged 1 commit intoNVIDIA:mainfrom
Jacobfaib:jacobf/2026-04-07/performance-noexcept-swap

Conversation

@Jacobfaib
Copy link
Copy Markdown
Contributor

Description

closes

Checklist

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

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

copy-pr-bot bot commented Apr 7, 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 7, 2026
@Jacobfaib Jacobfaib force-pushed the jacobf/2026-04-07/performance-noexcept-swap branch from 203b2a3 to 83fb1fe Compare April 7, 2026 15:24
@Jacobfaib Jacobfaib marked this pull request as ready for review April 7, 2026 15:29
@Jacobfaib Jacobfaib requested review from a team as code owners April 7, 2026 15:29
@Jacobfaib Jacobfaib requested review from fbusato and gevtushenko April 7, 2026 15:29
@cccl-authenticator-app cccl-authenticator-app bot moved this from In Progress to In Review in CCCL Apr 7, 2026
Copy link
Copy Markdown
Contributor

@fbusato fbusato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this improvement makes sense at theoretical level. I'm a bit worried about edge cases support with nvcc/nvc++/nvrtc. I remember that I had hard time with noexcept and compiler compatibility. @miscco should take a look at it

@Jacobfaib
Copy link
Copy Markdown
Contributor Author

Jacobfaib commented Apr 7, 2026

I remember that I had hard time with noexcept and compiler compatibility. @miscco should take a look at it

Yes I am struggling at the moment with a particular edge case of

struct IncompleteType;

cuda::std::tuple<IncompleteType&> t;

This is causing compilation errors because the noexcept specification is being eagerly computed, via is_nothrow_swappable_v<IncompleteType&>. However, computing is_nothrow_swappable with an incomplete type is undefined behavior according to the standard.

I guess I might have to resort to the usual method of deferring this via some dummy argument:

template <typename DummyT = char>
void swap(tuple& tup, DummyT = DummyT{}) noexcept(noexcept(...))

But it seems a little icky to do this on the public interface. I also don't understand how libc++ is getting around this, their implementation seems quite similar to ours but they don't have the error.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@miscco
Copy link
Copy Markdown
Contributor

miscco commented Apr 8, 2026

However, computing is_nothrow_swappable with an incomplete type is undefined behavior according to the standard.

I thought we were trying hard to make that work, will look at this on a friday

@Jacobfaib Jacobfaib force-pushed the jacobf/2026-04-07/performance-noexcept-swap branch from e864dfd to 88e97cf Compare April 8, 2026 12:27
@Jacobfaib
Copy link
Copy Markdown
Contributor Author

I thought we were trying hard to make that work, will look at this on a friday

The root problem is that older nvcc (or perhaps it's GCC) don't even allow you to write sizeof(T) if T is incomplete. See https://godbolt.org/z/9P64PE9s8 for an example.

@github-project-automation github-project-automation bot moved this from In Review to In Progress in CCCL Apr 8, 2026
@Jacobfaib Jacobfaib requested a review from miscco April 8, 2026 13:03
@Jacobfaib Jacobfaib requested a review from miscco April 8, 2026 17:34
@github-actions

This comment has been minimized.

@Jacobfaib Jacobfaib requested a review from fbusato April 8, 2026 22:05
Copy link
Copy Markdown
Contributor

@bernhardmgruber bernhardmgruber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thrust changes are fine

@Jacobfaib Jacobfaib force-pushed the jacobf/2026-04-07/performance-noexcept-swap branch from 2dbb793 to 9db2180 Compare April 9, 2026 09:58
@Jacobfaib Jacobfaib requested a review from miscco April 9, 2026 11:08
@Jacobfaib Jacobfaib force-pushed the jacobf/2026-04-07/performance-noexcept-swap branch from 9db2180 to 25c6bb2 Compare April 9, 2026 11:09
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

🥳 CI Workflow Results

🟩 Finished in 3h 00m: Pass: 100%/162 | Total: 3d 18h | Max: 2h 59m | Hits: 83%/401698

See results here.

@github-project-automation github-project-automation bot moved this from In Progress to In Review in CCCL Apr 9, 2026
@Jacobfaib Jacobfaib merged commit 0cecea0 into NVIDIA:main Apr 9, 2026
179 of 182 checks passed
@Jacobfaib Jacobfaib deleted the jacobf/2026-04-07/performance-noexcept-swap branch April 9, 2026 15:04
@github-project-automation github-project-automation bot moved this from In Review to Done in CCCL Apr 9, 2026
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.

4 participants