Proposal: Expose engine-defined compute timing for WebNN (`MLComputeTiming`)
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 30/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- javascript
- 領域
- api, machine-learning
調査の方向性
Read the WebNN explainer when it is published and review the open questions listed in this issue: entry naming, graph ID, accelerated status, and computeDuration semantics. Then identify the WebNN specification sections for the graph API and Model Loader, plus the WebPerf timing entry types registry. Done means the proposal's semantics and registry relationship are resolved and specified for both surfaces.
索引モデルが issue の本文から書いたものです。
説明
Problem
- WebNN has no performance surface: no timing, no attribution.
dispatch()has no completion signal: "callers can await the results of reading back the
output tensors."- The only way for a page to learn that a run finished is a readback — so the readback becomes
part of the number, and the bracket differs per engine. Page-timed numbers are not interoperable.
Scenario
A page runs a face detector and wants to pick a smaller model on a slow device. It cannot tell
whether the slow device is limited by the model, the hardware, or its own input preparation.
The only measurement it can take is this:
const start = performance.now();
context.dispatch(graph, inputs, outputs);
await context.readTensor(a); // the only completion signal
await context.readTensor(b);
console.log(`Inference: ${(performance.now() - start).toFixed(2)}ms`);
On a reference mobile device (NPU backend):
| measurement | how it was taken | value |
|---|---|---|
| actual graph execution | engine timestamps around the backend run | 5.69 ms |
| dispatch round trip | page timer around dispatch() only |
5.85 ms |
| the code above | dispatch() + two awaited readTensor() calls |
209.23 ms |
The page's "inference" is 209 ms against 5.7 ms of computation, and it cannot see the difference.
Proposal
MLComputeTiming: a PerformanceEntry interface with two engine-created entry types.
[Exposed=(Window,Worker)]
interface MLComputeTiming : PerformanceEntry {
readonly attribute DOMHighResTimeStamp computeDuration;
readonly attribute boolean accelerated;
[Default] object toJSON();
};
| entryType | created when |
|---|---|
ml-compile |
compilation completes, incl. initialization (build()) |
ml-compute |
one graph execution completes (dispatch()) |
- One entry per execution, never per operator.
- Observer-only:
availableFromTimeline: false, delivered throughPerformanceObserver. duration= submission → completion (queueing included);computeDuration= the engine's own
compute interval inside it.graphId(engine-assigned, per context) correlates compile and run entries;acceleratedis
one bit.
Relations
- #934 (effective compute policy):
complementary — this contributes measurements and the privacy framing, not a device surface. - #923 (compute policy rename):
decides the long-term shape of theacceleratedfield. - Model Loader (draft): the same entries are
designed to cover itsload()/compute()once that API stabilises. - WebPerf: the entry types need a row in the timing entry types registry. WebNN owns the
semantics; WebPerf owns the registration.
Measurements, alternatives, privacy and the open questions (naming, graphId vs MLGraph.id,
accelerated shape, computeDuration normativity) are in the explainer: link when published.
- 主要言語
- Bikeshed
- スター
- 566
- フォーク
- 72
- 平均マージ
- 6日 5時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
webmachinelearning/webnn のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
webmachinelearning/webnn#967 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
webmachinelearning/webnn#966 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
webmachinelearning/webnn#965 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
webmachinelearning/webnn#964 · コメント 1 件 · リアクション 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 8/100
webmachinelearning/webnn#961 ·
webmachinelearning/webnn の issue をすべて見る
似ている issue
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
11ty/buildawesome#4407 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area: image-engine bug priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
snapotter-hq/SnapOtter#3885 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
keyxmakerx/Chronicle#1721 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Gentleman-Programming/gentle-ai#5720 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信