Stream: git-wasmtime

Topic: wasmtime / PR #6515 riscv64: Implement SIMD `swizzle` and...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 03 2023 at 17:49):

afonso360 opened PR #6515 from afonso360:riscv-simd-swizzle-shuffle to bytecodealliance:main:

:wave: Hey,

This PR implements the swizzle and shuffle instructions in the RISC-V backend.

swizzle maps directly into vrgather with a SEW of 8, so that's a fairly simple implementation. For shuffle we have to do two vrgathers one for values in the range of the first register and the second for values in range of the second register and merge them together.

I double checked the shuffle implementation, and it seems to match what v8 does.

I also didn't try to include optimized lowerings of swizzle or shuffle.

vrgather is a somewhat special instruction in that it forbids the destination register from being the same as any of the source registers (including the mask register). I've modeled this as an early_def, which seems to be correct based on what I've read from regalloc2 docs, but I'm not 100% sure.

There are a few other instructions like this, but none that we have implemented yet.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 03 2023 at 17:49):

afonso360 requested fitzgen for a review on PR #6515.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 03 2023 at 17:49):

afonso360 requested wasmtime-compiler-reviewers for a review on PR #6515.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 03 2023 at 17:49):

afonso360 requested wasmtime-default-reviewers for a review on PR #6515.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 03 2023 at 17:51):

afonso360 edited PR #6515:

:wave: Hey,

This PR implements the swizzle and shuffle instructions in the RISC-V backend.

swizzle maps directly onto vrgather with a SEW of 8, so that's a fairly simple implementation. For shuffle we have to do two vrgathers one for values in the range of the first register and the second for values in range of the second register and merge them together.

I double checked the shuffle implementation, and it seems to match what v8 does.

I also didn't try to include optimized lowerings of swizzle or shuffle.

vrgather is a somewhat special instruction in that it forbids the destination register from being the same as any of the source registers (including the mask register). I've modeled this as an early_def, which seems to be correct based on what I've read from regalloc2 docs, but I'm not 100% sure.

There are a few other instructions like this, but none that we have implemented yet.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 03 2023 at 17:51):

afonso360 edited PR #6515:

:wave: Hey,

This PR implements the swizzle and shuffle instructions in the RISC-V backend.

swizzle maps directly onto vrgather with a SEW of 8, so that's a fairly simple implementation. For shuffle we have to do two vrgathers one for values in the range of the first register and the second for values in range of the second register and merge them together.

I double checked the shuffle implementation, and it seems to match what v8 does.

vrgather is a somewhat special instruction in that it forbids the destination register from being the same as any of the source registers (including the mask register). I've modeled this as an early_def, which seems to be correct based on what I've read from regalloc2 docs, but I'm not 100% sure.

There are a few other instructions like this, but none that we have implemented yet.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 06 2023 at 16:52):

fitzgen submitted PR review:

LGTM with the following little nitpicks. Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 06 2023 at 16:52):

fitzgen submitted PR review:

LGTM with the following little nitpicks. Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 06 2023 at 16:52):

fitzgen created PR review comment:

Can you either resolve this TODO in this PR or turn it into TODO(#1234) with a reference to a follow up issue?

view this post on Zulip Wasmtime GitHub notifications bot (Jun 06 2023 at 16:52):

fitzgen created PR review comment:

Nitpick: missing trailing newline

view this post on Zulip Wasmtime GitHub notifications bot (Jun 06 2023 at 17:47):

afonso360 updated PR #6515.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 06 2023 at 17:50):

afonso360 has enabled auto merge for PR #6515.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 06 2023 at 20:44):

afonso360 merged PR #6515.


Last updated: Dec 23 2024 at 13:07 UTC