Igalia’s Gyuyoung Kim introduces the WebGPU Conformance Test Suite, which helps all browser developers ensure compatibility with the WebGPU specification.
2. ● WebGPU is a new WebAPI that exposed modern computer graphics capabilities, specifically
Direct3D 12, Metal, and Vulkan, for performing rendering and computation operations on a
GPU[1]
What’s WebGPU?
3. WebGPU CTS
● CTS is an abbreviation for Conformance Test Suite.
● It tests the behaviors defined by the WebGPU specification.
● It’s written in TypeScript.
● It has been developed in GitHub(https://github.com/gpuweb/cts)
● The WebGPU CTS is able to be run with a sort of ‘adapter layer’ to work
under other test infrastructure like WPT and Telemetry.
● There are around 1,400 tests currently.
5. Contribution
● Testing tasks have been tracked in the CTS project tracker
● Procedure of adding a new test
a. Setup the CTS developing environment
b. Adding or Editing Test Plans
c. Implement Tests
d. Upload the test and request to review
6. Test Organization
● API: Tests for full coverage of the Javascript API surface of WebGPU.
● Shader: Tests for full coverage of the shaders that can be passed to
WebGPU.
● Idl: Tests to check that the WebGPU IDL is correctly implemented.
● Web Platform: Tests for Web platform-specific interactions
7. Test Example
g.test('buffer_state')
.desc(
`
Test that the buffer used for GPUQueue.writeBuffer() must be valid. Tests calling writeBuffer
with {valid, invalid, destroyed} buffer.
`
)
.params(u => u.combine('bufferState', [‘valid’, ‘invalid’, ‘destroyed’]))
.fn(async t => {
const { bufferState } = t.params;
const buffer = t.createBufferWithState(bufferState, {
size: 16,
usage: GPUBufferUsage.COPY_DST,
});
const data = new Uint8Array(16);
const _valid = bufferState === 'valid';
t.expectValidationError(() => {
t.device.queue.writeBuffer(buffer, 0, data, 0, data.length);
}, !_valid);
});
● .desc: Describe what it tests and
summarize how it tests that
functionality.
● .params: Define parameters with a list
of objects to be tested. Each such
instance of the test is a “case”.
● .fn: Implementation body of the test.
8. Parameterization
g.test('basic,plain_cases'
)
.paramsSimple
([
{ x: 2, y: 2 },
{ x: -10, y: -10 },
])
● The CTS provides helpers .params()
and friends for creating large cartesian
products of test parameters.
● These generate "test cases" further
subdivided into "test subcases".
g.test('basic,builder_cases'
)
.params(u =>
u
.combineWithParams
([{ x: 1 }, { x: 2 }])
.combineWithParams
([{ y: 1 }, { y: 2 }])
g.test('basic,builder_cases_subcases'
)
.params(u =>
u
.combineWithParams
([{ x: 1 }, { x: 2 }])
.beginSubcases
()
.combineWithParams
([{ y: 1 }, { y: 2 }])
)
9. Commit Rate by Affiliation
Affilation Commits#
@chromium.org 776
@google.com 410
@intel.com 200
@gmail.com 109
@igalia.com 91
others 143
Searched on November 13
10. Thank you!
Ken Russell (kbr@chromium.org)
Kai Ninomiya (kainino@chromium.org)
and other reviewers!