Skip to content

Commit

Permalink
[WebNN EP] Restore to use deviceType enum (microsoft#18154)
Browse files Browse the repository at this point in the history
The Chromium implementation will support `MLDeviceType` enum to align
with spec.

CL: https://chromium-review.googlesource.com/c/chromium/src/+/4986939
  • Loading branch information
Honry authored Nov 1, 2023
1 parent d1b85f5 commit c181159
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions onnxruntime/core/providers/webnn/webnn_execution_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ WebNNExecutionProvider::WebNNExecutionProvider(
ORT_THROW("Failed to get ml from navigator.");
}
emscripten::val context_options = emscripten::val::object();
// Currently WebNN implementation in Chromium temporarily reuses the MLContextOptions
// defined in Model Loader API, which uses MLDevicePreference instead of MLDeviceType
// defined in WebNN. Because there's an ongoing spec discussion to simplify this API at
// https://github.com/webmachinelearning/webnn/issues/302.
context_options.set("devicePreference", emscripten::val(webnn_device_flags));
context_options.set("deviceType", emscripten::val(webnn_device_flags));
// WebNN EP uses NHWC layout for CPU XNNPACK backend and NCHW for GPU DML backend.
if (webnn_device_flags.compare("cpu") == 0) {
preferred_layout_ = DataLayout::NHWC;
Expand Down

0 comments on commit c181159

Please sign in to comment.