Skip to content

Commit bd0414c

Browse files
authored
const_array_elements limit test: split into MAX, MAX/8, MAX/64 cases (#4497)
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
1 parent b05a778 commit bd0414c

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

src/webgpu/shader/execution/limits.spec.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -412,11 +412,22 @@ g.test('workgroup_array_byte_size_override')
412412

413413
g.test('const_array_elements')
414414
.desc(`Test that constant array expressions with the maximum number of elements are supported.`)
415+
.params(
416+
u =>
417+
// Some backend shader compilers take too long to compile the maximum
418+
// size. In that case the browser GPU process can time out. The WGSL
419+
// spec allows this as an 'uncategorized error'.
420+
// To get some useful signal from this test, also check a const array
421+
// with a significant size even though it may not be the maximum supported
422+
// size listed in the spec.
423+
u.combine('sizeDivisor', [64, 8, 1]) // Must include 1, to test largest size.
424+
)
415425
.fn(t => {
416-
const type = `array<u32, ${kMaxConstArrayElements}>`;
426+
const elementCount = Math.ceil(kMaxConstArrayElements / t.params.sizeDivisor);
427+
const type = `array<u32, ${elementCount}>`;
417428

418429
let expr = `${type}(`;
419-
for (let i = 0; i < kMaxConstArrayElements; i++) {
430+
for (let i = 0; i < elementCount; i++) {
420431
expr += `${i}, `;
421432
}
422433
expr += `)`;
@@ -430,10 +441,5 @@ g.test('const_array_elements')
430441
}
431442
`;
432443

433-
runShaderTest(
434-
t,
435-
code,
436-
new Uint32Array([...iterRange(kMaxConstArrayElements, _i => 0xdeadbeef)]),
437-
i => i
438-
);
444+
runShaderTest(t, code, new Uint32Array([...iterRange(elementCount, _i => 0xdeadbeef)]), i => i);
439445
});

0 commit comments

Comments
 (0)