-
Notifications
You must be signed in to change notification settings - Fork 53
Add device preference use cases to explainer #855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add device preference use cases to explainer #855
Conversation
Adds a new subsection "Device Preference Use Cases" to the device-selection-explainer.md document. This subsection details several use cases for device selection preferences, mapping them to the preferences discussed in the W3C WebML WG minutes of 2025-05-08 (https://www.w3.org/2025/05/08-webmachinelearning-minutes.html#2ec0). The use cases cover: - Preferring CPU - Preferring NPU - Preferring GPU - Maximizing performance - Maximizing power efficiency - Minimizing overall system power Future-proof device names ("where JS and Wasm execute", "where WebGL and WebGPU programs execute", "other") are used in the descriptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new subsection titled "Device Preference Use Cases" to the device-selection-explainer.md document to clearly outline different device selection strategies for WebNN applications.
- Adds detailed use cases for preferring CPU, NPU, GPU, maximizing performance, maximizing power efficiency, and minimizing overall system power.
- Provides example preference strings and descriptions mapped to W3C WebML WG minutes.
Updates the description for the "Prefer execution on a Neural Processing Unit (NPU)" use case in device-selection-explainer.md. The term "other" as a future-proof device category is now explicitly defined as encompassing specialized ML accelerators that are distinct from CPUs and GPUs. This addresses feedback to improve clarity for you regarding the NPU use case and its relation to the "other" device category.
|
N.B.: This is an experiment on how to translate the group's meeting discussion into an explainer update using coding agents working together. Any explainer content is non-normative and thus makes for a good testing ground. Also, in my experience, none of the agents understand all the Bikeshed syntax nuances yet but are good with Markdown. That said, we require the usual human reviews for any changes, including for non-normative content. Cc @dontcallmedom to share any W3C-level best practices on the topic. |
|
Playing along AI generated markup, we could include/merge these considerations as well :). Hardware Selection Guide
Key Decision Criteria
Modern systems often combine all three:
|
|
N.B. I am as well working on this right now, albeit using human mind (for synthesis), also adding to the historic sections. |
During local inference (graph compilation) of various AI models, summarize strategies on how to distribute compute nodes (operations) among GPU, NPU or CPU.When distributing compute nodes across GPU, NPU, and CPU during AI model inference, optimal strategies depend on operation type, model architecture, and system constraints. Below are key approaches based on performance characteristics and hardware capabilities: 1. Operation-Type Optimization
2. Model Architecture Considerations
3. Batch Size and Latency Tradeoffs
4. Power-Constrained Deployments
5. Dynamic OrchestrationTools like NVIDIA Dynamo Planner monitor GPU/NPU utilization and automatically:
By combining hardware-specific strengths with adaptive resource management, developers can achieve 2–30× throughput improvements while maintaining strict latency targets21. ReferencesFootnotes
|
|
As for inputs for W3C best practices on explainers/spec generation (human to human specifications in general), I think we should make sure to digest all AI output through human synthesis (incl. context checking, extension, validation) even if it could be used just for code generation (machine - human - human - machine workflows), i.e. keeping a human in the middle, until we have sufficient machine abstracting power in the middle to make sure a given spec is a valid projection of the full context of the technical scope (as expected from engineers). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good, but based primarily on the ONNX API only. Not sure if the coverage matches well with other frameworks, or should we work more on distilling more common (as in intersection) use cases first. However, I think we could merge this and refine later.
This commit incorporates feedback from PR webmachinelearning#855: - Adds a citation to ONNX Runtime's OrtExecutionProviderDevicePolicy as an informing API for the device preference list. - Refines the usage of "other" in use case descriptions for clarity: - Removes quotes from "other" in "Maximize Performance". - Removes redundant ("other") clarification for NPU in "Maximize Power Efficiency".
|
Thank you @zolkis and our agents Jules and Copilot for your contributions to this experiment. |
This commit comprehensively updates the device selection explainer to reflect the latest discussions, API changes, and community feedback. Key changes include: - Updated Introduction and History sections to accurately reflect the removal of `MLDeviceType` from `MLContextOptions` (following PR webmachinelearning#809) and the shift towards hint-based, implementation-led device selection. - Clarified the impact of key issues (webmachinelearning#749, webmachinelearning#302, webmachinelearning#350) and PRs (webmachinelearning#809, webmachinelearning#824, webmachinelearning#855) on the device selection strategy. - Ensured the "Key use cases and requirements" section aligns with the current API, incorporating the device preference use cases from PR webmachinelearning#855. - Updated JavaScript examples in "Scenarios, examples, design discussion" to be consistent with the current API, marking future/hypothetical features (like `opSupportLimitsPerDevice()` and a `fallback` option) with explanatory notes. - Added new open questions based on recent discussions (e.g., issue webmachinelearning#836, PR webmachinelearning#854 regarding querying actual device usage). - Refined the "Background thoughts" section, particularly the "Example Hardware Selection Guide," adding an editor's note about ongoing discussions (PR webmachinelearning#860). - Corrected the "Considered alternatives" and "Minimum Viable Solution" sections to accurately represent the current and past approaches. - Updated the "Next Phase Device Selection Solution" to clarify the status of proposals like `querySupport` (issue webmachinelearning#815) and the investigation of `graph.devices` (issue webmachinelearning#836, PR webmachinelearning#854). - Performed a full proofread, correcting grammar, typos, and markdown formatting for improved clarity and consistency throughout the document.
This commit comprehensively updates the device selection explainer to reflect the latest discussions, API changes, and community feedback. Key changes include: - Updated Introduction and History sections to accurately reflect the removal of `MLDeviceType` from `MLContextOptions` (following PR webmachinelearning#809) and the shift towards hint-based, implementation-led device selection. - Clarified the impact of key issues (webmachinelearning#749, webmachinelearning#302, webmachinelearning#350) and PRs (webmachinelearning#809, webmachinelearning#824, webmachinelearning#855) on the device selection strategy. - Ensured the "Key use cases and requirements" section aligns with the current API, incorporating the device preference use cases from PR webmachinelearning#855. - Updated JavaScript examples in "Scenarios, examples, design discussion" to be consistent with the current API, marking future/hypothetical features (like `opSupportLimitsPerDevice()` and a `fallback` option) with explanatory notes. - Added new open questions based on recent discussions (e.g., issue webmachinelearning#836, PR webmachinelearning#854 regarding querying actual device usage). - Refined the "Background thoughts" section, particularly the "Example Hardware Selection Guide," adding an editor's note about ongoing discussions (PR webmachinelearning#860). - Corrected the "Considered alternatives" and "Minimum Viable Solution" sections to accurately represent the current and past approaches. - Updated the "Next Phase Device Selection Solution" to clarify the status of proposals like `querySupport` (issue webmachinelearning#815) and the investigation of `graph.devices` (issue webmachinelearning#836, PR webmachinelearning#854). - Performed a full proofread, correcting grammar, typos, and markdown formatting for improved clarity and consistency throughout the document.
This commit comprehensively updates the device selection explainer to reflect the latest discussions, API changes, and community feedback. Key changes include: - Updated Introduction and History sections to accurately reflect the removal of `MLDeviceType` from `MLContextOptions` (following PR webmachinelearning#809) and the shift towards hint-based, implementation-led device selection. - Clarified the impact of key issues (webmachinelearning#749, webmachinelearning#302, webmachinelearning#350) and PRs (webmachinelearning#809, webmachinelearning#824, webmachinelearning#855) on the device selection strategy. - Ensured the "Key use cases and requirements" section aligns with the current API, incorporating the device preference use cases from PR webmachinelearning#855. - Updated JavaScript examples in "Scenarios, examples, design discussion" to be consistent with the current API, marking future/hypothetical features (like `opSupportLimitsPerDevice()` and a `fallback` option) with explanatory notes. - Added new open questions based on recent discussions (e.g., issue webmachinelearning#836, PR webmachinelearning#854 regarding querying actual device usage). - Refined the "Background thoughts" section, particularly the "Example Hardware Selection Guide," adding an editor's note about ongoing discussions (PR webmachinelearning#860). - Corrected the "Considered alternatives" and "Minimum Viable Solution" sections to accurately represent the current and past approaches. - Updated the "Next Phase Device Selection Solution" to clarify the status of proposals like `querySupport` (issue webmachinelearning#815) and the investigation of `graph.devices` (issue webmachinelearning#836, PR webmachinelearning#854). - Performed a full proofread, correcting grammar, typos, and markdown formatting for improved clarity and consistency throughout the document.
This commit comprehensively updates the device selection explainer to reflect the latest discussions, API changes, and community feedback. Key changes include: - Updated Introduction and History sections to accurately reflect the removal of `MLDeviceType` from `MLContextOptions` (following PR #809) and the shift towards hint-based, implementation-led device selection. - Clarified the impact of key issues (#749, #302, #350) and PRs (#809, #824, #855) on the device selection strategy. - Ensured the "Key use cases and requirements" section aligns with the current API, incorporating the device preference use cases from PR #855. - Updated JavaScript examples in "Scenarios, examples, design discussion" to be consistent with the current API, marking future/hypothetical features (like `opSupportLimitsPerDevice()` and a `fallback` option) with explanatory notes. - Added new open questions based on recent discussions (e.g., issue #836, PR #854 regarding querying actual device usage). - Refined the "Background thoughts" section, particularly the "Example Hardware Selection Guide," adding an editor's note about ongoing discussions (PR #860). - Corrected the "Considered alternatives" and "Minimum Viable Solution" sections to accurately represent the current and past approaches. - Updated the "Next Phase Device Selection Solution" to clarify the status of proposals like `querySupport` (issue #815) and the investigation of `graph.devices` (issue #836, PR #854). - Performed a full proofread, correcting grammar, typos, and markdown formatting for improved clarity and consistency throughout the document. Signed-off-by: Zoltan Kis <[email protected]> With thanks to Jules for proofreading: Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit comprehensively updates the device selection explainer to reflect the latest discussions, API changes, and community feedback. Key changes include: - Updated Introduction and History sections to accurately reflect the removal of `MLDeviceType` from `MLContextOptions` (following PR #809) and the shift towards hint-based, implementation-led device selection. - Clarified the impact of key issues (#749, #302, #350) and PRs (#809, #824, #855) on the device selection strategy. - Ensured the "Key use cases and requirements" section aligns with the current API, incorporating the device preference use cases from PR #855. - Updated JavaScript examples in "Scenarios, examples, design discussion" to be consistent with the current API, marking future/hypothetical features (like `opSupportLimitsPerDevice()` and a `fallback` option) with explanatory notes. - Added new open questions based on recent discussions (e.g., issue #836, PR #854 regarding querying actual device usage). - Refined the "Background thoughts" section, particularly the "Example Hardware Selection Guide," adding an editor's note about ongoing discussions (PR #860). - Corrected the "Considered alternatives" and "Minimum Viable Solution" sections to accurately represent the current and past approaches. - Updated the "Next Phase Device Selection Solution" to clarify the status of proposals like `querySupport` (issue #815) and the investigation of `graph.devices` (issue #836, PR #854). - Performed a full proofread, correcting grammar, typos, and markdown formatting for improved clarity and consistency throughout the document. Signed-off-by: Zoltan Kis <[email protected]> With thanks to Jules for proofreading: Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Adds a new subsection "Device Preference Use Cases" to the device-selection-explainer.md document.
This subsection details several use cases for device selection preferences, mapping them to the preferences discussed in the W3C WebML WG minutes of 2025-05-08 (https://www.w3.org/2025/05/08-webmachinelearning-minutes.html#2ec0).
The use cases cover:
Future-proof device names ("where JS and Wasm execute", "where WebGL and WebGPU programs execute", "other") are used in the descriptions.