Skip to content

Commit

Permalink
Merge branch 'gpuweb:main' into shader-validations
Browse files Browse the repository at this point in the history
  • Loading branch information
lokokung authored Mar 13, 2024
2 parents b69d185 + f1aa942 commit bc46661
Show file tree
Hide file tree
Showing 24 changed files with 583 additions and 162 deletions.
2 changes: 1 addition & 1 deletion docs/intro/developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The following url parameters change how the harness runs:

- `runnow=1` runs all matching tests on page load.
- `debug=1` enables verbose debug logging from tests.
- `worker=dedicated` runs the tests on a dedicated worker instead of the main thread.
- `worker=dedicated` (or `worker` or `worker=1`) runs the tests on a dedicated worker instead of the main thread.
- `worker=shared` runs the tests on a shared worker instead of the main thread.
- `worker=service` runs the tests on a service worker instead of the main thread.
- `power_preference=low-power` runs most tests passing `powerPreference: low-power` to `requestAdapter`
Expand Down
4 changes: 2 additions & 2 deletions src/common/internal/query/query.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TestParams } from '../../framework/fixture.js';
import { optionString } from '../../runtime/helper/options.js';
import { optionWorkerMode } from '../../runtime/helper/options.js';
import { assert, unreachable } from '../../util/util.js';
import { Expectation } from '../logging/result.js';

Expand Down Expand Up @@ -193,7 +193,7 @@ Expectation should be of the form path/to/cts.https.html?debug=0&q=suite:test_pa
);

