Skip to content

Support SSE 4.2 for the Singlepass compiler #2775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 17, 2022

Conversation

batconjurer
Copy link
Contributor

Closes #2767

Description

This PR adds support for the SSE 4.2 instruction set in the singlepass compiler. Previously, only AVX was supported. This implementation may also work for SSE 4.1, but this should be double checked. It does use the blendvps instruction indroduced in SSE 4.1, so it cannot support any earlier SSE versions at present for sure.

The following are the main changes:

  • The assembler has changed from a Vec to a struct containing this as well as the corresponding CPU feature (indicating AVX/SSE4.2/...)
  • A set of SSE function macros have been added. To handle non-destructive operations, additional moves may be made before executing the corresponding SSE instruction if src1 != dst
  • A minor change to the EmitterX64 trait. It now has a function for returning a possible CPU feature.
  • The implementation of EmitterX64 for the assembler has obviously changed. It chooses the emitted assembly based on the CPU feature.

Verified

This commit was signed with the committer’s verified signature.
batconjurer Jacob Turner
…tween different simd instruction sets. Partial work on supporting SSE4.2

Verified

This commit was signed with the committer’s verified signature.
batconjurer Jacob Turner
…s. Added >= SSE 4.1 implementation for emit_vblendvpd. Added some TODOs

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was signed with the committer’s verified signature.
batconjurer Jacob Turner

Verified

This commit was signed with the committer’s verified signature.
batconjurer Jacob Turner

Verified

This commit was signed with the committer’s verified signature.
batconjurer Jacob Turner

Verified

This commit was signed with the committer’s verified signature.
batconjurer Jacob Turner
…ns. Changed the roundss/sd function

Verified

This commit was signed with the committer’s verified signature.
batconjurer Jacob Turner

Verified

This commit was signed with the committer’s verified signature.
batconjurer Jacob Turner
…= dst
@syrusakbary
Copy link
Member

bors try

@ptitSeb
Copy link
Contributor

ptitSeb commented Feb 16, 2022

Can you rebase or merge your branch with current source code? The issue with the windows test has been fixed on master.

Verified

This commit was signed with the committer’s verified signature.
batconjurer Jacob Turner
@ptitSeb
Copy link
Contributor

ptitSeb commented Feb 17, 2022

bors r+

bors bot added a commit that referenced this pull request Feb 17, 2022
Merge #2775

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2775: Support SSE 4.2 for the Singlepass compiler r=ptitSeb a=batconjurer

Closes #2767 

# Description
This PR adds support for the SSE 4.2 instruction set in the singlepass compiler. Previously, only AVX was supported. This implementation may also work for SSE 4.1, but this should be double checked. It does use the `blendvps` instruction indroduced in SSE 4.1, so it cannot support any earlier SSE versions at present for sure. 

The following are the main changes:
 - The assembler has changed from a Vec<X64Relocation> to a struct containing this as well as the corresponding CPU feature (indicating AVX/SSE4.2/...)
 - A set of SSE function macros have been added. To handle non-destructive operations, additional moves may be made before executing the corresponding SSE instruction if `src1 != dst`
 - A minor change to the `EmitterX64` trait. It now has a function for returning a possible CPU feature.
 - The implementation of `EmitterX64` for the assembler has obviously changed. It chooses the emitted assembly based on the CPU feature.


Co-authored-by: R2D2 <jacob.turner870@gmail.com>
Co-authored-by: Jacob Turner <jacob.turner870@gmail.com>
@bors
Copy link
Contributor

bors bot commented Feb 17, 2022

Build failed:

@ptitSeb
Copy link
Contributor

ptitSeb commented Feb 17, 2022

sorry, code linter is complaining. you need to run cargo fmt --all.

Verified

This commit was signed with the committer’s verified signature.
batconjurer Jacob Turner
@ptitSeb
Copy link
Contributor

ptitSeb commented Feb 17, 2022

bors r+

@bors
Copy link
Contributor

bors bot commented Feb 17, 2022

@bors bors bot merged commit fba8465 into wasmerio:master Feb 17, 2022
ptitSeb added a commit that referenced this pull request Feb 18, 2022
bors bot added a commit that referenced this pull request Feb 18, 2022
Merge #2795

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2795: Fix singlepass Arm64 since #2775 r=Amanieu a=ptitSeb

# Description
PR #2775 broke Singlepass on Aarm64, since the test to check if the CPU have AVX or SSE 4.2 was done for all Architecture instead of being limited to x86_64.

Co-authored-by: ptitSeb <sebastien.chev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support SSE legacy instructions for the SInglepass compiler
3 participants