jeffcharles opened PR #8990 from jeffcharles:winch-add-v128-const
to bytecodealliance:main
:
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
Adding support forv128.const
to Winch. Start of work to add SIMD support to Winch for the x64 architecture.
jeffcharles submitted PR review.
jeffcharles created PR review comment:
Not sure if we want to keep the
wasm_features(simd)
check on here since this is a SIMD test. I removed it so the test would run on Winch.
jeffcharles submitted PR review.
jeffcharles created PR review comment:
This is a result of changing how memory values are popped from the stack. It now uses the type of the Wasm value to determine the scratch register to use so this now uses the XMM scratch register instead of a GPR.
jeffcharles submitted PR review.
jeffcharles created PR review comment:
Ditto for this change to the disass.
jeffcharles submitted PR review.
jeffcharles created PR review comment:
This now needs to handle 128 bit values so using the GPR scratch won't work.
saulecabrera requested saulecabrera for a review on PR #8990.
jeffcharles has marked PR #8990 as ready for review.
jeffcharles requested elliottt for a review on PR #8990.
jeffcharles requested wasmtime-compiler-reviewers for a review on PR #8990.
jeffcharles requested wasmtime-core-reviewers for a review on PR #8990.
github-actions[bot] commented on PR #8990:
Subscribe to Label Action
cc @saulecabrera
<details>
This issue or pull request has been labeled: "winch"Thus the following users have been cc'd because of the following labels:
- saulecabrera: winch
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
saulecabrera submitted PR review:
It's going on a good direction!
One thing that we need to also update as part of this PR is the stack alignment details in the ABI.
Currently, the stack alignment and slot size are both set to 8 bytes, given that types > 8 bytes were not supported. We'd probably want to ensure that it's now set to 16.
saulecabrera submitted PR review:
It's going on a good direction!
One thing that we need to also update as part of this PR is the stack alignment details in the ABI.
Currently, the stack alignment and slot size are both set to 8 bytes, given that types > 8 bytes were not supported. We'd probably want to ensure that it's now set to 16.
saulecabrera created PR review comment:
I've been giving a bit of thought to this change. If I'm not wrong the motivation is to future-proof, be explicit and correctly differentiate the scratch register for different types (GPR, FPR) and sizes (FPR vs v128).
I'm wondering if there's an alternative way that would allow a similar outcome without need to introduce more
*_scratch_reg
variations. One option that I can think of is to removescratch_reg
andfloat_scratch_reg
and rely exclusively onscratch_for
andsratch!(M, &ty)
method and macro respectively. This might make it easier to encapsulate the details of which register should be used depending on the type/size/architecture.
saulecabrera edited PR review comment.
jeffcharles submitted PR review.
jeffcharles created PR review comment:
Yeah I debated whether to just use the float scratch register directly but that seemed like it would be mixing different levels of abstraction. Changing everything to use
scratch_for
orscratch!(M, &ty)
instead makes sense to me. I'll make those changes. Might try doing that in a separate PR to keep it easier to review.
jeffcharles submitted PR review.
jeffcharles created PR review comment:
I looked into this a little more, the
scratch!
macro relies onscratch_for
andscratch_for
relies on thescratch_reg
andfloat_scratch_reg
methods being present on the ABI trait. I could removescratch_reg
andfloat_scratch_reg
from the trait and move the implementation ofscratch_for
into the ABI trait implementations. The logic isn't that complicated so repeating the logic in each trait implementation with the registers hard-coded wouldn't necessarily be too bad.Alternatively, I could not add
vector_scratch_reg
on the trait, updatescratch_for
to use thefloat_scratch_register
for v128, and updatestore_impl
to usescratch_for
. That'll avoid having to implementscratch_for
for each ABI trait implementation.
saulecabrera submitted PR review.
saulecabrera created PR review comment:
In my original comment I was leaning more towards the first option from your comment above: moving
scratch_for
to each ABI implementation, hoping to (i) get the most flexibility (architecture-wise) at the cost of some repetition (ii) reduce the number of scratch related methods from the ABI trait.
jeffcharles submitted PR review.
jeffcharles created PR review comment:
Opened https://github.com/bytecodealliance/wasmtime/pull/8999 to do the refactoring.
jeffcharles updated PR #8990.
jeffcharles submitted PR review.
jeffcharles created PR review comment:
I could change this to just reuse the existing floating point register methods given this is inside the x64 ABI if that would be preferable.
jeffcharles commented on PR #8990:
The merge commit removed the new vector method on the ABI trait. Not sure if you would like me to do the same with the
next_vr
and associated methods I've added in the X64ABI file.
jeffcharles requested saulecabrera for a review on PR #8990.
saulecabrera commented on PR #8990:
The merge commit removed the new vector method on the ABI trait. Not sure if you would like me to do the same with the
next_vr
and associated methods I've added in the X64ABI file.Yeah it sounds reasonable to me to get rid of
next_vr
andvector_reg_for
👍🏽
jeffcharles updated PR #8990.
jeffcharles updated PR #8990.
jeffcharles updated PR #8990.
jeffcharles updated PR #8990.
jeffcharles updated PR #8990.
saulecabrera submitted PR review:
This looks great to me, thanks!
saulecabrera merged PR #8990.
Last updated: Dec 23 2024 at 13:07 UTC