Repository navigation
Add low-precision floating point data types explainer - #938
Conversation
fdwr
left a comment
There was a problem hiding this comment.
Tis a nice document, thanks for preparing, and I support adding low precision data types (I may just have "are we sure xyz" questions 馃檪).
|
I observe general support and no concerns, see also meeting minutes. @mklimenko-nv, any pending changes you'd still like to integrate into this v1 PR? Otherwise, editors are free to merge this by our next meeting. |
|
@mklimenko-nv thank you, it looks like all feedback has been addressed. The editor are free to merge this explainer PR. @mklimenko-nv are you interested in taking the first stab at the spec PR for this? |
|
@anssiko, yeah, sounds good to me, let me prepare a spec PR for this. Thanks! |
| We propose extending the MLOperandDataType enum and define, how these types interact with typed arrays, since JavaScript lacks native `bfloat16` and `float8` arrays. | ||
|
|
||
| ### 1. Extend MLOperandDataType | ||
| ```javascript |
There was a problem hiding this comment.
Label the IDL snippet as idl or webidl?
| Currently, buffer validation checks that the `ArrayBufferView`'s type matches the operand's data type exactly. There is already precedent for relaxing this: before `Float16Array` existed, `float16` operands accepted a `Uint16Array` as the underlying storage. Following the same pattern, `bfloat16` and `float8e4m3` operands would accept `Uint16Array` and `Uint8Array` respectively as type-punned storage. The validation algorithm needs to be updated to allow this substitution while still validating that the buffer's element count and byte length match the operand's shape and per-element size. | ||
|
|
||
| ## Data types and Q/DQ nodes handling | ||
| Due to a significant variety of hardware available to users, spanning across multiple generations, it is expected that some data types could be unsupported. WebNN delegates the graph execution to the underlying framework (like DirectML, CoreML, Windows ML). |
There was a problem hiding this comment.
Mention LiteRT instead of DirectML, which is consistent with the explainer: https://github.com/webmachinelearning/webnn/blob/main/explainer.md?plain=1#L44
This PR is a first step to add low-precision floating point data types to the WebNN specification. It's a follow-up to #930 with a conservative addition of
bfloat16andfloat8types only, with a potential follow-up for microscaled data types.