mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
[web] remove xnnpack from web backends (#19116)
### Description XNNPACK is already disabled in web assembly build. This change removes the xnnpack backend registration in JS.
This commit is contained in:
parent
e1e45901e2
commit
f917dde717
7 changed files with 14 additions and 21 deletions
|
|
@ -181,7 +181,7 @@ export declare namespace InferenceSession {
|
|||
|
||||
// Currently, we have the following backends to support execution providers:
|
||||
// Backend Node.js binding: supports 'cpu' and 'cuda'.
|
||||
// Backend WebAssembly: supports 'cpu', 'wasm', 'xnnpack' and 'webnn'.
|
||||
// Backend WebAssembly: supports 'cpu', 'wasm', 'webgpu' and 'webnn'.
|
||||
// Backend ONNX.js: supports 'webgl'.
|
||||
// Backend React Native: supports 'cpu', 'xnnpack', 'coreml' (iOS), 'nnapi' (Android).
|
||||
interface ExecutionProviderOptionMap {
|
||||
|
|
|
|||
|
|
@ -26,11 +26,8 @@ if (!BUILD_DEFS.DISABLE_WASM) {
|
|||
}
|
||||
registerBackend('cpu', wasmBackend, 10);
|
||||
registerBackend('wasm', wasmBackend, 10);
|
||||
if (BUILD_DEFS.DISABLE_TRAINING) {
|
||||
registerBackend('xnnpack', wasmBackend, 9);
|
||||
if (!BUILD_DEFS.DISABLE_WEBNN) {
|
||||
registerBackend('webnn', wasmBackend, 9);
|
||||
}
|
||||
if (!BUILD_DEFS.DISABLE_WEBNN) {
|
||||
registerBackend('webnn', wasmBackend, 9);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,9 +60,6 @@ const setExecutionProviders =
|
|||
|
||||
// check EP name
|
||||
switch (epName) {
|
||||
case 'xnnpack':
|
||||
epName = 'XNNPACK';
|
||||
break;
|
||||
case 'webnn':
|
||||
epName = 'WEBNN';
|
||||
if (typeof ep !== 'string') {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ Options:
|
|||
webgl
|
||||
webgpu
|
||||
wasm
|
||||
xnnpack
|
||||
webnn
|
||||
-e=<...>, --env=<...> Specify the environment to run the test. Should be one of the following:
|
||||
chrome (default)
|
||||
|
|
@ -111,7 +110,7 @@ Examples:
|
|||
|
||||
export declare namespace TestRunnerCliArgs {
|
||||
type Mode = 'suite0'|'suite1'|'model'|'unittest'|'op';
|
||||
type Backend = 'cpu'|'webgl'|'webgpu'|'wasm'|'onnxruntime'|'xnnpack'|'webnn';
|
||||
type Backend = 'cpu'|'webgl'|'webgpu'|'wasm'|'onnxruntime'|'webnn';
|
||||
type Environment = 'chrome'|'edge'|'firefox'|'electron'|'safari'|'node'|'bs';
|
||||
type BundleMode = 'dev'|'perf';
|
||||
type IOBindingMode = 'none'|'gpu-tensor'|'gpu-location';
|
||||
|
|
@ -378,13 +377,13 @@ export function parseTestRunnerCliArgs(cmdlineArgs: string[]): TestRunnerCliArgs
|
|||
}
|
||||
|
||||
// Option: -b=<...>, --backend=<...>
|
||||
const browserBackends = ['webgl', 'webgpu', 'wasm', 'xnnpack', 'webnn'];
|
||||
const browserBackends = ['webgl', 'webgpu', 'wasm', 'webnn'];
|
||||
|
||||
// TODO: remove this when Chrome support WebNN.
|
||||
// we need this for now because Chrome does not support webnn yet,
|
||||
// and ChromeCanary is not in CI.
|
||||
|
||||
const defaultBrowserBackends = ['webgl', 'webgpu', 'wasm', 'xnnpack' /*, 'webnn'*/];
|
||||
const defaultBrowserBackends = ['webgl', 'webgpu', 'wasm' /*, 'webnn'*/];
|
||||
const nodejsBackends = ['cpu', 'wasm'];
|
||||
const backendArgs = args.backend || args.b;
|
||||
const backend = (typeof backendArgs !== 'string') ? (env === 'node' ? nodejsBackends : defaultBrowserBackends) :
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ async function loadTensors(
|
|||
const outputs: Test.NamedTensor[] = [];
|
||||
let dataFileType: 'none'|'pb'|'npy' = 'none';
|
||||
|
||||
const allowInt64 = ['wasm', 'xnnpack', 'webgpu', 'webnn'].includes(backendName);
|
||||
const allowInt64 = ['wasm', 'webgpu', 'webnn'].includes(backendName);
|
||||
|
||||
for (const dataFile of testCase.dataFiles) {
|
||||
const ext = extname(dataFile);
|
||||
|
|
@ -317,7 +317,7 @@ export class TensorResultValidator {
|
|||
} else if (backend === 'webgpu') {
|
||||
this.absoluteThreshold = WEBGPU_THRESHOLD_ABSOLUTE_ERROR;
|
||||
this.relativeThreshold = WEBGPU_THRESHOLD_RELATIVE_ERROR;
|
||||
} else if (backend === 'wasm' || backend === 'xnnpack' || backend === 'webnn') {
|
||||
} else if (backend === 'wasm' || backend === 'webnn') {
|
||||
this.absoluteThreshold = WASM_THRESHOLD_ABSOLUTE_ERROR;
|
||||
this.relativeThreshold = WASM_THRESHOLD_RELATIVE_ERROR;
|
||||
} else if (backend === 'onnxruntime') {
|
||||
|
|
|
|||
|
|
@ -169,12 +169,12 @@ jobs:
|
|||
errorActionPreference: stop
|
||||
displayName: 'Pack NPM packages'
|
||||
- script: |
|
||||
npm test -- -e=chrome -b=webgl,wasm,xnnpack
|
||||
npm test -- -e=chrome -b=webgl,wasm
|
||||
workingDirectory: '$(Build.SourcesDirectory)\js\web'
|
||||
displayName: 'Run ort-web tests (wasm,webgl,xnnpack backend)'
|
||||
displayName: 'Run ort-web tests (wasm,webgl backend)'
|
||||
condition: eq('${{ parameters.RunWebGpuTests }}', 'false')
|
||||
- script: |
|
||||
npm test -- -e=chrome -b=webgl,wasm,xnnpack,webgpu $(webgpuCommandlineExtraFlags)
|
||||
npm test -- -e=chrome -b=webgl,wasm,webgpu $(webgpuCommandlineExtraFlags)
|
||||
workingDirectory: '$(Build.SourcesDirectory)\js\web'
|
||||
displayName: 'Run ort-web tests (ALL backends)'
|
||||
condition: eq('${{ parameters.RunWebGpuTests }}', 'true')
|
||||
|
|
|
|||
|
|
@ -68,15 +68,15 @@ jobs:
|
|||
workingDirectory: '$(Build.SourcesDirectory)\js\web'
|
||||
displayName: 'npm ci /js/web/'
|
||||
- script: |
|
||||
npm test -- suite0 -b=wasm,webgl,xnnpack --wasm-init-timeout=30000 --file-cache
|
||||
npm test -- suite0 -b=wasm,webgl --wasm-init-timeout=30000 --file-cache
|
||||
workingDirectory: '$(Build.SourcesDirectory)\js\web'
|
||||
displayName: 'npm test (Suite0, Chrome)'
|
||||
- script: |
|
||||
npm test -- suite0 -b=wasm,webgl,xnnpack --env=firefox --wasm-init-timeout=30000 --file-cache
|
||||
npm test -- suite0 -b=wasm,webgl --env=firefox --wasm-init-timeout=30000 --file-cache
|
||||
workingDirectory: '$(Build.SourcesDirectory)\js\web'
|
||||
displayName: 'npm test (Suite0, Firefox)'
|
||||
- script: |
|
||||
npm test -- suite0 -b=wasm,webgl,xnnpack --env=edge --wasm-init-timeout=30000 --file-cache
|
||||
npm test -- suite0 -b=wasm,webgl --env=edge --wasm-init-timeout=30000 --file-cache
|
||||
workingDirectory: '$(Build.SourcesDirectory)\js\web'
|
||||
displayName: 'npm test (Suite0, Edge)'
|
||||
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
|
||||
|
|
|
|||
Loading…
Reference in a new issue