onnxruntime/js/common/lib/env.ts
Ye Wang 83dc22585c
Second round cherry-pick to rel-1.9.0 (#9062)
* Adding async fetching for webgl backend (#8951)

* Adding async fetching for webgl backend

* fix PR comments and CI failure.

* fixing a bug

* adding a flag

* Enable linking in exception throwing support library when build onnxruntime wasm. (#8973)

* Enable linking in exception throwing support library when build onnxruntime webassembly containing onnxruntime-extensions.

* Add flag in build.py to enable linking exceptions throwing library.

* Update onnxruntime-extensions document and bind custom_ops build flag with use_extensions.

* Update doc.

* Update cgmanifest.json.

Co-authored-by: Zuwei Zhao <zuzhao@microsoft.com>

* Remove document text from error message in a couple of ops (#9003)

* do not add pkg wheel entry to the index html file if it already exists (#9004)

* do not add pkg wheel entry to the index html file if it already exists

* [js/web] fix ort web e2e test (#9025)

* Fix cmake POWER10 detection

Recent commit 60c98a8 changed variable mlas_common_srcs which affects
POWER10 detection.

* Fix Where op type reduction processing (#9033)

* Update type reduction script to track Where Op's second input type.

* Clean up op_kernel_type_control.h includes.

* Use more maintainable include.

* Fix ROCm wheels CI pipeline break by installing latest protobuf from source (#9047)

* install protobuf from source

* fix rm command in Dockerfile

* fix options on rm command

* fix cd into protobuf source directory

* try again

* remove strip step

* debug list the files

* ls on /usr

* more debug

* more debug

* adjust LD_LIBRARY_PATH

* try remove protobuf before ORT build

* [js/web] a bugfix and add tests for wasm proxy worker (#9048)

* [js/web] add tests for wasm proxy worker

* fix script src override

* Set onnxruntime_DISABLE_RTTI to default OFF (#9049)

Co-authored-by: Du Li <duli1@microsoft.com>
Co-authored-by: Zuwei Zhao <4123666+Zuwei-Zhao@users.noreply.github.com>
Co-authored-by: Zuwei Zhao <zuzhao@microsoft.com>
Co-authored-by: Hariharan Seshadri <shariharan91@gmail.com>
Co-authored-by: liqun Fu <liqfu@microsoft.com>
Co-authored-by: Yulong Wang <yulongw@microsoft.com>
Co-authored-by: Rajalakshmi Srinivasaraghavan <rajis@linux.ibm.com>
Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
Co-authored-by: Suffian Khan <sukha@microsoft.com>
Co-authored-by: Changming Sun <chasun@microsoft.com>
2021-09-15 18:02:07 -07:00

96 lines
2.6 KiB
TypeScript

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import {EnvImpl} from './env-impl';
export declare namespace Env {
export type WasmPrefixOrFilePaths = string|{
'ort-wasm.wasm'?: string;
'ort-wasm-threaded.wasm'?: string;
'ort-wasm-simd.wasm'?: string;
'ort-wasm-simd-threaded.wasm'?: string;
};
export interface WebAssemblyFlags {
/**
* set or get number of thread(s). If omitted or set to 0, number of thread(s) will be determined by system. If set
* to 1, no worker thread will be spawned.
*
* This setting is available only when WebAssembly multithread feature is available in current context.
*/
numThreads?: number;
/**
* set or get a boolean value indicating whether to enable SIMD. If set to false, SIMD will be forcely disabled.
*
* This setting is available only when WebAssembly SIMD feature is available in current context.
*/
simd?: boolean;
/**
* Set or get a number specifying the timeout for initialization of WebAssembly backend, in milliseconds. A zero
* value indicates no timeout is set. (default is 0)
*/
initTimeout?: number;
/**
* Set a custom URL prefix to the .wasm files or a set of overrides for each .wasm file. The override path should be
* an absolute path.
*/
wasmPaths?: WasmPrefixOrFilePaths;
/**
* Set or get a boolean value indicating whether to proxy the execution of main thread to a worker thread.
*/
proxy?: boolean;
}
export interface WebGLFlags {
/**
* Set or get the WebGL Context ID (webgl or webgl2). Default value is webgl2.
*/
contextId?: 'webgl'|'webgl2';
/**
* Set or get the maximum batch size for matmul. 0 means to disable batching.
*/
matmulMaxBatchSize?: number;
/**
* Set or get the texture cache mode. Default value is full.
*/
textureCacheMode?: 'initializerOnly'|'full';
/**
* Set or get the packed texture mode
*/
pack?: boolean;
/**
* Set or get whether enable async download.
*/
async?: boolean;
}
}
export interface Env {
/**
* set the severity level for logging. If omitted, default is 'warning'
*/
logLevel?: 'verbose'|'info'|'warning'|'error'|'fatal';
/**
* Indicate whether run in debug mode.
*/
debug?: boolean;
/**
* Represent a set of flags for WebAssembly
*/
wasm: Env.WebAssemblyFlags;
/**
* Represent a set of flags for WebGL
*/
webgl: Env.WebGLFlags;
[name: string]: unknown;
}
/**
* Represent a set of flags as a global singleton.
*/
export const env: Env = new EnvImpl();