Skip to content

v8x16.shuffle optimizations needed #2531

Closed

Description

@yurydelendik

I translated the IDCT SSE code into Wasm. The algorithm uses lots of various punpckxxxx instructions, though WebAssembly has v8x16.shuffle. The v8 lowers into native SSE2 equivalents by matching immediate argument. I cannot find if we do it for any of the cranelift backends.

STR:

  1. Use test case at https://github.com/yurydelendik/zbar-wasm/raw/0083a9a48c8c06e5555424d85f71ce5a4b560145/zbar_jpeg/test.wasm
  2. Run time wasmtime run --enable-simd test.wasm --invoke test500

Observe the time; it is about 15 sec here. Node runs test.wasm (_initialize + test500) in about 11 sec here.

It is expected that wasmtime/cranelift will improve the performance by using specialized SSE2 instructions by 40-50%.

Activity

  1. abrown commented on Dec 30, 2020

    @abrown
    Member

    I agree; perhaps this benchmark could be adapted for sightglass?

  2. yurydelendik commented on Dec 30, 2020

    @yurydelendik
    ContributorAuthor

    perhaps this benchmark could be adapted for sightglass?

    Not familiar with the sightglass. Can you sketch what needs to be done?

  3. abrown commented on Dec 30, 2020

    @abrown
    Member

    Here is a high-level document describing the basic idea and here is an example.

  4. alexcrichton commented on Jun 22, 2023

    @alexcrichton
    Member

    Can confirm that all these shuffles are now implemented, even on aarch64 too. All i8x16.shuffle instructions present in the above module are compiled to single-instruction lowerings on both x86_64 and aarch64. In that case I'm going to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions