Fix cuda.coop limitation preventing user-defined types when items_per_thread > 1 in block scan module. - #4756
Merged
tpn merged 4 commits intoMay 21, 2025
Conversation
gevtushenko
approved these changes
May 20, 2025
| scan_op: ScanOpType, | ||
| initial_value: Any = None, | ||
| items_per_thread: int = 1, | ||
| items_per_thread: int = 4, |
Collaborator
There was a problem hiding this comment.
important: having default number of items per thread is a bit concerning. Even if there was a reasonable default, it's dictated by user data, not CUB. Since we don't know what user is about to pass (yet), I'd probably favor interface that forces user to spell this number explicitly.
Contributor
Author
There was a problem hiding this comment.
I feel like this PR is the most sensible place to land that. I'll work on another commit now.
gevtushenko
approved these changes
May 21, 2025
Contributor
🟨 CI finished in 1h 24m: Pass: 83%/12 | Total: 1h 50m | Avg: 9m 12s | Max: 20m 00s
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| libcu++ | |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| stdpar | |
| +/- | python |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| libcu++ | |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| stdpar | |
| +/- | python |
| CCCL C Parallel Library | |
| Catch2Helper |
🏃 Runner counts (total jobs: 12)
| # | Runner |
|---|---|
| 6 | linux-amd64-cpu16 |
| 6 | linux-amd64-gpu-rtxa6000-latest-1 |
The lowering error Numba CUDA was reporting was simply due to it not knowing how to lower the `initial_value` `Complex()` that was being used in the tests. Adding in a `lower_constant` to `Complex` was sufficient to fix the issue. There are now no restrictions regarding user-defined types and items per thread greater than 1.
Now that there are no restrictions to usage when items_per_thread is greater than 1 (i.e. we fixed the user-defined types issue), it makes sense to use a more optimal default that should yield better performance out-of-the-box for most use cases.
Per @gevtushenko's suggestion.
tpn
force-pushed
the
4747-fix-items_per_thread-restriction-in-cuda-coop
branch
from
May 21, 2025 02:00
6e59a37 to
bef7ddc
Compare
Contributor
🟩 CI finished in 27m 41s: Pass: 100%/12 | Total: 1h 51m | Avg: 9m 15s | Max: 19m 52s
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| libcu++ | |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| stdpar | |
| +/- | python |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| libcu++ | |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| stdpar | |
| +/- | python |
| CCCL C Parallel Library | |
| Catch2Helper |
🏃 Runner counts (total jobs: 12)
| # | Runner |
|---|---|
| 6 | linux-amd64-cpu16 |
| 6 | linux-amd64-gpu-rtxa6000-latest-1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commits have been organized to ease review. Underlying "bug" was fixed by adding a missing
lower_constantfor theComplextype we use in our tests of user-defined types._block_scan.pyinvariants and docstrings updated accordingly.Additionally, now that there are no restrictions regarding items_per_thread > 1, I have changed the default from 1 to 4, such that we have a more optimal default out-of-the-box.
This will close #4747 when merged.