mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-12 00:59:23 +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.
|
||||
*
|
||||
* @deprecated Use `env.trace` instead. If `env.trace` is set, this property will be ignored.
|
||||
* @defaultValue `false`
|
||||
*/
|
||||
trace?: boolean;
|
||||
|
|
@ -167,6 +168,7 @@ export interface Env {
|
|||
* @defaultValue `'warning'`
|
||||
*/
|
||||
logLevel?: 'verbose'|'info'|'warning'|'error'|'fatal';
|
||||
|
||||
/**
|
||||
* Indicate whether run in debug mode.
|
||||
*
|
||||
|
|
@ -174,6 +176,13 @@ export interface Env {
|
|||
*/
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* set or get a boolean value indicating whether to enable trace.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
*/
|
||||
trace?: boolean;
|
||||
|
||||
/**
|
||||
* Get version of the current package.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
import {env} from './env-impl.js';
|
||||
|
||||
export const TRACE = (deviceType: string, label: string) => {
|
||||
if (!env.wasm.trace) {
|
||||
if (typeof env.trace === 'undefined' ? !env.wasm.trace : !env.trace) {
|
||||
return;
|
||||
}
|
||||
// eslint-disable-next-line no-console
|
||||
|
|
@ -30,14 +30,14 @@ const TRACE_FUNC = (msg: string, extraMsg?: string) => {
|
|||
};
|
||||
|
||||
export const TRACE_FUNC_BEGIN = (extraMsg?: string) => {
|
||||
if (!env.wasm.trace) {
|
||||
if (typeof env.trace === 'undefined' ? !env.wasm.trace : !env.trace) {
|
||||
return;
|
||||
}
|
||||
TRACE_FUNC('BEGIN', extraMsg);
|
||||
};
|
||||
|
||||
export const TRACE_FUNC_END = (extraMsg?: string) => {
|
||||
if (!env.wasm.trace) {
|
||||
if (typeof env.trace === 'undefined' ? !env.wasm.trace : !env.trace) {
|
||||
return;
|
||||
}
|
||||
TRACE_FUNC('END', extraMsg);
|
||||
|
|
|
|||
|
|
@ -710,7 +710,8 @@ export class WebGpuBackend {
|
|||
}
|
||||
setQueryType(): void {
|
||||
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')) {
|
||||
this.queryType = 'inside-passes';
|
||||
} else if (this.device.features.has('timestamp-query')) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue