Meeting minutes
Repository: webmachinelearning/webnn
Anssi: please join me in welcoming Hyojin Song from LGE to the group!
Web Neural Network API
Repository: webmachinelearning/webnn
ZeroPoint for quantizeLinear and dequantizeLinear
<gb> PR 985 Make zeroPoint optional for quantizeLinear() and dequantizeLinear() (by Yuhengwe1) [Agenda+]
<gb> Issue 943 Make zeroPoint optional for quantizeLinear and dequantizeLinear operations (by Yuhengwe1) [Agenda+]
Anssi: we have a PR to make zeroPoint optional in quantizeLinear and dequantizeLinear
… as discussed in the initial issue, this enables performance optimizations
… this suggested change allows implementations to optimize memory use and improve overall performance
… select the appropriate kernel based on the presence of zeroPoint
… since our last discussion, Yuheng proposed the following enhancements to clarify the behavior:
… "outputDataType is now a required argument of quantizeLinear(), and MLQuantizeLinearOptions is dropped"
… Mikhail notes this clarification matches TensorRT
… Dwayne notes asymmeticity in the handling of zeroPoint between quantizeLinear and dequantizeLinear
… and proposes to handle zeroPoint symmetrically in both quantizeLinear and dequantizeLinear
… proposal to move zeroPoint from the MLQuantizeDequantizeLinearOptions dictionary into an optional parameter of (de)quantizeLinear()
… dictionary MLQuantizeDequantizeLinearOptions { MLOperand zeroPoint }
… =>
… MLOperand (de)quantizeLinear(..., optional MLOperand zeroPoint, ...)
Anssi: Dwayne's proposal improves the consistency of the API, unless there are known tradeoffs I'd prefer to see that design considered
… any known tradeoffs with Dwayne's symmetric proposal?
Dwayne: zeroPoint is technically optional, most of the times this is very salient, should be part of the function prototype
Mikhail: zeroPoint is more often found in legacy models, not in LLMs, but in Computer Vision models, Stable Diffusion models
… we see trend in moving toward symmetric quantization
Mikhail: overall I'm not opposed in making zeroPoint optional, however, we cannot deduce the output data type from input and scale
… maybe output datatype could also move to the dictionary, need to think
Anssi: implementation work in flight?
Ningxin: Yuheng is prototyping
Anssi: let's solicit feedback in the issue and PR before we proceed to land this
Overflows in float32
Anssi: issue #967
<gb> Issue 967 Do subnormal results have to be preserved when the reference formula overflows in float32? (by matthargett) [Agenda+]
Anssi: Matt was running SmolLM2-135M and ran into float32 overflows when using the sigmoid emulation path we have in the spec: 1 / (exp(-x) + 1)
… current WPT assumes subnormal results are preserved within the tolerance
… Dwayne suggested we should split this in two:
… pure data movement operators should preserve bits
… math operators may allow flush-to-zero for subnormal results
… WebGPU allows flush-to-zero for subnormal results in mathematical operations
https://
Anssi: the list provided by Dwayne suggests we don't yet know how all backends handle this
… we also have learnings from DirectML conformance test that could apply here
Dwayne: two categories are accurate, we can investigate the backends, knowing some backends allow flushing suggest we should make that supported case in the spec, some backends do preserve so need corresponding logic in WPT
<DwayneR> +1
<mklimenko> +1
RESOLUTION: Update WPT comparison helpers for bitwise data movement ops and a mathy comparer for subnormal flushing. Optionally research how different backends and hardware handle subnormal results. (issue #967)
MikeW: are we confident all hardware can preserve subnormals over float32?
Dwayne: not confident
Dwayne: the overflow case is orthogonal to subnormal preservation
<Mike_Wyrzykowski> +1
MikeW: no concerns then
WebNN caching with Cross-Origin Storage
Anssi: issue #971
<gb> Issue 971 Investigate how to integrate WebNN caching with Cross-Origin Storage (by anssiko) [Agenda+]
Anssi: this is a Dublin resolution follow-up to investigate how to integrate WebNN caching with Cross-Origin Storage so that compiled models can be used cross-origin
… Tom has been looking into the integration of WebNN caching with Cross-Origin Storage
… COS spec added a "derived artifacts" feature that enables caching a compiled WebNN graph (or a Wasm modules, or a GPU pipeline):
https://
Anssi: to make WebNN caching compatible with COS derived artifacts, Tom proposes the following WebNN changes:
… - a new constant() overload with a Blob and an optional byte range
… - new steps in build() to derive a key and look up for a cached compiled graph
<Zakim> Tom, you wanted to explain the details
Tom: this is an outcome of Dublin F2F, per resolution I started investigate this and have a proposed solution for the group
… derived artifact in COS spec allow to go from Blob to derived artifact given a key
… it has the notion of the Blob's hash, used to lookup what's the compiled graph
… core idea is to come up with a new key algorithm
… mitigations in place to avoid this being used as a tracking vector
… question to the group, can compiled graphs be produced outside the renderer, and independently of how the graph ran, as the spec requires?
Tom: core key is a lookup from the hash from the Blob, connected to something internally storable that is connected with the compiled graph
Rafael: per sample code we're hashing the weights, it saves from re-downloading weights
… there's also value in saving the output of the compilation itself
Tom: that is also part of the proposal
… hash is tied to the Blob, key is based on the Blob hash
… objective to save in cache the compiled graph
Rafael: I was confused because I saw sample code referring to weights
Tom: hidden magic, storing the actual weights, after compilation, lookup points to the compiled graph
Rafael: storing the compiled graph and getting it again, does that happen automatically without the developer needing to manage the keys?
Tom: happens in the background, as a developer only need to store the weights and obtain what looks like weights but the implementation would get back the compiled graph internally
Rafael: web developers only need to consider the weights, not the internal representation of the compiled graph
Rafael: about the budget, is this the user's budget, or domain's, or website's?
Tom: COS challenge is it has a risk of becoming a super-cookie
… the budget makes this attack as hard as possible, if not impossible
… you can't read enough data back to make the attack successful
Mikhail: idea of caching compiled graphs is great, when we compile the binary blob, when do we retrieve this compiled graph?
Tom: you get the key to the cached compiled graph when you fetch the same weights for the next time
Mikhail: if we rely on weights themselves, this could be broken when we have weight sharing between multiple models
… for example, decode and prefill parts
Tom: we could store both weights
Rafael: I think the intent of this feature is when you compile the graph, it is small enough that it can be cached together with that origin and this avoid the recompile
Tom: with the feedback from Mikhail, need to store both the weights and compiled artifacts
<ningxin> webmachinelearning/
<gb> Issue 807 Caching mechanism for MLGraph (by anssiko) [question] [feature request]
Ningxin: Tom could you clarify what is this proposals relationship with the explicit caching API?
https://
Tom: the proposals seem to be independent, COS is a web platform-level primitive
Tom: welcome WebNN experts to provide comments on the WebNN spec changes
<mklimenko> +1
<DwayneR> +1
<tomayac> +1
RESOLUTION: The group supports exploring WebNN compiled graph caching with Cross-Origin Storage using derived artifacts, next step spec PR to review the proposed WebNN changes in context. Investigate WebNN MLGraph Cache Explainer synergies. (issue #971)
WebNN-WebGPU interop 2027
Anssi: things are aligning here, WebGPU is getting adopted by products, WebNN OT is approaching, and we're rechartering the group for 2027
… now is an appropriate time to refresh our WebNN-WebGPU interop priorities for 2027
… we have open issues related to WebGPU interop not touched in a while, and we should review them to see if there are any updates or new information
Anssi: I'd do a quick checkout on existing issues first and then see what new may be in the pipeline for 2027
Anssi: interopDevice for zero-copy selection issue #941
<gb> Issue 941 WebNN/WebGPU zero-copy device selection (by bbernhar) [webgpu interop] [Agenda+]
Anssi: Bryan, Reilly and MikeW seem to agree that createContext({ interopDevice: gpuDevice }) design is the cleanest approach
… any ongoing prototyping work, blockers the group should know about?
Bryan: high-level spec looks good to me, implementation story for multi-adapter case requires significant work
… from the spec side, pretty stable, one edge case having an explicit export destination for interop devices
Bryan: I'm fine moving this to spec PR phase, not blocking anyone
Anssi: exported GPUBuffer usage flags issue #954
<gb> Issue 954 MLTensor export to GPUBuffer with custom usages? (by mwyrzykowski) [webgpu interop] [Agenda+]
Anssi: MikeW and Bryan agree the best approach is that createExportableTensor() accepts the exact GPUBufferUsageFlags for the exported buffer
… next steps?
Bryan: wanted to ask MikeW if explicit indirect is needed
Anssi: timelines issue #529 and timeline destruction issue #716
<gb> Issue 716 MLBuffer destruction timeline (by reillyeon) [question]
<gb> Issue 529 Specify WebNN timelines (by a-sully) [webgpu interop] [Agenda+]
Anssi: since this issue was opened, the group added [[timeline]] internal slot that is associated with the execution of operations:
https://
Anssi: this internal slot allows us to track the timeline of operations, referenced from methods in the WebNN spec that involve execution of operations:
… 8.3.1. dispatch()
… 8.3.2. createTensor()
… 8.3.3. createExportableTensor()
… 8.3.4. createConstantTensor()
… 8.3.5. readTensor(tensor)
… 8.3.6. readTensor(tensor, outputData)
… 8.3.7. writeTensor()
… 8.3.8. exportToGPU()
… 8.4.1. destroy()
… 8.8. MLTensor interface
… 8.8.1. Creating an MLTensor
… 8.8.2. destroy()
… 8.9.4. build method
Anssi: we also have an open issue for timeline destruction #716 (note that MLBuffer evolved into MLTensor)
<gb> Issue 716 MLBuffer destruction timeline (by reillyeon) [question]
Anssi: and since then we have spec'd MLContext.destroy() and MLTensor.destroy()
https://
https://
Anssi: are we satisfied with the current timeline tracking and destruction mechanisms, what is the remaining work before we can close #529 and #716?
<gb> Issue 529 Specify WebNN timelines (by a-sully) [webgpu interop] [Agenda+]
Bryan: this issue is an old one, so could be stale, not sure if we need a multi-queue timeline model
… question is, is anyone blocked on these two issues?
Anssi: Bryan, can you check if we can close these two issues?
Anssi: there's an older issue requesting sample code for WebGPU interop #343
<gb> Issue 343 Add sample code for WebGPU interop (by huningxin) [editorial] [webgpu interop] [Agenda+]
Anssi: do we have a plan for providing sample code for WebGPU interop?
Bryan: this issue #343 builds upon the old model, I'd see if the new model addresses the concerns of OP in the issue
Anssi: I'd like to brainstorm on any additional opportunities for WebNN-WebGPU interop for 2027
Bryan: we have a use case showing up with video pipelines with SuperRes
… optimization to avoid complex shaders
… issue #961
<gb> Issue 961 Direct Video Plane Access for WebNN (by bbernhar)
Bryan: a lot of models we see are pinned on a specific device, to hit the performance goals, control over the device is important for many use cases
… if the model does not support an op, if zero-copy not working, bad user experience, large performance cliffs developers have to figure out
Anssi: control over explicit device type would address that?
Bryan: right, that would help with these use cases, secondary is to provide detection if zero-copy is supported or not, needs the whole stack
Happy Holidays
Anssi: as the year is coming to an end, I would like to wish everyone Happy Holidays
… thank you all for your contributions this year, it has been a productive, busy and successful year, with more excitement coming in 2027
… our next meeting will take place 14 January 2027, see you all then!