From 83455642e469a05568e4879f548ed281807b77b0 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Tue, 25 Feb 2025 15:09:25 -0800 Subject: [PATCH] Refactor shader/execution/expression/unary Issue #4178 --- .../unary/address_of_and_indirection.spec.ts | 28 ++++++------ .../expression/unary/af_arithmetic.spec.ts | 4 +- .../expression/unary/af_assignment.spec.ts | 8 ++-- .../expression/unary/ai_arithmetic.spec.ts | 4 +- .../expression/unary/ai_assignment.spec.ts | 4 +- .../expression/unary/ai_complement.spec.ts | 4 +- .../expression/unary/bool_conversion.spec.ts | 8 ++-- .../expression/unary/bool_logical.spec.ts | 4 +- .../expression/unary/f16_arithmetic.spec.ts | 8 ++-- .../expression/unary/f16_conversion.spec.ts | 44 +++++-------------- .../expression/unary/f32_arithmetic.spec.ts | 4 +- .../expression/unary/f32_conversion.spec.ts | 12 ++--- .../expression/unary/i32_arithmetic.spec.ts | 4 +- .../expression/unary/i32_complement.spec.ts | 4 +- .../expression/unary/i32_conversion.spec.ts | 8 ++-- .../expression/unary/u32_complement.spec.ts | 4 +- .../expression/unary/u32_conversion.spec.ts | 8 ++-- 17 files changed, 62 insertions(+), 98 deletions(-) diff --git a/src/webgpu/shader/execution/expression/unary/address_of_and_indirection.spec.ts b/src/webgpu/shader/execution/expression/unary/address_of_and_indirection.spec.ts index bdce7870ddad..2d3df8c1cafe 100644 --- a/src/webgpu/shader/execution/expression/unary/address_of_and_indirection.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/address_of_and_indirection.spec.ts @@ -4,7 +4,7 @@ Execution Tests for unary address-of and indirection (dereference) import { makeTestGroup } from '../../../../../common/framework/test_group.js'; import { keysOf } from '../../../../../common/util/data_tables.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { ScalarKind, scalarType } from '../../../../util/conversion.js'; import { sparseScalarF32Range } from '../../../../util/math.js'; import { @@ -13,7 +13,7 @@ import { run, } from '../expression.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); // All the ways to deref an expression const kDerefCases = { @@ -52,12 +52,10 @@ Pointer expression dereference. .combine('derefType', keysOf(kDerefCases)) .filter(p => !kDerefCases[p.derefType].requires_pointer_composite_access) ) - .beforeAllSubcases(t => { + .fn(async t => { if (t.params.scalarType === 'f16') { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); } - }) - .fn(async t => { const ty = scalarType(t.params.scalarType); const cases = sparseScalarF32Range().map(e => { return { input: ty.create(e), expected: ty.create(e) }; @@ -92,15 +90,15 @@ Pointer expression dereference as lhs of index accessor expression .combine('derefType', keysOf(kDerefCases)) ) .beforeAllSubcases(t => { - if (t.params.scalarType === 'f16') { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - } t.skipIf( kDerefCases[t.params.derefType].requires_pointer_composite_access && !t.hasLanguageFeature('pointer_composite_access') ); }) .fn(async t => { + if (t.params.scalarType === 'f16') { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); + } const ty = scalarType(t.params.scalarType); const cases = sparseScalarF32Range().map(e => { return { input: ty.create(e), expected: ty.create(e) }; @@ -135,15 +133,15 @@ Pointer expression dereference as lhs of member accessor expression .combine('derefType', keysOf(kDerefCases)) ) .beforeAllSubcases(t => { - if (t.params.scalarType === 'f16') { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - } t.skipIf( kDerefCases[t.params.derefType].requires_pointer_composite_access && !t.hasLanguageFeature('pointer_composite_access') ); }) .fn(async t => { + if (t.params.scalarType === 'f16') { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); + } const ty = scalarType(t.params.scalarType); const cases = sparseScalarF32Range().map(e => { return { input: ty.create(e), expected: ty.create(e) }; @@ -181,15 +179,15 @@ Pointer expression dereference as lhs of swizzle expression .combine('derefType', keysOf(kDerefCases)) ) .beforeAllSubcases(t => { - if (t.params.scalarType === 'f16') { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - } t.skipIf( kDerefCases[t.params.derefType].requires_pointer_composite_access && !t.hasLanguageFeature('pointer_composite_access') ); }) .fn(async t => { + if (t.params.scalarType === 'f16') { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); + } const ty = scalarType(t.params.scalarType); const cases = sparseScalarF32Range().map(e => { return { input: ty.create(e), expected: ty.create(e) }; diff --git a/src/webgpu/shader/execution/expression/unary/af_arithmetic.spec.ts b/src/webgpu/shader/execution/expression/unary/af_arithmetic.spec.ts index 686d4b7c4ac2..46e4411f5b6f 100644 --- a/src/webgpu/shader/execution/expression/unary/af_arithmetic.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/af_arithmetic.spec.ts @@ -3,14 +3,14 @@ Execution Tests for Type.abstractFloat arithmetic unary expression operations `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { Type } from '../../../../util/conversion.js'; import { onlyConstInputSource, run } from '../expression.js'; import { d } from './af_arithmetic.cache.js'; import { abstractFloatUnary } from './unary.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); g.test('negation') .specURL('https://www.w3.org/TR/WGSL/#floating-point-evaluation') diff --git a/src/webgpu/shader/execution/expression/unary/af_assignment.spec.ts b/src/webgpu/shader/execution/expression/unary/af_assignment.spec.ts index 001c47e117bd..a796c0e7206a 100644 --- a/src/webgpu/shader/execution/expression/unary/af_assignment.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/af_assignment.spec.ts @@ -3,7 +3,7 @@ Execution Tests for assignment of AbstractFloats `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { Type } from '../../../../util/conversion.js'; import { ShaderBuilder, @@ -23,7 +23,7 @@ function abstract_assignment(): ShaderBuilder { return abstractFloatShaderBuilder(value => `${value}`); } -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); g.test('abstract') .specURL('https://www.w3.org/TR/WGSL/#floating-point-conversion') @@ -66,11 +66,9 @@ g.test('f16') concretizing to f16 ` ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - }) .params(u => u.combine('inputSource', onlyConstInputSource)) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cases = await d.get('f16'); await run(t, concrete_assignment(), [Type.abstractFloat], Type.f16, t.params, cases); }); diff --git a/src/webgpu/shader/execution/expression/unary/ai_arithmetic.spec.ts b/src/webgpu/shader/execution/expression/unary/ai_arithmetic.spec.ts index 625a38b2d5af..760570cb4f67 100644 --- a/src/webgpu/shader/execution/expression/unary/ai_arithmetic.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/ai_arithmetic.spec.ts @@ -3,14 +3,14 @@ Execution Tests for the abstract integer arithmetic unary expression operations `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { Type } from '../../../../util/conversion.js'; import { onlyConstInputSource, run } from '../expression.js'; import { d } from './ai_arithmetic.cache.js'; import { abstractIntUnary } from './unary.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); g.test('negation') .specURL('https://www.w3.org/TR/WGSL/#arithmetic-expr') diff --git a/src/webgpu/shader/execution/expression/unary/ai_assignment.spec.ts b/src/webgpu/shader/execution/expression/unary/ai_assignment.spec.ts index fe1ba2d9fc12..80c3edb34441 100644 --- a/src/webgpu/shader/execution/expression/unary/ai_assignment.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/ai_assignment.spec.ts @@ -3,7 +3,7 @@ Execution Tests for assignment of AbstractInts `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { Type } from '../../../../util/conversion.js'; import { ShaderBuilder, @@ -23,7 +23,7 @@ function abstract_assignment(): ShaderBuilder { return abstractIntShaderBuilder(value => `${value}`); } -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); g.test('abstract') .specURL('https://www.w3.org/TR/WGSL/#abstract-types') diff --git a/src/webgpu/shader/execution/expression/unary/ai_complement.spec.ts b/src/webgpu/shader/execution/expression/unary/ai_complement.spec.ts index 507ae219cb29..29c75bf10d4f 100644 --- a/src/webgpu/shader/execution/expression/unary/ai_complement.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/ai_complement.spec.ts @@ -3,14 +3,14 @@ Execution Tests for the Type.abstractInt bitwise complement operation `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { abstractInt, Type } from '../../../../util/conversion.js'; import { fullI64Range } from '../../../../util/math.js'; import { onlyConstInputSource, run } from '../expression.js'; import { abstractIntUnary } from './unary.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); g.test('complement') .specURL('https://www.w3.org/TR/WGSL/#bit-expr') diff --git a/src/webgpu/shader/execution/expression/unary/bool_conversion.spec.ts b/src/webgpu/shader/execution/expression/unary/bool_conversion.spec.ts index 55d01d3eda1f..aba41f775ec2 100644 --- a/src/webgpu/shader/execution/expression/unary/bool_conversion.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/bool_conversion.spec.ts @@ -3,14 +3,14 @@ Execution Tests for the boolean conversion operations `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { Type } from '../../../../util/conversion.js'; import { ShaderBuilder, allInputSources, run } from '../expression.js'; import { d } from './bool_conversion.cache.js'; import { unary } from './unary.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); /** Generate expression builder based on how the test case is to be vectorized */ function vectorizeToExpression(vectorize: undefined | 2 | 3 | 4): ShaderBuilder { @@ -108,10 +108,8 @@ The result is false if e is 0.0 or -0.0, and true otherwise. .params(u => u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase('shader-f16'); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cases = await d.get('f16'); await run(t, vectorizeToExpression(t.params.vectorize), [Type.f16], Type.bool, t.params, cases); }); diff --git a/src/webgpu/shader/execution/expression/unary/bool_logical.spec.ts b/src/webgpu/shader/execution/expression/unary/bool_logical.spec.ts index 58d4b9fc0fc3..7cb508218f33 100644 --- a/src/webgpu/shader/execution/expression/unary/bool_logical.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/bool_logical.spec.ts @@ -3,13 +3,13 @@ Execution Tests for the boolean unary logical expression operations `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { bool, Type } from '../../../../util/conversion.js'; import { allInputSources, run } from '../expression.js'; import { unary } from './unary.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); g.test('negation') .specURL('https://www.w3.org/TR/WGSL/#logical-expr') diff --git a/src/webgpu/shader/execution/expression/unary/f16_arithmetic.spec.ts b/src/webgpu/shader/execution/expression/unary/f16_arithmetic.spec.ts index 813bbf7a64e6..67eb648d2049 100644 --- a/src/webgpu/shader/execution/expression/unary/f16_arithmetic.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/f16_arithmetic.spec.ts @@ -3,14 +3,14 @@ Execution Tests for the f16 arithmetic unary expression operations `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { Type } from '../../../../util/conversion.js'; import { allInputSources, run } from '../expression.js'; import { d } from './f16_arithmetic.cache.js'; import { unary } from './unary.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); g.test('negation') .specURL('https://www.w3.org/TR/WGSL/#floating-point-evaluation') @@ -23,10 +23,8 @@ Accuracy: Correctly rounded .params(u => u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cases = await d.get('negation'); await run(t, unary('-'), [Type.f16], Type.f16, t.params, cases); }); diff --git a/src/webgpu/shader/execution/expression/unary/f16_conversion.spec.ts b/src/webgpu/shader/execution/expression/unary/f16_conversion.spec.ts index 92bd9c6a0703..b87937bbf554 100644 --- a/src/webgpu/shader/execution/expression/unary/f16_conversion.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/f16_conversion.spec.ts @@ -3,14 +3,14 @@ Execution Tests for the f32 conversion operations `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { Type } from '../../../../util/conversion.js'; import { ShaderBuilder, allInputSources, run, onlyConstInputSource } from '../expression.js'; import { d } from './f16_conversion.cache.js'; import { unary } from './unary.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); /** Generate a ShaderBuilder based on how the test case is to be vectorized */ function vectorizeToExpression(vectorize: undefined | 2 | 3 | 4): ShaderBuilder { @@ -34,10 +34,8 @@ The result is 1.0 if e is true and 0.0 otherwise .params(u => u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cases = await d.get('bool'); await run(t, vectorizeToExpression(t.params.vectorize), [Type.bool], Type.f16, t.params, cases); }); @@ -54,10 +52,8 @@ Converted to f16, +/-Inf if out of range .params(u => u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cases = await d.get(t.params.inputSource === 'const' ? 'u32_const' : 'u32_non_const'); await run(t, vectorizeToExpression(t.params.vectorize), [Type.u32], Type.f16, t.params, cases); }); @@ -74,10 +70,8 @@ Converted to f16, +/-Inf if out of range .params(u => u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cases = await d.get(t.params.inputSource === 'const' ? 'i32_const' : 'i32_non_const'); await run(t, vectorizeToExpression(t.params.vectorize), [Type.i32], Type.f16, t.params, cases); }); @@ -96,10 +90,8 @@ Converted to f16, +/-Inf if out of range .combine('inputSource', onlyConstInputSource) .combine('vectorize', [undefined, 2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cases = await d.get('abstract_int'); await run( t, @@ -123,10 +115,8 @@ Correctly rounded to f16 .params(u => u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cases = await d.get(t.params.inputSource === 'const' ? 'f32_const' : 'f32_non_const'); await run(t, vectorizeToExpression(t.params.vectorize), [Type.f32], Type.f16, t.params, cases); }); @@ -140,10 +130,8 @@ g.test('f32_mat') .combine('cols', [2, 3, 4] as const) .combine('rows', [2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cols = t.params.cols; const rows = t.params.rows; const cases = await d.get( @@ -173,10 +161,8 @@ g.test('f16') .params(u => u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cases = await d.get('f16'); await run(t, vectorizeToExpression(t.params.vectorize), [Type.f16], Type.f16, t.params, cases); }); @@ -190,10 +176,8 @@ g.test('f16_mat') .combine('cols', [2, 3, 4] as const) .combine('rows', [2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cols = t.params.cols; const rows = t.params.rows; const cases = await d.get( @@ -225,10 +209,8 @@ Correctly rounded to f16 .combine('inputSource', onlyConstInputSource) .combine('vectorize', [undefined, 2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cases = await d.get('abstract_float'); await run( t, @@ -249,10 +231,8 @@ g.test('abstract_float_mat') .combine('cols', [2, 3, 4] as const) .combine('rows', [2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cols = t.params.cols; const rows = t.params.rows; const cases = await d.get(`abstract_float_mat${cols}x${rows}`); diff --git a/src/webgpu/shader/execution/expression/unary/f32_arithmetic.spec.ts b/src/webgpu/shader/execution/expression/unary/f32_arithmetic.spec.ts index 3bb48705e854..47cc0c09ae7a 100644 --- a/src/webgpu/shader/execution/expression/unary/f32_arithmetic.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/f32_arithmetic.spec.ts @@ -3,14 +3,14 @@ Execution Tests for the f32 arithmetic unary expression operations `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { Type } from '../../../../util/conversion.js'; import { allInputSources, run } from '../expression.js'; import { d } from './f32_arithmetic.cache.js'; import { unary } from './unary.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); g.test('negation') .specURL('https://www.w3.org/TR/WGSL/#floating-point-evaluation') diff --git a/src/webgpu/shader/execution/expression/unary/f32_conversion.spec.ts b/src/webgpu/shader/execution/expression/unary/f32_conversion.spec.ts index 7a42334cb860..c7d018cd18d7 100644 --- a/src/webgpu/shader/execution/expression/unary/f32_conversion.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/f32_conversion.spec.ts @@ -3,14 +3,14 @@ Execution Tests for the f32 conversion operations `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { Type } from '../../../../util/conversion.js'; import { ShaderBuilder, allInputSources, run, onlyConstInputSource } from '../expression.js'; import { d } from './f32_conversion.cache.js'; import { unary } from './unary.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); /** Generate a ShaderBuilder based on how the test case is to be vectorized */ function vectorizeToExpression(vectorize: undefined | 2 | 3 | 4): ShaderBuilder { @@ -155,10 +155,8 @@ g.test('f16') .params(u => u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cases = await d.get('f16'); await run(t, vectorizeToExpression(t.params.vectorize), [Type.f16], Type.f32, t.params, cases); }); @@ -172,10 +170,8 @@ g.test('f16_mat') .combine('cols', [2, 3, 4] as const) .combine('rows', [2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cols = t.params.cols; const rows = t.params.rows; const cases = await d.get( diff --git a/src/webgpu/shader/execution/expression/unary/i32_arithmetic.spec.ts b/src/webgpu/shader/execution/expression/unary/i32_arithmetic.spec.ts index a7d16a96cd88..2fbacd43e27a 100644 --- a/src/webgpu/shader/execution/expression/unary/i32_arithmetic.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/i32_arithmetic.spec.ts @@ -3,14 +3,14 @@ Execution Tests for the i32 arithmetic unary expression operations `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { Type } from '../../../../util/conversion.js'; import { allInputSources, run } from '../expression.js'; import { d } from './i32_arithmetic.cache.js'; import { unary } from './unary.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); g.test('negation') .specURL('https://www.w3.org/TR/WGSL/#floating-point-evaluation') diff --git a/src/webgpu/shader/execution/expression/unary/i32_complement.spec.ts b/src/webgpu/shader/execution/expression/unary/i32_complement.spec.ts index 01e5728d70d1..dc02799b3c48 100644 --- a/src/webgpu/shader/execution/expression/unary/i32_complement.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/i32_complement.spec.ts @@ -3,14 +3,14 @@ Execution Tests for the i32 bitwise complement operation `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { i32, Type } from '../../../../util/conversion.js'; import { fullI32Range } from '../../../../util/math.js'; import { allInputSources, run } from '../expression.js'; import { unary } from './unary.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); g.test('i32_complement') .specURL('https://www.w3.org/TR/WGSL/#bit-expr') diff --git a/src/webgpu/shader/execution/expression/unary/i32_conversion.spec.ts b/src/webgpu/shader/execution/expression/unary/i32_conversion.spec.ts index b47ffe0d07d6..ed9a6cab27a0 100644 --- a/src/webgpu/shader/execution/expression/unary/i32_conversion.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/i32_conversion.spec.ts @@ -3,14 +3,14 @@ Execution Tests for the i32 conversion operations `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { Type } from '../../../../util/conversion.js'; import { ShaderBuilder, allInputSources, run, onlyConstInputSource } from '../expression.js'; import { d } from './i32_conversion.cache.js'; import { unary } from './unary.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); /** Generate a ShaderBuilder based on how the test case is to be vectorized */ function vectorizeToExpression(vectorize: undefined | 2 | 3 | 4): ShaderBuilder { @@ -97,10 +97,8 @@ e is converted to u32, rounding towards zero .params(u => u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase('shader-f16'); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cases = await d.get('f16'); await run(t, vectorizeToExpression(t.params.vectorize), [Type.f16], Type.i32, t.params, cases); }); diff --git a/src/webgpu/shader/execution/expression/unary/u32_complement.spec.ts b/src/webgpu/shader/execution/expression/unary/u32_complement.spec.ts index 74251a32c62b..a98492e3f74d 100644 --- a/src/webgpu/shader/execution/expression/unary/u32_complement.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/u32_complement.spec.ts @@ -3,14 +3,14 @@ Execution Tests for the u32 bitwise complement operation `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { Type, u32 } from '../../../../util/conversion.js'; import { fullU32Range } from '../../../../util/math.js'; import { allInputSources, run } from '../expression.js'; import { unary } from './unary.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); g.test('u32_complement') .specURL('https://www.w3.org/TR/WGSL/#bit-expr') diff --git a/src/webgpu/shader/execution/expression/unary/u32_conversion.spec.ts b/src/webgpu/shader/execution/expression/unary/u32_conversion.spec.ts index 6d342afffb95..844e1d83c51e 100644 --- a/src/webgpu/shader/execution/expression/unary/u32_conversion.spec.ts +++ b/src/webgpu/shader/execution/expression/unary/u32_conversion.spec.ts @@ -3,14 +3,14 @@ Execution Tests for the u32 conversion operations `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; -import { GPUTest } from '../../../../gpu_test.js'; +import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; import { Type } from '../../../../util/conversion.js'; import { ShaderBuilder, allInputSources, run, onlyConstInputSource } from '../expression.js'; import { d } from './u32_conversion.cache.js'; import { unary } from './unary.js'; -export const g = makeTestGroup(GPUTest); +export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); /** Generate a ShaderBuilder based on how the test case is to be vectorized */ function vectorizeToExpression(vectorize: undefined | 2 | 3 | 4): ShaderBuilder { @@ -97,10 +97,8 @@ e is converted to u32, rounding towards zero .params(u => u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const) ) - .beforeAllSubcases(t => { - t.selectDeviceOrSkipTestCase('shader-f16'); - }) .fn(async t => { + t.skipIfDeviceDoesNotHaveFeature('shader-f16'); const cases = await d.get('f16'); await run(t, vectorizeToExpression(t.params.vectorize), [Type.f16], Type.u32, t.params, cases); });