From 51a9354f070fc15d1acbadc87dd10ebfc680e9fb Mon Sep 17 00:00:00 2001 From: mingmingtasd Date: Tue, 7 May 2024 16:32:13 +0800 Subject: [PATCH 01/11] Add NPU steps --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 9fb13259..c96ed66c 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,21 @@ WebNN requires a compatible browser to run, and Windows 11 v21H2 (DML 1.6.0) or 4. In the drop-down menu, select `Enabled`. 5. Relaunch your browser. +#### Running NPU Guides on Windows +Running WebNN NPU requires devices with capable NPU hardware e.g. Intel NPU hardware. Based on the steps 1~4 of WebNN Installation Guides above, some other steps are required: + +1. Download and install the latest Intel NPU driver according to this [Guides Documentation](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html). +2. Apply the latest redistributable DirectML.dll: +* For Google Chrome Canary: +Download the latest redistributable DirectML package from [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/), extract the package and copy the DirectML.dll (e.g. \bin\x64-win\DirectML.dll) to the Chrome canary’s directory (e.g. C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\\"version number"\). +* For Microsoft Edge Canary: +Edge browser will download the latest DirectML.dll automatically when WebNN is enabled. +3. Launch your browser in Windows Command Line: +* For Google Chrome Canary: +> "C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --disable-gpu-sandbox +* For Microsoft Edge Canary: +> "C:\Users\\"username"\AppData\Local\Microsoft\Edge SxS\Application\msedge.exe" --disable-gpu-sandbox + ## Support and Feedback If you encounter any issues or have feedback on the WebNN Samples, please open an issue on the repository. We appreciate your input and will strive to address any problems as quickly as possible. From c3473bc19babb03ddda2c57ef4f1c160340f6fd1 Mon Sep 17 00:00:00 2001 From: mingmingtasd Date: Wed, 8 May 2024 09:15:43 +0800 Subject: [PATCH 02/11] address belem's comments --- README.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c96ed66c..f41a09e3 100644 --- a/README.md +++ b/README.md @@ -47,19 +47,16 @@ WebNN requires a compatible browser to run, and Windows 11 v21H2 (DML 1.6.0) or 4. In the drop-down menu, select `Enabled`. 5. Relaunch your browser. -#### Running NPU Guides on Windows -Running WebNN NPU requires devices with capable NPU hardware e.g. Intel NPU hardware. Based on the steps 1~4 of WebNN Installation Guides above, some other steps are required: +#### Running WebNN on NPU +Running WebNN on NPU requires capable NPU hardware e.g. Intel® AI Boost NPU from Intel® Core™ Ultra processors. -1. Download and install the latest Intel NPU driver according to this [Guides Documentation](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html). -2. Apply the latest redistributable DirectML.dll: -* For Google Chrome Canary: +1. Download and install the [latest Intel NPU driver](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html). +2. Microsoft Edge browser will download the latest DirectML.dll automatically when WebNN is enabled. Apply the latest redistributable DirectML.dll for Google Chrome Canary: Download the latest redistributable DirectML package from [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/), extract the package and copy the DirectML.dll (e.g. \bin\x64-win\DirectML.dll) to the Chrome canary’s directory (e.g. C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\\"version number"\). -* For Microsoft Edge Canary: -Edge browser will download the latest DirectML.dll automatically when WebNN is enabled. 3. Launch your browser in Windows Command Line: -* For Google Chrome Canary: +* Google Chrome Canary: > "C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --disable-gpu-sandbox -* For Microsoft Edge Canary: +* Microsoft Edge Canary: > "C:\Users\\"username"\AppData\Local\Microsoft\Edge SxS\Application\msedge.exe" --disable-gpu-sandbox ## Support and Feedback From 86aa2b7320f102a3aeabb143bfa64e78424acc6d Mon Sep 17 00:00:00 2001 From: mingmingtasd Date: Wed, 8 May 2024 10:07:36 +0800 Subject: [PATCH 03/11] Update commands --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f41a09e3..833a56c0 100644 --- a/README.md +++ b/README.md @@ -55,9 +55,9 @@ Running WebNN on NPU requires capable NPU hardware e.g. Intel® AI Boost NPU fro Download the latest redistributable DirectML package from [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/), extract the package and copy the DirectML.dll (e.g. \bin\x64-win\DirectML.dll) to the Chrome canary’s directory (e.g. C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\\"version number"\). 3. Launch your browser in Windows Command Line: * Google Chrome Canary: -> "C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --disable-gpu-sandbox +> "C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --use-redist-dml * Microsoft Edge Canary: -> "C:\Users\\"username"\AppData\Local\Microsoft\Edge SxS\Application\msedge.exe" --disable-gpu-sandbox +> "C:\Users\\"username"\AppData\Local\Microsoft\Edge SxS\Application\msedge.exe" ## Support and Feedback If you encounter any issues or have feedback on the WebNN Samples, please open an issue on the repository. We appreciate your input and will strive to address any problems as quickly as possible. From 00bc08853af7540e2aca16cb5fd76c10f7a7f5fe Mon Sep 17 00:00:00 2001 From: mingmingtasd Date: Wed, 8 May 2024 10:11:52 +0800 Subject: [PATCH 04/11] address belem's comments --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 833a56c0..2ba78170 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Running WebNN on NPU requires capable NPU hardware e.g. Intel® AI Boost NPU fro 1. Download and install the [latest Intel NPU driver](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html). 2. Microsoft Edge browser will download the latest DirectML.dll automatically when WebNN is enabled. Apply the latest redistributable DirectML.dll for Google Chrome Canary: -Download the latest redistributable DirectML package from [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/), extract the package and copy the DirectML.dll (e.g. \bin\x64-win\DirectML.dll) to the Chrome canary’s directory (e.g. C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\\"version number"\). +Download the latest redistributable [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/), extract the package and copy the DirectML.dll (e.g. \bin\x64-win\DirectML.dll) to the Chrome Canary’s directory (e.g. C:\Users\"username"\AppData\Local\Google\Chrome SxS\Application\"version number"). 3. Launch your browser in Windows Command Line: * Google Chrome Canary: > "C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --use-redist-dml From 88243c7c28a9609de1d5ebc1db2047f45d98b66f Mon Sep 17 00:00:00 2001 From: mingmingtasd Date: Wed, 8 May 2024 11:09:57 +0800 Subject: [PATCH 05/11] address belem's comments --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2ba78170..2feed040 100644 --- a/README.md +++ b/README.md @@ -50,14 +50,17 @@ WebNN requires a compatible browser to run, and Windows 11 v21H2 (DML 1.6.0) or #### Running WebNN on NPU Running WebNN on NPU requires capable NPU hardware e.g. Intel® AI Boost NPU from Intel® Core™ Ultra processors. +* Google Chrome Canary: 1. Download and install the [latest Intel NPU driver](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html). -2. Microsoft Edge browser will download the latest DirectML.dll automatically when WebNN is enabled. Apply the latest redistributable DirectML.dll for Google Chrome Canary: -Download the latest redistributable [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/), extract the package and copy the DirectML.dll (e.g. \bin\x64-win\DirectML.dll) to the Chrome Canary’s directory (e.g. C:\Users\"username"\AppData\Local\Google\Chrome SxS\Application\"version number"). +2. Download the latest redistributable [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/), extract the package and copy the DirectML.dll (e.g. \bin\x64-win\DirectML.dll) to the Chrome Canary’s directory (e.g. C:\Users\"username"\AppData\Local\Google\Chrome SxS\Application\"version number"). 3. Launch your browser in Windows Command Line: -* Google Chrome Canary: -> "C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --use-redist-dml +```bash +"C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --use-redist-dml +``` + * Microsoft Edge Canary: -> "C:\Users\\"username"\AppData\Local\Microsoft\Edge SxS\Application\msedge.exe" +1. Download and install the [latest Intel NPU driver](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html). +2. Launch your browser. ## Support and Feedback If you encounter any issues or have feedback on the WebNN Samples, please open an issue on the repository. We appreciate your input and will strive to address any problems as quickly as possible. From 7041eb042d2d14ab4645b8f4fc1d8e1cd44bfe12 Mon Sep 17 00:00:00 2001 From: mingmingtasd Date: Wed, 8 May 2024 13:31:26 +0800 Subject: [PATCH 06/11] fix nit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2feed040..42a0a15f 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ WebNN requires a compatible browser to run, and Windows 11 v21H2 (DML 1.6.0) or 5. Relaunch your browser. #### Running WebNN on NPU -Running WebNN on NPU requires capable NPU hardware e.g. Intel® AI Boost NPU from Intel® Core™ Ultra processors. +Running WebNN on NPU requires capable NPU hardware e.g. Intel® AI Boost NPU of Intel® Core™ Ultra processors. * Google Chrome Canary: 1. Download and install the [latest Intel NPU driver](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html). From 2fc0d3e71d449c88db3082b5acef9c75297b2e60 Mon Sep 17 00:00:00 2001 From: mingmingtasd Date: Thu, 15 Aug 2024 10:54:53 +0800 Subject: [PATCH 07/11] add notes and `--disable_webnn_for_npu=0` --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 42a0a15f..c5884e8e 100644 --- a/README.md +++ b/README.md @@ -55,12 +55,19 @@ Running WebNN on NPU requires capable NPU hardware e.g. Intel® AI Boost NPU of 2. Download the latest redistributable [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/), extract the package and copy the DirectML.dll (e.g. \bin\x64-win\DirectML.dll) to the Chrome Canary’s directory (e.g. C:\Users\"username"\AppData\Local\Google\Chrome SxS\Application\"version number"). 3. Launch your browser in Windows Command Line: ```bash -"C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --use-redist-dml +"C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --use-redist-dml --disable_webnn_for_npu=0 ``` * Microsoft Edge Canary: 1. Download and install the [latest Intel NPU driver](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html). -2. Launch your browser. +2. Launch your browser in Windows Command Line: +```bash +"C:\Users\\"username"\AppData\Local\Microsoft\Edge SxS\Application\msedge.exe" --disable_webnn_for_npu=0 +``` +3. For the first time you enable the `Enables WebNN API` flag, please wait a moment while the latest redistributable [Microsoft.AI.DirectML] is downloaded automatically. + +* Notes: +There is an intermittent issue of Intel NPU driver which will be fixed soon, please relaunch your browser to try again if you encounter a failure. ## Support and Feedback If you encounter any issues or have feedback on the WebNN Samples, please open an issue on the repository. We appreciate your input and will strive to address any problems as quickly as possible. From 86a1085ca201e5b1a99bb138ba938b03a26f5479 Mon Sep 17 00:00:00 2001 From: mingmingtasd Date: Thu, 15 Aug 2024 16:30:28 +0800 Subject: [PATCH 08/11] Add explanation for flags and issue --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c5884e8e..d69ac44d 100644 --- a/README.md +++ b/README.md @@ -48,26 +48,26 @@ WebNN requires a compatible browser to run, and Windows 11 v21H2 (DML 1.6.0) or 5. Relaunch your browser. #### Running WebNN on NPU -Running WebNN on NPU requires capable NPU hardware e.g. Intel® AI Boost NPU of Intel® Core™ Ultra processors. +Running WebNN on NPU requires capable NPU hardware. For Intel® AI Boost NPU of Intel® Core™ Ultra processors, download and install the [latest Intel NPU driver](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html). At present, the [image classification](https://webmachinelearning.github.io/webnn-samples/image_classification/) and [object detection](https://webmachinelearning.github.io/webnn-samples/object_detection/) samples support NPU. * Google Chrome Canary: -1. Download and install the [latest Intel NPU driver](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html). -2. Download the latest redistributable [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/), extract the package and copy the DirectML.dll (e.g. \bin\x64-win\DirectML.dll) to the Chrome Canary’s directory (e.g. C:\Users\"username"\AppData\Local\Google\Chrome SxS\Application\"version number"). -3. Launch your browser in Windows Command Line: +1. Download the latest redistributable [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/), extract the package and copy the DirectML.dll (e.g. \bin\x64-win\DirectML.dll) to the Chrome Canary’s directory (e.g. C:\Users\"username"\AppData\Local\Google\Chrome SxS\Application\"version number"). +2. Launch your browser in Windows Command Line: ```bash "C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --use-redist-dml --disable_webnn_for_npu=0 ``` * Microsoft Edge Canary: -1. Download and install the [latest Intel NPU driver](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html). -2. Launch your browser in Windows Command Line: +1. Launch your browser in Windows Command Line: ```bash "C:\Users\\"username"\AppData\Local\Microsoft\Edge SxS\Application\msedge.exe" --disable_webnn_for_npu=0 ``` -3. For the first time you enable the `Enables WebNN API` flag, please wait a moment while the latest redistributable [Microsoft.AI.DirectML] is downloaded automatically. +2. For the first time you enable the `Enables WebNN API` flag, please wait a moment while the latest redistributable [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/) is downloaded automatically before trying the samples. * Notes: -There is an intermittent issue of Intel NPU driver which will be fixed soon, please relaunch your browser to try again if you encounter a failure. +1. There is an intermittent issue with the Intel NPU driver that causes failure of NPU adapter creation. The `WebNN(NPU)` backend button in the samples will be disabled with message "Unable to find a capable adapter". If you encounter this issue, please relaunch your browser and try again. +2. The flag `disable_webnn_for_npu` is set to true by default to disable WebNN on NPU due to the aforementioned issue. To bypass this, use `--disable_webnn_for_npu=0`. This flag will be removed once the issue is resolved. +3. Running WebNN on NPU requires a higher version of DirectML.dll than the one in the Windows system. Using the `--use-redist-dml` flag will allow Google Chrome Canary to load the downloaded DirectML.dll with a sufficiently high version. ## Support and Feedback If you encounter any issues or have feedback on the WebNN Samples, please open an issue on the repository. We appreciate your input and will strive to address any problems as quickly as possible. From 33b8fde65c9a5c830326f2dc4fe6f94c357eb7a4 Mon Sep 17 00:00:00 2001 From: mingmingtasd Date: Mon, 19 Aug 2024 08:57:37 +0800 Subject: [PATCH 09/11] split step 1 (which is quite long) into steps 1 and 2 --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d69ac44d..d1d119e9 100644 --- a/README.md +++ b/README.md @@ -51,8 +51,9 @@ WebNN requires a compatible browser to run, and Windows 11 v21H2 (DML 1.6.0) or Running WebNN on NPU requires capable NPU hardware. For Intel® AI Boost NPU of Intel® Core™ Ultra processors, download and install the [latest Intel NPU driver](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html). At present, the [image classification](https://webmachinelearning.github.io/webnn-samples/image_classification/) and [object detection](https://webmachinelearning.github.io/webnn-samples/object_detection/) samples support NPU. * Google Chrome Canary: -1. Download the latest redistributable [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/), extract the package and copy the DirectML.dll (e.g. \bin\x64-win\DirectML.dll) to the Chrome Canary’s directory (e.g. C:\Users\"username"\AppData\Local\Google\Chrome SxS\Application\"version number"). -2. Launch your browser in Windows Command Line: +1. Download the latest redistributable [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/). +2. Extract the package and copy the DirectML.dll (e.g. \bin\x64-win\DirectML.dll) to the Chrome Canary’s directory (e.g. C:\Users\"username"\AppData\Local\Google\Chrome SxS\Application\"version number"). +3. Launch your browser in Windows Command Line: ```bash "C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --use-redist-dml --disable_webnn_for_npu=0 ``` From 9509921b1b42a24c65b069d1ba96c04c58ab2eb8 Mon Sep 17 00:00:00 2001 From: mingmingtasd Date: Mon, 19 Aug 2024 09:06:14 +0800 Subject: [PATCH 10/11] fix nits: add Install NPU driver title --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d1d119e9..64ebbb60 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,11 @@ WebNN requires a compatible browser to run, and Windows 11 v21H2 (DML 1.6.0) or 5. Relaunch your browser. #### Running WebNN on NPU -Running WebNN on NPU requires capable NPU hardware. For Intel® AI Boost NPU of Intel® Core™ Ultra processors, download and install the [latest Intel NPU driver](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html). At present, the [image classification](https://webmachinelearning.github.io/webnn-samples/image_classification/) and [object detection](https://webmachinelearning.github.io/webnn-samples/object_detection/) samples support NPU. +At present, the [image classification](https://webmachinelearning.github.io/webnn-samples/image_classification/) and [object detection](https://webmachinelearning.github.io/webnn-samples/object_detection/) samples support NPU. + +* Install NPU driver: + + For Intel® AI Boost NPU of Intel® Core™ Ultra processors, download and install the [latest Intel NPU driver](https://www.intel.com/content/www/us/en/download/794734/intel-npu-driver-windows.html). * Google Chrome Canary: 1. Download the latest redistributable [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/). From 655cd2e222401c9a1ff782e35c853246edbb7817 Mon Sep 17 00:00:00 2001 From: mingmingtasd Date: Fri, 30 Aug 2024 14:37:18 +0800 Subject: [PATCH 11/11] use LOCALAPPDATA --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 64ebbb60..e27f9d05 100644 --- a/README.md +++ b/README.md @@ -56,16 +56,16 @@ At present, the [image classification](https://webmachinelearning.github.io/webn * Google Chrome Canary: 1. Download the latest redistributable [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/). -2. Extract the package and copy the DirectML.dll (e.g. \bin\x64-win\DirectML.dll) to the Chrome Canary’s directory (e.g. C:\Users\"username"\AppData\Local\Google\Chrome SxS\Application\"version number"). +2. Extract the package and copy the DirectML.dll (e.g. \bin\x64-win\DirectML.dll) to the Chrome Canary’s directory (e.g.C:\Users\"username"\AppData\Local\Google\Chrome SxS\Application\"version number"). Note that Chrome Canary may automatically update to a new version, in which case DirectML.dll will need to be recopied to the directory. 3. Launch your browser in Windows Command Line: ```bash -"C:\Users\\"username"\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --use-redist-dml --disable_webnn_for_npu=0 +"%LOCALAPPDATA%\Google\Chrome SxS\Application\chrome.exe" --use-redist-dml --disable_webnn_for_npu=0 ``` * Microsoft Edge Canary: 1. Launch your browser in Windows Command Line: ```bash -"C:\Users\\"username"\AppData\Local\Microsoft\Edge SxS\Application\msedge.exe" --disable_webnn_for_npu=0 +"%LOCALAPPDATA%\Microsoft\Edge SxS\Application\msedge.exe" --disable_webnn_for_npu=0 ``` 2. For the first time you enable the `Enables WebNN API` flag, please wait a moment while the latest redistributable [Microsoft.AI.DirectML](https://www.nuget.org/packages/Microsoft.AI.DirectML/) is downloaded automatically before trying the samples.