Skip to content

Commit

Permalink
Disable logToWebSocket by default (#3536)
Browse files Browse the repository at this point in the history
Fixes 3504
  • Loading branch information
kainino0x authored Mar 21, 2024
1 parent 3901910 commit 278383f
Show file tree
Hide file tree
Showing 11 changed files with 142 additions and 127 deletions.
6 changes: 6 additions & 0 deletions src/common/framework/test_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export type TestConfig = {
* Whether or not to request a fallback adapter.
*/
forceFallbackAdapter: boolean;

/**
* Whether to enable the `logToWebSocket` function used for out-of-band test logging.
*/
logToWebSocket: boolean;
};

export const globalTestConfig: TestConfig = {
Expand All @@ -35,4 +40,5 @@ export const globalTestConfig: TestConfig = {
unrollConstEvalLoops: false,
compatibility: false,
forceFallbackAdapter: false,
logToWebSocket: false,
};
4 changes: 2 additions & 2 deletions src/common/internal/test_group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { validQueryPart } from '../internal/query/validQueryPart.js';
import { DeepReadonly } from '../util/types.js';
import { assert, unreachable } from '../util/util.js';

import { logToWebsocket } from './websocket_logger.js';
import { logToWebSocket } from './websocket_logger.js';

export type RunFn = (
rec: TestCaseRecorder,
Expand Down Expand Up @@ -737,7 +737,7 @@ class RunCaseSpecific implements RunCase {
timems: rec.result.timems,
nonskippedSubcaseCount: rec.nonskippedSubcaseCount,
};
logToWebsocket(JSON.stringify(msg));
logToWebSocket(JSON.stringify(msg));
}
}
}
Expand Down
13 changes: 9 additions & 4 deletions src/common/internal/websocket_logger.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { globalTestConfig } from '../framework/test_config.js';

