From dbf19968abb9090569cd0a1f7417244571bd44e9 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Tue, 28 Nov 2023 08:58:01 -0800 Subject: [PATCH] align --- .../shader/execution/memory_model/memory_model_setup.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/webgpu/shader/execution/memory_model/memory_model_setup.ts b/src/webgpu/shader/execution/memory_model/memory_model_setup.ts index 5aeaf139ac02..26183aff611f 100644 --- a/src/webgpu/shader/execution/memory_model/memory_model_setup.ts +++ b/src/webgpu/shader/execution/memory_model/memory_model_setup.ts @@ -1,5 +1,6 @@ import { GPUTest } from '../../../gpu_test'; import { checkElementsPassPredicate } from '../../../util/check_contents.js'; +import { align } from '../../../util/math.js'; /* All buffer sizes are counted in units of 4-byte words. */ @@ -275,12 +276,12 @@ export class MemoryModelTester { // Combine 3 arrays into 1 buffer as we need to keep the number of storage buffers to 4 for compat. const falseSharingAvoidanceQuantum = 4096; - const barrierSize = Math.max(bytesPerWord, falseSharingAvoidanceQuantum); - const scratchpadSize = Math.max( + const barrierSize = align(bytesPerWord, falseSharingAvoidanceQuantum); + const scratchpadSize = align( this.params.scratchMemorySize * bytesPerWord, falseSharingAvoidanceQuantum ); - const scratchMemoryLocationsSize = Math.max( + const scratchMemoryLocationsSize = align( this.params.maxWorkgroups * bytesPerWord, falseSharingAvoidanceQuantum );