Skip to content

Commit bdfb6cb

Browse files
committed
amdilc: increase minimum spirv buffer size to reduce realloc call count
1 parent 4c4b31c commit bdfb6cb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/amdilc/amdilc_spirv.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ static void putBuffer(
1818
unsigned size = (buffer->wordCount + otherBuffer->wordCount) * sizeof(IlcSpvWord);
1919
if (buffer->wordSize < size) {
2020
// Grow the buffer exponentially to minimize allocations
21-
buffer->wordSize = sizeof(IlcSpvWord);
21+
if (buffer->wordSize < sizeof(IlcSpvWord)) {
22+
buffer->wordSize = sizeof(IlcSpvWord) * 1024;
23+
}
24+
2225
while (buffer->wordSize < size) {
2326
buffer->wordSize *= BUFFER_ALLOC_FACTOR;
2427
}

0 commit comments

Comments
 (0)