-
Notifications
You must be signed in to change notification settings - Fork 158
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
Project Proposal: Support LLVM GlobalISel for RISC-V Vector Extension #410
Comments
Don't forget about CallLowering for vectors, which is part of IR Translation. I think this may be needed so you obey the vector ABI. For example, to lower the function below, we need to know how to lower the vector argument and where to place the vector return value. define <vscale x 8 x i32> @intrinsic_vadd_vi_nxv8i32_nxv8i32_i32(<vscale x 8 x i32> %0, i64 %1) nounwind {
entry:
%a = call <vscale x 8 x i32> @llvm.riscv.vadd.nxv8i32.i32(
<vscale x 8 x i32> undef,
<vscale x 8 x i32> %0,
i32 9,
i64 %1)
ret <vscale x 8 x i32> %a
} to intrinsic_vadd_vi_nxv8i32_nxv8i32_i32:
# %bb.0: # %entry
vsetvli zero, a0, e32, m4, ta, ma
vadd.vi v8, v8, 9
ret I think the SDAG equivalent is in LowerCall, RISCV::CC_RISCV, RISCVTargetLowering::analyzeInputArgs, and analyzeOutputArgs. It may be better to implement the CC_RISCV_FAST_CC if it is simpler. |
This sounds really cool, and quite ambitious, @jiahanxie353! I'm interested to see where this goes. Can you please expand on your evaluation plan to make it as explicit as possible? In particular:
|
Sure! Let me expand on my evaluation plan!
After some research, I found there's no benchmarks/comprehensive test suites for GlobalIsel (I also went to an LLVM office hour today, and the developer confirmed this unfortunate reality). Mostly the tests for GlobalISel tests are just MIR tests that are crafted by the contributers and are submitted with their PR patches. I plan to use
I expect all test cases to pass for the instructions I plan to support (
I looked into Spike and it claim to support RISC-V Vector Extension, as stated in the README:
Totally agree! I was trying to install the simulator and run the actual vector code today, but was stuck on some issues with |
Excellent! All sounds good; thanks!! |
What will you do?
Support LLVM Global Instruction Selection for a subset of RISC-V Vector Extension, namely vector integer add and sub and basic vector load/store.
How will you do it?
Therefore, I will leverage these two, combined with the semantic meaning of LLVM Generic Opcodes and RISC-V Vector Extension Spec to support the aforementioned basic RISC-V Vector Extension instructions.
For the actual implementation, I will support the full pipeline:
The beginning of the pipeline should be straightfoward and interesting things will happen downstream.
How will you empirically measure success?
I will use LLVM IR as inputs and inspect the RISCV-V Vector Extension assembly outputs.
First, I need to make sure the assembly is doing the correct thing as expected.
Then, I will compare my GlobalISel outputs with the outputs from SelectionDAG, which will be used as the ground truth. If these two are equal, that means I have an "optimal" GlobalISel implementation.
Team members:
I will do the implementation job individually, but will ask @michaelmaitland for guidance if necessary.
The text was updated successfully, but these errors were encountered: