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
Use cub::DeviceTransform::Transform in thrust::tabulate #5808
changed the title [-]Use `cub::DeviceTransform::Fill` in `thrust::tabulate` #5806[/-][+]Use `cub::DeviceTransform::Fill` in `thrust::tabulate`[/+]on Sep 8, 2025
changed the title [-]Use `cub::DeviceTransform::Fill` in `thrust::tabulate`[/-][+]Use `cub::DeviceTransform::Transform` in `thrust::tabulate`[/+]on Sep 8, 2025
So, this is a bit harder. We can express tabulate as a transformation of a counting iterator range to the output range. The counting iterator is not contiguous though, so we fall back to the prefetch algorithm. However, we want to use the vectorized storing from the vectorized algorithm.
One way we can go forward is to allow non-contiguous iterators as input to the vectorized algorithm, where we would just load the data scalar by scalar. We may also want to combine the vectorized and prefetching algorithm, since the vectorized one already includes the prefetching one as a runtime fallback. However, the prefetching algorithm has the advantage of being runtime tuneable to achieve certain bytes in flight and thus a runtime number of elements per thread. Combining this may be difficult and time consuming.
Could we detect, whether the return value of iter is a reference and if not take the fast path anyway?
The check I chose is now whether the iterator is contiguous or not. I only regard contiguous iterators in inputs for whether we can vectorize loads or not. If the iterator is not contiguous, I just load it serially into a local array. Then I process serially and store vectors again if possible.
Activity
[-]`tabulate`[/-][+]Use `cub::DeviceTransform::Fill` in `thrust::tabulate` #5806[/+][-]Use `cub::DeviceTransform::Fill` in `thrust::tabulate` #5806[/-][+]Use `cub::DeviceTransform::Fill` in `thrust::tabulate`[/+][-]Use `cub::DeviceTransform::Fill` in `thrust::tabulate`[/-][+]Use `cub::DeviceTransform::Transform` in `thrust::tabulate`[/+]bernhardmgruber commentedon Sep 8, 2025
So, this is a bit harder. We can express
tabulateas a transformation of a counting iterator range to the output range. The counting iterator is not contiguous though, so we fall back to the prefetch algorithm. However, we want to use the vectorized storing from the vectorized algorithm.One way we can go forward is to allow non-contiguous iterators as input to the vectorized algorithm, where we would just load the data scalar by scalar. We may also want to combine the vectorized and prefetching algorithm, since the vectorized one already includes the prefetching one as a runtime fallback. However, the prefetching algorithm has the advantage of being runtime tuneable to achieve certain bytes in flight and thus a runtime number of elements per thread. Combining this may be difficult and time consuming.
miscco commentedon Sep 9, 2025
Could we detect, whether the return value of
iteris a reference and if not take the fast path anyway?bernhardmgruber commentedon Sep 26, 2025
The check I chose is now whether the iterator is contiguous or not. I only regard contiguous iterators in inputs for whether we can vectorize loads or not. If the iterator is not contiguous, I just load it serially into a local array. Then I process serially and store vectors again if possible.