-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Significant change to RISC V and scalable vector code generation. #7616
Conversation
issues iwth single element vectors being confused with scalars and other conversions that can happen via using call_intrin. Allows using any size vector. Only downside is splitting large vectors no longer happens, but RISC-V allows an LMUL of 8, meaning a vector of up to 8 times the vector register size will compile so this is much less of an issue. Splitting larger vectors can be added. Should also allow fractionaly LMUL in all cases, but this is not verified.
support. Should handle many more cases and be well on the way to handling arbitary vector widths within the LMUL range. More tests added to simd_op_check_riscv . Likely well setup to move SVE2 to a similar approach, perhaps without the full genearilty on vector lengths. (I.e. they may need to be quantized to vscale, or offer better performance in that case.)
…/halide/Halide into riscv_intrinsics_single_lane_fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far. Let me know when I should pull it into google3 for testing.
Looks like some legitimate failures, e.g. https://buildbot.halide-lang.org/master/#/builders/84/builds/40 |
was being presented with a scalar only mismatch. Changed it to ignore scalar to scalar cases.) Address review feedback.
…/halide/Halide into riscv_intrinsics_single_lane_fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending green
…lide#7616) * Completely rework how RISC-V vector intrinsics are called to avoid issues iwth single element vectors being confused with scalars and other conversions that can happen via using call_intrin. Allows using any size vector. Only downside is splitting large vectors no longer happens, but RISC-V allows an LMUL of 8, meaning a vector of up to 8 times the vector register size will compile so this is much less of an issue. Splitting larger vectors can be added. Should also allow fractionaly LMUL in all cases, but this is not verified. * Significant refactor/rewrite of RISC V vector intrinsics support. Should handle many more cases and be well on the way to handling arbitary vector widths within the LMUL range. More tests added to simd_op_check_riscv . Likely well setup to move SVE2 to a similar approach, perhaps without the full genearilty on vector lengths. (I.e. they may need to be quantized to vscale, or offer better performance in that case.) * Formatting fixes. * More formatting. * Don't try to convert void types to match expected vector type. * Backout comment change that is no longer relevant. * Fix failure in camera_pipe app. (Code to make sure vector types match was being presented with a scalar only mismatch. Changed it to ignore scalar to scalar cases.) Address review feedback. * One more review comment. * Comment fix. --------- Co-authored-by: Steven Johnson <[email protected]>
It is now possible to convert between fixed and scalable vectors in LLVM. Full generality is likely not working and various architecture specific intrinsics still require scalable vectors. This PR moves to using fixed vectors to represent types that are not quantized to a vscale size and converting to a longer vscale size as necessary.
RISC V vectorization should support lengths from 2 lanes up to 8 times the number of lanes supported for the given type and vector_bits specified in the target. (All the LMUL values.) 1 lane vectors likely do not work for intrinsics quite yet due to confusion re: scalars, but this PR should remove this case showing up via just doing scalar operations when scalars are involved. (Vector/scalar is supported, and some test cases were added. More coverage for .vi vs .vx forms is needed.)
PR will likely need some changed but want to get review started now.