Skip to content

Commit

Permalink
Merge branch 'main' into remove_subgroups_f16_enable_from_cts
Browse files Browse the repository at this point in the history
  • Loading branch information
petermcneeleychromium authored Dec 11, 2024
2 parents 52a18eb + 1e545f5 commit 4762b76
Show file tree
Hide file tree
Showing 10 changed files with 177 additions and 88 deletions.
4 changes: 2 additions & 2 deletions src/webgpu/api/operation/rendering/draw.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import {
TypedArrayBufferView,
TypedArrayBufferViewConstructor,
} from '../../../../common/util/util.js';
import { MaxLimitsTest, TextureTestMixin } from '../../../gpu_test.js';
import { GPUTest, MaxLimitsTestMixin, TextureTestMixin } from '../../../gpu_test.js';
import { PerPixelComparison } from '../../../util/texture/texture_ok.js';

class DrawTest extends TextureTestMixin(MaxLimitsTest) {
class DrawTest extends TextureTestMixin(MaxLimitsTestMixin(GPUTest)) {
checkTriangleDraw(opts: {
firstIndex: number | undefined;
count: number;
Expand Down
4 changes: 2 additions & 2 deletions src/webgpu/api/operation/sampling/sampler_texture.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Tests samplers with textures.

import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { assert, range } from '../../../../common/util/util.js';
import { MaxLimitsTest, TextureTestMixin } from '../../../gpu_test.js';
import { GPUTest, MaxLimitsTestMixin, TextureTestMixin } from '../../../gpu_test.js';
import { TexelView } from '../../../util/texture/texel_view.js';

export const g = makeTestGroup(TextureTestMixin(MaxLimitsTest));
export const g = makeTestGroup(TextureTestMixin(MaxLimitsTestMixin(GPUTest)));

g.test('sample_texture_combos')
.desc(
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -14,14 +16,18 @@ 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')
.desc(`Tests that attachment state must have <= device.limits.maxColorAttachments.`)
.params(u =>
u.beginSubcases().combine(
'colorFormatCount',
range(kMaxColorAttachmentsToTest, i => i + 1)
range(kMaxColorAttachments, i => i + 1)
)
)
.fn(t => {
Expand Down Expand Up @@ -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 => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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: {
Expand Down Expand Up @@ -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 => {
Expand Down
10 changes: 8 additions & 2 deletions src/webgpu/api/validation/render_pipeline/fragment_state.spec.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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];
Expand Down Expand Up @@ -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])
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const description = `
Tests for resource compatibilty between pipeline layout and shader modules
Tests for resource compatibility between pipeline layout and shader modules
`;

import { makeTestGroup } from '../../../../common/framework/test_group.js';
Expand Down
29 changes: 20 additions & 9 deletions src/webgpu/gpu_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1333,16 +1333,27 @@ export class MaxLimitsGPUTestSubcaseBatchState extends GPUTestSubcaseBatchState
}
}

/**
* A Test that requests all the max limits from the adapter on the device.
*/
export class MaxLimitsTest extends GPUTest {
public static override MakeSharedState(
recorder: TestCaseRecorder,
params: TestParams
): GPUTestSubcaseBatchState {
return new MaxLimitsGPUTestSubcaseBatchState(recorder, params);
export type MaxLimitsTestMixinType = {
// placeholder. Change to an interface if we need MaxLimits specific methods.
};

export function MaxLimitsTestMixin<F extends FixtureClass<GPUTestBase>>(
Base: F
): FixtureClassWithMixin<F, MaxLimitsTestMixinType> {
class MaxLimitsImpl
extends (Base as FixtureClassInterface<GPUTestBase>)
implements MaxLimitsTestMixinType
{
//
public static override MakeSharedState(
recorder: TestCaseRecorder,
params: TestParams
): GPUTestSubcaseBatchState {
return new MaxLimitsGPUTestSubcaseBatchState(recorder, params);
}
}

return MaxLimitsImpl as unknown as FixtureClassWithMixin<F, MaxLimitsTestMixinType>;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const g = makeTestGroup(GPUTest);
function validForConst(c: Case): boolean {
const low = (c.input as Value[])[0] as ScalarValue;
const high = (c.input as Value[])[1] as ScalarValue;
return low.value < high.value;
return low.value !== high.value;
}

g.test('abstract_float')
Expand Down
Loading

0 comments on commit 4762b76

Please sign in to comment.