Skip to content

Commit 827371a

Browse files
authored
Merge pull request #772 from umar456/scan_fix
Fix out of bound access in local_scan kernel
2 parents 924ed68 + 86b36ba commit 827371a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/boost/compute/algorithm/detail/scan_on_gpu.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class local_scan_kernel : public meta_kernel
108108
// store sum for the block
109109
if(exclusive){
110110
*this <<
111-
"if(lid == block_size - 1){\n" <<
111+
"if(lid == block_size - 1 && gid < count) {\n" <<
112112
" block_sums[get_group_id(0)] = " <<
113113
op(first[expr<cl_uint>("gid")], var<T>("scratch[lid]")) <<
114114
";\n" <<

0 commit comments

Comments
 (0)