Skip to content

Commit

Permalink
Fix several issues
Browse files Browse the repository at this point in the history
- Set default DISABLE_WEBNN to false, to allow to build WebNN EP locally.
- Update test suite for WebNN, comment tests with int32/int64 input.
- Fix lint error.
  • Loading branch information
zesongw committed Dec 1, 2023
1 parent fd3a72d commit 5eb8973
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 50 deletions.
16 changes: 12 additions & 4 deletions js/web/script/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const SOURCE_ROOT_FOLDER = path.join(__dirname, '../..'); // <ORT_ROOT>/js/
const DEFAULT_DEFINE = {
'BUILD_DEFS.DISABLE_WEBGL': 'false',
'BUILD_DEFS.DISABLE_WEBGPU': 'false',
'BUILD_DEFS.DISABLE_WEBNN': 'true', // Disable WebNN until CI is ready.
'BUILD_DEFS.DISABLE_WEBNN': 'false',
'BUILD_DEFS.DISABLE_WASM': 'false',
'BUILD_DEFS.DISABLE_WASM_PROXY': 'false',
'BUILD_DEFS.DISABLE_WASM_THREAD': 'false',
Expand Down Expand Up @@ -360,6 +360,7 @@ async function main() {
...DEFAULT_DEFINE,
'BUILD_DEFS.DISABLE_WEBGPU': 'true',
'BUILD_DEFS.DISABLE_WEBGL': 'true',
'BUILD_DEFS.DISABLE_WEBNN': 'true',
'BUILD_DEFS.DISABLE_WASM_PROXY': 'true',
'BUILD_DEFS.DISABLE_WASM_THREAD': 'true',
},
Expand All @@ -371,7 +372,7 @@ async function main() {
await addBuildTask(buildOrt({
outputBundleName: 'ort.all',
format: 'iife',
define: {...DEFAULT_DEFINE, 'BUILD_DEFS.DISABLE_WEBNN': 'false'}
define: {...DEFAULT_DEFINE}
}));
}

Expand All @@ -396,7 +397,7 @@ async function main() {
// ort.webgpu[.min].js
await addAllWebBuildTasks({
outputBundleName: 'ort.webgpu',
define: {...DEFAULT_DEFINE, 'BUILD_DEFS.DISABLE_WEBGL': 'true'},
define: {...DEFAULT_DEFINE, 'BUILD_DEFS.DISABLE_WEBGL': 'true', 'BUILD_DEFS.DISABLE_WEBNN': 'true'},
});
// ort.wasm[.min].js
await addAllWebBuildTasks({
Expand All @@ -406,7 +407,12 @@ async function main() {
// ort.webgl[.min].js
await addAllWebBuildTasks({
outputBundleName: 'ort.webgl',
define: {...DEFAULT_DEFINE, 'BUILD_DEFS.DISABLE_WEBGPU': 'true', 'BUILD_DEFS.DISABLE_WASM': 'true'},
define: {
...DEFAULT_DEFINE,
'BUILD_DEFS.DISABLE_WEBGPU': 'true',
'BUILD_DEFS.DISABLE_WASM': 'true',
'BUILD_DEFS.DISABLE_WEBNN': 'true',
},
});
// ort.wasm-core[.min].js
await addAllWebBuildTasks({
Expand All @@ -415,6 +421,7 @@ async function main() {
...DEFAULT_DEFINE,
'BUILD_DEFS.DISABLE_WEBGPU': 'true',
'BUILD_DEFS.DISABLE_WEBGL': 'true',
'BUILD_DEFS.DISABLE_WEBNN': 'true',
'BUILD_DEFS.DISABLE_WASM_PROXY': 'true',
'BUILD_DEFS.DISABLE_WASM_THREAD': 'true',
},
Expand All @@ -427,6 +434,7 @@ async function main() {
'BUILD_DEFS.DISABLE_TRAINING': 'false',
'BUILD_DEFS.DISABLE_WEBGPU': 'true',
'BUILD_DEFS.DISABLE_WEBGL': 'true',
'BUILD_DEFS.DISABLE_WEBNN': 'true',
},
});
}
Expand Down
90 changes: 45 additions & 45 deletions js/web/test/suite-test-list.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2185,44 +2185,44 @@
// "test_reflect_pad",
"test_relu",
// "test_reshape_allowzero_reordered",
"test_reshape_extended_dims",
"test_reshape_negative_dim",
"test_reshape_negative_extended_dims",
"test_reshape_one_dim",
"test_reshape_reduced_dims",
"test_reshape_reordered_all_dims",
"test_reshape_reordered_dims",
"test_reshape_reordered_last_dims",
"test_reshape_zero_and_negative_dim",
"test_reshape_zero_dim",
"test_resize_downsample_linear",
"test_resize_downsample_nearest",
"test_resize_downsample_scales_cubic_A_n0p5_exclude_outside",
// "test_reshape_extended_dims",
// "test_reshape_negative_dim",
// "test_reshape_negative_extended_dims",
// "test_reshape_one_dim",
// "test_reshape_reduced_dims",
// "test_reshape_reordered_all_dims",
// "test_reshape_reordered_dims",
// "test_reshape_reordered_last_dims",
// "test_reshape_zero_and_negative_dim",
// "test_reshape_zero_dim",
// "test_resize_downsample_linear",
// "test_resize_downsample_nearest",
// "test_resize_downsample_scales_cubic_A_n0p5_exclude_outside",
// "test_resize_downsample_scales_cubic_align_corners",
"test_resize_downsample_scales_cubic",
// "test_resize_downsample_scales_cubic",
// "test_resize_downsample_scales_linear_align_corners",
"test_resize_downsample_scales_linear",
"test_resize_downsample_scales_nearest",
"test_resize_downsample_sizes_cubic",
"test_resize_downsample_sizes_linear_pytorch_half_pixel",
"test_resize_downsample_sizes_nearest_tf_half_pixel_for_nn",
"test_resize_downsample_sizes_nearest",
"test_resize_nearest",
"test_resize_tf_crop_and_resize",
"test_resize_upsample_linear",
"test_resize_upsample_nearest",
"test_resize_upsample_scales_cubic_A_n0p5_exclude_outside",
"test_resize_upsample_scales_cubic_align_corners",
"test_resize_upsample_scales_cubic_asymmetric",
"test_resize_upsample_scales_cubic",
"test_resize_upsample_scales_linear_align_corners",
"test_resize_upsample_scales_linear",
"test_resize_upsample_scales_nearest",
"test_resize_upsample_sizes_cubic",
"opset{12,13,17,18}/test_resize_upsample_sizes_nearest_ceil_half_pixel",
"opset{12,13,17,18}/test_resize_upsample_sizes_nearest_floor_align_corners",
"opset{12,13,17,18}/test_resize_upsample_sizes_nearest_round_prefer_ceil_asymmetric",
"test_resize_upsample_sizes_nearest",
// "test_resize_downsample_scales_linear",
// "test_resize_downsample_scales_nearest",
// "test_resize_downsample_sizes_cubic",
// "test_resize_downsample_sizes_linear_pytorch_half_pixel",
// "test_resize_downsample_sizes_nearest_tf_half_pixel_for_nn",
// "test_resize_downsample_sizes_nearest",
// "test_resize_nearest",
// "test_resize_tf_crop_and_resize",
// "test_resize_upsample_linear",
// "test_resize_upsample_nearest",
// "test_resize_upsample_scales_cubic_A_n0p5_exclude_outside",
// "test_resize_upsample_scales_cubic_align_corners",
// "test_resize_upsample_scales_cubic_asymmetric",
// "test_resize_upsample_scales_cubic",
// "test_resize_upsample_scales_linear_align_corners",
// "test_resize_upsample_scales_linear",
// "test_resize_upsample_scales_nearest",
// "test_resize_upsample_sizes_cubic",
// "opset{12,13,17,18}/test_resize_upsample_sizes_nearest_ceil_half_pixel",
// "opset{12,13,17,18}/test_resize_upsample_sizes_nearest_floor_align_corners",
// "opset{12,13,17,18}/test_resize_upsample_sizes_nearest_round_prefer_ceil_asymmetric",
// "test_resize_upsample_sizes_nearest",
// // "test_reversesequence_batch",
// // "test_reversesequence_time",
// // "test_rnn_seq_length",
Expand Down Expand Up @@ -2436,17 +2436,17 @@
// // "test_softsign",
// "test_spacetodepth_example",
// "test_spacetodepth",
"test_split_equal_parts_1d",
"test_split_equal_parts_2d",
"test_split_equal_parts_default_axis",
"test_split_variable_parts_1d",
"test_split_variable_parts_2d",
"test_split_variable_parts_default_axis",
"test_split_zero_size_splits",
// "test_split_equal_parts_1d",
// "test_split_equal_parts_2d",
// "test_split_equal_parts_default_axis",
// "test_split_variable_parts_1d",
// "test_split_variable_parts_2d",
// "test_split_variable_parts_default_axis",
// "test_split_zero_size_splits",
"test_sqrt_example",
"test_sqrt",
"test_squeeze_negative_axes",
"test_squeeze",
// "test_squeeze_negative_axes",
// "test_squeeze",
// // "test_stft_with_window",
// // "test_stft",
// // "test_strnormalizer_export_monday_casesensintive_lower",
Expand Down
2 changes: 1 addition & 1 deletion js/web/test/test-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export class ModelTestContext {

const initStart = now();
const executionProviderConfig =
modelTest.backend == 'webnn' ? (testOptions?.webnnOptions || 'webnn') : modelTest.backend!;
modelTest.backend === 'webnn' ? (testOptions?.webnnOptions || 'webnn') : modelTest.backend!;
const session = await initializeSession(
modelTest.modelUrl, executionProviderConfig, modelTest.ioBinding, profile, testOptions?.sessionOptions || {},
this.cache);
Expand Down

0 comments on commit 5eb8973

Please sign in to comment.