Skip to content

Commit

Permalink
Fix for out of bounds access
Browse files Browse the repository at this point in the history
Rounding up the clusters_results size to avoid out of bounds access when subgroup_size is not a multiple of cluster_size.
  • Loading branch information
tomasz-platek authored Oct 8, 2024
1 parent 9cf4394 commit 5e779f0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ template <typename Ty, ArithmeticOp operation> struct RED_CLU
int ii = j * ns;
int n = ii + ns > nw ? nw - ii : ns;
std::vector<Ty> clusters_results;
int clusters_counter = ns / test_params.cluster_size;
int clusters_counter = (ns + test_params.cluster_size - 1) / test_params.cluster_size;
clusters_results.resize(clusters_counter);

// Compute target
Expand Down

0 comments on commit 5e779f0

Please sign in to comment.