-
Notifications
You must be signed in to change notification settings - Fork 43
Add Python pseudocode to memory operations #107
Conversation
Also fix typo in Load and Splat semantics
Change semantics for memory operations to use `from_bytes` to get the lane or vector values from byte array (assume that it would work on `S` type). Change `memory.bytes` -> `memory`, use `bytes(a)` as a way to convert a value to a bytestring.
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.
LGTM, pulling in Deepti for comments (if any), thank you Petr for these changes!
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.
Sorry this is very delayed, I missed that I was added as a reviewer on this.
The functions below are all memory operations, and they should use the memarg correctly, i.e. currently it looks like it's only reading from the start of the memory, but memarg contains an address offset and the expected alignment that is not accounted for here. Offset should be used to calculate effective address, and even though unaligned loads/stores are supported, I think the alignment hint here should be specified.
Sorry, I lost track of this. I was under impression that alignment hint should not affect the address, that's why only offset is used in this PR. Alignment has seemed a bit of a murky area to me, any clarity would be greatly appreciated :) From docs on webassembly.org:
Also, similar language in current spec on github:
|
Right, alignment hints are part of the To keep the naming consistent, the pseudocode should use |
Good point on offset, changed that. |
Sorry I wasn't clear in my earlier comment, I did mean that memarg.offset should be used instead of memory start as it's confusing to use terminology not a part of memarg, looks like that's fixed now so that part of the PR lgtm. By accounting for alignment as well, I meant that if the specified alignment is larger than the natural alignment of s128 type, that will be a validation failure, and pseudo code should probably account for that? I can see how that's probably out of scope for this PR as the rest of the text in SIMD.md doesn't talk about validation failures right now so approving. But this is more noticeable in pseudocode as that is more explicit about the operation. |
The semantics here are not quite right, |
Introducing pseudocode for memory operations.