Current Behavior
make_iter_mode calls scattered throughout algorithm implementations force compile-time resolution between user-embedded access modes (in sycl_iterator) and algorithm-required modes via iter_mode_resolver. Conflicting modes without a matching specialization trigger a static_assert.
Issues
-
Resolution logic is scattered: Access mode resolution happens via make_iter_mode calls throughout algorithm implementations rather than centrally in __get_sycl_range when the sycl_iterator is actually processed.
-
Incomplete recursion through fancy iterators: iter_mode only recurses through zip_iterator. It does not recurse through:
permutation_iterator
transform_iterator
reverse_iterator
If a user wraps a sycl_iterator in any of these, make_iter_mode passes it through unchanged via the generic "common iterator" overload, never reaching the underlying sycl_iterator for resolution.
Proposed Improvement
Move access mode resolution into __get_sycl_range at the leaf level when processing sycl_iterator (or types where is_hetero_iterator_v is true). This would:
- Centralize resolution logic in one place, so it always occurs
- Automatically handle all fancy iterator compositions since
__get_sycl_range already recurses through them
- Allow removal of most/all
make_iter_mode calls from algorithm implementations
- Ensure consistent behavior regardless of iterator wrapping
Current Behavior
make_iter_modecalls scattered throughout algorithm implementations force compile-time resolution between user-embedded access modes (insycl_iterator) and algorithm-required modes viaiter_mode_resolver. Conflicting modes without a matching specialization trigger astatic_assert.Issues
Resolution logic is scattered: Access mode resolution happens via
make_iter_modecalls throughout algorithm implementations rather than centrally in__get_sycl_rangewhen thesycl_iteratoris actually processed.Incomplete recursion through fancy iterators:
iter_modeonly recurses throughzip_iterator. It does not recurse through:permutation_iteratortransform_iteratorreverse_iteratorIf a user wraps a
sycl_iteratorin any of these,make_iter_modepasses it through unchanged via the generic "common iterator" overload, never reaching the underlyingsycl_iteratorfor resolution.Proposed Improvement
Move access mode resolution into
__get_sycl_rangeat the leaf level when processingsycl_iterator(or types whereis_hetero_iterator_vis true). This would:__get_sycl_rangealready recurses through themmake_iter_modecalls from algorithm implementations