[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:
Yulong Wang 2024-01-13 23:04:02 -08:00 committed by GitHub
parent e1e45901e2
commit f917dde717
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 14 additions and 21 deletions

View file

@ -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 {

View file

@ -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);
}
}

View file

@ -60,9 +60,6 @@ const setExecutionProviders =
// check EP name
switch (epName) {
case 'xnnpack':
epName = 'XNNPACK';
break;
case 'webnn':
epName = 'WEBNN';
if (typeof ep !== 'string') {

View file

@ -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) :

View file

@ -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') {

View file

@ -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')

View file

@ -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