mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-26 19:52:38 +00:00
[js/common] move 'env.wasm.trace' to 'env.trace' (#19617)
### Description Try to move 'env.wasm.trace' to 'env.trace' to make it less confusing, because it also works in webgpu. Marked 'env.wasm.trace' as deprecated.
This commit is contained in:
parent
2e4d1b8f1b
commit
3cb81cdde2
3 changed files with 14 additions and 4 deletions
|
|
@ -36,6 +36,7 @@ export declare namespace Env {
|
||||||
/**
|
/**
|
||||||
* set or get a boolean value indicating whether to enable trace.
|
* set or get a boolean value indicating whether to enable trace.
|
||||||
*
|
*
|
||||||
|
* @deprecated Use `env.trace` instead. If `env.trace` is set, this property will be ignored.
|
||||||
* @defaultValue `false`
|
* @defaultValue `false`
|
||||||
*/
|
*/
|
||||||
trace?: boolean;
|
trace?: boolean;
|
||||||
|
|
@ -167,6 +168,7 @@ export interface Env {
|
||||||
* @defaultValue `'warning'`
|
* @defaultValue `'warning'`
|
||||||
*/
|
*/
|
||||||
logLevel?: 'verbose'|'info'|'warning'|'error'|'fatal';
|
logLevel?: 'verbose'|'info'|'warning'|'error'|'fatal';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicate whether run in debug mode.
|
* Indicate whether run in debug mode.
|
||||||
*
|
*
|
||||||
|
|
@ -174,6 +176,13 @@ export interface Env {
|
||||||
*/
|
*/
|
||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set or get a boolean value indicating whether to enable trace.
|
||||||
|
*
|
||||||
|
* @defaultValue `false`
|
||||||
|
*/
|
||||||
|
trace?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get version of the current package.
|
* Get version of the current package.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
import {env} from './env-impl.js';
|
import {env} from './env-impl.js';
|
||||||
|
|
||||||
export const TRACE = (deviceType: string, label: string) => {
|
export const TRACE = (deviceType: string, label: string) => {
|
||||||
if (!env.wasm.trace) {
|
if (typeof env.trace === 'undefined' ? !env.wasm.trace : !env.trace) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
|
|
@ -30,14 +30,14 @@ const TRACE_FUNC = (msg: string, extraMsg?: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const TRACE_FUNC_BEGIN = (extraMsg?: string) => {
|
export const TRACE_FUNC_BEGIN = (extraMsg?: string) => {
|
||||||
if (!env.wasm.trace) {
|
if (typeof env.trace === 'undefined' ? !env.wasm.trace : !env.trace) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TRACE_FUNC('BEGIN', extraMsg);
|
TRACE_FUNC('BEGIN', extraMsg);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const TRACE_FUNC_END = (extraMsg?: string) => {
|
export const TRACE_FUNC_END = (extraMsg?: string) => {
|
||||||
if (!env.wasm.trace) {
|
if (typeof env.trace === 'undefined' ? !env.wasm.trace : !env.trace) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TRACE_FUNC('END', extraMsg);
|
TRACE_FUNC('END', extraMsg);
|
||||||
|
|
|
||||||
|
|
@ -710,7 +710,8 @@ export class WebGpuBackend {
|
||||||
}
|
}
|
||||||
setQueryType(): void {
|
setQueryType(): void {
|
||||||
this.queryType = 'none';
|
this.queryType = 'none';
|
||||||
if (this.env.webgpu.profiling?.mode === 'default' || this.env.wasm.trace) {
|
if (this.env.webgpu.profiling?.mode === 'default' ||
|
||||||
|
(typeof this.env.trace === 'undefined' ? this.env.wasm.trace : this.env.trace)) {
|
||||||
if (this.device.features.has('chromium-experimental-timestamp-query-inside-passes')) {
|
if (this.device.features.has('chromium-experimental-timestamp-query-inside-passes')) {
|
||||||
this.queryType = 'inside-passes';
|
this.queryType = 'inside-passes';
|
||||||
} else if (this.device.features.has('timestamp-query')) {
|
} else if (this.device.features.has('timestamp-query')) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue