Stream: git-wasmtime

Topic: wasmtime / PR #9794 pulley: Refactor conditional branches...


view this post on Zulip Wasmtime GitHub notifications bot (Dec 11 2024 at 20:36):

alexcrichton opened PR #9794 from alexcrichton:pulley-condition-refactor to bytecodealliance:main:

This commit first fixed an issue with table access codegen to disable
spectre mitigations on Pulley targets like how spectre is disabled for
memory accesses as well. This unblocked many tests related to tables
which then led to a different error about a trapnz with an 8-bit value
not being supported.

In fixing trapnz with 8-bit values this PR went ahead and did a
general-purpose refactoring for how conditional branches are managed.
Previously conditional traps and conditional branches had some
duplicated logic and the goal was to unify everything. There is now a
single Cond which represents the condition of a conditional jump which
is used uniformly for all locations such as select, brif, and
trap[n]z. This new type represents all the sorts of conditional
branches that can be done in Pulley, for example integer comparisons and
whether or not a register is zero. This Cond type has various helpers
for printing it, inverting it, collecting operands, emission, etc.

The end result is that it's a bit wordy to work with Cond right now
due to the size of the variants but all locations working with
conditional traps are deduplicated and now it's just repetitive logic
rather than duplicated logic.

Putting all of this together gets a large batch of spec tests working.

I'll note that this does remove a feature where trapnz was turned into
nothing or an unconditional trap if the argument was a constant, but
that feels like an optimization perhaps best left for the middle-end
rather than doing it in the backend.

cc https://github.com/bytecodealliance/wasmtime/issues/9783

view this post on Zulip Wasmtime GitHub notifications bot (Dec 11 2024 at 20:36):

alexcrichton requested cfallin for a review on PR #9794.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 11 2024 at 20:36):

alexcrichton requested wasmtime-compiler-reviewers for a review on PR #9794.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 11 2024 at 20:36):

alexcrichton requested wasmtime-core-reviewers for a review on PR #9794.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 11 2024 at 20:36):

alexcrichton requested fitzgen for a review on PR #9794.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 11 2024 at 20:36):

alexcrichton requested wasmtime-default-reviewers for a review on PR #9794.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 11 2024 at 20:36):

alexcrichton commented on PR #9794:

Note this is currently based on https://github.com/bytecodealliance/wasmtime/pull/9793

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

github-actions[bot] commented on PR #9794:

Subscribe to Label Action

cc @cfallin, @fitzgen

<details>
This issue or pull request has been labeled: "cranelift", "isle", "pulley", "wasmtime:api"

Thus the following users have been cc'd because of the following labels:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Dec 12 2024 at 00:02):

alexcrichton updated PR #9794.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 12 2024 at 00:03):

alexcrichton edited a comment on PR #9794:

~~Note this is currently based on https://github.com/bytecodealliance/wasmtime/pull/9793~~

view this post on Zulip Wasmtime GitHub notifications bot (Dec 12 2024 at 14:01):

fitzgen commented on PR #9794:

I'll note that this does remove a feature where trapnz was turned into
nothing or an unconditional trap if the argument was a constant, but
that feels like an optimization perhaps best left for the middle-end
rather than doing it in the backend.

Agreed that ideally that would happen in the mid-end, but FWIW the mid-end doesn't have the power to do that currently. I think it is ultimately fine to remove this now tho, and if it is ever an issue in the future we can address it again at that point.

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

fitzgen submitted PR review.

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

fitzgen merged PR #9794.


Last updated: Dec 23 2024 at 12:05 UTC