Skip to content

Slightly expand testing for cuda::counting_iterator#8338

Merged
Jacobfaib merged 9 commits intoNVIDIA:mainfrom
Jacobfaib:jacobf/2026-04-09/non-integral-counting-iterator
Apr 10, 2026
Merged

Slightly expand testing for cuda::counting_iterator#8338
Jacobfaib merged 9 commits intoNVIDIA:mainfrom
Jacobfaib:jacobf/2026-04-09/non-integral-counting-iterator

Conversation

@Jacobfaib
Copy link
Copy Markdown
Contributor

@Jacobfaib Jacobfaib commented Apr 9, 2026

Description

Extract out support for non-integral types from #5963 Slightly expand testing for cuda::counting_iterator. Per offline discussion it was decided that we don't really want to support non-integral types in iterators. Having an iterator where it + 5 is not the same as ++it... x5 is a very easy footgun. Users can approximate the same effect by doing transform_iterator{counting_iterator, cast_to<float>} if they really want this.

Checklist

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

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

copy-pr-bot bot commented Apr 9, 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 9, 2026
@Jacobfaib
Copy link
Copy Markdown
Contributor Author

/ok to test

1 similar comment
@Jacobfaib
Copy link
Copy Markdown
Contributor Author

/ok to test

auto diff = ::std::distance(iter1, iter2);
static_assert(cuda::std::is_same_v<decltype(diff), cuda::std::iter_difference_t<cuda::counting_iterator<int>>>);
static_assert(cuda::std::is_same_v<decltype(diff), cuda::std::iter_difference_t<cuda::counting_iterator<T>>>);
static_assert(noexcept(::std::distance(iter1, iter2)));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is wrong. The standard does not mandate that std::distance() is noexcept (or that it checks noexcept-ness). Indeed, neither Apple-clangs libc++, LLVM, or GCC mark this as noexcept.

@Jacobfaib
Copy link
Copy Markdown
Contributor Author

/ok to test

1 similar comment
@Jacobfaib
Copy link
Copy Markdown
Contributor Author

/ok to test

@Jacobfaib
Copy link
Copy Markdown
Contributor Author

/ok to test

@Jacobfaib Jacobfaib force-pushed the jacobf/2026-04-09/non-integral-counting-iterator branch from 5fa4691 to 7dfde3f Compare April 9, 2026 18:13
@Jacobfaib
Copy link
Copy Markdown
Contributor Author

/ok to test

@Jacobfaib
Copy link
Copy Markdown
Contributor Author

/ok to test

@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 April 9, 2026 20:54
@Jacobfaib Jacobfaib requested a review from a team as a code owner April 9, 2026 20:54
@Jacobfaib Jacobfaib requested a review from ericniebler April 9, 2026 20:54
@cccl-authenticator-app cccl-authenticator-app bot moved this from In Progress to In Review in CCCL Apr 9, 2026
@github-actions

This comment has been minimized.

@Jacobfaib Jacobfaib requested a review from miscco April 9, 2026 23:57
@Jacobfaib Jacobfaib changed the title Add support for non-integral types to cuda::counting_iterator Slightly expand testing for cuda::counting_iterator Apr 10, 2026
@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 27m 48s: Pass: 100%/65 | Total: 10h 38m | Max: 27m 47s | Hits: 99%/257404

See results here.

@Jacobfaib Jacobfaib requested a review from miscco April 10, 2026 15:41
@Jacobfaib Jacobfaib merged commit d5b1958 into NVIDIA:main Apr 10, 2026
82 of 86 checks passed
@Jacobfaib Jacobfaib deleted the jacobf/2026-04-09/non-integral-counting-iterator branch April 10, 2026 17:34
@github-project-automation github-project-automation bot moved this from In Review to Done in CCCL Apr 10, 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.

3 participants