-
Notifications
You must be signed in to change notification settings - Fork 43
Use specific uN
types for ImmLaneIdxM
representations
#256
Comments
To be clear, you're just proposing a change to the boundary between an invalid and a malformed module, right? Not a change to the binary encoding? Seems ok to me, but we should consider @binji's comment from the other thread:
I would be in favor of leaving this to whomever (@dtig?) is writing and reviewing the formal spec to give them the flexibility to simplify things as they see fit. |
Yep. |
I don't see a problem with this, also I think we already catch this as a validation failure in the V8 implementation even though it's not clearly specified here, as intuitively it seemed like the this should be a validation failure - though I can see how as it's not explicit, this can vary based on implementation. Regarding the snippet of the comment, we already need a union of these operations anyway because they don't cleanly fit into the semantics of other operations that are currently in the spec. Though for the purposes of the overview readability I'd prefer that we retain the ImmLaneIdx* representation, and add more details about invalid indices, or maybe that's what @RReverser is proposing? |
@dtig right, the change here would make the following a malformed module instead of an invalid module: |
The current spec text [0] uses a single definition of "lane index" for simplicity, and it is defined as a If we had separate I don't think either is more simple, just different presentation. [0] https://www.ngzhian.com/simd/core/syntax/instructions.html#simd-instructions |
Right, it's just about moving checks earlier so that such mismatch could be reported by parsers rather than validators. |
Yea agree, the point of my post was to highlight what spec changes will need to be made if we were to make this change - which isn't a lot. We can probably discuss this at the next sync #338 |
@alexcrichton, @yurydelendik: I haven't read this too closely but from the subgroup meeting I think this is forward and may affect https://github.com/bytecodealliance/wasm-tools. |
From today's sync meeting, it was agreed that we can make this change:
If anyone foresees issues with this change, please raise it up (thanks Andrew for cc-ing). |
Thanks! |
This is a follow-up to #242 and an extraction from the discussion in WebAssembly/threads#162 (comment).
Short version: could we define binary representations of
ImmLaneIdx*
via custom-lengthu*
types? The WebAssembly grammar already supports arbitrary-sized integers, and normally post-validation step is used for things we'd like to extend or change in the future.I'd argue that all usages of
ImmLaneIdx*
do not fall under this category, as they are in instructions that make sense only with index in the strict given range. So an invalid index should be considered malformed and caught at the parsing stage rather than via post-validation.More specifically, I propose the following representations in
BinarySIMD.md
:Thoughts?
The text was updated successfully, but these errors were encountered: