Repository navigation
Conversation
📝 Summary
Priority: ➖ Normal Change: Feature Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: NVIDIA/cccl
- Branch: main
- File: .coderabbit.yaml
- Commit: 4811a1c
- Layers: Repository YAML
- Review profile: CHILL
- Plan: Enterprise
- Run ID:
5edcfec5-b438-4a5a-b137-c63cb20648ae
📒 Files selected for processing: 4
cudax/include/cuda/experimental/coop/__group/fwd.cuhcudax/include/cuda/experimental/coop/__group/synchronizer/barrier_synchronizer.cuhcudax/test/coop/group/synchronizer/barrier_synchronizer.cudocs/cudax/coop/group/synchronizer/barrier_synchronizer.rst
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
| _CCCL_REQUIRES(::cuda::std::is_same_v<_RangeView, ::cuda::std::ranges::views::all_t<_Range>>) | ||
| _CCCL_DEVICE_API barrier_synchronizer(_Range&& __barriers) noexcept( | ||
| noexcept(::cuda::std::ranges::views::all(::cuda::std::forward<_Range>(__barriers)))) | ||
| : __barriers_{::cuda::std::ranges::views::all(::cuda::std::forward<_Range>(__barriers))} |
There was a problem hiding this comment.
If it's already all_t, why do you need to rewrap it in all()? Or am I misreading this?
There was a problem hiding this comment.
No, it's a viewable range that I store as all_t<R> range
| _CCCL_REQUIRES( | ||
| ::cuda::std::ranges::viewable_range<_Range> _CCCL_AND __is_cuda_barrier_v<::cuda::std::ranges::range_value_t<_Range>>) | ||
| _CCCL_DEDUCTION_GUIDE_ATTRIBUTES barrier_synchronizer(_Range&&) | ||
| -> barrier_synchronizer<::cuda::std::ranges::views::all_t<_Range>>; |
There was a problem hiding this comment.
Why all_t here? Why not just _Range?
There was a problem hiding this comment.
Because it handles for me all of the problems that come with taking a view over a range. I discussed this in the past with @miscco, it's the most suitable thing
| if (__mapping_result.is_valid()) | ||
| { | ||
| __group_barrier_ptr = __barriers_.data() + __mapping_result.group_rank(); | ||
| if constexpr (::cuda::std::ranges::sized_range<_RangeView>) |
There was a problem hiding this comment.
For your own sanity, I would suggest requiring sized ranges. I guess it might preclude filter views but not having constant-time access to size of the range also means that the range could be forward-pass only, or have some other weird quirks.
| static_assert(__is_cuda_barrier_v<::cuda::std::ranges::range_value_t<_RangeView>>, | ||
| "_RangeView's value type must be cv-unqualified cuda::barrier type"); |
There was a problem hiding this comment.
More generally, I would impose far more restrictions on the range here as well. It seems like at the very least you want:
- RangeView satisfies
ranges::forward_range(you seemingly want to be able to iterate a few times over the range) - You probably also want
ranges::borrowed_rangesince you'll be storing the view and so can't e.g. accept a temporary or initializer list. - You do not actually care about the
range_value_t. What you care about isrange_reference_tbecause you do not store the value, you onlyaddressof(*it).
There was a problem hiding this comment.
I would also say we need both forward_range and borrowed_range
e5dd794 to
f9a5ef6
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments: 1
cudax/test/coop/group/synchronizer/barrier_synchronizer.cu: 1
48-55: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winsuggestion: Cover the unsized range and barrier selection paths.
The
make_instancetest uses only a sized array. Add a non-sized forward range to exercise the iterator path. Also verify that differentgroup_rank()values select different barriers. Existing related tests use barrier arrays, while the unsized-range selection test covers onlyinterwarp_synchronizer.
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: NVIDIA/cccl
- Branch: main
- File: .coderabbit.yaml
- Commit: 4811a1c
- Layers: Repository YAML
- Review profile: CHILL
- Plan: Enterprise
- Run ID:
1fbdd949-9d3a-45e4-bfe0-aecc1da75eb2
📒 Files selected for processing: 2
cudax/include/cuda/experimental/coop/__group/synchronizer/barrier_synchronizer.cuhcudax/test/coop/group/synchronizer/barrier_synchronizer.cu
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 7 remain after this review.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: NVIDIA/cccl
- Branch: main
- File: .coderabbit.yaml
- Commit: 4811a1c
- Layers: Repository YAML
- Review profile: CHILL
- Plan: Enterprise
- Run ID:
8b5bda43-2dfa-427c-9b71-750ca952100e
📒 Files selected for processing: 1
cudax/test/coop/group/generic_group.cu
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 6 remain after this review.
|
|
||
| const cudax::coop::group_by mapping{cuda::std::cw<N>}; | ||
| const cudax::coop::barrier_synchronizer synchronizer{barriers}; | ||
| cudax::coop::barrier_synchronizer synchronizer{barriers}; |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
important: Use explicit template arguments for barrier_synchronizer.
Both declarations use barrier_synchronizer synchronizer{barriers} without template arguments. The coding guideline forbids deduction-guide-dependent initialization. Spell out the _RangeView template argument in both tests.
Also applies to: 125-125
Source: Coding guidelines
|
I kinda fail to see why this is useful. Is there some specific case that inspired this? In general I think usage of explicit synchronizers will be rare and this seems even more obscure |
I'd like all of the groups APIs to be somewhat uniform. All mappings that take multiple values are implemented to accept a C++ range. I think it would make sense to do the same thing for this case as well |
This PR rewords
cudax::coop::barrier_synchronizerto take a range of barriers instead of a contiguous array.