Skip to content

Commit

Permalink
Update DevicePool to provide multiple devices
Browse files Browse the repository at this point in the history
- Remove mismatched device pool, make the device pool could provide
  multiple devices at once, and reserve a default mismatched device
  at test initialization.
- Cancel selecting the default mismatched device in tests. For
  requesting mismatched device with particular features, we still need
  to call selectMismatchedDeviceOrSkipTestCase.
  • Loading branch information
haoxli committed Apr 5, 2022
1 parent 23afd04 commit c51c6a2
Show file tree
Hide file tree
Showing 25 changed files with 89 additions and 183 deletions.
8 changes: 0 additions & 8 deletions src/webgpu/api/validation/createBindGroup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,10 +502,6 @@ g.test('bind_group_layout,device_mismatch')
.fn(async t => {
const mismatched = t.params.mismatched;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const bgl = device.createBindGroupLayout({
Expand Down Expand Up @@ -560,10 +556,6 @@ g.test('binding_resources,device_mismatch')
.fn(async t => {
const { entry, resource0Mismatched, resource1Mismatched } = t.params;

if (resource0Mismatched || resource1Mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const info = bindingTypeInfo(entry);

const resource0 = resource0Mismatched
Expand Down
8 changes: 0 additions & 8 deletions src/webgpu/api/validation/createComputePipeline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,6 @@ g.test('pipeline_layout,device_mismatch')
.fn(async t => {
const { isAsync, mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const layout = device.createPipelineLayout({ bindGroupLayouts: [] });
Expand All @@ -209,10 +205,6 @@ g.test('shader_module,device_mismatch')
.fn(async t => {
const { isAsync, mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const module = device.createShaderModule({
Expand Down
4 changes: 0 additions & 4 deletions src/webgpu/api/validation/createPipelineLayout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ g.test('bind_group_layouts,device_mismatch')

const mismatched = layout0Mismatched || layout1Mismatched;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const bglDescriptor: GPUBindGroupLayoutDescriptor = {
entries: [],
};
Expand Down
8 changes: 0 additions & 8 deletions src/webgpu/api/validation/createRenderPipeline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,10 +664,6 @@ g.test('pipeline_layout,device_mismatch')
.fn(async t => {
const { isAsync, mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const layout = device.createPipelineLayout({ bindGroupLayouts: [] });
Expand Down Expand Up @@ -708,10 +704,6 @@ g.test('shader_module,device_mismatch')
.fn(async t => {
const { isAsync, vertex_mismatched, fragment_mismatched, _success } = t.params;

if (vertex_mismatched || fragment_mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const code = `
@stage(vertex) fn main() -> @builtin(position) vec4<f32> {
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
Expand Down
12 changes: 0 additions & 12 deletions src/webgpu/api/validation/encoding/beginRenderPass.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ g.test('color_attachments,device_mismatch')

const mismatched = view0Mismatched || target0Mismatched || view1Mismatched || target1Mismatched;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const view0Texture = view0Mismatched
? t.getDeviceMismatchedRenderTexture(4)
: t.getRenderTexture(4);
Expand Down Expand Up @@ -114,10 +110,6 @@ g.test('depth_stencil_attachment,device_mismatch')
.fn(async t => {
const { mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const descriptor: GPUTextureDescriptor = {
size: { width: 4, height: 4, depthOrArrayLayers: 1 },
format: 'depth24plus-stencil8',
Expand Down Expand Up @@ -154,10 +146,6 @@ g.test('occlusion_query_set,device_mismatch')
.fn(async t => {
const { mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const occlusionQuerySet = device.createQuerySet({
Expand Down
4 changes: 0 additions & 4 deletions src/webgpu/api/validation/encoding/cmds/clearBuffer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ g.test('buffer,device_mismatch')
.fn(async t => {
const { mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;
const size = 8;

Expand Down
8 changes: 0 additions & 8 deletions src/webgpu/api/validation/encoding/cmds/compute_pass.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ g.test('pipeline,device_mismatch')
.fn(async t => {
const { mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const pipeline = device.createComputePipeline({
Expand Down Expand Up @@ -184,10 +180,6 @@ g.test('indirect_dispatch_buffer,device_mismatch')
.fn(async t => {
const { mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const pipeline = t.createNoOpComputePipeline();

const device = mismatched ? t.mismatchedDevice : t.device;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ g.test('buffer,device_mismatch')
const { srcMismatched, dstMismatched } = t.params;
const mismatched = srcMismatched || dstMismatched;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const srcBuffer = device.createBuffer({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ g.test('texture,device_mismatch')
const { srcMismatched, dstMismatched } = t.params;
const mismatched = srcMismatched || dstMismatched;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;
const size = { width: 4, height: 4, depthOrArrayLayers: 1 };
const format = 'rgba8unorm';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ g.test('indirect_buffer,device_mismatch')
.fn(async t => {
const { encoderType, indexed, mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const indirectBuffer = device.createBuffer({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ g.test('index_buffer,device_mismatch')
.fn(async t => {
const { encoderType, mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const indexBuffer = device.createBuffer({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ g.test('pipeline,device_mismatch')
.fn(async t => {
const { encoderType, mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const pipeline = device.createRenderPipeline({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ g.test('vertex_buffer,device_mismatch')
.fn(async t => {
const { encoderType, mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const vertexBuffer = device.createBuffer({
Expand Down
4 changes: 0 additions & 4 deletions src/webgpu/api/validation/encoding/cmds/setBindGroup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@ g.test('bind_group,device_mismatch')
.fn(async t => {
const { encoderType, useU32Array, mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const buffer = device.createBuffer({
Expand Down
2 changes: 1 addition & 1 deletion src/webgpu/api/validation/encoding/queries/general.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ g.test('timestamp_query,device_mismatch')
.fn(async t => {
const { mismatched } = t.params;

await t.selectDeviceForQueryTypeOrSkipTestCase('timestamp');
await t.selectDeviceOrSkipTestCase('timestamp-query');

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase('timestamp-query');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,6 @@ g.test('query_set_buffer,device_mismatch')
const { querySetMismatched, bufferMismatched } = t.params;
const mismatched = querySetMismatched || bufferMismatched;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;
const queryCout = 1;

Expand Down
4 changes: 0 additions & 4 deletions src/webgpu/api/validation/encoding/render_bundle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ g.test('device_mismatch')
const { bundle0Mismatched, bundle1Mismatched } = t.params;
const mismatched = bundle0Mismatched || bundle1Mismatched;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const descriptor: GPURenderBundleEncoderDescriptor = {
Expand Down
4 changes: 0 additions & 4 deletions src/webgpu/api/validation/image_copy/buffer_related.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ g.test('buffer,device_mismatch')
.fn(async t => {
const { method, mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const buffer = device.createBuffer({
Expand Down
4 changes: 0 additions & 4 deletions src/webgpu/api/validation/image_copy/texture_related.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ g.test('texture,device_mismatch')
.fn(async t => {
const { method, mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const texture = device.createTexture({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,10 +618,6 @@ g.test('destination_texture,device_mismatch')
.fn(async t => {
const { mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;
const copySize = { width: 1, height: 1, depthOrArrayLayers: 1 };

Expand Down
4 changes: 0 additions & 4 deletions src/webgpu/api/validation/queue/submit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ g.test('command_buffer,device_mismatch')
const { cb0Mismatched, cb1Mismatched } = t.params;
const mismatched = cb0Mismatched || cb1Mismatched;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const encoder0 = cb0Mismatched
? t.mismatchedDevice.createCommandEncoder()
: t.device.createCommandEncoder();
Expand Down
4 changes: 0 additions & 4 deletions src/webgpu/api/validation/queue/writeBuffer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,6 @@ g.test('buffer,device_mismatch')
.fn(async t => {
const { mismatched } = t.params;

if (mismatched) {
await t.selectMismatchedDeviceOrSkipTestCase(undefined);
}

const device = mismatched ? t.mismatchedDevice : t.device;

const buffer = device.createBuffer({
Expand Down
Loading

0 comments on commit c51c6a2

Please sign in to comment.