LearnGet Started⚙️ Installation

Installation

To use WebNN before the Origin Trial milestone, complete these setup requirements.

Enabling WebNN

Download and install the latest Chrome Canary or Edge Canary

Search for Enables WebNN API and change it to Enabled

Exit browser

Running WebNN on CPU or GPU

Launch Chrome Canary or Edge Canary

launch-chrome-canary
  "%LOCALAPPDATA%\Google\Chrome SxS\Application\chrome.exe"
launch-edge-canary
  "%LOCALAPPDATA%\Microsoft\Edge SxS\Application\msedge.exe"

Running WebNN on NPU

Chrome Canary

Prepare the DirectML.dll

Download the latest redistributable Microsoft.AI.DirectML, rename microsoft.ai.directml.[version].nupkg to microsoft.ai.directml.[version].nupkg.zip and extract it

Put the DirectML.dll into correct path

Copy \bin\x64-win\DirectML.dll to %LOCALAPPDATA%\Google\Chrome SxS\Application\[version]\

  • %LOCALAPPDATA% means C:\Users\<username>\AppData\Local\
  • Note that Chrome Canary frequently updates automatically. When this occurs, recopy the DirectML.dll to the new version’s directory.

Launch Chrome Canary in Windows Command Line

enable-webnn-npu-chrome-canary
  "%LOCALAPPDATA%\Google\Chrome SxS\Application\chrome.exe" --use-redist-dml --disable_webnn_for_npu=0
Edge Canary

Ensure the DirectML.dll was downloaded automatically

  • Launch Edge Canary
  • Go to %LOCALAPPDATA%\Microsoft\Edge SxS\User Data, check the EdgeOnnxRuntimeDirectML\[version]\DirectML.dll exists
  • %LOCALAPPDATA% means C:\Users\<username>\AppData\Local\
  • Exit Edge Canary

Launch Edge Canary in Windows Command Line

enable-webnn-npu-edge-canary
  "%LOCALAPPDATA%\Microsoft\Edge SxS\Application\msedge.exe" --disable_webnn_for_npu=0

Force to download the DirectML.dll manually

If EdgeOnnxRuntimeDirectML\[version]\DirectML.dll does not exist under %LOCALAPPDATA%\Microsoft\Edge SxS\User Data:

  • Go to edge://components/
  • Click Check for update button of Edge Video Super Resolution
  • Repeat step 2