From 931479809676a4dc104ef98794538707e2408757 Mon Sep 17 00:00:00 2001 From: David Neto Date: Fri, 7 Nov 2025 15:56:09 -0500 Subject: [PATCH] const_array_elements limit test: split into MAX, MAX/8, MAX/64 cases The MAX const array size is 2047. The driver compiler can take a long time compiling the MAX case. For example a laptop with an Intel Gen12 LP GPU with the Mesa driver can take 28s to compile the shader. This exceeds Chrome's GPU watchdog timeout (10s) and the test will fail. Instead of completely disabling the test, split it into cases for MAX, MAX/8, and MAX/64 elements. This lets us skip the very largest cases, but still attempt smaller bug significant array sizes. That lets us get some signal that the large-ish const arrays are viable. The additional runtime for the new cases are insignificant compared to the full case. Fixed: #4496 --- src/webgpu/shader/execution/limits.spec.ts | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/webgpu/shader/execution/limits.spec.ts b/src/webgpu/shader/execution/limits.spec.ts index d3262cd36e87..5540d1f9391d 100644 --- a/src/webgpu/shader/execution/limits.spec.ts +++ b/src/webgpu/shader/execution/limits.spec.ts @@ -412,11 +412,22 @@ g.test('workgroup_array_byte_size_override') g.test('const_array_elements') .desc(`Test that constant array expressions with the maximum number of elements are supported.`) + .params( + u => + // Some backend shader compilers take too long to compile the maximum + // size. In that case the browser GPU process can time out. The WGSL + // spec allows this as an 'uncategorized error'. + // To get some useful signal from this test, also check a const array + // with a significant size even though it may not be the maximum supported + // size listed in the spec. + u.combine('sizeDivisor', [64, 8, 1]) // Must include 1, to test largest size. + ) .fn(t => { - const type = `array`; + const elementCount = Math.ceil(kMaxConstArrayElements / t.params.sizeDivisor); + const type = `array`; let expr = `${type}(`; - for (let i = 0; i < kMaxConstArrayElements; i++) { + for (let i = 0; i < elementCount; i++) { expr += `${i}, `; } expr += `)`; @@ -430,10 +441,5 @@ g.test('const_array_elements') } `; - runShaderTest( - t, - code, - new Uint32Array([...iterRange(kMaxConstArrayElements, _i => 0xdeadbeef)]), - i => i - ); + runShaderTest(t, code, new Uint32Array([...iterRange(elementCount, _i => 0xdeadbeef)]), i => i); });