You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[cudax] Fix group_as accessing range through brackets - #12582
__group_as_map reads unit counts sequentially through an iterator. Tests cover exhaustive and non-exhaustive mappings for {4, 12, 16}, and a non-exhaustive mapping for {4, 6, 8}.
NVIDIA/cccl#12223: This PR changes group_as to accept viewable ranges; the current change replaces indexed count access with iterator-based access.
Change: Bug fix
Merge Risk: Low · up to 279c8
Certain supported custom count ranges may fail to compile or be read after exhaustion. These compatibility gaps need correction or owner awareness.
Security architecture risk: Low · up to 279c8
The intended forward-only inputs preserve the existing mapping behavior. A narrow contract concern remains: mapping traverses the counts repeatedly, but its input requirements do not enforce reusable iterators. No privilege expansion or isolation bypass is demonstrated.
Retained concerns
Low · architecture · inferred: The widened runtime range acceptance does not express the multipass invariant required by mapping. Accumulation can consume a sized single-pass range before the new iterator traversal reads it, potentially producing invalid iterator access or incorrect mapping within the calling device kernel. This is an inferred failure-containment concern under the declared constraints; documented indexing requirements and the absence of a concrete single-pass consumer limit the exposure established here.
Security review details
Security Blast Radius
inferred — The supported effect is on subgroup membership and lane-mask metadata in calling device kernels. The available evidence does not establish a downstream authorization, tenant-isolation, credential, or service boundary that consumes these results.
Trust Boundaries and Controls
observed — The named TestKernel and operator() routing subjects are inside an anonymous namespace and are launched by a test case with fixed count fixtures. Their changes do not constitute a new externally exposed production entrypoint.
Hardening Proposals
proposed — Make the reusable-iteration requirement explicit in the dynamic range contract, for example through an appropriate forward-range constraint, and align the documentation with the intended forward-only support.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
cat -n libcudacxx/include/cuda/std/__cccl/assert.h | sed -n '34,170p'
cat -n libcudacxx/include/cuda/std/__numeric/accumulate.h | sed -n '20,110p'
cat -n libcudacxx/include/cuda/std/__ranges/concepts.h | sed -n '55,120p'
cat -n libcudacxx/include/cuda/std/__ranges/all.h | sed -n '35,155p'
cat -n cudax/include/cuda/experimental/coop/__group/mapping/group_as.cuh | sed -n '53,153p'
cat -n cudax/test/coop/group/mapping/group_as.cu | sed -n '28,105p;325,350p'
rg -n -F -e 'group_as' docs/cudax/coop/group
rg -n -F -e 'weakly_incrementable' -e 'input_iterator' libcudacxx/include/cuda/std/__iterator/concepts.h
Repository: NVIDIA/cccl
Length of output: 27079
Script executed:
cat -n docs/cudax/coop/group/mapping/group_as.rst | sed -n '1,105p'
cat -n libcudacxx/include/cuda/std/__iterator/concepts.h | sed -n '92,158p'
cat -n libcudacxx/include/cuda/std/__ranges/ref_view.h | sed -n '35,150p'
cat -n libcudacxx/include/cuda/std/__ranges/access.h | sed -n '230,320p'
Repository: NVIDIA/cccl
Length of output: 13390
important: Process single-pass counts in one traversal.
With device assertions disabled, non-exhaustive validation can consume a single-pass range before the new traversal dereferences it. With assertions enabled, the earlier assertion can also consume the range and cause a valid mapping to return invalid. Combine validation and mapping in one traversal while preserving the existing range contract.
important: Avoid dereferencing the postfix result.
A sized input range can have fresh iterators whose postfix increment returns void. For such a range, group_as::map can fail to compile. Read the value before using prefix increment.
Fix
--- "a/cudax/include/cuda/experimental/coop/__group/mapping/group_as.cuh"+++ "b/cudax/include/cuda/experimental/coop/__group/mapping/group_as.cuh"@@ -100,7 +100,8 @@
_CCCL_PRAGMA_UNROLL_FULL()
for (::cuda::std::uint32_t __i = 0; __i < __curr_ngroups; ++__i)
{
- const auto __i_count = static_cast<::cuda::std::uint32_t>(*__it++);+ const auto __i_count = static_cast<::cuda::std::uint32_t>(*__it);+ ++__it;
if (__prev_unit_rank < __sum + __i_count)
{
const auto __group_rank = __prev_mapping_result.group_rank() * __curr_ngroups + __i;
Committable suggestion
IMPORTANT
Review the replacement and indentation, then test before committing.
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
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.
No description provided.