Browser Compatibility
WebNN APIs
May 20, 2025: DirectML was officially deprecated during Microsoft Build 2025. WebNN leverages Windows ML to access OpenVINO and other execution providers (EPs) for hardware acceleration. The DirectML backend (
dml/) is no longer present in the Chromium WebNN service; DirectML is only reachable as an ONNX Runtime EP.
| Platform / Build Conditions | CPU (device: "cpu") | GPU (device: "gpu") | NPU (device: "npu") |
|---|---|---|---|
Windows 11 24H2+ with feature kWebNNOnnxRuntime (enabled by default) | ONNX Runtime (Windows ML): the default CPU EP, plus a same-vendor CPU EP when available (ort/environment.cc: SelectEpDevicesForCpu) | ONNX Runtime: first GPU EP device (discrete before integrated, WebGPU EP before DirectML EP) with CPU EP fallback; falls back to CPU when there is no GPU or only a software adapter such as WARP (SelectEpDevicesForGpu) | ONNX Runtime: first NPU EP device with CPU EP fallback; falls back to the GPU selection when there is no NPU or the NPU driver is below the EP’s minimum version (SelectEpDevicesForNpu) |
Windows before 11 24H2, Windows App Runtime unavailable, or kWebNNOnnxRuntime disabled / ORT environment creation failed | LiteRT with XNNPACK, in the renderer process (webnn_context_provider_impl.cc: FallbackToTFLite) | LiteRT GPU accelerator (WebGPU) in the GPU process, then in-process LiteRT when unavailable (tflite/graph_impl_litert.cc) | In-process LiteRT; NPU accelerator is not supported yet (crbug.com/454732289) |
macOS ≥14.4 on Apple Silicon, non-incognito, with feature kWebNNCoreML (enabled by default) | Core ML with MLComputeUnitsCPUOnly (coreml/graph_impl_coreml.mm) | Core ML with MLComputeUnitsAll; MLComputeUnitsCPUAndGPU when kWebNNCoreMLExplicitGPUOrNPU is on (off by default) | Core ML with MLComputeUnitsAll; MLComputeUnitsCPUAndNeuralEngine when kWebNNCoreMLExplicitGPUOrNPU is on |
| macOS Intel, macOS <14.4, incognito, or Core ML disabled | LiteRT + XNNPACK (in-process) | LiteRT GPU accelerator (WebGPU), then in-process fallback | In-process LiteRT |
| iOS | kWebNNCoreML is disabled by default (Core ML sandbox issue, crbug.com/417496826), so LiteRT + XNNPACK | LiteRT GPU accelerator, then in-process fallback | In-process LiteRT |
| ChromeOS, Linux, Android | LiteRT + XNNPACK in the renderer process | LiteRT GPU accelerator (WebGPU/Dawn) in the GPU process when available; otherwise in-process LiteRT | In-process LiteRT; NPU accelerator is not supported yet |
- Backend selection is implemented in
WebNNContextProviderImpl::CreateWebNNContext(webnn_context_provider_impl.cc): Windows tries ONNX Runtime first, Apple platforms try Core ML, and everything else (or any failed attempt) goes throughFallbackToTFLite, which uses LiteRT. features.gnienables TFLite/LiteRT (webnn_use_tflite,webnn_use_litert) on Android, ChromeOS, Linux, Apple and Windows.webnn_use_chrome_ml_api(enable_ml_internal) is a build flag only; the OpenCL and NNAPI delegate paths described in earlier versions of this page are not in the current sources.- LiteRT routing (
ShouldUseInProcessTflite):cpuandnpurequests are served in the renderer process;gpurequests first try a LiteRT context in the GPU process using the WebGPU accelerator (preloaded before sandbox lockdown), and the renderer creates an in-process context if that is not supported. WithkWebNNLiteRTGpuInRenderer(off by default) GPU requests run in the renderer. - LiteRT enables the XNNPACK CPU accelerator whenever it is built in (
BUILD_LITERT_WITH_XNNPACK), so GPU requests always keep CPU as a fallback. - ONNX Runtime requires Windows 11 24H2 or later (
kWinAppRuntimeSupportedMinVersion) and the Windows App Runtime; with--webnn-ort-ignore-ihv-epsor an older Windows version, only the built-in EPs are used.--webnn-ort-disable-cpu-fallbackdisables the CPU EP fallback. kWebNNCompilerProcess(Apple on by default, Windows off by default) moves graph compilation into a separate Compiler process.- Core ML only reports
gpu/npuwhen the corresponding compute units are available on the device (coreml/graph_impl_coreml.mm).
Note
- The WebNN API mainly supported with Chromium-based browsers on ChromeOS, Linux, macOS, Windows and Android.
- Chromium-based browsers include but are not limited to Google Chrome, Microsoft Edge, Opera, Vivaldi, Brave, Samsung Internet etc.
| Interface | Method | Chromium Version |
|---|---|---|
| navigator.ml | M112 | |
| ML | M112 | |
| ML | createContext() | M112 |
| MLContext | M112 | |
| MLContext | dispatch() | M128 |
| MLContext | createTensor() | M129 |
| MLContext | readTensor(tensor) | M129 |
| MLContext | readTensor(tensor, outputData) | M129 |
| MLContext | writeTensor() | M129 |
| MLContext | opSupportLimits() | M128 |
| MLGraph | M112 | |
| MLOperand | M112 | |
| MLOperand | MLNumber | M132 |
| MLTensor | M124 | |
| MLTensor | destroy() | M124 |
| MLGraphBuilder | M112 | |
| MLGraphBuilder | MLGraphBuilder() constructor | M112 |
| MLGraphBuilder | input(name, descriptor) | M112 |
| MLGraphBuilder | constant(descriptor, buffer) | M112 |
| MLGraphBuilder | constant(type, value) | M112 |
| MLGraphBuilder | build(outputs) | M112 |
Last updated on