Stream: git-wasmtime

Topic: wasmtime / issue #4767 cranelift: Add VEX and EVEX memory...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 24 2022 at 11:21):

afonso360 opened issue #4767:

:wave: Hey,

Feature

We should add the memory encodings for VEX and EVEX instructions.

Benefit

Better codegen.

Implementation

Alternatives

We could keep doing what we do now and have worse codegen.

cc: @abrown

view this post on Zulip Wasmtime GitHub notifications bot (Sep 02 2022 at 15:50):

akirilov-arm labeled issue #4767:

:wave: Hey,

Feature

We should add the memory encodings for VEX and EVEX instructions.

Benefit

Better codegen.

Implementation

Alternatives

We could keep doing what we do now and have worse codegen.

cc: @abrown

view this post on Zulip Wasmtime GitHub notifications bot (Sep 02 2022 at 15:50):

akirilov-arm labeled issue #4767:

:wave: Hey,

Feature

We should add the memory encodings for VEX and EVEX instructions.

Benefit

Better codegen.

Implementation

Alternatives

We could keep doing what we do now and have worse codegen.

cc: @abrown

view this post on Zulip Wasmtime GitHub notifications bot (Sep 02 2022 at 15:50):

akirilov-arm labeled issue #4767:

:wave: Hey,

Feature

We should add the memory encodings for VEX and EVEX instructions.

Benefit

Better codegen.

Implementation

Alternatives

We could keep doing what we do now and have worse codegen.

cc: @abrown

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2023 at 17:41):

afonso360 commented on issue #4767:

We discussed this a little bit in today's cranelift meeting. While it would be nice for cranelift, @cfallin pointed out that it would be slightly less relevant for wasmtime since the instructions that use these memory encodings have alignment restrictions, and WebAssembly has alignment hints but no guarantees, so we can't use it there.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2023 at 22:29):

abrown commented on issue #4767:

I discussed this with @cfallin a bit and wanted to correct some misconceptions. As I did some digging in the x86 manual, the SSE documentation (section 10.3) does indicate that memory operands must be aligned:

The address of a 128-bit packed memory operand must be aligned on a 16-byte boundary, except in the following
cases:
• The MOVUPS instruction supports unaligned accesses.
• Scalar instructions that use a 4-byte memory operand that is not subject to alignment requirements.

But the same restriction does not apply for VEX (read AVX) and EVEX (AVX-512) instructions:

Memory alignment requirements on EVEX-encoded SIMD instructions are similar to VEX-encoded SIMD instructions. Memory alignment applies to EVEX-encoded SIMD instructions in three categories:
• Explicitly-aligned SIMD load and store instructions accessing 64 bytes of memory with EVEX prefix encoded
vector length of 512 bits (e.g., VMOVAPD, VMOVAPS, VMOVDQA, etc.). These instructions always require the
memory address to be aligned on a 64-byte boundary.15-14 Vol. 1
PROGRAMMING WITH INTEL® AVX-512
• Explicitly-unaligned SIMD load and store instructions accessing 64 bytes or less of data from memory (e.g.,
VMOVUPD, VMOVUPS, VMOVDQU, VMOVQ, VMOVD, etc.). These instructions do not require the memory
address to be aligned on a natural vector-length byte boundary.
• Most arithmetic and data processing instructions encoded using EVEX support memory access semantics.
When these instructions access from memory, there are no alignment restrictions.

There are additional benefits to using VEX and EVEX encodings (e.g., using 3 registers) that @cfallin pointed out so I think this issue should still be considered. In fact, this is something I would be interested in helping out with (cc: @alexcrichton, who may have something already in progress).

view this post on Zulip Wasmtime GitHub notifications bot (Feb 16 2023 at 00:13):

alexcrichton commented on issue #4767:

I ended up giving this a stab in https://github.com/bytecodealliance/wasmtime/pull/5795, but it could very well be wrong! (I also didn't handle EVEX yet)

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

alexcrichton commented on issue #4767:

The final bit of EVEX was done in https://github.com/bytecodealliance/wasmtime/pull/6416, so I think this is done now.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 22 2023 at 15:04):

alexcrichton closed issue #4767:

:wave: Hey,

Feature

We should add the memory encodings for VEX and EVEX instructions.

Benefit

Better codegen.

Implementation

Alternatives

We could keep doing what we do now and have worse codegen.

cc: @abrown


Last updated: Oct 23 2024 at 20:03 UTC