File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 11// SPDX-License-Identifier: Apache-2.0
22// SPDX-FileCopyrightText: Copyright the Vortex contributors
33
4+ #include " config.cuh"
45#include < stdint.h>
56
7+ #define MIN (a, b ) (((a) < (b)) : (a) : (b))
8+
69template <typename ValueT>
710__device__ void sequence (
811 ValueT *const output,
912 ValueT base,
1013 ValueT multiplier,
1114 uint64_t len
1215) {
13- const uint64_t idx = blockIdx .x * blockDim .x + threadIdx .x ;
14- if (idx >= len) {
15- return ;
16- }
16+ const uint64_t worker = blockIdx .x * blockDim .x + threadIdx .x ;
1717
18- output[idx] = static_cast <ValueT>(idx) * multiplier + base;
18+ const uint64_t elemStart = MIN (worker * ELEMENTS_PER_THREAD, len);
19+ const uint64_t elemEnd = MIN (elemStart + ELEMENTS_PER_THREAD, len);
20+
21+ for (uint64_t idx = elemStart; idx < elemEnd; idx++) {
22+ output[idx] = static_cast <ValueT>(idx) * multiplier + base;
23+ }
1924}
2025
2126#define GENERATE_KERNEL (ValueT, suffix ) \
You can’t perform that action at this time.
0 commit comments