Skip to Content
🚧 The WebNN documentation is work-in-progress. Share feedback →

Debugging

Use Custom Build of ONNX Runtime

  1. Follow the WebNN Installation Guide to enable WebNN API and switch to Windows ML / ONNX Runtime backend
  2. Put the ONNX Runtime dynamic link librares into a folder under C:\Program Files\, e.g. C:\Program Files\ONNXRuntime
  3. Launch your Chrome or Edge browser with switch --webnn-ort-library-path-for-testing
"%LOCALAPPDATA%\Google\Chrome SxS\Application\chrome.exe" --webnn-ort-library-path-for-testing="C:\Program Files\ONNXRuntime" --allow-third-party-modules
"%LOCALAPPDATA%\Microsoft\Edge SxS\Application\msedge.exe" --webnn-ort-library-path-for-testing="C:\Program Files\ONNXRuntime" --allow-third-party-modules

Use Custom Build of Execution Providers

If you are running WebNN on AMD, Intel, Nvidia, or Qualcomm devices and need to debug WebNN using specific Execution Provider of ONNX Runtime:

  1. Follow the WebNN Installation Guide to enable WebNN API and switch to Windows ML / ONNX Runtime backend
  2. Put the ONNX Runtime and Execution Provider dynamic link librares into a folder under C:\Program Files\, e.g. C:\Program Files\ONNXRuntime-EP
  3. Launch your Chrome or Edge browser with switch --webnn-ort-ep-library-path-for-testing

Execution Provider Mapping Table for Independent Hardware Vendors

IHVsExecution ProviderDLL
OpenVINOExecutionProvideronnxruntime_providers_openvino_plugin.dll
TBDTBD
NvTensorRTRTXExecutionProvideronnxruntime_providers_nv_tensorrt_rtx.dll
QNNExecutionProvideronnxruntime_providers_qnn.dll

Intel OpenVINO Execution Provider

The following examples show how to specify the locations of ONNX Runtime and Intel OpenVINO Execution Provider libraries:

"%LOCALAPPDATA%\Google\Chrome SxS\Application\chrome.exe" --webnn-ort-ep-library-path-for-testing=OpenVINOExecutionProvider?"C:\Program Files\ONNXRuntime-EP\onnxruntime_providers_openvino_plugin.dll" --allow-third-party-modules
"%LOCALAPPDATA%\Microsoft\Edge SxS\Application\msedge.exe" --webnn-ort-ep-library-path-for-testing=OpenVINOExecutionProvider?"C:\Program Files\ONNXRuntime-EP\onnxruntime_providers_openvino_plugin.dll" --allow-third-party-modules

Other IHVs

AMD (TBD)

TBD

Nvidia Nv Tensor RT RTX Execution Provider

"%LOCALAPPDATA%\Google\Chrome SxS\Application\chrome.exe" --webnn-ort-ep-library-path-for-testing=NvTensorRTRTXExecutionProvider?"C:\Program Files\ONNXRuntime-EP\onnxruntime_providers_nv_tensorrt_rtx.dll" --allow-third-party-modules
"%LOCALAPPDATA%\Microsoft\Edge SxS\Application\msedge.exe" --webnn-ort-ep-library-path-for-testing=NvTensorRTRTXExecutionProvider?"C:\Program Files\ONNXRuntime-EP\onnxruntime_providers_nv_tensorrt_rtx.dll" --allow-third-party-modules

Qualcomm QNN Execution Provider

"%LOCALAPPDATA%\Google\Chrome SxS\Application\chrome.exe" --webnn-ort-ep-library-path-for-testing=QNNExecutionProvider?"C:\Program Files\ONNXRuntime-EP\onnxruntime_providers_qnn.dll" --allow-third-party-modules
"%LOCALAPPDATA%\Microsoft\Edge SxS\Application\msedge.exe" --webnn-ort-ep-library-path-for-testing=QNNExecutionProvider?"C:\Program Files\ONNXRuntime-EP\onnxruntime_providers_qnn.dll" --allow-third-party-modules

Use Custom Build of GPU or NPU Drivers

If you are testing with custom or internal GPU or NPU drivers, add the --allow-third-party-modules switch when launching the browser.

"%LOCALAPPDATA%\Google\Chrome SxS\Application\chrome.exe" --allow-third-party-modules
"%LOCALAPPDATA%\Microsoft\Edge SxS\Application\msedge.exe" --allow-third-party-modules

Debug Sandbox Issues

In some cases, you may need to debug WebNN by disabling Chromium’s security sandbox using the --disable-gpu-sandbox switch.

"%LOCALAPPDATA%\Google\Chrome SxS\Application\chrome.exe" --disable-gpu-sandbox
"%LOCALAPPDATA%\Microsoft\Edge SxS\Application\msedge.exe" --disable-gpu-sandbox

Inspect the Verbose Logging

You can configure the logging severity level of ONNX Runtime using the switch --webnn-ort-logging-level. Other available severity levels include “INFO”, “WARNING”, “ERROR” (default), and “FATAL”.

"%LOCALAPPDATA%\Google\Chrome SxS\Application\chrome.exe" --webnn-ort-logging-level=VERBOSE
"%LOCALAPPDATA%\Microsoft\Edge SxS\Application\msedge.exe" --webnn-ort-logging-level=VERBOSE

Additional Debug Options

Additional WebNN switches are available:

Additional Resources

Last updated on