Enabling WebNN for GPU
- Requires Windows 11 v21H2 (DML 1.6.0) or higher and a GPU, for support of "expand" and "layerNormalization" ops. See WebNN implementation status
- Requires Chromium desktop (e.g. Chrome, Edge) 129 or higher
- Enable
chrome://flags/#web-machine-learning-neural-network
and relaunch the browser
- Enable graphics/hardware acceleration browser setting
- Make sure your system graphics settings for the browser uses high performance / discrete GPU
Enabling WebNN for NPU
To get started with WebNN NPU on DirectML compatible devices you will need:
- Windows 11, version 24H2 or newer
- Insider version of Edge (exact instructions provided below)
- The latest driver from our WebNN NPU Partners:
Enabling Insider version of Edge:
-
Microsoft Edge Canary or Dev Channel with WebNN flag enabled in
about:flags
- Download from https://www.microsoft.com/en-us/edge/download/insider
- Run installer
- Navigate to
about://flags
- Search for
Enables WebNN API
and change it to Enabled
- Exit browser
-
Download DirectML redistributable
- Download DirectML from https://www.nuget.org/packages/Microsoft.AI.DirectML/1.15.2
- Rename
microsoft.ai.directml.1.15.2.nupkg
to microsoft.ai.directml.1.15.2.nupkg.zip
and extract it
-
Copy
microsoft.ai.directml.1.15.2.nupkg.zip\bin\<arch>-win\directml.dll
to the appropriate directory
(replace with x64 on Intel devices and arm64 on Qualcomm devices)
- Edge Dev:
C:\Program Files (x86)\Microsoft\Edge Dev\Application\129.0.2779.0\
- When the dialog asks for Administrator permission, choose
Continue
- Edge Canary:
%LOCALAPPDATA%\Microsoft\Edge SxS\Application\129.0.2779.0\
- Note the following on copying
Directml.dll
to Edge directory
- The version-specific directory (129.0.2779.0) may differ on your machine
- New versions of Edge may require
directml.dll
to be recopied to the directory
-
Launch Edge insider
- Open terminal and change your working directory to the Edge Insider build:
- If using Edge Dev:
C:\Program Files (x86)\Microsoft\Edge Dev\Application
- If using Edge Canary:
%LOCALAPPDATA%\Microsoft\Edge SxS\Application
.\msedge.exe --use-redist-dml --disable_webnn_for_npu=0 --disable-gpu-sandbox