{"id":13574501,"url":"https://github.com/webmachinelearning/webnn-native","last_synced_at":"2025-10-13T13:10:34.814Z","repository":{"id":36981514,"uuid":"331678463","full_name":"webmachinelearning/webnn-native","owner":"webmachinelearning","description":"🧠⚙️ Standalone native implementation of the Web Neural Network API","archived":false,"fork":false,"pushed_at":"2023-04-07T02:14:10.000Z","size":6959,"stargazers_count":56,"open_issues_count":38,"forks_count":21,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-07T23:05:23.526Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webmachinelearning.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-01-21T15:59:03.000Z","updated_at":"2024-12-27T07:42:32.000Z","dependencies_parsed_at":"2024-01-14T04:07:55.631Z","dependency_job_id":null,"html_url":"https://github.com/webmachinelearning/webnn-native","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/webmachinelearning/webnn-native","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webmachinelearning%2Fwebnn-native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webmachinelearning%2Fwebnn-native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webmachinelearning%2Fwebnn-native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webmachinelearning%2Fwebnn-native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webmachinelearning","download_url":"https://codeload.github.com/webmachinelearning/webnn-native/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webmachinelearning%2Fwebnn-native/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279015283,"owners_count":26085683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T15:00:52.147Z","updated_at":"2025-10-13T13:10:34.768Z","avatar_url":"https://github.com/webmachinelearning.png","language":"C++","funding_links":[],"categories":["Table of Contents","Table of content"],"sub_categories":["AI - Frameworks and Toolkits","Miscellaneous"],"readme":"| Backend \\ OS | Windows | Linux |\n|---|---|---|\n| null (for unit test) | [![null backend](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_null.yml/badge.svg)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_null.yml)| |\n| DirectMLX | [![DirectMLX backend (Windows)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_dmlx.yml/badge.svg)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_dmlx.yml)\u003cbr\u003e[![Node Binding (DirectMLX backend / Windows)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_node_dmlx.yml/badge.svg)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_node_dmlx.yml)\u003cbr\u003e[![Memory leak check - DirectMLX backend (Windows)](https://github.com/webmachinelearning/webnn-native/actions/workflows/memory_leak_check_dmlx.yml/badge.svg)](https://github.com/webmachinelearning/webnn-native/actions/workflows/memory_leak_check_dmlx.yml)| |\n| OpenVINO | [![OpenVINO backend (Windows)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_openvino_windows.yml/badge.svg)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_openvino_windows.yml)\u003cbr\u003e[![Node Binding (OpenVINO backend / Windows)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_node_openvino_windows.yml/badge.svg)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_node_openvino_windows.yml)|[![OpenVINO backend (Linux)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_openvino_linux.yml/badge.svg)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_openvino_linux.yml)\u003cbr\u003e[![Node Binding (OpenVINO backend / Linux)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_node_openvino_linux.yml/badge.svg)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_node_openvino_linux.yml)|\n| XNNPACK | [![XNNPACK backend (Windows)](https://github.com/BruceDai/webnn-native/actions/workflows/build_test_xnnpack_windows.yml/badge.svg)](https://github.com/BruceDai/webnn-native/actions/workflows/build_test_xnnpack_windows.yml)|[![XNNPACK backend (Linux)](https://github.com/BruceDai/webnn-native/actions/workflows/build_test_xnnpack_linux.yml/badge.svg)](https://github.com/BruceDai/webnn-native/actions/workflows/build_test_xnnpack_linux.yml)|\n| oneDNN |[![oneDNN backend (Windows)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_onednn_windows.yml/badge.svg)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_onednn_windows.yml)|[![oneDNN backend (Linux)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_onednn_linux.yml/badge.svg)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_test_onednn_linux.yml)|\n| MLAS | [![MLAS backend (Windows)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_mlas_windows.yml/badge.svg)](https://github.com/webmachinelearning/webnn-native/actions/workflows/build_mlas_windows.yml)| |\n\n[![clang format](https://github.com/webmachinelearning/webnn-native/actions/workflows/clang_format_check.yml/badge.svg)](https://github.com/webmachinelearning/webnn-native/actions/workflows/clang_format_check.yml)\n\n# WebNN-native\n\nWebNN-native is a native implementation of the [Web Neural Network API](https://webmachinelearning.github.io/webnn/).\n\nIt provides several building blocks:\n\n - **WebNN C/C++ headers** that applications and other building blocks use.\n   - The `webnn.h` that is an one-to-one mapping with the WebNN IDL.\n   - A C++ wrapper for the `webnn.h`\n - **Backend implementations** that use platforms' ML APIs:\n   - **DirectML** on Windows 10\n   - **DirectMLX** on Windows 10\n   - **OpenVINO** on Windows 10 and Linux\n   - **oneDNN** on Windows 10 and Linux\n   - **XNNPACK** on Windows 10 and Linux\n   - **MLAS** on Windows 10 and Linux\n   - _Other backends are to be added_\n\nWebNN-native uses the code of other open source projects:\n\n * The code generator and infrastructure code of [Dawn](https://dawn.googlesource.com/dawn/) project.\n * The DirectMLX and device wrapper of [DirectML](https://github.com/microsoft/DirectML) project.\n * The [XNNPACK](https://github.com/google/XNNPACK) project.\n * The [oneDNN](https://github.com/oneapi-src/oneDNN) project.\n * The [MLAS](https://github.com/microsoft/onnxruntime/tree/master/onnxruntime/core/mlas) project.\n\n## Build and Run\n\n### Install `depot_tools`\n\nWebNN-native uses the Chromium build system and dependency management so you need to [install depot_tools] and add it to the PATH.\n\n[install depot_tools]: http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up\n\n**Notes**:\n * On Windows, you'll need to set the environment variable `DEPOT_TOOLS_WIN_TOOLCHAIN=0`. This tells depot_tools to use your locally installed version of Visual Studio (by default, depot_tools will try to download a Google-internal version).\n\n### Get the code\n\nGet the source code as follows:\n\n```sh\n# Clone the repo as \"webnn-native\"\n\u003e git clone https://github.com/webmachinelearning/webnn-native.git webnn-native \u0026\u0026 cd webnn-native\n\n# Bootstrap the gclient configuration\n\u003e cp scripts/standalone.gclient .gclient\n\n# Fetch external dependencies and toolchains with gclient\n\u003e gclient sync\n```\n\n### Setting up the build\n\nGenerate build files using `gn args out/Debug` or `gn args out/Release`.\n\nA text editor will appear asking build options, the most common option is `is_debug=true/false`; otherwise `gn args out/Release --list` shows all the possible options.\n\nTo build with a backend, please set the corresponding option from following table.\n\n| Backend | Option |\n|---------|--------------|\n| DirectML | `webnn_enable_dml=true` |\n| DirectMLX | `webnn_enable_dmlx=true` |\n| OpenVINO | `webnn_enable_openvino=true` |\n| XNNPACK | `webnn_enable_xnnpack=true` |\n| oneDNN | `webnn_enable_onednn=true` |\n| MLAS | `webnn_enable_mlas=true` |\n\n### Build\n\nThen use `ninja -C out/Release` or `ninja -C out/Debug` to build WebNN-native.\n\n**Notes**\n * To build with XNNPACK backend, please build XNNPACK first, e.g. by [`./scripts/build-local.sh`](https://github.com/google/XNNPACK/blob/master/scripts/build-local.sh). For Windows build, it requires supplying -DCMAKE_MSVC_RUNTIME_LIBRARY=\"MultiThreaded$\u003c$\u003cCONFIG:Debug\u003e:Debug\u003e\" to set MSVC static runtime library.\n * To build with oneDNN backend, please build oneDNN first by following the [build from source instructions](https://oneapi-src.github.io/oneDNN/dev_guide_build.html).\n * To build with MLAS backend, please build MLAS (part of ONNX Runtime) first by following the [Build ONNX Runtime for inferencing](https://onnxruntime.ai/docs/build/inferencing.html#build-onnx-runtime-for-inferencing), e.g., by `.\\build.bat --config Release --parallel --enable_msvc_static_runtime` for Windows build.\n\n### Run tests\n\nRun unit tests:\n```sh\n\u003e ./out/Release/webnn_unittests\n```\n\nRun end2end tests on a default device:\n```sh\n\u003e ./out/Release/webnn_end2end_tests\n```\nYou can also specify a device to run end2end tests using \"-d\" option, for example:\n```sh\n\u003e ./out/Release/webnn_end2end_tests -d gpu\n```\nCurrently \"cpu\", \"gpu\" and \"default\" are supported, more devices are to be supported in the future.\n\n**Notes**:\n * For OpenVINO backend, please [install 2021.4 version](https://docs.openvinotoolkit.org/2021.4/openvino_docs_install_guides_installing_openvino_linux.html#install-openvino) and [set the environment variables](https://docs.openvinotoolkit.org/2021.4/openvino_docs_install_guides_installing_openvino_linux.html#set-the-environment-variables) before running the end2end tests.\n * The current implementation of oneDNN and MLAS backends is mainly for the investigation of WebNN [Operation Level Execution\n](https://webmachinelearning.github.io/webnn/#usecase-op-level-exec) use case. So only a limited set of tests (such as of conv2d) is expected to pass.\n\n### Run examples\n\n * [LeNet](/examples/LeNet/README.md)\n\n## License\n\nApache 2.0 Public License, please see [LICENSE](/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebmachinelearning%2Fwebnn-native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebmachinelearning%2Fwebnn-native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebmachinelearning%2Fwebnn-native/lists"}