From 3dbe4ce12983ccc1ad42e228057c7d8adc17cb78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaufort?= Date: Mon, 30 Oct 2023 15:00:41 +0100 Subject: [PATCH] Add missing tests for adapter capability guarantees (#3107) --- .../features/texture_formats.spec.ts | 16 ++++++++++++++++ .../limits/maxBindGroups.spec.ts | 8 ++++++++ .../limits/maxComputeWorkgroupSizeX.spec.ts | 8 ++++++++ .../limits/maxComputeWorkgroupSizeY.spec.ts | 8 ++++++++ .../limits/maxComputeWorkgroupSizeZ.spec.ts | 8 ++++++++ .../maxComputeWorkgroupsPerDimension.spec.ts | 18 ++++++++++++++++++ .../limits/maxStorageBufferBindingSize.spec.ts | 8 ++++++++ .../limits/maxVertexBufferArrayStride.spec.ts | 8 ++++++++ .../limits/maxVertexBuffers.spec.ts | 8 ++++++++ src/webgpu/capability_info.ts | 1 + src/webgpu/listing_meta.json | 9 +++++++++ 11 files changed, 100 insertions(+) diff --git a/src/webgpu/api/validation/capability_checks/features/texture_formats.spec.ts b/src/webgpu/api/validation/capability_checks/features/texture_formats.spec.ts index 6b99f9f84f67..8654bc6feba6 100644 --- a/src/webgpu/api/validation/capability_checks/features/texture_formats.spec.ts +++ b/src/webgpu/api/validation/capability_checks/features/texture_formats.spec.ts @@ -3,6 +3,7 @@ Tests for capability checking for features enabling optional texture formats. `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; +import { getGPU } from '../../../../../common/util/navigator_gpu.js'; import { assert } from '../../../../../common/util/util.js'; import { kAllTextureFormats, kTextureFormatInfo } from '../../../../format_info.js'; import { kAllCanvasTypes, createCanvas } from '../../../../util/create_elements.js'; @@ -437,3 +438,18 @@ g.test('render_bundle_encoder_descriptor_depth_stencil_format') }); }); }); + +g.test('check_capability_guarantees') + .desc( + `check "texture-compression-bc" is supported or both "texture-compression-etc2" and "texture-compression-astc" are supported.` + ) + .fn(async t => { + const adapter = await getGPU(t.rec).requestAdapter(); + assert(adapter !== null); + + const features = adapter.features; + t.expect( + features.has('texture-compression-bc') || + (features.has('texture-compression-etc2') && features.has('texture-compression-astc')) + ); + }); diff --git a/src/webgpu/api/validation/capability_checks/limits/maxBindGroups.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxBindGroups.spec.ts index 2d3e1dcc95aa..2b987175c542 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxBindGroups.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxBindGroups.spec.ts @@ -85,3 +85,11 @@ g.test('setBindGroup,at_over') } ); }); + +g.test('validate,maxBindGroupsPlusVertexBuffers') + .desc(`Test that ${limit} <= maxBindGroupsPlusVertexBuffers`) + .fn(t => { + const { adapter, defaultLimit, adapterLimit } = t; + t.expect(defaultLimit <= t.getDefaultLimit('maxBindGroupsPlusVertexBuffers')); + t.expect(adapterLimit <= adapter.limits.maxBindGroupsPlusVertexBuffers); + }); diff --git a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeX.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeX.spec.ts index 7948cce8af97..6d394f998cda 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeX.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeX.spec.ts @@ -10,3 +10,11 @@ g.test('createComputePipeline,at_over') const { limitTest, testValueName, async } = t.params; await t.testMaxComputeWorkgroupSize(limitTest, testValueName, async, 'X'); }); + +g.test('validate,maxComputeInvocationsPerWorkgroup') + .desc(`Test that ${limit} <= maxComputeInvocationsPerWorkgroup`) + .fn(t => { + const { adapter, defaultLimit, adapterLimit } = t; + t.expect(defaultLimit <= t.getDefaultLimit('maxComputeInvocationsPerWorkgroup')); + t.expect(adapterLimit <= adapter.limits.maxComputeInvocationsPerWorkgroup); + }); diff --git a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeY.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeY.spec.ts index 4585676fb2a4..26eeaa9a64fe 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeY.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeY.spec.ts @@ -10,3 +10,11 @@ g.test('createComputePipeline,at_over') const { limitTest, testValueName, async } = t.params; await t.testMaxComputeWorkgroupSize(limitTest, testValueName, async, 'Y'); }); + +g.test('validate,maxComputeInvocationsPerWorkgroup') + .desc(`Test that ${limit} <= maxComputeInvocationsPerWorkgroup`) + .fn(t => { + const { adapter, defaultLimit, adapterLimit } = t; + t.expect(defaultLimit <= t.getDefaultLimit('maxComputeInvocationsPerWorkgroup')); + t.expect(adapterLimit <= adapter.limits.maxComputeInvocationsPerWorkgroup); + }); diff --git a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeZ.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeZ.spec.ts index 8be1aa4b4770..9a199f4cd3f5 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeZ.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeZ.spec.ts @@ -10,3 +10,11 @@ g.test('createComputePipeline,at_over') const { limitTest, testValueName, async } = t.params; await t.testMaxComputeWorkgroupSize(limitTest, testValueName, async, 'Z'); }); + +g.test('validate,maxComputeInvocationsPerWorkgroup') + .desc(`Test that ${limit} <= maxComputeInvocationsPerWorkgroup`) + .fn(t => { + const { adapter, defaultLimit, adapterLimit } = t; + t.expect(defaultLimit <= t.getDefaultLimit('maxComputeInvocationsPerWorkgroup')); + t.expect(adapterLimit <= adapter.limits.maxComputeInvocationsPerWorkgroup); + }); diff --git a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupsPerDimension.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupsPerDimension.spec.ts index 997fa46a7e71..cff50726ba12 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupsPerDimension.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupsPerDimension.spec.ts @@ -77,3 +77,21 @@ g.test('dispatchWorkgroups,at_over') } ); }); + +g.test('validate') + .desc( + `Test that ${limit} <= maxComputeWorkgroupSizeX x maxComputeWorkgroupSizeY x maxComputeWorkgroupSizeZ` + ) + .fn(t => { + const { adapter, defaultLimit, adapterLimit } = t; + const defaultMaxComputeWorkgroupSizeProduct = + t.getDefaultLimit('maxComputeWorkgroupSizeX') * + t.getDefaultLimit('maxComputeWorkgroupSizeY') * + t.getDefaultLimit('maxComputeWorkgroupSizeZ'); + const maxComputeWorkgroupSizeProduct = + adapter.limits.maxComputeWorkgroupSizeX * + adapter.limits.maxComputeWorkgroupSizeY * + adapter.limits.maxComputeWorkgroupSizeZ; + t.expect(defaultLimit <= defaultMaxComputeWorkgroupSizeProduct); + t.expect(adapterLimit <= maxComputeWorkgroupSizeProduct); + }); diff --git a/src/webgpu/api/validation/capability_checks/limits/maxStorageBufferBindingSize.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxStorageBufferBindingSize.spec.ts index 15fca54445a6..d504d0b7fb64 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxStorageBufferBindingSize.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxStorageBufferBindingSize.spec.ts @@ -144,6 +144,14 @@ g.test('createBindGroup,at_over') ); }); +g.test('validate') + .desc(`Test that ${limit} is a multiple of 4 bytes`) + .fn(t => { + const { defaultLimit, adapterLimit } = t; + t.expect(defaultLimit % 4 === 0); + t.expect(adapterLimit % 4 === 0); + }); + g.test('validate,maxBufferSize') .desc(`Test that ${limit} <= maxBufferSize`) .fn(t => { diff --git a/src/webgpu/api/validation/capability_checks/limits/maxVertexBufferArrayStride.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxVertexBufferArrayStride.spec.ts index 950323105570..0af5724f2a2a 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxVertexBufferArrayStride.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxVertexBufferArrayStride.spec.ts @@ -111,3 +111,11 @@ g.test('createRenderPipeline,at_over') } ); }); + +g.test('validate') + .desc(`Test that ${limit} is a multiple of 4 bytes`) + .fn(t => { + const { defaultLimit, adapterLimit } = t; + t.expect(defaultLimit % 4 === 0); + t.expect(adapterLimit % 4 === 0); + }); diff --git a/src/webgpu/api/validation/capability_checks/limits/maxVertexBuffers.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxVertexBuffers.spec.ts index 97a1c241287b..04e0fe72fa44 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxVertexBuffers.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxVertexBuffers.spec.ts @@ -90,3 +90,11 @@ g.test('setVertexBuffer,at_over') } ); }); + +g.test('validate,maxBindGroupsPlusVertexBuffers') + .desc(`Test that ${limit} <= maxBindGroupsPlusVertexBuffers`) + .fn(t => { + const { adapter, defaultLimit, adapterLimit } = t; + t.expect(defaultLimit <= t.getDefaultLimit('maxBindGroupsPlusVertexBuffers')); + t.expect(adapterLimit <= adapter.limits.maxBindGroupsPlusVertexBuffers); + }); diff --git a/src/webgpu/capability_info.ts b/src/webgpu/capability_info.ts index 3626877544af..f0b5e938a134 100644 --- a/src/webgpu/capability_info.ts +++ b/src/webgpu/capability_info.ts @@ -667,6 +667,7 @@ const [ 'maxTextureArrayLayers': [ , 256, 256, ], 'maxBindGroups': [ , 4, 4, ], + 'maxBindGroupsPlusVertexBuffers': [ , 24, 24, ], 'maxBindingsPerBindGroup': [ , 1000, 1000, ], 'maxDynamicUniformBuffersPerPipelineLayout': [ , 8, 8, ], 'maxDynamicStorageBuffersPerPipelineLayout': [ , 4, 4, ], diff --git a/src/webgpu/listing_meta.json b/src/webgpu/listing_meta.json index fa57ff978139..f9caeefc6ee1 100644 --- a/src/webgpu/listing_meta.json +++ b/src/webgpu/listing_meta.json @@ -267,6 +267,7 @@ "webgpu:api,validation,capability_checks,features,query_types:writeTimestamp:*": { "subcaseMS": 1.200 }, "webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:*": { "subcaseMS": 4.339 }, "webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration_view_formats:*": { "subcaseMS": 4.522 }, + "webgpu:api,validation,capability_checks,features,texture_formats:check_capability_guarantees:*": { "subcaseMS": 55.901 }, "webgpu:api,validation,capability_checks,features,texture_formats:depth_stencil_state:*": { "subcaseMS": 15.701 }, "webgpu:api,validation,capability_checks,features,texture_formats:render_bundle_encoder_descriptor_depth_stencil_format:*": { "subcaseMS": 0.800 }, "webgpu:api,validation,capability_checks,features,texture_formats:texture_descriptor:*": { "subcaseMS": 3.830 }, @@ -275,6 +276,7 @@ "webgpu:api,validation,capability_checks,limits,maxBindGroups:createPipeline,at_over:*": { "subcaseMS": 10.990 }, "webgpu:api,validation,capability_checks,limits,maxBindGroups:createPipelineLayout,at_over:*": { "subcaseMS": 9.310 }, "webgpu:api,validation,capability_checks,limits,maxBindGroups:setBindGroup,at_over:*": { "subcaseMS": 9.984 }, + "webgpu:api,validation,capability_checks,limits,maxBindGroups:validate,maxBindGroupsPlusVertexBuffers:*": { "subcaseMS": 11.200 }, "webgpu:api,validation,capability_checks,limits,maxBindingsPerBindGroup:createBindGroupLayout,at_over:*": { "subcaseMS": 12.441 }, "webgpu:api,validation,capability_checks,limits,maxBindingsPerBindGroup:createPipeline,at_over:*": { "subcaseMS": 11.179 }, "webgpu:api,validation,capability_checks,limits,maxBindingsPerBindGroup:validate:*": { "subcaseMS": 12.401 }, @@ -289,10 +291,14 @@ "webgpu:api,validation,capability_checks,limits,maxColorAttachments:validate,maxColorAttachmentBytesPerSample:*": { "subcaseMS": 1.101 }, "webgpu:api,validation,capability_checks,limits,maxComputeInvocationsPerWorkgroup:createComputePipeline,at_over:*": { "subcaseMS": 13.735 }, "webgpu:api,validation,capability_checks,limits,maxComputeWorkgroupSizeX:createComputePipeline,at_over:*": { "subcaseMS": 14.465 }, + "webgpu:api,validation,capability_checks,limits,maxComputeWorkgroupSizeX:validate,maxComputeInvocationsPerWorkgroup:*": { "subcaseMS": 2.701 }, "webgpu:api,validation,capability_checks,limits,maxComputeWorkgroupSizeY:createComputePipeline,at_over:*": { "subcaseMS": 14.131 }, + "webgpu:api,validation,capability_checks,limits,maxComputeWorkgroupSizeY:validate,maxComputeInvocationsPerWorkgroup:*": { "subcaseMS": 2.700 }, "webgpu:api,validation,capability_checks,limits,maxComputeWorkgroupSizeZ:createComputePipeline,at_over:*": { "subcaseMS": 14.920 }, + "webgpu:api,validation,capability_checks,limits,maxComputeWorkgroupSizeZ:validate,maxComputeInvocationsPerWorkgroup:*": { "subcaseMS": 2.601 }, "webgpu:api,validation,capability_checks,limits,maxComputeWorkgroupStorageSize:createComputePipeline,at_over:*": { "subcaseMS": 12.009 }, "webgpu:api,validation,capability_checks,limits,maxComputeWorkgroupsPerDimension:dispatchWorkgroups,at_over:*": { "subcaseMS": 13.310 }, + "webgpu:api,validation,capability_checks,limits,maxComputeWorkgroupsPerDimension:validate:*": { "subcaseMS": 138.900 }, "webgpu:api,validation,capability_checks,limits,maxDynamicStorageBuffersPerPipelineLayout:createBindGroupLayout,at_over:*": { "subcaseMS": 15.680 }, "webgpu:api,validation,capability_checks,limits,maxDynamicUniformBuffersPerPipelineLayout:createBindGroupLayout,at_over:*": { "subcaseMS": 10.268 }, "webgpu:api,validation,capability_checks,limits,maxInterStageShaderComponents:createRenderPipeline,at_over:*": { "subcaseMS": 12.916 }, @@ -305,6 +311,7 @@ "webgpu:api,validation,capability_checks,limits,maxSamplersPerShaderStage:createPipelineLayout,at_over:*": { "subcaseMS": 10.427 }, "webgpu:api,validation,capability_checks,limits,maxStorageBufferBindingSize:createBindGroup,at_over:*": { "subcaseMS": 51.810 }, "webgpu:api,validation,capability_checks,limits,maxStorageBufferBindingSize:validate,maxBufferSize:*": { "subcaseMS": 0.900 }, + "webgpu:api,validation,capability_checks,limits,maxStorageBufferBindingSize:validate:*": { "subcaseMS": 132.400 }, "webgpu:api,validation,capability_checks,limits,maxStorageBuffersPerShaderStage:createBindGroupLayout,at_over:*": { "subcaseMS": 4.565 }, "webgpu:api,validation,capability_checks,limits,maxStorageBuffersPerShaderStage:createPipeline,at_over:*": { "subcaseMS": 7.884 }, "webgpu:api,validation,capability_checks,limits,maxStorageBuffersPerShaderStage:createPipelineLayout,at_over:*": { "subcaseMS": 5.007 }, @@ -324,8 +331,10 @@ "webgpu:api,validation,capability_checks,limits,maxUniformBuffersPerShaderStage:createPipelineLayout,at_over:*": { "subcaseMS": 6.109 }, "webgpu:api,validation,capability_checks,limits,maxVertexAttributes:createRenderPipeline,at_over:*": { "subcaseMS": 9.090 }, "webgpu:api,validation,capability_checks,limits,maxVertexBufferArrayStride:createRenderPipeline,at_over:*": { "subcaseMS": 10.060 }, + "webgpu:api,validation,capability_checks,limits,maxVertexBufferArrayStride:validate:*": { "subcaseMS": 139.500 }, "webgpu:api,validation,capability_checks,limits,maxVertexBuffers:createRenderPipeline,at_over:*": { "subcaseMS": 8.903 }, "webgpu:api,validation,capability_checks,limits,maxVertexBuffers:setVertexBuffer,at_over:*": { "subcaseMS": 7.695 }, + "webgpu:api,validation,capability_checks,limits,maxVertexBuffers:validate,maxBindGroupsPlusVertexBuffers:*": { "subcaseMS": 153.900 }, "webgpu:api,validation,capability_checks,limits,minStorageBufferOffsetAlignment:createBindGroup,at_over:*": { "subcaseMS": 9.650 }, "webgpu:api,validation,capability_checks,limits,minStorageBufferOffsetAlignment:setBindGroup,at_over:*": { "subcaseMS": 8.931 }, "webgpu:api,validation,capability_checks,limits,minStorageBufferOffsetAlignment:validate,greaterThanOrEqualTo32:*": { "subcaseMS": 31.801 },