const params = expectationURL.searchParams;
if (optionString('worker', params) !== optionString('worker', wptURL.searchParams)) {
if (optionWorkerMode('worker', params) !== optionWorkerMode('worker', wptURL.searchParams)) {
continue;
}

Expand Down
34 changes: 29 additions & 5 deletions src/common/runtime/helper/options.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { unreachable } from '../../util/util.js';

let windowURL: URL | undefined = undefined;
function getWindowURL() {
if (windowURL === undefined) {
Expand All @@ -6,6 +8,7 @@ function getWindowURL() {
return windowURL;
}

/** Parse a runner option that is always boolean-typed. False if missing or '0'. */
export function optionEnabled(
opt: string,
searchParams: URLSearchParams = getWindowURL().searchParams
Expand All @@ -14,27 +17,48 @@ export function optionEnabled(
return val !== null && val !== '0';
}

/** Parse a runner option that is always string-typed. If the option is missing, returns `''`. */
export function optionString(
opt: string,
searchParams: URLSearchParams = getWindowURL().searchParams
): string {
return searchParams.get(opt) || '';
}

/** Runtime modes for whether to run tests in a worker. '0' means no worker. */
type WorkerMode = '0' | 'dedicated' | 'service' | 'shared';
/** Parse a runner option for different worker modes (as in `?worker=shared`). */
export function optionWorkerMode(
opt: string,
searchParams: URLSearchParams = getWindowURL().searchParams
): WorkerMode {
const value = searchParams.get(opt);
if (value === null || value === '0') {
return '0';
} else if (value === 'service') {
return 'service';
} else if (value === 'shared') {
return 'shared';
} else if (value === '' || value === '1' || value === 'dedicated') {
return 'dedicated';
}
unreachable('invalid worker= option value');
}

/**
* The possible options for the tests.
*/
export interface CTSOptions {
worker?: 'dedicated' | 'shared' | 'service' | '';
worker: WorkerMode;
debug: boolean;
compatibility: boolean;
forceFallbackAdapter: boolean;
unrollConstEvalLoops: boolean;
powerPreference?: GPUPowerPreference | '';
powerPreference: GPUPowerPreference | '';
}

export const kDefaultCTSOptions: CTSOptions = {
worker: '',
worker: '0',
debug: true,
compatibility: false,
forceFallbackAdapter: false,
Expand Down Expand Up @@ -63,9 +87,9 @@ export type OptionsInfos<Type> = Record<keyof Type, OptionInfo>;
export const kCTSOptionsInfo: OptionsInfos<CTSOptions> = {
worker: {
description: 'run in a worker',
parser: optionString,
parser: optionWorkerMode,
selectValueDescriptions: [
{ value: '', description: 'no worker' },
{ value: '0', description: 'no worker' },
{ value: 'dedicated', description: 'dedicated worker' },
{ value: 'shared', description: 'shared worker' },
{ value: 'service', description: 'service worker' },
Expand Down
2 changes: 1 addition & 1 deletion src/common/runtime/standalone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ function keyValueToPairs([k, v]: [string, ParamValue]): [string, string][] {
*/
function prepareParams(params: Record<string, ParamValue>): string {
const pairsArrays = Object.entries(params)
.filter(([, v]) => !!v)
.filter(([, v]) => !!v && v !== '0')
.map(keyValueToPairs);
const pairs = pairsArrays.flat();
return new URLSearchParams(pairs).toString();
Expand Down
4 changes: 2 additions & 2 deletions src/common/runtime/wpt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { parseQuery } from '../internal/query/parseQuery.js';
import { parseExpectationsForTestQuery, relativeQueryString } from '../internal/query/query.js';
import { assert } from '../util/util.js';

import { optionEnabled, optionString } from './helper/options.js';
import { optionEnabled, optionWorkerMode } from './helper/options.js';
import { TestDedicatedWorker, TestServiceWorker, TestSharedWorker } from './helper/test_worker.js';

// testharness.js API (https://web-platform-tests.org/writing-tests/testharness-api.html)
Expand All @@ -31,7 +31,7 @@ setup({
});

void (async () => {
const workerString = optionString('worker');
const workerString = optionWorkerMode('worker');
const dedicatedWorker = workerString === 'dedicated' ? new TestDedicatedWorker() : undefined;
const sharedWorker = workerString === 'shared' ? new TestSharedWorker() : undefined;
const serviceWorker = workerString === 'service' ? new TestServiceWorker() : undefined;
Expand Down
216 changes: 108 additions & 108 deletions src/resources/cache/hashes.json
Original file line number Diff line number Diff line change
@@ -1,110 +1,110 @@
{
"webgpu/shader/execution/binary/af_addition.bin": "f79f0374",
"webgpu/shader/execution/binary/af_logical.bin": "9ab41597",
"webgpu/shader/execution/binary/af_division.bin": "770fc018",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "a401d81a",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "a9e51912",
"webgpu/shader/execution/binary/af_multiplication.bin": "8f7b5f84",
"webgpu/shader/execution/binary/af_remainder.bin": "133a1dd7",
"webgpu/shader/execution/binary/af_subtraction.bin": "9148f3ce",
"webgpu/shader/execution/binary/f16_addition.bin": "d58a9371",
"webgpu/shader/execution/binary/f16_logical.bin": "80f9e754",
"webgpu/shader/execution/binary/f16_division.bin": "5d2bf113",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "531954a6",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "b871cd18",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "3603d1db",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "c97537aa",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "273b76c6",
"webgpu/shader/execution/binary/f16_multiplication.bin": "d98cd937",
"webgpu/shader/execution/binary/f16_remainder.bin": "6e5227f4",
"webgpu/shader/execution/binary/f16_subtraction.bin": "d243bbad",
"webgpu/shader/execution/binary/f32_addition.bin": "c288aef6",
"webgpu/shader/execution/binary/f32_logical.bin": "47467130",
"webgpu/shader/execution/binary/f32_division.bin": "c9c76117",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "88eedbfa",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "9f76f2ac",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "1d667df9",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "aa253cf1",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "98a63b3a",
"webgpu/shader/execution/binary/f32_multiplication.bin": "dce8dd5b",
"webgpu/shader/execution/binary/f32_remainder.bin": "d3bdb9e3",
"webgpu/shader/execution/binary/f32_subtraction.bin": "8a48e67a",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "d345f9c7",
"webgpu/shader/execution/binary/i32_comparison.bin": "6d4ae7e0",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "163f8a38",
"webgpu/shader/execution/binary/u32_comparison.bin": "f6c1497b",
"webgpu/shader/execution/abs.bin": "e21a06df",
"webgpu/shader/execution/acos.bin": "2a92d3d5",
"webgpu/shader/execution/acosh.bin": "c2cc2e23",
"webgpu/shader/execution/asin.bin": "2027460e",
"webgpu/shader/execution/asinh.bin": "21bac67b",
"webgpu/shader/execution/atan.bin": "6422056c",
"webgpu/shader/execution/atan2.bin": "d8ade832",
"webgpu/shader/execution/atanh.bin": "de1dd54c",
"webgpu/shader/execution/bitcast.bin": "fdd0874",
"webgpu/shader/execution/ceil.bin": "6596b2e2",
"webgpu/shader/execution/clamp.bin": "9a92d1b7",
"webgpu/shader/execution/cos.bin": "647f5fda",
"webgpu/shader/execution/cosh.bin": "5f847611",
"webgpu/shader/execution/cross.bin": "117f2e0f",
"webgpu/shader/execution/degrees.bin": "cadaa756",
"webgpu/shader/execution/determinant.bin": "f2df9222",
"webgpu/shader/execution/distance.bin": "d6a161d1",
"webgpu/shader/execution/dot.bin": "c788d592",
"webgpu/shader/execution/exp.bin": "a76c67ca",
"webgpu/shader/execution/exp2.bin": "a5b443c5",
"webgpu/shader/execution/faceForward.bin": "75f1f377",
"webgpu/shader/execution/floor.bin": "8aea5f9c",
"webgpu/shader/execution/fma.bin": "8682909f",
"webgpu/shader/execution/fract.bin": "ff3283f0",
"webgpu/shader/execution/frexp.bin": "9639418e",
"webgpu/shader/execution/inverseSqrt.bin": "9de3fa15",
"webgpu/shader/execution/ldexp.bin": "43fde30e",
"webgpu/shader/execution/length.bin": "24b87c1a",
"webgpu/shader/execution/log.bin": "c8447a16",
"webgpu/shader/execution/log2.bin": "bcefcef6",
"webgpu/shader/execution/max.bin": "bbd522ab",
"webgpu/shader/execution/min.bin": "4687f034",
"webgpu/shader/execution/mix.bin": "e79fc2e8",
"webgpu/shader/execution/modf.bin": "feedecc3",
"webgpu/shader/execution/normalize.bin": "78e7c0",
"webgpu/shader/execution/pack2x16float.bin": "e472a927",
"webgpu/shader/execution/pow.bin": "38d0ff7",
"webgpu/shader/execution/quantizeToF16.bin": "5496ab3",
"webgpu/shader/execution/radians.bin": "db736290",
"webgpu/shader/execution/reflect.bin": "b08379ba",
"webgpu/shader/execution/refract.bin": "d360cf82",
"webgpu/shader/execution/round.bin": "3d2c318e",
"webgpu/shader/execution/saturate.bin": "33892d9c",
"webgpu/shader/execution/sign.bin": "8a54e6ec",
"webgpu/shader/execution/sin.bin": "f0cd3a32",
"webgpu/shader/execution/sinh.bin": "4d1b0134",
"webgpu/shader/execution/smoothstep.bin": "a3b004be",
"webgpu/shader/execution/sqrt.bin": "dd8a5970",
"webgpu/shader/execution/step.bin": "eec1579d",
"webgpu/shader/execution/tan.bin": "612d43b",
"webgpu/shader/execution/tanh.bin": "6f95242c",
"webgpu/shader/execution/transpose.bin": "b1a9a7f7",
"webgpu/shader/execution/trunc.bin": "cdf5939e",
"webgpu/shader/execution/unpack2x16float.bin": "b992957a",
"webgpu/shader/execution/unpack2x16snorm.bin": "394e0942",
"webgpu/shader/execution/unpack2x16unorm.bin": "78f0ef3c",
"webgpu/shader/execution/unpack4x8snorm.bin": "926f3f3e",
"webgpu/shader/execution/unpack4x8unorm.bin": "3640a996",
"webgpu/shader/execution/unary/af_arithmetic.bin": "bf05a1b1",
"webgpu/shader/execution/unary/af_assignment.bin": "d711e244",
"webgpu/shader/execution/unary/bool_conversion.bin": "d0c1e5a3",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "6095e89f",
"webgpu/shader/execution/unary/f16_conversion.bin": "76546200",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "a16e7cf4",
"webgpu/shader/execution/unary/f32_conversion.bin": "62604b96",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "a8649cbb",
"webgpu/shader/execution/unary/i32_conversion.bin": "e5157a69",
"webgpu/shader/execution/unary/u32_conversion.bin": "d07d0c20",
"webgpu/shader/execution/unary/ai_assignment.bin": "f62c765c",
"webgpu/shader/execution/binary/ai_arithmetic.bin": "43501242",
"webgpu/shader/execution/unary/ai_arithmetic.bin": "8e448c53",
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "c57c159e",
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "d21017f3",
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "ddd2f83a"
"webgpu/shader/execution/binary/af_addition.bin": "24160909",
"webgpu/shader/execution/binary/af_logical.bin": "ffb5a83f",
"webgpu/shader/execution/binary/af_division.bin": "c230ac78",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "9079a042",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "6b55102f",
"webgpu/shader/execution/binary/af_multiplication.bin": "4fc3b0d6",
"webgpu/shader/execution/binary/af_remainder.bin": "366caec6",
"webgpu/shader/execution/binary/af_subtraction.bin": "49a16db4",
"webgpu/shader/execution/binary/f16_addition.bin": "3fb1ee09",
"webgpu/shader/execution/binary/f16_logical.bin": "65cdc6f",
"webgpu/shader/execution/binary/f16_division.bin": "1b5bd44a",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "fdea291a",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "e727482e",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "24d70bdd",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "7acd3c3b",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "9e01e0cf",
"webgpu/shader/execution/binary/f16_multiplication.bin": "c24b705c",
"webgpu/shader/execution/binary/f16_remainder.bin": "2764c7e1",
"webgpu/shader/execution/binary/f16_subtraction.bin": "d4014a38",
"webgpu/shader/execution/binary/f32_addition.bin": "b6707259",
"webgpu/shader/execution/binary/f32_logical.bin": "d40c1c0",
"webgpu/shader/execution/binary/f32_division.bin": "e19e30a6",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "6a13d6d6",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "4c5cb0a2",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "6b00d17f",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "319d3ae1",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "1c4893ca",
"webgpu/shader/execution/binary/f32_multiplication.bin": "f7dbbc8",
"webgpu/shader/execution/binary/f32_remainder.bin": "fb5dd3fe",
"webgpu/shader/execution/binary/f32_subtraction.bin": "aeaca568",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "90a3514a",
"webgpu/shader/execution/binary/i32_comparison.bin": "840b09e6",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "e3f04e97",
"webgpu/shader/execution/binary/u32_comparison.bin": "dc1398d3",
"webgpu/shader/execution/abs.bin": "2b663377",
"webgpu/shader/execution/acos.bin": "a888c67f",
"webgpu/shader/execution/acosh.bin": "5383658b",
"webgpu/shader/execution/asin.bin": "a580a322",
"webgpu/shader/execution/asinh.bin": "31388535",
"webgpu/shader/execution/atan.bin": "c6f4c771",
"webgpu/shader/execution/atan2.bin": "3b9a37a1",
"webgpu/shader/execution/atanh.bin": "7295a313",
"webgpu/shader/execution/bitcast.bin": "73e0bea6",
"webgpu/shader/execution/ceil.bin": "24bd6be9",
"webgpu/shader/execution/clamp.bin": "8ed55492",
"webgpu/shader/execution/cos.bin": "4d36fa0",
"webgpu/shader/execution/cosh.bin": "a7da3a3",
"webgpu/shader/execution/cross.bin": "6ce2660b",
"webgpu/shader/execution/degrees.bin": "53a0849",
"webgpu/shader/execution/determinant.bin": "873e78af",
"webgpu/shader/execution/distance.bin": "bfce09a0",
"webgpu/shader/execution/dot.bin": "566b6e55",
"webgpu/shader/execution/exp.bin": "d8142d49",
"webgpu/shader/execution/exp2.bin": "52a403d1",
"webgpu/shader/execution/faceForward.bin": "f90dacbe",
"webgpu/shader/execution/floor.bin": "c7465b11",
"webgpu/shader/execution/fma.bin": "db3497d4",
"webgpu/shader/execution/fract.bin": "e65c5bd1",
"webgpu/shader/execution/frexp.bin": "5ce112f4",
"webgpu/shader/execution/inverseSqrt.bin": "84ea0a57",
"webgpu/shader/execution/ldexp.bin": "9d11f120",
"webgpu/shader/execution/length.bin": "dd759736",
"webgpu/shader/execution/log.bin": "5f77a59d",
"webgpu/shader/execution/log2.bin": "57fff45e",
"webgpu/shader/execution/max.bin": "c7cdd54f",
"webgpu/shader/execution/min.bin": "422be325",
"webgpu/shader/execution/mix.bin": "957e7d92",
"webgpu/shader/execution/modf.bin": "946d1f4f",
"webgpu/shader/execution/normalize.bin": "2ac02e80",
"webgpu/shader/execution/pack2x16float.bin": "d7ef3cf5",
"webgpu/shader/execution/pow.bin": "cd492166",
"webgpu/shader/execution/quantizeToF16.bin": "58bac06c",
"webgpu/shader/execution/radians.bin": "6ac08f50",
"webgpu/shader/execution/reflect.bin": "3c260554",
"webgpu/shader/execution/refract.bin": "7e952d7c",
"webgpu/shader/execution/round.bin": "f6b9bda1",
"webgpu/shader/execution/saturate.bin": "1c22f301",
"webgpu/shader/execution/sign.bin": "3ce55105",
"webgpu/shader/execution/sin.bin": "d48e7f2a",
"webgpu/shader/execution/sinh.bin": "f227c1d1",
"webgpu/shader/execution/smoothstep.bin": "6bdb4309",
"webgpu/shader/execution/sqrt.bin": "cd576d27",
"webgpu/shader/execution/step.bin": "dd584686",
"webgpu/shader/execution/tan.bin": "5ae50f61",
"webgpu/shader/execution/tanh.bin": "fe7a619d",
"webgpu/shader/execution/transpose.bin": "469edd7e",
"webgpu/shader/execution/trunc.bin": "8d3a05de",
"webgpu/shader/execution/unpack2x16float.bin": "e897c5ac",
"webgpu/shader/execution/unpack2x16snorm.bin": "450d5402",
"webgpu/shader/execution/unpack2x16unorm.bin": "306b3bf9",
"webgpu/shader/execution/unpack4x8snorm.bin": "fc1bd4c3",
"webgpu/shader/execution/unpack4x8unorm.bin": "763288cc",
"webgpu/shader/execution/unary/af_arithmetic.bin": "a39d4121",
"webgpu/shader/execution/unary/af_assignment.bin": "6ed540e8",
"webgpu/shader/execution/unary/bool_conversion.bin": "f37ea003",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "9cadc739",
"webgpu/shader/execution/unary/f16_conversion.bin": "49c7b38e",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "28da577a",
"webgpu/shader/execution/unary/f32_conversion.bin": "fcdfdd08",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "25cf27d1",
"webgpu/shader/execution/unary/i32_conversion.bin": "276dcf69",
"webgpu/shader/execution/unary/u32_conversion.bin": "acac2172",
"webgpu/shader/execution/unary/ai_assignment.bin": "c876d431",
"webgpu/shader/execution/binary/ai_arithmetic.bin": "36a1d65b",
"webgpu/shader/execution/unary/ai_arithmetic.bin": "89e34dcf",
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "3fd8797b",
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "bf99158a",
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "8bcc7c30"
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit bc46661

Please sign in to comment.