Skip to content

Implement relaxed SIMD dot product instructions #4586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 11, 2022
Merged

Implement relaxed SIMD dot product instructions #4586

merged 2 commits into from
Apr 11, 2022

Conversation

tlively
Copy link
Member

@tlively tlively commented Apr 7, 2022

As proposed in WebAssembly/relaxed-simd#52.

@tlively tlively requested a review from aheejin April 7, 2022 20:41
Copy link
Member

@aheejin aheejin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the relaxed version instruction i7x16 and not i8x16?

Comment on lines +2375 to +2378
template<size_t Lanes,
size_t Factor,
LaneArray<Lanes * Factor> (Literal::*IntoLanes)() const>
static Literal dot(const Literal& left, const Literal& right) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a brief comment about what this does can be helpful, like, "lane-wise multiply signed n-bit integers in the two input vectors and add adjacent pairs of the full (n*2)-bit results". I wasn't aware that adjacent pairs are added in the result before checking the instruction description myself.

@tlively
Copy link
Member Author

tlively commented Apr 8, 2022

Why is the relaxed version instruction i7x16 and not i8x16?

Apparently it ignores the high bit on one of the inputs. Actually, now that I write that out, I realize that this is not what I implemented in the interpreter. Will fix that.

@tlively
Copy link
Member Author

tlively commented Apr 11, 2022

Actually, the text on the proposal issue is confusing, so I think the code is already correct. The output of the instruction is deterministic if the input is up to 7 bits, but otherwise it may have one of two behaviors. The code in this PR implements the same behavior as ARM, so I don't think it needs to change.

@tlively tlively enabled auto-merge (squash) April 11, 2022 22:24
@tlively tlively merged commit ce0333d into main Apr 11, 2022
@tlively tlively deleted the relaxed-dot branch April 11, 2022 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants