Smart compaction goes brrrrr

This commit is contained in:
2026-09-17 23:01:29 +02:00
parent f34550e692
commit 306b01b44c
5 changed files with 180 additions and 401 deletions
+3 -2
View File
@@ -113,6 +113,7 @@ void scatter(
uint32_t3 local_thread_id: SV_GroupThreadID,
uint32_t3 global_thread_id: SV_DispatchThreadID)
{
let total = index_buffer.getCount();
let thread_index = global_thread_id.x;
let local_thread_index = local_thread_id.x;
@@ -123,12 +124,12 @@ void scatter(
let sum2 = sum_buffer[thread_index * 2 + 1] + reduced_value;
// Scatter index to compact index buffer if predicate is true
if (count_buffer[thread_index * 2] != 0)
if (count_buffer[thread_index * 2] != 0 && sum1 < total)
{
index_buffer[sum1] = thread_index * 2;
}
if (count_buffer[thread_index * 2 + 1] != 0)
if (count_buffer[thread_index * 2 + 1] != 0 && sum2 < total)
{
index_buffer[sum2] = thread_index * 2 + 1;
}
Binary file not shown.