/**
* - 'uninitialized' means we haven't tried to connect yet
* - Promise means it's pending
Expand All @@ -8,12 +10,15 @@ let connection: Promise<WebSocket | 'failed'> | WebSocket | 'failed' | 'uninitia
'uninitialized';

/**
* Log a string to a websocket at `localhost:59497`. See `tools/websocket-logger`.
* If the logToWebSocket option is enabled (?log_to_web_socket=1 in browser,
* --log-to-web-socket on command line, or enable it by default in options.ts),
* log a string to a websocket at `localhost:59497`. See `tools/websocket-logger`.
*
* This does nothing if a connection couldn't be established on the first call.
* This does nothing if a logToWebSocket is not enabled, or if a connection
* couldn't be established on the first call.
*/
export function logToWebsocket(msg: string) {
if (connection === 'failed') {
export function logToWebSocket(msg: string) {
if (!globalTestConfig.logToWebSocket || connection === 'failed') {
return;
}

Expand Down
2 changes: 2 additions & 0 deletions src/common/runtime/cmdline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ for (let i = 0; i < sys.args.length; ++i) {
globalTestConfig.compatibility = true;
} else if (a === '--force-fallback-adapter') {
globalTestConfig.forceFallbackAdapter = true;
} else if (a === '--log-to-websocket') {
globalTestConfig.logToWebSocket = true;
} else {
console.log('unrecognized flag: ', a);
usage(1);
Expand Down
5 changes: 4 additions & 1 deletion src/common/runtime/helper/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export interface CTSOptions {
compatibility: boolean;
forceFallbackAdapter: boolean;
unrollConstEvalLoops: boolean;
powerPreference?: GPUPowerPreference | '';
powerPreference: GPUPowerPreference | '';
logToWebSocket: boolean;
}

export const kDefaultCTSOptions: CTSOptions = {
Expand All @@ -40,6 +41,7 @@ export const kDefaultCTSOptions: CTSOptions = {
forceFallbackAdapter: false,
unrollConstEvalLoops: false,
powerPreference: '',
logToWebSocket: false,
};

/**
Expand Down Expand Up @@ -84,6 +86,7 @@ export const kCTSOptionsInfo: OptionsInfos<CTSOptions> = {
{ value: 'high-performance', description: 'high-performance' },
],
},
logToWebSocket: { description: 'send some logs to ws://localhost:59497/' },
};

/**
Expand Down
5 changes: 3 additions & 2 deletions src/common/runtime/helper/utils_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ export interface WorkerTestRunRequest {
* Set config environment for workers with ctsOptions and return a Logger.
*/
export function setupWorkerEnvironment(ctsOptions: CTSOptions): Logger {
const { debug, unrollConstEvalLoops, powerPreference, compatibility } = ctsOptions;
globalTestConfig.unrollConstEvalLoops = unrollConstEvalLoops;
const { debug, powerPreference, compatibility } = ctsOptions;
globalTestConfig.unrollConstEvalLoops = ctsOptions.unrollConstEvalLoops;
globalTestConfig.compatibility = compatibility;
globalTestConfig.logToWebSocket = ctsOptions.logToWebSocket;

Logger.globalDebugMode = debug;
const log = new Logger();
Expand Down
2 changes: 2 additions & 0 deletions src/common/runtime/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ for (let i = 0; i < sys.args.length; ++i) {
emitCoverage = true;
} else if (a === '--force-fallback-adapter') {
globalTestConfig.forceFallbackAdapter = true;
} else if (a === '--log-to-websocket') {
globalTestConfig.logToWebSocket = true;
} else if (a === '--gpu-provider') {
const modulePath = sys.args[++i];
gpuProviderModule = require(modulePath);
Expand Down
12 changes: 3 additions & 9 deletions src/common/runtime/standalone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,10 @@ const { queries: qs, options } = parseSearchParamLikeWithOptions(
kStandaloneOptionsInfos,
window.location.search || rootQuerySpec
);
const {
runnow,
debug,
unrollConstEvalLoops,
powerPreference,
compatibility,
forceFallbackAdapter,
} = options;
globalTestConfig.unrollConstEvalLoops = unrollConstEvalLoops;
const { runnow, debug, powerPreference, compatibility, forceFallbackAdapter } = options;
globalTestConfig.unrollConstEvalLoops = options.unrollConstEvalLoops;
globalTestConfig.compatibility = compatibility;
globalTestConfig.logToWebSocket = options.logToWebSocket;

Logger.globalDebugMode = debug;
const logger = new Logger();
Expand Down
4 changes: 3 additions & 1 deletion src/common/tools/merge_listing_times.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ How to generate TIMING_LOG_FILES files:
- Launch the 'websocket-logger' tool (see its README.md), which listens for
log messages on localhost:59497.
- Run the tests you want to capture data for, on the same system. Since
- With the logToWebSocket flag enabled (?log_to_web_socket=1 in browser,
--log-to-web-socket on command line, or enable it by default in options.ts)...
- ... run the tests you want to capture data for, on the same system. Since
logging is done through the websocket side-channel, you can run the tests
under any runtime (standalone, WPT, etc.) as long as WebSocket support is
available (always true in browsers).
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": "7ce358c0",
"webgpu/shader/execution/binary/af_logical.bin": "4f841d5b",
"webgpu/shader/execution/binary/af_division.bin": "4d9441a",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "cfabb7cf",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "4073ab7",
"webgpu/shader/execution/binary/af_multiplication.bin": "314f459d",
"webgpu/shader/execution/binary/af_remainder.bin": "7957e61a",
"webgpu/shader/execution/binary/af_subtraction.bin": "4e079c33",
"webgpu/shader/execution/binary/f16_addition.bin": "fb951e0b",
"webgpu/shader/execution/binary/f16_logical.bin": "9b8d9213",
"webgpu/shader/execution/binary/f16_division.bin": "50e59ff7",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "fea79c44",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "2537923d",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "d2d11f12",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "15f22b30",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "e78c619d",
"webgpu/shader/execution/binary/f16_multiplication.bin": "d4f268f2",
"webgpu/shader/execution/binary/f16_remainder.bin": "229402ce",
"webgpu/shader/execution/binary/f16_subtraction.bin": "fb1f92c5",
"webgpu/shader/execution/binary/f32_addition.bin": "50ce83bd",
"webgpu/shader/execution/binary/f32_logical.bin": "5c6b5f70",
"webgpu/shader/execution/binary/f32_division.bin": "e9ee3d15",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "5268ff93",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "b544a90d",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "1a8369f5",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "f8205c67",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "1d645d7d",
"webgpu/shader/execution/binary/f32_multiplication.bin": "d7c76e9",
"webgpu/shader/execution/binary/f32_remainder.bin": "a4c5ac72",
"webgpu/shader/execution/binary/f32_subtraction.bin": "e122631c",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "4de0a760",
"webgpu/shader/execution/binary/i32_comparison.bin": "43fa569a",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "27268577",
"webgpu/shader/execution/binary/u32_comparison.bin": "daa10109",
"webgpu/shader/execution/abs.bin": "eb80796a",
"webgpu/shader/execution/acos.bin": "fba0df22",
"webgpu/shader/execution/acosh.bin": "c9c6163f",
"webgpu/shader/execution/asin.bin": "cafcc06e",
"webgpu/shader/execution/asinh.bin": "66c9ef9a",
"webgpu/shader/execution/atan.bin": "c3081ff0",
"webgpu/shader/execution/atan2.bin": "5e756536",
"webgpu/shader/execution/atanh.bin": "61eed097",
"webgpu/shader/execution/bitcast.bin": "8ded343e",
"webgpu/shader/execution/ceil.bin": "ff34d08b",
"webgpu/shader/execution/clamp.bin": "4a47c2ba",
"webgpu/shader/execution/cos.bin": "b181f8f6",
"webgpu/shader/execution/cosh.bin": "5f0dacaa",
"webgpu/shader/execution/cross.bin": "40853d3b",
"webgpu/shader/execution/degrees.bin": "b0fe04da",
"webgpu/shader/execution/determinant.bin": "9f1e22bc",
"webgpu/shader/execution/distance.bin": "6e061016",
"webgpu/shader/execution/dot.bin": "c2006ea5",
"webgpu/shader/execution/exp.bin": "9c4f523c",
"webgpu/shader/execution/exp2.bin": "2c32c324",
"webgpu/shader/execution/faceForward.bin": "af680aaa",
"webgpu/shader/execution/floor.bin": "73da0f53",
"webgpu/shader/execution/fma.bin": "50302348",
"webgpu/shader/execution/fract.bin": "ff39c6ad",
"webgpu/shader/execution/frexp.bin": "24c9f488",
"webgpu/shader/execution/inverseSqrt.bin": "1b804c0c",
"webgpu/shader/execution/ldexp.bin": "31252855",
"webgpu/shader/execution/length.bin": "4a59b13",
"webgpu/shader/execution/log.bin": "e5257ca7",
"webgpu/shader/execution/log2.bin": "98c9d48b",
"webgpu/shader/execution/max.bin": "b51cbdc3",
"webgpu/shader/execution/min.bin": "b7a1bb54",
"webgpu/shader/execution/mix.bin": "45015b11",
"webgpu/shader/execution/modf.bin": "29b98e66",
"webgpu/shader/execution/normalize.bin": "5c00f125",
"webgpu/shader/execution/pack2x16float.bin": "2e344361",
"webgpu/shader/execution/pow.bin": "3e883036",
"webgpu/shader/execution/quantizeToF16.bin": "29f8ad28",
"webgpu/shader/execution/radians.bin": "98840ac9",
"webgpu/shader/execution/reflect.bin": "d86261b0",
"webgpu/shader/execution/refract.bin": "d16ee553",
"webgpu/shader/execution/round.bin": "331b3f29",
"webgpu/shader/execution/saturate.bin": "732d92e",
"webgpu/shader/execution/sign.bin": "6e23ffff",
"webgpu/shader/execution/sin.bin": "65959031",
"webgpu/shader/execution/sinh.bin": "bf50e06",
"webgpu/shader/execution/smoothstep.bin": "9f1c6459",
"webgpu/shader/execution/sqrt.bin": "1685fb38",
"webgpu/shader/execution/step.bin": "f54a01f6",
"webgpu/shader/execution/tan.bin": "ecbcdf75",
"webgpu/shader/execution/tanh.bin": "cc8d0a39",
"webgpu/shader/execution/transpose.bin": "1d29e3f1",
"webgpu/shader/execution/trunc.bin": "b0aa10fc",
"webgpu/shader/execution/unpack2x16float.bin": "d18f1932",
"webgpu/shader/execution/unpack2x16snorm.bin": "6efd551",
"webgpu/shader/execution/unpack2x16unorm.bin": "32b063e8",
"webgpu/shader/execution/unpack4x8snorm.bin": "bbdb7af7",
"webgpu/shader/execution/unpack4x8unorm.bin": "79773cdc",
"webgpu/shader/execution/unary/af_arithmetic.bin": "ea8cdb53",
"webgpu/shader/execution/unary/af_assignment.bin": "d0209f98",
"webgpu/shader/execution/unary/bool_conversion.bin": "eb77c972",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "6936be94",
"webgpu/shader/execution/unary/f16_conversion.bin": "eeabc58f",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "e1a45f70",
"webgpu/shader/execution/unary/f32_conversion.bin": "3afd9d69",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "44fc246d",
"webgpu/shader/execution/unary/i32_conversion.bin": "ae197d05",
"webgpu/shader/execution/unary/u32_conversion.bin": "ebb53722",
"webgpu/shader/execution/unary/ai_assignment.bin": "b8f56b9",
"webgpu/shader/execution/binary/ai_arithmetic.bin": "81216e44",
"webgpu/shader/execution/unary/ai_arithmetic.bin": "ca04838a",
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "e53fc5b2",
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "59dcdf08",
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "c253fad1"
"webgpu/shader/execution/binary/af_addition.bin": "cc46f375",
"webgpu/shader/execution/binary/af_logical.bin": "a96d0397",
"webgpu/shader/execution/binary/af_division.bin": "9947b11a",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "56d9ea9e",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "e3431b91",
"webgpu/shader/execution/binary/af_multiplication.bin": "d87b2f1b",
"webgpu/shader/execution/binary/af_remainder.bin": "71d8432f",
"webgpu/shader/execution/binary/af_subtraction.bin": "8c3e4a0a",
"webgpu/shader/execution/binary/f16_addition.bin": "dd5dd072",
"webgpu/shader/execution/binary/f16_logical.bin": "d1f632dd",
"webgpu/shader/execution/binary/f16_division.bin": "166dbe68",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "47c71854",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "fe436936",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "e192e191",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "8b8ea740",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "8f85bf5f",
"webgpu/shader/execution/binary/f16_multiplication.bin": "1f9bd007",
"webgpu/shader/execution/binary/f16_remainder.bin": "75cebe2e",
"webgpu/shader/execution/binary/f16_subtraction.bin": "665cb599",
"webgpu/shader/execution/binary/f32_addition.bin": "d66775eb",
"webgpu/shader/execution/binary/f32_logical.bin": "8759f532",
"webgpu/shader/execution/binary/f32_division.bin": "4cf768ee",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "29c7484c",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "d2ecc107",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "cccb9209",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "3cc4c9b8",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "d2e2029e",
"webgpu/shader/execution/binary/f32_multiplication.bin": "13d34f2",
"webgpu/shader/execution/binary/f32_remainder.bin": "17d30b22",
"webgpu/shader/execution/binary/f32_subtraction.bin": "49a59e26",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "119fe0bd",
"webgpu/shader/execution/binary/i32_comparison.bin": "9749440b",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "902e89b8",
"webgpu/shader/execution/binary/u32_comparison.bin": "a5f8da57",
"webgpu/shader/execution/abs.bin": "805797bf",
"webgpu/shader/execution/acos.bin": "93089d9e",
"webgpu/shader/execution/acosh.bin": "b35dc462",
"webgpu/shader/execution/asin.bin": "d5bda311",
"webgpu/shader/execution/asinh.bin": "ae10d9a0",
"webgpu/shader/execution/atan.bin": "99c1e67f",
"webgpu/shader/execution/atan2.bin": "462e7e6a",
"webgpu/shader/execution/atanh.bin": "e70e1792",
"webgpu/shader/execution/bitcast.bin": "bd0bc184",
"webgpu/shader/execution/ceil.bin": "b56ea84a",
"webgpu/shader/execution/clamp.bin": "ff5a401f",
"webgpu/shader/execution/cos.bin": "bfad82a2",
"webgpu/shader/execution/cosh.bin": "e71a9b5",
"webgpu/shader/execution/cross.bin": "27700ac",
"webgpu/shader/execution/degrees.bin": "690bf0ac",
"webgpu/shader/execution/determinant.bin": "b9597fbc",
"webgpu/shader/execution/distance.bin": "55181230",
"webgpu/shader/execution/dot.bin": "7f477f0d",
"webgpu/shader/execution/exp.bin": "8b9f445d",
"webgpu/shader/execution/exp2.bin": "84e22d81",
"webgpu/shader/execution/faceForward.bin": "7dad0a6f",
"webgpu/shader/execution/floor.bin": "87184f81",
"webgpu/shader/execution/fma.bin": "c020820d",
"webgpu/shader/execution/fract.bin": "d0bb2f7a",
"webgpu/shader/execution/frexp.bin": "d18a686e",
"webgpu/shader/execution/inverseSqrt.bin": "47aca3d3",
"webgpu/shader/execution/ldexp.bin": "55575b9e",
"webgpu/shader/execution/length.bin": "48c6ff24",
"webgpu/shader/execution/log.bin": "ea97557c",
"webgpu/shader/execution/log2.bin": "5f800fe1",
"webgpu/shader/execution/max.bin": "582080bc",
"webgpu/shader/execution/min.bin": "aa7c99c6",
"webgpu/shader/execution/mix.bin": "29595ab0",
"webgpu/shader/execution/modf.bin": "6556fce6",
"webgpu/shader/execution/normalize.bin": "53441d1e",
"webgpu/shader/execution/pack2x16float.bin": "83b4b256",
"webgpu/shader/execution/pow.bin": "90403cbe",
"webgpu/shader/execution/quantizeToF16.bin": "2fce486e",
"webgpu/shader/execution/radians.bin": "540e8c18",
"webgpu/shader/execution/reflect.bin": "2d7a6f8f",
"webgpu/shader/execution/refract.bin": "f180e0bb",
"webgpu/shader/execution/round.bin": "65f0fae6",
"webgpu/shader/execution/saturate.bin": "7e0a1def",
"webgpu/shader/execution/sign.bin": "c628a9b3",
"webgpu/shader/execution/sin.bin": "447991fb",
"webgpu/shader/execution/sinh.bin": "1e833f83",
"webgpu/shader/execution/smoothstep.bin": "e7adffa5",
"webgpu/shader/execution/sqrt.bin": "b3cb5e5",
"webgpu/shader/execution/step.bin": "c26e3a34",
"webgpu/shader/execution/tan.bin": "8eebcaac",
"webgpu/shader/execution/tanh.bin": "46e7a9d1",
"webgpu/shader/execution/transpose.bin": "e7ae0d43",
"webgpu/shader/execution/trunc.bin": "47c27ad9",
"webgpu/shader/execution/unpack2x16float.bin": "870b90d",
"webgpu/shader/execution/unpack2x16snorm.bin": "b5ee7356",
"webgpu/shader/execution/unpack2x16unorm.bin": "310beef6",
"webgpu/shader/execution/unpack4x8snorm.bin": "5c9e94f5",
"webgpu/shader/execution/unpack4x8unorm.bin": "290950c8",
"webgpu/shader/execution/unary/af_arithmetic.bin": "87085660",
"webgpu/shader/execution/unary/af_assignment.bin": "cce1a82b",
"webgpu/shader/execution/unary/bool_conversion.bin": "247f2b83",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "3345fdcb",
"webgpu/shader/execution/unary/f16_conversion.bin": "dc75125b",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "a1ed9b8",
"webgpu/shader/execution/unary/f32_conversion.bin": "886fa15d",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "d51bbffb",
"webgpu/shader/execution/unary/i32_conversion.bin": "76c9d481",
"webgpu/shader/execution/unary/u32_conversion.bin": "f6b0e41",
"webgpu/shader/execution/unary/ai_assignment.bin": "79ae98e8",
"webgpu/shader/execution/binary/ai_arithmetic.bin": "c59804c3",
"webgpu/shader/execution/unary/ai_arithmetic.bin": "9e23d866",
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "b951f27f",
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "6756e689",
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "60714ed1"
}
Binary file modified src/resources/cache/webgpu/shader/execution/bitcast.bin
Binary file not shown.

0 comments on commit 278383f

Please sign in to comment.