Skip to content

Implement vec256/512 #3966

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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

Implement vec256/512 #3966

wants to merge 11 commits into from

Conversation

TheNumbat
Copy link
Contributor

@TheNumbat TheNumbat commented May 5, 2025

Adds support for 256 and 512 bit vectors throughout the compiler. Generally has exactly the same semantics as 128 bit vectors, but larger. About half of the diff (+5k loc) is from enabling AVX/AVX2 in simdgen.

  • 256-bit types are allowed with simd_beta. The basic tests for 128-bit have been duplicated for 256, but none of the operations in the other tests are implemented yet. AVX and AVX2 architecture extensions have been added and are enabled by default, since we already enable other Haswell extensions.
  • 512-bit types are allowed with simd_alpha. They do not yet have tests and their usage will trigger a fatal error in emit. The AVX512F extension is also disabled by default.

Todo (before review):

  • figure out how to make the runtime save ymm/zmm gc regs
  • fix issues with external aligned stack args
    • when any parameter is 32/64 bytes, stack needs to be 32/64 aligned
    • the 32/64 byte stack parameters also need to be 32/64 aligned

For later PRs:

  • align ocaml stack for vec slots
  • static & reinterpret casts
  • use vex encoding for sse when avx enabled (and evex if avx512)
  • array accessors
  • constants
  • intrinsics
  • avx512 mask registers
  • avx512 tests

@TheNumbat TheNumbat added flambda2 Prerequisite for, or part of, flambda2 backend simd SIMD support labels May 5, 2025
@TheNumbat TheNumbat added the lambda Lambda language changes label May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend flambda2 Prerequisite for, or part of, flambda2 lambda Lambda language changes simd SIMD support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant