From 1e545f5fc54cbb7f347effee407d76e64666bbc1 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Wed, 11 Dec 2024 00:53:58 -0500 Subject: [PATCH] Remove many test cases that never run because maxColorAttachments=8 (#4087) * part 1: use indices instead of full data for subcase params * part 2: remove cases that are always no-ops at maxColorAttachments>8 --- .../createRenderBundleEncoder.spec.ts | 12 +++- .../attachment_compatibility.spec.ts | 70 ++++++++++--------- .../render_pass_descriptor.spec.ts | 9 ++- .../render_pipeline/fragment_state.spec.ts | 10 ++- 4 files changed, 62 insertions(+), 39 deletions(-) diff --git a/src/webgpu/api/validation/encoding/createRenderBundleEncoder.spec.ts b/src/webgpu/api/validation/encoding/createRenderBundleEncoder.spec.ts index b4beeb8fbe5d..ade00417411b 100644 --- a/src/webgpu/api/validation/encoding/createRenderBundleEncoder.spec.ts +++ b/src/webgpu/api/validation/encoding/createRenderBundleEncoder.spec.ts @@ -1,10 +1,12 @@ export const description = ` createRenderBundleEncoder validation tests. + +TODO(#3363): Make this into a MaxLimitTest and increase kMaxColorAttachments. `; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { range } from '../../../../common/util/util.js'; -import { kMaxColorAttachmentsToTest } from '../../../capability_info.js'; +import { getDefaultLimits } from '../../../capability_info.js'; import { computeBytesPerSampleFromFormats, kAllTextureFormats, @@ -14,6 +16,10 @@ import { } from '../../../format_info.js'; import { ValidationTest } from '../validation_test.js'; +// MAINTENANCE_TODO: This should be changed to kMaxColorAttachmentsToTest +// when this is made a MaxLimitTest (see above). +const kMaxColorAttachments = getDefaultLimits('core').maxColorAttachments.default; + export const g = makeTestGroup(ValidationTest); g.test('attachment_state,limits,maxColorAttachments') @@ -21,7 +27,7 @@ g.test('attachment_state,limits,maxColorAttachments') .params(u => u.beginSubcases().combine( 'colorFormatCount', - range(kMaxColorAttachmentsToTest, i => i + 1) + range(kMaxColorAttachments, i => i + 1) ) ) .fn(t => { @@ -52,7 +58,7 @@ g.test('attachment_state,limits,maxColorAttachmentBytesPerSample,aligned') .beginSubcases() .combine( 'colorFormatCount', - range(kMaxColorAttachmentsToTest, i => i + 1) + range(kMaxColorAttachments, i => i + 1) ) ) .beforeAllSubcases(t => { diff --git a/src/webgpu/api/validation/render_pass/attachment_compatibility.spec.ts b/src/webgpu/api/validation/render_pass/attachment_compatibility.spec.ts index b0a4bf226dba..8f5982f8af18 100644 --- a/src/webgpu/api/validation/render_pass/attachment_compatibility.spec.ts +++ b/src/webgpu/api/validation/render_pass/attachment_compatibility.spec.ts @@ -1,10 +1,12 @@ export const description = ` Validation for attachment compatibility between render passes, bundles, and pipelines + +TODO(#3363): Make this into a MaxLimitTest and increase kMaxColorAttachments. `; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { range } from '../../../../common/util/util.js'; -import { kMaxColorAttachmentsToTest, kTextureSampleCounts } from '../../../capability_info.js'; +import { getDefaultLimits, kTextureSampleCounts } from '../../../capability_info.js'; import { kRegularTextureFormats, kSizedDepthStencilFormats, @@ -15,7 +17,11 @@ import { } from '../../../format_info.js'; import { ValidationTest } from '../validation_test.js'; -const kColorAttachmentCounts = range(kMaxColorAttachmentsToTest, i => i + 1); +// MAINTENANCE_TODO: This should be changed to kMaxColorAttachmentsToTest +// when this is made a MaxLimitTest (see above). +const kMaxColorAttachments = getDefaultLimits('core').maxColorAttachments.default; + +const kColorAttachmentCounts = range(kMaxColorAttachments, i => i + 1); const kColorAttachments = kColorAttachmentCounts .map(count => { // generate cases with 0..1 null attachments at different location @@ -240,26 +246,25 @@ g.test('render_pass_and_bundle,color_sparse') // introduce attachmentCount to make it easier to split the test .combine('attachmentCount', kColorAttachmentCounts) .beginSubcases() - .combine('passAttachments', kColorAttachments) - .combine('bundleAttachments', kColorAttachments) - .filter( - p => - p.attachmentCount === p.passAttachments.length && - p.attachmentCount === p.bundleAttachments.length + // Indices into kColorAttachments + .expand('iPass', p => + range(kColorAttachments.length, i => i).filter( + i => kColorAttachments[i].length === p.attachmentCount + ) + ) + .expand('iBundle', p => + range(kColorAttachments.length, i => i).filter( + i => kColorAttachments[i].length === p.attachmentCount + ) ) ) .fn(t => { - const { passAttachments, bundleAttachments } = t.params; + const passAttachments = kColorAttachments[t.params.iPass]; + const bundleAttachments = kColorAttachments[t.params.iBundle]; const { maxColorAttachments } = t.device.limits; - t.skipIf( - passAttachments.length > maxColorAttachments, - `num passAttachments: ${passAttachments.length} > maxColorAttachments for device: ${maxColorAttachments}` - ); - t.skipIf( - bundleAttachments.length > maxColorAttachments, - `num bundleAttachments: ${bundleAttachments.length} > maxColorAttachments for device: ${maxColorAttachments}` - ); + t.skipIf(passAttachments.length > maxColorAttachments); + t.skipIf(bundleAttachments.length > maxColorAttachments); const colorFormats = bundleAttachments.map(i => (i ? 'rgba8uint' : null)); const bundleEncoder = t.device.createRenderBundleEncoder({ @@ -445,25 +450,26 @@ Test that each of color attachments in render passes or bundles match that of th // introduce attachmentCount to make it easier to split the test .combine('attachmentCount', kColorAttachmentCounts) .beginSubcases() - .combine('encoderAttachments', kColorAttachments) - .combine('pipelineAttachments', kColorAttachments) - .filter( - p => - p.attachmentCount === p.encoderAttachments.length && - p.attachmentCount === p.pipelineAttachments.length + // Indices into kColorAttachments + .expand('iEncoder', p => + range(kColorAttachments.length, i => i).filter( + i => kColorAttachments[i].length === p.attachmentCount + ) + ) + .expand('iPipeline', p => + range(kColorAttachments.length, i => i).filter( + i => kColorAttachments[i].length === p.attachmentCount + ) ) ) .fn(t => { - const { encoderType, encoderAttachments, pipelineAttachments } = t.params; + const { encoderType } = t.params; + const encoderAttachments = kColorAttachments[t.params.iEncoder]; + const pipelineAttachments = kColorAttachments[t.params.iPipeline]; + const { maxColorAttachments } = t.device.limits; - t.skipIf( - encoderAttachments.length > maxColorAttachments, - `num encoderAttachments: ${encoderAttachments.length} > maxColorAttachments for device: ${maxColorAttachments}` - ); - t.skipIf( - pipelineAttachments.length > maxColorAttachments, - `num pipelineAttachments: ${pipelineAttachments.length} > maxColorAttachments for device: ${maxColorAttachments}` - ); + t.skipIf(encoderAttachments.length > maxColorAttachments); + t.skipIf(pipelineAttachments.length > maxColorAttachments); const colorTargets = pipelineAttachments.map(i => i ? ({ format: 'rgba8uint', writeMask: 0 } as GPUColorTargetState) : null diff --git a/src/webgpu/api/validation/render_pass/render_pass_descriptor.spec.ts b/src/webgpu/api/validation/render_pass/render_pass_descriptor.spec.ts index 76fca77a90bf..3ded92c5c022 100644 --- a/src/webgpu/api/validation/render_pass/render_pass_descriptor.spec.ts +++ b/src/webgpu/api/validation/render_pass/render_pass_descriptor.spec.ts @@ -1,12 +1,13 @@ export const description = ` render pass descriptor validation tests. +TODO(#3363): Make this into a MaxLimitTest and increase kMaxColorAttachments. TODO: review for completeness `; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { range } from '../../../../common/util/util.js'; -import { kMaxColorAttachmentsToTest, kQueryTypes } from '../../../capability_info.js'; +import { getDefaultLimits, kQueryTypes } from '../../../capability_info.js'; import { GPUConst } from '../../../constants.js'; import { computeBytesPerSampleFromFormats, @@ -16,6 +17,10 @@ import { } from '../../../format_info.js'; import { ValidationTest } from '../validation_test.js'; +// MAINTENANCE_TODO: This should be changed to kMaxColorAttachmentsToTest +// when this is made a MaxLimitTest (see above). +const kMaxColorAttachments = getDefaultLimits('core').maxColorAttachments.default; + class F extends ValidationTest { createTestTexture( options: { @@ -201,7 +206,7 @@ g.test('color_attachments,limits,maxColorAttachmentBytesPerSample,aligned') .beginSubcases() .combine( 'attachmentCount', - range(kMaxColorAttachmentsToTest, i => i + 1) + range(kMaxColorAttachments, i => i + 1) ) ) .beforeAllSubcases(t => { diff --git a/src/webgpu/api/validation/render_pipeline/fragment_state.spec.ts b/src/webgpu/api/validation/render_pipeline/fragment_state.spec.ts index 51a5d5f79763..efbe8b0b5b94 100644 --- a/src/webgpu/api/validation/render_pipeline/fragment_state.spec.ts +++ b/src/webgpu/api/validation/render_pipeline/fragment_state.spec.ts @@ -1,14 +1,16 @@ export const description = ` This test dedicatedly tests validation of GPUFragmentState of createRenderPipeline. + +TODO(#3363): Make this into a MaxLimitTest and increase kMaxColorAttachments. `; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { assert, range } from '../../../../common/util/util.js'; import { + getDefaultLimits, IsDualSourceBlendingFactor, kBlendFactors, kBlendOperations, - kMaxColorAttachmentsToTest, } from '../../../capability_info.js'; import { GPUConst } from '../../../constants.js'; import { @@ -28,6 +30,10 @@ import { kTexelRepresentationInfo } from '../../../util/texture/texel_data.js'; import { ColorTargetState, CreateRenderPipelineValidationTest } from './common.js'; +// MAINTENANCE_TODO: This should be changed to kMaxColorAttachmentsToTest +// when this is made a MaxLimitTest (see above). +const kMaxColorAttachments = getDefaultLimits('core').maxColorAttachments.default; + export const g = makeTestGroup(CreateRenderPipelineValidationTest); const values = [0, 1, 0, 1]; @@ -169,7 +175,7 @@ g.test('limits,maxColorAttachmentBytesPerSample,aligned') .beginSubcases() .combine( 'attachmentCount', - range(kMaxColorAttachmentsToTest, i => i + 1) + range(kMaxColorAttachments, i => i + 1) ) .combine('isAsync', [false, true]) )