Skip to content
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

Add support for generating LLVM vector predication intrinsics. #7111

Merged
merged 22 commits into from
Oct 25, 2022

Conversation

zvookin
Copy link
Member

@zvookin zvookin commented Oct 21, 2022

LLVM now has intrinsics for length bounded, predicated, vector operations. These are a generalization of the current vector IR LLVM has long had and will likely become the preferred way to generate pretty much all vector code in the future. (With appropriately restricted arguments to target existing fixed width SIMD instruction sets.)

Code has been tested in the riscv_update branch and will be used by the RISC V backend. PR has been separated out to make for a smaller, easier to review PR.

This required adding some helper methods to CodeGen_LLVM as the intrinsics have specific type mangling and argument pattterns that can be handled in common code.

@zvookin zvookin requested a review from abadams October 21, 2022 15:45
Copy link
Contributor

@steven-johnson steven-johnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with various style comments.

src/CodeGen_LLVM.h Show resolved Hide resolved
src/CodeGen_LLVM.h Outdated Show resolved Hide resolved
src/CodeGen_LLVM.h Outdated Show resolved Hide resolved
src/CodeGen_LLVM.h Outdated Show resolved Hide resolved
src/CodeGen_LLVM.h Show resolved Hide resolved
src/CodeGen_LLVM.cpp Outdated Show resolved Hide resolved
src/CodeGen_LLVM.cpp Show resolved Hide resolved
src/CodeGen_LLVM.cpp Outdated Show resolved Hide resolved
src/CodeGen_LLVM.cpp Outdated Show resolved Hide resolved
src/CodeGen_LLVM.cpp Show resolved Hide resolved
Z Stern added 5 commits October 24, 2022 18:06
caveperson programmer habits die hard.

Improve comments.
Change TODO(zalman) to TODO(zvookin) uniformly.

Few other cleanups.
strided load for dense case. Add some comments.
@zvookin zvookin merged commit 9163310 into main Oct 25, 2022
@zvookin zvookin deleted the llvm_vector_predication_intrinsics branch October 25, 2022 05:24
ardier pushed a commit to ardier/Halide-mutation that referenced this pull request Mar 3, 2024
…e#7111)

Add support for generating llvm.vp.* intrinsics. This is particularly
useful for RISC V, but it may be a simpler, better optimized path, for
Halide vector operations in general.

Add support for a maximum vector size that might be larger than the
native vector size. RISC V vector LMUL support is an example of an
architecture supporting this.
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.

3 participants