DirectML

WebNN Installation Guide

Enabling Insider version of Edge for WebNN Dev Preview GPU

WebNN Dev Preview GPU requires a compatible browser to run, and Windows* 11 v21H2 (DML 1.6.0) or higher:
  1. Download the Microsoft Edge Canary or Dev browser
  2. To enable WebNN, in your browser address bar, enter about://flags, and then press Enter. An Experiments page opens
  3. In the Search flags box, enter webnn. Enables WebNN API appears
  4. In the drop-down menu, select Enabled
  5. Relaunch your browser

Enabling Insider version of Edge for WebNN Dev Preview 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:
    • Intel® Core™ Ultra NPU Driver for Windows
    • Qualcomm® Hexagon NPU Driver Package for windows
Enabling Insider version of Edge:
  1. Microsoft Edge Canary or Dev Channel with WebNN flag enabled in about:flags
    1. Download from https://www.microsoft.com/en-us/edge/download/insider
    2. Run installer
    3. Navigate to about://flags
    4. Search for Enables WebNN API and change it to Enabled
    5. Exit browser
  2. Download DirectML redistributable
    1. Download DirectML from https://www.nuget.org/packages/Microsoft.AI.DirectML/1.15.4
    2. Rename microsoft.ai.directml.1.15.4.nupkg to microsoft.ai.directml.1.15.4.nupkg.zip and extract it
  3. Copy microsoft.ai.directml.1.15.4.nupkg.zip\bin\<arch>-win\directml.dll to the appropriate directory
    (replace with x64 on Intel devices and arm64 on Qualcomm devices)
    1. Edge Dev: C:\Program Files (x86)\Microsoft\Edge Dev\Application\129.0.2779.0\
      1. When the dialog asks for Administrator permission, choose Continue
    2. Edge Canary: %LOCALAPPDATA%\Microsoft\Edge SxS\Application\129.0.2779.0\
    3. Note the following on copying Directml.dll to Edge directory
      1. The version-specific directory (129.0.2779.0) may differ on your machine
      2. New versions of Edge may require directml.dll to be recopied to the directory
  4. Launch Edge insider
    1. 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
    2. .\msedge.exe --use-redist-dml --disable_webnn_for_npu=0 --disable-gpu-sandbox
  • Direct Machine Learning (DirectML)
  • ONNX Runtime Web
  • ONNX
  • WebNN API
  • WebNN Installation Guide