Stream: git-wasmtime

Topic: wasmtime / PR #8596 riscv64: Improve pattern matching rul...


view this post on Zulip Wasmtime GitHub notifications bot (May 11 2024 at 11:38):

afonso360 opened PR #8596 from afonso360:riscv-fma-v3 to bytecodealliance:main:

This commit reworks our FMA pattern matching to be slightly less verbose. It additionally adds the (fma x (splat y) z) pattern for vectors, which can be proven to be equivalent to (splat x).

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2024 at 11:38):

afonso360 requested fitzgen for a review on PR #8596.

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2024 at 11:38):

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

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2024 at 11:42):

afonso360 edited PR #8596:

:wave: Hey,

This PR reworks our FMA pattern matching to be slightly less verbose using the suggestions provided by @jameysharp on https://github.com/bytecodealliance/wasmtime/pull/8588#issuecomment-2103773727.

It additionally adds the (fma x (splat y) z) pattern for vectors, which can be proven to be equivalent to (splat x). See https://github.com/bytecodealliance/wasmtime/pull/8588#issuecomment-2105622411. I've only added ISA tests for these patterns since it turns out they are already present in the SIMD FMA runtests.

I think all of the patterns matched here are sound although I can't formally prove all of them. This comment https://github.com/bytecodealliance/wasmtime/pull/8588#issuecomment-2105622411 describes most of the validations that I did.

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2024 at 11:43):

afonso360 edited PR #8596:

:wave: Hey,

This PR reworks our FMA pattern matching to be slightly less verbose using the suggestions provided by @jameysharp on https://github.com/bytecodealliance/wasmtime/pull/8588#issuecomment-2103773727.

It additionally adds the (fma x (splat y) z) pattern for vectors, which can be proven to be equivalent to (fma (splat x) y z). See https://github.com/bytecodealliance/wasmtime/pull/8588#issuecomment-2105622411. I've only added ISA tests for these patterns since it turns out they are already present in the SIMD FMA runtests.

I think all of the patterns matched here are sound although I can't formally prove all of them. This comment https://github.com/bytecodealliance/wasmtime/pull/8588#issuecomment-2105622411 describes most of the validations that I did.

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2024 at 11:44):

afonso360 edited PR #8596:

:wave: Hey,

This PR reworks our FMA pattern matching to be slightly less verbose using the suggestions provided by @jameysharp on https://github.com/bytecodealliance/wasmtime/pull/8588#issuecomment-2103773727.

It additionally adds the (fma x (splat y) z) pattern for vectors, which can be proven to be equivalent to (fma y (splat x) z). See https://github.com/bytecodealliance/wasmtime/pull/8588#issuecomment-2105622411. I've only added ISA tests for these patterns since it turns out they are already present in the SIMD FMA runtests.

I think all of the patterns matched here are sound although I can't formally prove all of them. This comment https://github.com/bytecodealliance/wasmtime/pull/8588#issuecomment-2105622411 describes most of the validations that I did.

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2024 at 11:44):

afonso360 edited PR #8596.

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2024 at 14:08):

fitzgen requested jameysharp for a review on PR #8596.

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2024 at 14:08):

fitzgen commented on PR #8596:

Redirecting to @jameysharp since it seems like he has more context here.

view this post on Zulip Wasmtime GitHub notifications bot (May 12 2024 at 20:40):

jameysharp submitted PR review:

Fantastic, I love that this worked out, and I really appreciate the effort you put into using Alive2 to check which of my guesses were correct. Too bad about signed zeroes…

By the way, this motivated me to write up #8599, which would make this kind of pattern easier to write someday.

view this post on Zulip Wasmtime GitHub notifications bot (May 12 2024 at 20:40):

jameysharp submitted PR review:

Fantastic, I love that this worked out, and I really appreciate the effort you put into using Alive2 to check which of my guesses were correct. Too bad about signed zeroes…

By the way, this motivated me to write up #8599, which would make this kind of pattern easier to write someday.

view this post on Zulip Wasmtime GitHub notifications bot (May 12 2024 at 20:40):

jameysharp created PR review comment:

Interesting, why does this rule need a priority?

view this post on Zulip Wasmtime GitHub notifications bot (May 12 2024 at 21:05):

afonso360 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (May 12 2024 at 21:05):

afonso360 created PR review comment:

Oops, it shouldn't. I was debugging some stuff and forgot to remove it.

view this post on Zulip Wasmtime GitHub notifications bot (May 12 2024 at 21:06):

afonso360 updated PR #8596.

view this post on Zulip Wasmtime GitHub notifications bot (May 12 2024 at 21:07):

afonso360 has enabled auto merge for PR #8596.

view this post on Zulip Wasmtime GitHub notifications bot (May 12 2024 at 21:48):

afonso360 merged PR #8596.


Last updated: Dec 23 2024 at 13:07 UTC