Skip to content

Commit

Permalink
Move 'debug' option to globalTestConfig (#3537)
Browse files Browse the repository at this point in the history
This consolidates some of the global state (the other being
defaultRequestAdapterOptions).

- In `server` runtime, separate 'debug' from 'verbose' for consistency
  with other runtimes
- Remove dead code `messagesForPreviouslySeenStacks`
  • Loading branch information
kainino0x authored Mar 26, 2024
1 parent 43a752e commit c3b50f7
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 123 deletions.
6 changes: 6 additions & 0 deletions src/common/framework/test_config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
export type TestConfig = {
/**
* Enable debug-level logs (normally logged via `Fixture.debug()`).
*/
enableDebugLogs: boolean;

maxSubcasesInFlight: number;
testHeartbeatCallback: () => void;
noRaceWithRejectOnTimeout: boolean;
Expand Down Expand Up @@ -34,6 +39,7 @@ export type TestConfig = {
};

export const globalTestConfig: TestConfig = {
enableDebugLogs: false,
maxSubcasesInFlight: 500,
testHeartbeatCallback: () => {},
noRaceWithRejectOnTimeout: false,
Expand Down
5 changes: 2 additions & 3 deletions src/common/internal/logging/logger.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { globalTestConfig } from '../../framework/test_config.js';
import { version } from '../version.js';

import { LiveTestCaseResult } from './result.js';
Expand All @@ -6,8 +7,6 @@ import { TestCaseRecorder } from './test_case_recorder.js';
export type LogResults = Map<string, LiveTestCaseResult>;

export class Logger {
static globalDebugMode: boolean = false;

readonly overriddenDebugMode: boolean | undefined;
readonly results: LogResults = new Map();

Expand All @@ -19,7 +18,7 @@ export class Logger {
const result: LiveTestCaseResult = { status: 'running', timems: -1 };
this.results.set(name, result);
return [
new TestCaseRecorder(result, this.overriddenDebugMode ?? Logger.globalDebugMode),
new TestCaseRecorder(result, this.overriddenDebugMode ?? globalTestConfig.enableDebugLogs),
result,
];
}
Expand Down
2 changes: 0 additions & 2 deletions src/common/internal/logging/test_case_recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ export class TestCaseRecorder {
private logs: LogMessageWithStack[] = [];
private logLinesAtCurrentSeverity = 0;
private debugging = false;
/** Used to dedup log messages which have identical stacks. */
private messagesForPreviouslySeenStacks = new Map<string, LogMessageWithStack>();

constructor(result: LiveTestCaseResult, debugging: boolean) {
this.result = result;
Expand Down
4 changes: 1 addition & 3 deletions src/common/runtime/cmdline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ Colors.enabled = false;
let verbose = false;
let emitCoverage = false;
let listMode: listModes = 'none';
let debug = false;
let printJSON = false;
let quiet = false;
let loadWebGPUExpectations: Promise<unknown> | undefined = undefined;
Expand All @@ -89,7 +88,7 @@ for (let i = 0; i < sys.args.length; ++i) {
} else if (a === '--list-unimplemented') {
listMode = 'unimplemented';
} else if (a === '--debug') {
debug = true;
globalTestConfig.enableDebugLogs = true;
} else if (a === '--print-json') {
printJSON = true;
} else if (a === '--expectations') {
Expand Down Expand Up @@ -176,7 +175,6 @@ if (queries.length === 0) {
filterQuery
);

Logger.globalDebugMode = debug;
const log = new Logger();

const failed: Array<[string, LiveTestCaseResult]> = [];
Expand Down
4 changes: 2 additions & 2 deletions src/common/runtime/helper/utils_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export interface WorkerTestRunRequest {
* Set config environment for workers with ctsOptions and return a Logger.
*/
export function setupWorkerEnvironment(ctsOptions: CTSOptions): Logger {
const { debug, powerPreference, compatibility } = ctsOptions;
const { powerPreference, compatibility } = ctsOptions;
globalTestConfig.enableDebugLogs = ctsOptions.debug;
globalTestConfig.unrollConstEvalLoops = ctsOptions.unrollConstEvalLoops;
globalTestConfig.compatibility = compatibility;
globalTestConfig.logToWebSocket = ctsOptions.logToWebSocket;

Logger.globalDebugMode = debug;
const log = new Logger();

if (powerPreference || compatibility) {
Expand Down
4 changes: 3 additions & 1 deletion src/common/runtime/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Options:
--compat Run tests in compatibility mode.
--coverage Add coverage data to each result.
--verbose Print result/log of every test as it runs.
--debug Include debug messages in logging.
--gpu-provider Path to node module that provides the GPU implementation.
--gpu-provider-flag Flag to set on the gpu-provider as <flag>=<value>
--unroll-const-eval-loops Unrolls loops in constant-evaluation shader execution tests
Expand Down Expand Up @@ -102,6 +103,8 @@ for (let i = 0; i < sys.args.length; ++i) {
gpuProviderModule = require(modulePath);
} else if (a === '--gpu-provider-flag') {
gpuProviderFlags.push(sys.args[++i]);
} else if (a === '--debug') {
globalTestConfig.enableDebugLogs = true;
} else if (a === '--unroll-const-eval-loops') {
globalTestConfig.unrollConstEvalLoops = true;
} else if (a === '--help') {
Expand Down Expand Up @@ -159,7 +162,6 @@ if (verbose) {

// eslint-disable-next-line @typescript-eslint/require-await
(async () => {
Logger.globalDebugMode = verbose;
const log = new Logger();
const testcases = new Map<string, TestTreeLeaf>();

Expand Down
4 changes: 2 additions & 2 deletions src/common/runtime/standalone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ const { queries: qs, options } = parseSearchParamLikeWithOptions(
kStandaloneOptionsInfos,
window.location.search || rootQuerySpec
);
const { runnow, debug, powerPreference, compatibility, forceFallbackAdapter } = options;
const { runnow, powerPreference, compatibility, forceFallbackAdapter } = options;
globalTestConfig.enableDebugLogs = options.debug;
globalTestConfig.unrollConstEvalLoops = options.unrollConstEvalLoops;
globalTestConfig.compatibility = compatibility;
globalTestConfig.logToWebSocket = options.logToWebSocket;

Logger.globalDebugMode = debug;
const logger = new Logger();

setBaseResourcePath('../out/resources');
Expand Down
3 changes: 1 addition & 2 deletions src/common/util/util.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Float16Array } from '../../external/petamoriken/float16/float16.js';
import { SkipTestCase } from '../framework/fixture.js';
import { globalTestConfig } from '../framework/test_config.js';
import { Logger } from '../internal/logging/logger.js';

import { keysOf } from './data_tables.js';
import { timeout } from './timeout.js';
Expand All @@ -24,7 +23,7 @@ export class ErrorWithExtra extends Error {
super(message);

const oldExtras = baseOrMessage instanceof ErrorWithExtra ? baseOrMessage.extra : {};
this.extra = Logger.globalDebugMode
this.extra = globalTestConfig.enableDebugLogs
? { ...oldExtras, ...newExtra() }
: { omitted: 'pass ?debug=1' };
}
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": "8295e1ff",
"webgpu/shader/execution/binary/af_logical.bin": "1b9df6b8",
"webgpu/shader/execution/binary/af_division.bin": "5d795028",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "853758e4",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "ef3de2db",
"webgpu/shader/execution/binary/af_multiplication.bin": "3c615c8b",
"webgpu/shader/execution/binary/af_remainder.bin": "2bc2bbc3",
"webgpu/shader/execution/binary/af_subtraction.bin": "c0abd1d",
"webgpu/shader/execution/binary/f16_addition.bin": "4dd18ff",
"webgpu/shader/execution/binary/f16_logical.bin": "56f5fb0a",
"webgpu/shader/execution/binary/f16_division.bin": "f89baa3a",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "f1975960",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "22e337e2",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "baf0c21",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "187cf217",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "e6b99cca",
"webgpu/shader/execution/binary/f16_multiplication.bin": "7616a3c5",
"webgpu/shader/execution/binary/f16_remainder.bin": "d8a04999",
"webgpu/shader/execution/binary/f16_subtraction.bin": "edbed2d4",
"webgpu/shader/execution/binary/f32_addition.bin": "c7ba1d32",
"webgpu/shader/execution/binary/f32_logical.bin": "d64f0f75",
"webgpu/shader/execution/binary/f32_division.bin": "245361cb",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "182f7c3d",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "344933a3",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "d6815f41",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "a0566cc6",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "506bddf5",
"webgpu/shader/execution/binary/f32_multiplication.bin": "8f0ffb40",
"webgpu/shader/execution/binary/f32_remainder.bin": "a07e3b6e",
"webgpu/shader/execution/binary/f32_subtraction.bin": "5250713f",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "b5e7533e",
"webgpu/shader/execution/binary/i32_comparison.bin": "9e3294e2",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "ba4907a2",
"webgpu/shader/execution/binary/u32_comparison.bin": "51b6a5e0",
"webgpu/shader/execution/abs.bin": "37c9ff92",
"webgpu/shader/execution/acos.bin": "9fe49787",
"webgpu/shader/execution/acosh.bin": "f0cab83b",
"webgpu/shader/execution/asin.bin": "60a6f81b",
"webgpu/shader/execution/asinh.bin": "54b743",
"webgpu/shader/execution/atan.bin": "a4c06d28",
"webgpu/shader/execution/atan2.bin": "23378b78",
"webgpu/shader/execution/atanh.bin": "7a9e01b7",
"webgpu/shader/execution/bitcast.bin": "919a54af",
"webgpu/shader/execution/ceil.bin": "bd652de3",
"webgpu/shader/execution/clamp.bin": "f4a07fd9",
"webgpu/shader/execution/cos.bin": "a25213d8",
"webgpu/shader/execution/cosh.bin": "50a62a9c",
"webgpu/shader/execution/cross.bin": "9a90cd4d",
"webgpu/shader/execution/degrees.bin": "a5e2277b",
"webgpu/shader/execution/determinant.bin": "f3219ff",
"webgpu/shader/execution/distance.bin": "2f1ba649",
"webgpu/shader/execution/dot.bin": "d76ca862",
"webgpu/shader/execution/exp.bin": "bace8733",
"webgpu/shader/execution/exp2.bin": "83187dc2",
"webgpu/shader/execution/faceForward.bin": "d6a8c672",
"webgpu/shader/execution/floor.bin": "141fa1cb",
"webgpu/shader/execution/fma.bin": "eef58d71",
"webgpu/shader/execution/fract.bin": "e0ed5a47",
"webgpu/shader/execution/frexp.bin": "53c880c2",
"webgpu/shader/execution/inverseSqrt.bin": "7b0bea55",
"webgpu/shader/execution/ldexp.bin": "1d95d50",
"webgpu/shader/execution/length.bin": "714dc281",
"webgpu/shader/execution/log.bin": "4f49547e",
"webgpu/shader/execution/log2.bin": "98c354ce",
"webgpu/shader/execution/max.bin": "7d1077ce",
"webgpu/shader/execution/min.bin": "38f100e5",
"webgpu/shader/execution/mix.bin": "3fd0b0e4",
"webgpu/shader/execution/modf.bin": "843cf9cf",
"webgpu/shader/execution/normalize.bin": "3f90b427",
"webgpu/shader/execution/pack2x16float.bin": "1a61f373",
"webgpu/shader/execution/pow.bin": "2b754e9d",
"webgpu/shader/execution/quantizeToF16.bin": "d5569d0b",
"webgpu/shader/execution/radians.bin": "804c845a",
"webgpu/shader/execution/reflect.bin": "6d7d89be",
"webgpu/shader/execution/refract.bin": "85cb8a6f",
"webgpu/shader/execution/round.bin": "83a9f09f",
"webgpu/shader/execution/saturate.bin": "4b0444bc",
"webgpu/shader/execution/sign.bin": "6e88b42f",
"webgpu/shader/execution/sin.bin": "44cc0d7b",
"webgpu/shader/execution/sinh.bin": "f698cb93",
"webgpu/shader/execution/smoothstep.bin": "f2acff50",
"webgpu/shader/execution/sqrt.bin": "c5b2e68a",
"webgpu/shader/execution/step.bin": "950499ce",
"webgpu/shader/execution/tan.bin": "69e7b99e",
"webgpu/shader/execution/tanh.bin": "13a69f4e",
"webgpu/shader/execution/transpose.bin": "97cca475",
"webgpu/shader/execution/trunc.bin": "8a03c63e",
"webgpu/shader/execution/unpack2x16float.bin": "d3346aee",
"webgpu/shader/execution/unpack2x16snorm.bin": "b141ba89",
"webgpu/shader/execution/unpack2x16unorm.bin": "1574f0e0",
"webgpu/shader/execution/unpack4x8snorm.bin": "359c9b67",
"webgpu/shader/execution/unpack4x8unorm.bin": "463f3622",
"webgpu/shader/execution/unary/af_arithmetic.bin": "387cffde",
"webgpu/shader/execution/unary/af_assignment.bin": "7b6fea86",
"webgpu/shader/execution/unary/bool_conversion.bin": "d42a9e83",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "6ccfa9b9",
"webgpu/shader/execution/unary/f16_conversion.bin": "cf0b38be",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "6725561f",
"webgpu/shader/execution/unary/f32_conversion.bin": "c331aec1",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "22f94632",
"webgpu/shader/execution/unary/i32_conversion.bin": "3f89d871",
"webgpu/shader/execution/unary/u32_conversion.bin": "4751045f",
"webgpu/shader/execution/unary/ai_assignment.bin": "19653bbf",
"webgpu/shader/execution/binary/ai_arithmetic.bin": "a41d22e",
"webgpu/shader/execution/unary/ai_arithmetic.bin": "69403380",
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "813b0c99",
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "d4a350eb",
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "e5fd3330"
"webgpu/shader/execution/binary/af_addition.bin": "c81e9a6a",
"webgpu/shader/execution/binary/af_logical.bin": "bdb8779e",
"webgpu/shader/execution/binary/af_division.bin": "91b298a2",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "8f2099e6",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "4fe4ee58",
"webgpu/shader/execution/binary/af_multiplication.bin": "d334de48",
"webgpu/shader/execution/binary/af_remainder.bin": "5b24778a",
"webgpu/shader/execution/binary/af_subtraction.bin": "b4620c61",
"webgpu/shader/execution/binary/f16_addition.bin": "686a0a9a",
"webgpu/shader/execution/binary/f16_logical.bin": "a005a942",
"webgpu/shader/execution/binary/f16_division.bin": "3ed8c6c",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "76d1e540",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "b17d6dc9",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "7f0432d2",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "bdf2100f",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "e892af82",
"webgpu/shader/execution/binary/f16_multiplication.bin": "f1411db",
"webgpu/shader/execution/binary/f16_remainder.bin": "d5cea08b",
"webgpu/shader/execution/binary/f16_subtraction.bin": "91e77b1f",
"webgpu/shader/execution/binary/f32_addition.bin": "a6c39628",
"webgpu/shader/execution/binary/f32_logical.bin": "404fe327",
"webgpu/shader/execution/binary/f32_division.bin": "746f7464",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "96ea9287",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "e9f5aa33",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "fb92b9cb",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "33c1660",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "6bf01cbd",
"webgpu/shader/execution/binary/f32_multiplication.bin": "95d7cbc0",
"webgpu/shader/execution/binary/f32_remainder.bin": "8b2422cb",
"webgpu/shader/execution/binary/f32_subtraction.bin": "eade1766",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "80e51f2e",
"webgpu/shader/execution/binary/i32_comparison.bin": "e93a0150",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "da5dd067",
"webgpu/shader/execution/binary/u32_comparison.bin": "b8b438c4",
"webgpu/shader/execution/abs.bin": "c7e66a30",
"webgpu/shader/execution/acos.bin": "72f06f41",
"webgpu/shader/execution/acosh.bin": "1e7d8a48",
"webgpu/shader/execution/asin.bin": "371ff16",
"webgpu/shader/execution/asinh.bin": "5a1dbc0d",
"webgpu/shader/execution/atan.bin": "4f8001d5",
"webgpu/shader/execution/atan2.bin": "fae11ec2",
"webgpu/shader/execution/atanh.bin": "df7a6cd8",
"webgpu/shader/execution/bitcast.bin": "b53ea8b5",
"webgpu/shader/execution/ceil.bin": "981576c2",
"webgpu/shader/execution/clamp.bin": "7797995",
"webgpu/shader/execution/cos.bin": "e2b04239",
"webgpu/shader/execution/cosh.bin": "d77ada8f",
"webgpu/shader/execution/cross.bin": "4a7505b6",
"webgpu/shader/execution/degrees.bin": "ca587506",
"webgpu/shader/execution/determinant.bin": "e9d2f7ee",
"webgpu/shader/execution/distance.bin": "1361610c",
"webgpu/shader/execution/dot.bin": "398e3843",
"webgpu/shader/execution/exp.bin": "4cba6519",
"webgpu/shader/execution/exp2.bin": "cbe8fcaf",
"webgpu/shader/execution/faceForward.bin": "a7861c17",
"webgpu/shader/execution/floor.bin": "a27220fb",
"webgpu/shader/execution/fma.bin": "9e2523eb",
"webgpu/shader/execution/fract.bin": "add43952",
"webgpu/shader/execution/frexp.bin": "4c26ef50",
"webgpu/shader/execution/inverseSqrt.bin": "4f6f77b8",
"webgpu/shader/execution/ldexp.bin": "70e0ae83",
"webgpu/shader/execution/length.bin": "acb10b7",
"webgpu/shader/execution/log.bin": "5cdd2a4e",
"webgpu/shader/execution/log2.bin": "909eb7d5",
"webgpu/shader/execution/max.bin": "d135a51d",
"webgpu/shader/execution/min.bin": "2cedabe1",
"webgpu/shader/execution/mix.bin": "58d6f3d0",
"webgpu/shader/execution/modf.bin": "2d817b7a",
"webgpu/shader/execution/normalize.bin": "744887ff",
"webgpu/shader/execution/pack2x16float.bin": "8aeccc52",
"webgpu/shader/execution/pow.bin": "ef787e97",
"webgpu/shader/execution/quantizeToF16.bin": "31044deb",
"webgpu/shader/execution/radians.bin": "4396cfc0",
"webgpu/shader/execution/reflect.bin": "e07d960e",
"webgpu/shader/execution/refract.bin": "eeaeaffb",
"webgpu/shader/execution/round.bin": "91b508f0",
"webgpu/shader/execution/saturate.bin": "2c422cb7",
"webgpu/shader/execution/sign.bin": "e9330fe7",
"webgpu/shader/execution/sin.bin": "b2430345",
"webgpu/shader/execution/sinh.bin": "7882d98a",
"webgpu/shader/execution/smoothstep.bin": "9e25cd3",
"webgpu/shader/execution/sqrt.bin": "84cf47d1",
"webgpu/shader/execution/step.bin": "9f906852",
"webgpu/shader/execution/tan.bin": "7a1bffc1",
"webgpu/shader/execution/tanh.bin": "936be58c",
"webgpu/shader/execution/transpose.bin": "c2773838",
"webgpu/shader/execution/trunc.bin": "92d0ffbf",
"webgpu/shader/execution/unpack2x16float.bin": "3eeba5fd",
"webgpu/shader/execution/unpack2x16snorm.bin": "aa6698d6",
"webgpu/shader/execution/unpack2x16unorm.bin": "73b1cab6",
"webgpu/shader/execution/unpack4x8snorm.bin": "52608aee",
"webgpu/shader/execution/unpack4x8unorm.bin": "98432db",
"webgpu/shader/execution/unary/af_arithmetic.bin": "8cf68528",
"webgpu/shader/execution/unary/af_assignment.bin": "697a07f2",
"webgpu/shader/execution/unary/bool_conversion.bin": "41f44cfb",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "4333cfe2",
"webgpu/shader/execution/unary/f16_conversion.bin": "46889550",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "b9e83bbe",
"webgpu/shader/execution/unary/f32_conversion.bin": "baeea248",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "e4e44486",
"webgpu/shader/execution/unary/i32_conversion.bin": "4a9dd35f",
"webgpu/shader/execution/unary/u32_conversion.bin": "b41d956f",
"webgpu/shader/execution/unary/ai_assignment.bin": "c4d6ba53",
"webgpu/shader/execution/binary/ai_arithmetic.bin": "5c13510b",
"webgpu/shader/execution/unary/ai_arithmetic.bin": "5f34c968",
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "be88f96b",
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "181920b9",
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "8660404"
}

0 comments on commit c3b50f7

Please sign in to comment.