Skip to content

Commit

Permalink
amdilc: increase minimum spirv buffer size to reduce realloc call count
Browse files Browse the repository at this point in the history
  • Loading branch information
Cherser-s committed Sep 8, 2023
1 parent 4c4b31c commit bdfb6cb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/amdilc/amdilc_spirv.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ static void putBuffer(
unsigned size = (buffer->wordCount + otherBuffer->wordCount) * sizeof(IlcSpvWord);
if (buffer->wordSize < size) {
// Grow the buffer exponentially to minimize allocations
buffer->wordSize = sizeof(IlcSpvWord);
if (buffer->wordSize < sizeof(IlcSpvWord)) {
buffer->wordSize = sizeof(IlcSpvWord) * 1024;
}

while (buffer->wordSize < size) {
buffer->wordSize *= BUFFER_ALLOC_FACTOR;
}
Expand Down

0 comments on commit bdfb6cb

Please sign in to comment.