From 15cbb6c031706d957cc2337e08015c2b7d043267 Mon Sep 17 00:00:00 2001 From: Cherser-s <29800876+Cherser-s@users.noreply.github.com> Date: Sat, 10 Dec 2022 10:58:33 +0300 Subject: [PATCH] amdilc: increase minimum spirv buffer size to reduce realloc call count --- src/amdilc/amdilc_spirv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/amdilc/amdilc_spirv.c b/src/amdilc/amdilc_spirv.c index e96ab97e..9a66657b 100644 --- a/src/amdilc/amdilc_spirv.c +++ b/src/amdilc/amdilc_spirv.c @@ -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; }