From c17c672ec0050982a20eb60ab8ae91773d0971a8 Mon Sep 17 00:00:00 2001 From: Brandon Jones Date: Thu, 2 Nov 2023 14:24:23 -0700 Subject: [PATCH] Extended the async pipeline pattern to two more sets of long running tests --- src/webgpu/shader/execution/robust_access.spec.ts | 12 ++++++------ src/webgpu/shader/execution/zero_init.spec.ts | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/webgpu/shader/execution/robust_access.spec.ts b/src/webgpu/shader/execution/robust_access.spec.ts index 03b58265661a..965dd283dd16 100644 --- a/src/webgpu/shader/execution/robust_access.spec.ts +++ b/src/webgpu/shader/execution/robust_access.spec.ts @@ -23,14 +23,14 @@ const kMinI32 = -0x8000_0000; * Non-test bindings are in bind group 1, including: * - `constants.zero`: a dynamically-uniform `0u` value. */ -function runShaderTest( +async function runShaderTest( t: GPUTest, stage: GPUShaderStageFlags, testSource: string, layout: GPUPipelineLayout, testBindings: GPUBindGroupEntry[], dynamicOffsets?: number[] -): void { +): Promise { assert(stage === GPUShaderStage.COMPUTE, 'Only know how to deal with compute for now'); // Contains just zero (for now). @@ -62,7 +62,7 @@ fn main() { t.debug(source); const module = t.device.createShaderModule({ code: source }); - const pipeline = t.device.createComputePipeline({ + const pipeline = await t.device.createComputePipelineAsync({ layout, compute: { module, entryPoint: 'main' }, }); @@ -172,7 +172,7 @@ g.test('linear_memory') .expand('baseType', supportedScalarTypes) .expandWithParams(generateTypes) ) - .fn(t => { + .fn(async t => { const { addressSpace, storageMode, @@ -448,7 +448,7 @@ fn runTest() -> u32 { ); // Run the shader, accessing the buffer. - runShaderTest( + await runShaderTest( t, GPUShaderStage.COMPUTE, testSource, @@ -475,6 +475,6 @@ fn runTest() -> u32 { bufferBindingEnd ); } else { - runShaderTest(t, GPUShaderStage.COMPUTE, testSource, layout, []); + await runShaderTest(t, GPUShaderStage.COMPUTE, testSource, layout, []); } }); diff --git a/src/webgpu/shader/execution/zero_init.spec.ts b/src/webgpu/shader/execution/zero_init.spec.ts index fe298a161a66..e03a72f8df56 100644 --- a/src/webgpu/shader/execution/zero_init.spec.ts +++ b/src/webgpu/shader/execution/zero_init.spec.ts @@ -227,7 +227,7 @@ g.test('compute,zero_init') }) ) .batch(15) - .fn(t => { + .fn(async t => { const { workgroupSize } = t.params; const { maxComputeInvocationsPerWorkgroup } = t.device.limits; const numWorkgroupInvocations = workgroupSize.reduce((a, b) => a * b); @@ -446,7 +446,7 @@ g.test('compute,zero_init') ], }); - const fillPipeline = t.device.createComputePipeline({ + const fillPipeline = await t.device.createComputePipelineAsync({ layout: t.device.createPipelineLayout({ bindGroupLayouts: [fillLayout] }), label: 'Workgroup Fill Pipeline', compute: { @@ -495,7 +495,7 @@ g.test('compute,zero_init') t.queue.submit([e.finish()]); } - const pipeline = t.device.createComputePipeline({ + const pipeline = await t.device.createComputePipelineAsync({ layout: 'auto', compute: { module: t.device.createShaderModule({