File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
include/nbl/builtin/hlsl/sort Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -72,19 +72,18 @@ struct counting
72
72
histogram.atomicAdd (tid, sum);
73
73
74
74
const bool is_last_wg_invocation = tid == (GroupSize - 1 );
75
+ const uint16_t adjusted_key_bucket_count = KeyBucketCount + (GroupSize - KeyBucketCount % GroupSize);
75
76
76
- for (int i = 1 ; i < buckets_per_thread; i++ )
77
+ for (tid += GroupSize; tid < adjusted_key_bucket_count; tid += GroupSize )
77
78
{
78
- uint32_t prev_bucket_count = GroupSize * i;
79
-
80
79
if (is_last_wg_invocation) {
81
- sdata.set (prev_bucket_count, sdata.get (prev_bucket_count) + sum);
80
+ uint32_t startIndex = tid - tid % GroupSize;
81
+ sdata.set (startIndex, sdata.get (startIndex) + sum);
82
82
}
83
83
84
- uint32_t index = prev_bucket_count + tid;
85
- sum = inclusive_scan (sdata.get (index), sdata);
84
+ sum = inclusive_scan (sdata.get (tid), sdata);
86
85
87
- histogram.atomicAdd (prev_bucket_count + tid, sum);
86
+ histogram.atomicAdd (tid, sum);
88
87
}
89
88
}
90
89
You can’t perform that action at this time.
0 commit comments