@@ -29,8 +29,10 @@ Options:
29
29
*** General Options ***
30
30
31
31
-h, --help Print this message.
32
- -d, --debug Specify to run test runner in debug mode.
33
- Debug mode outputs verbose log for test runner, sets up environment debug flag, and keeps karma not to exit after tests completed.
32
+ -d, --debug Specify to run test runner in debug mode. Debug mode does the following:
33
+ - outputs verbose log for test runner
34
+ - sets up environment debug flag (env.debug = true)
35
+ - opens Chromium debug port at 9333 and keeps karma not to exit after tests completed.
34
36
-b=<...>, --backend=<...> Specify one or more backend(s) to run the test upon.
35
37
Backends can be one or more of the following, splitted by comma:
36
38
webgl
@@ -47,38 +49,55 @@ Options:
47
49
bs (for BrowserStack tests)
48
50
-p, --profile Enable profiler.
49
51
Profiler will generate extra logs which include the information of events time consumption
52
+ -t, --trace Enable trace.
50
53
-P[=<...>], --perf[=<...>] Generate performance number. Cannot be used with flag --debug.
51
54
This flag can be used with a number as value, specifying the total count of test cases to run. The test cases may be used multiple times. Default value is 10.
52
55
-c, --file-cache Enable file cache.
56
+
57
+ *** Session Options ***
58
+ -u=<...>, --optimized-model-file-path=<...> Specify whether to dump the optimized model.
59
+ -o=<...>, --graph-optimization-level=<...> Specify graph optimization level.
60
+ Default is 'all'. Valid values are 'disabled', 'basic', 'extended', 'all'.
53
61
-i=<...>, --io-binding=<...> Specify the IO binding testing type. Should be one of the following:
54
- none (default)
62
+ none (default)
55
63
gpu-tensor use pre-allocated GPU tensors for inputs and outputs
56
64
gpu-location use pre-allocated GPU tensors for inputs and set preferredOutputLocation to 'gpu-buffer'
57
65
58
- *** Session Options ***
59
- -u=<...>, --optimized-model-file-path=<...> Specify whether to dump the optimized model.
60
- -o=<...>, --graph-optimization-level=<...> Specify graph optimization level.
61
- Default is 'all'. Valid values are 'disabled', 'basic', 'extended', 'all'.
62
66
*** Logging Options ***
63
67
64
- --log-verbose=<...> Set log level to verbose
65
- --log-info=<...> Set log level to info
66
- --log-warning=<...> Set log level to warning
67
- --log-error=<...> Set log level to error
68
- The 4 flags above specify the logging configuration. Each flag allows to specify one or more category(s), splitted by comma. If use the flags without value, the log level will be applied to all category.
68
+ --log-verbose Set log level to verbose
69
+ --log-info Set log level to info
70
+ --log-warning Set log level to warning
71
+ --log-error Set log level to error
72
+ The 4 flags above specify the logging configuration.
69
73
70
74
*** Backend Options ***
71
75
76
+ --wasm.<...>=<...> Set global environment flags for each backend.
77
+ --webgl.<...>=<...> These flags can be used multiple times to set multiple flags. For example:
78
+ --webgpu.<...>=<...> --webgpu.profiling.mode=default --wasm.numThreads=1 --wasm.simd=false
79
+ --webnn.<...>=<...>
80
+
81
+ --webnn-device-type Set the WebNN device type (cpu/gpu)
82
+
72
83
-x, --wasm-number-threads Set the WebAssembly number of threads
84
+ ("--wasm-number-threads" is deprecated. use "--wasm.numThreads" or "-x" instead)
73
85
--wasm-init-timeout Set the timeout for WebAssembly backend initialization, in milliseconds
86
+ (deprecated. use "--wasm.initTimeout" instead)
74
87
--wasm-enable-simd Set whether to enable SIMD
88
+ (deprecated. use "--wasm.simd" instead)
75
89
--wasm-enable-proxy Set whether to enable proxy worker
90
+ (deprecated. use "--wasm.proxy" instead)
76
91
--webgl-context-id Set the WebGL context ID (webgl/webgl2)
92
+ (deprecated. use "--webgl.contextId" instead)
77
93
--webgl-matmul-max-batch-size Set the WebGL matmulMaxBatchSize
94
+ (deprecated. use "--webgl.matmulMaxBatchSize" instead)
78
95
--webgl-texture-cache-mode Set the WebGL texture cache mode (initializerOnly/full)
96
+ (deprecated. use "--webgl.textureCacheMode" instead)
79
97
--webgl-texture-pack-mode Set the WebGL texture pack mode (true/false)
98
+ (deprecated. use "--webgl.pack" instead)
80
99
--webgpu-profiling-mode Set the WebGPU profiling mode (off/default)
81
- --webnn-device-type Set the WebNN device type (cpu/gpu )
100
+ (deprecated. use "--webgpu.profiling.mode" instead )
82
101
83
102
*** Browser Options ***
84
103
@@ -171,7 +190,6 @@ export interface TestRunnerCliArgs {
171
190
172
191
cpuOptions ?: InferenceSession . CpuExecutionProviderOption ;
173
192
cudaOptions ?: InferenceSession . CudaExecutionProviderOption ;
174
- cudaFlags ?: Record < string , unknown > ;
175
193
wasmOptions ?: InferenceSession . WebAssemblyExecutionProviderOption ;
176
194
webglOptions ?: InferenceSession . WebGLExecutionProviderOption ;
177
195
webnnOptions ?: InferenceSession . WebNNExecutionProviderOption ;
@@ -260,80 +278,73 @@ function parseCpuOptions(_args: minimist.ParsedArgs): InferenceSession.CpuExecut
260
278
return { name : 'cpu' } ;
261
279
}
262
280
263
- function parseCpuFlags ( _args : minimist . ParsedArgs ) : Record < string , unknown > {
264
- return { } ;
265
- }
266
-
267
281
function parseWasmOptions ( _args : minimist . ParsedArgs ) : InferenceSession . WebAssemblyExecutionProviderOption {
268
282
return { name : 'wasm' } ;
269
283
}
270
284
271
285
function parseWasmFlags ( args : minimist . ParsedArgs ) : Env . WebAssemblyFlags {
272
- const numThreads = args . x || args [ 'wasm-number-threads' ] ;
286
+ const wasm = args . wasm || { } ;
287
+ const numThreads = wasm . numThreads = wasm . numThreads ?? ( args . x ?? args [ 'wasm-number-threads' ] ) ;
273
288
if ( typeof numThreads !== 'undefined' && typeof numThreads !== 'number' ) {
274
- throw new Error ( 'Flag "x"/"wasm-number-threads" must be a number value' ) ;
289
+ throw new Error ( 'Flag "wasm.numThreads"/" x"/"wasm-number-threads" must be a number value' ) ;
275
290
}
276
- const initTimeout = args [ 'wasm-init-timeout' ] ;
291
+ const initTimeout = wasm . initTimeout = wasm . initTimeout ?? args [ 'wasm-init-timeout' ] ;
277
292
if ( typeof initTimeout !== 'undefined' && typeof initTimeout !== 'number' ) {
278
- throw new Error ( 'Flag "wasm-init-timeout" must be a number value' ) ;
279
- }
280
- let simd = args [ 'wasm-enable-simd' ] ;
281
- if ( simd === 'true' ) {
282
- simd = true ;
283
- } else if ( simd === 'false' ) {
284
- simd = false ;
285
- } else if ( typeof simd !== 'undefined' && typeof simd !== 'boolean' ) {
286
- throw new Error ( 'Flag "wasm-enable-simd" must be a boolean value' ) ;
287
- }
288
- let proxy = args [ 'wasm-enable-proxy' ] ;
289
- if ( proxy === 'true' ) {
290
- proxy = true ;
291
- } else if ( proxy === 'false' ) {
292
- proxy = false ;
293
- } else if ( typeof proxy !== 'undefined' && typeof proxy !== 'boolean' ) {
294
- throw new Error ( 'Flag "wasm-enable-proxy" must be a boolean value' ) ;
295
- }
296
- return { numThreads, initTimeout, simd, proxy} ;
293
+ throw new Error ( 'Flag "wasm.initTimeout"/"wasm-init-timeout" must be a number value' ) ;
294
+ }
295
+ const simd = wasm . simd = parseBooleanArg ( wasm . simd ?? args [ 'wasm-enable-simd' ] ) ;
296
+ if ( typeof simd !== 'undefined' && typeof simd !== 'boolean' ) {
297
+ throw new Error ( 'Flag "wasm.simd"/"wasm-enable-simd" must be a boolean value' ) ;
298
+ }
299
+ const proxy = wasm . proxy = parseBooleanArg ( wasm . proxy ?? args [ 'wasm-enable-proxy' ] ) ;
300
+ if ( typeof proxy !== 'undefined' && typeof proxy !== 'boolean' ) {
301
+ throw new Error ( 'Flag "wasm.proxy"/"wasm-enable-proxy" must be a boolean value' ) ;
302
+ }
303
+ return wasm ;
297
304
}
298
305
299
306
function parseWebglOptions ( _args : minimist . ParsedArgs ) : InferenceSession . WebGLExecutionProviderOption {
300
307
return { name : 'webgl' } ;
301
308
}
302
309
303
310
function parseWebglFlags ( args : minimist . ParsedArgs ) : Partial < Env . WebGLFlags > {
304
- const contextId = args [ 'webgl-context-id' ] ;
311
+ const webgl = args . webgl || { } ;
312
+ const contextId = webgl . contextId = webgl . contextId ?? args [ 'webgl-context-id' ] ;
305
313
if ( contextId !== undefined && contextId !== 'webgl' && contextId !== 'webgl2' ) {
306
- throw new Error ( 'Flag "webgl-context-id" is invalid' ) ;
314
+ throw new Error ( 'Flag "webgl.contextId"/"webgl -context-id" is invalid' ) ;
307
315
}
308
- const matmulMaxBatchSize = args [ 'webgl-matmul-max-batch-size' ] ;
316
+ const matmulMaxBatchSize = webgl . matmulMaxBatchSize = webgl . matmulMaxBatchSize ?? args [ 'webgl-matmul-max-batch-size' ] ;
309
317
if ( matmulMaxBatchSize !== undefined && typeof matmulMaxBatchSize !== 'number' ) {
310
- throw new Error ( 'Flag "webgl-matmul-max-batch-size" must be a number value' ) ;
318
+ throw new Error ( 'Flag "webgl.matmulMaxBatchSize"/"webgl -matmul-max-batch-size" must be a number value' ) ;
311
319
}
312
- const textureCacheMode = args [ 'webgl-texture-cache-mode' ] ;
320
+ const textureCacheMode = webgl . textureCacheMode = webgl . textureCacheMode ?? args [ 'webgl-texture-cache-mode' ] ;
313
321
if ( textureCacheMode !== undefined && textureCacheMode !== 'initializerOnly' && textureCacheMode !== 'full' ) {
314
- throw new Error ( 'Flag "webgl-texture-cache-mode" is invalid' ) ;
322
+ throw new Error ( 'Flag "webgl.textureCacheMode"/"webgl -texture-cache-mode" is invalid' ) ;
315
323
}
316
- const pack = args [ 'webgl-texture-pack-mode' ] ;
324
+ const pack = webgl . pack = parseBooleanArg ( webgl . pack ?? args [ 'webgl-texture-pack-mode' ] ) ;
317
325
if ( pack !== undefined && typeof pack !== 'boolean' ) {
318
- throw new Error ( 'Flag "webgl-texture-pack-mode" is invalid' ) ;
326
+ throw new Error ( 'Flag "webgl.pack"/"webgl -texture-pack-mode" is invalid' ) ;
319
327
}
320
- const async = args [ 'webgl-async' ] ;
328
+ const async = webgl . async = parseBooleanArg ( webgl . async ?? args [ 'webgl-async' ] ) ;
321
329
if ( async !== undefined && typeof async !== 'boolean' ) {
322
- throw new Error ( 'Flag "webgl-async" is invalid' ) ;
330
+ throw new Error ( 'Flag "webgl.async"/"webgl -async" is invalid' ) ;
323
331
}
324
- return { contextId , matmulMaxBatchSize , textureCacheMode , pack } ;
332
+ return webgl ;
325
333
}
326
334
327
335
function parseWebgpuFlags ( args : minimist . ParsedArgs ) : Partial < Env . WebGpuFlags > {
328
- const profilingMode = args [ 'webgpu-profiling-mode' ] ;
336
+ const webgpu = args . webgpu || { } ;
337
+ const profilingMode = ( webgpu . profiling = webgpu . profiling ?? { } ) . mode =
338
+ webgpu ?. profiling ?. mode ?? webgpu . profilingMode ?? args [ 'webgpu-profiling-mode' ] ;
329
339
if ( profilingMode !== undefined && profilingMode !== 'off' && profilingMode !== 'default' ) {
330
340
throw new Error ( 'Flag "webgpu-profiling-mode" is invalid' ) ;
331
341
}
332
- const validateInputContent = args [ 'webgpu-validate-input-content' ] ;
342
+ const validateInputContent = webgpu . validateInputContent =
343
+ parseBooleanArg ( webgpu . validateInputContent ?? args [ 'webgpu-validate-input-content' ] ) ;
333
344
if ( validateInputContent !== undefined && typeof validateInputContent !== 'boolean' ) {
334
345
throw new Error ( 'Flag "webgpu-validate-input-content" is invalid' ) ;
335
346
}
336
- return { profilingMode , validateInputContent } ;
347
+ return webgpu ;
337
348
}
338
349
339
350
function parseWebNNOptions ( args : minimist . ParsedArgs ) : InferenceSession . WebNNExecutionProviderOption {
@@ -344,12 +355,11 @@ function parseWebNNOptions(args: minimist.ParsedArgs): InferenceSession.WebNNExe
344
355
return { name : 'webnn' , deviceType} ;
345
356
}
346
357
347
- function parseGlobalEnvFlags ( args : minimist . ParsedArgs ) : NonNullable < TestRunnerCliArgs [ 'globalEnvFlags' ] > {
358
+ function parseGlobalEnvFlags ( args : minimist . ParsedArgs ) {
348
359
const wasm = parseWasmFlags ( args ) ;
349
360
const webgl = parseWebglFlags ( args ) ;
350
361
const webgpu = parseWebgpuFlags ( args ) ;
351
- const cpuFlags = parseCpuFlags ( args ) ;
352
- return { webgl, wasm, webgpu, ...cpuFlags } ;
362
+ return { webgl, wasm, webgpu} ;
353
363
}
354
364
355
365
export function parseTestRunnerCliArgs ( cmdlineArgs : string [ ] ) : TestRunnerCliArgs {
@@ -394,25 +404,33 @@ export function parseTestRunnerCliArgs(cmdlineArgs: string[]): TestRunnerCliArgs
394
404
}
395
405
}
396
406
397
- const globalEnvFlags = parseGlobalEnvFlags ( args ) ;
398
-
399
407
// Options:
400
408
// --log-verbose=<...>
401
409
// --log-info=<...>
402
410
// --log-warning=<...>
403
411
// --log-error=<...>
404
412
const logConfig = parseLogConfig ( args ) ;
405
- globalEnvFlags . logLevel = logConfig [ 0 ] ?. config . minimalSeverity ;
413
+ let logLevel = logConfig [ 0 ] ?. config . minimalSeverity ;
414
+
406
415
// Option: -p, --profile
407
416
const profile = ( args . profile || args . p ) ? true : false ;
408
417
if ( profile ) {
409
418
logConfig . push ( { category : 'Profiler.session' , config : { minimalSeverity : 'verbose' } } ) ;
410
419
logConfig . push ( { category : 'Profiler.node' , config : { minimalSeverity : 'verbose' } } ) ;
411
420
logConfig . push ( { category : 'Profiler.op' , config : { minimalSeverity : 'verbose' } } ) ;
412
421
logConfig . push ( { category : 'Profiler.backend' , config : { minimalSeverity : 'verbose' } } ) ;
413
- globalEnvFlags . logLevel = 'verbose' ;
422
+ logLevel = 'verbose' ;
414
423
}
415
424
425
+ // Option: -t, --trace
426
+ const trace = parseBooleanArg ( args . trace || args . t , false ) ;
427
+
428
+ // Options:
429
+ // --wasm.<...>=<...>
430
+ // --webgl.<...>=<...>
431
+ // --webgpu.<...>=<...>
432
+ const globalEnvFlags = { ...parseGlobalEnvFlags ( args ) , debug, trace, logLevel} ;
433
+
416
434
// Option: -P[=<...>], --perf[=<...>]
417
435
const perfArg = ( args . perf || args . P ) ;
418
436
const perf = perfArg ? true : false ;
0 commit comments