This is the inital patch for RISC-V vector extension (RVV) dialect. This patch include:
- RVV Dialect Definition
- RVV Scalable Vector Type
- RVV Operations
- RVV Intrinsic Operations
- Translation from RVV Dialect to LLVM Dialect
Paths
| Differential D108536
[mlir][RISCVV][RFC] Initial RISCVV Dialect Needs ReviewPublic Authored by zhanghb97 on Aug 23 2021, 3:05 AM.
Details Summary This is the inital patch for RISC-V vector extension (RVV) dialect. This patch include:
Diff Detail
Event TimelineComment Actions some initial comments, we are also having a discussion at discourse in the RFC thread
Comment Actions nit on the naming, rvv feels a bit too general. I'd rather go with a longer name that spells out riscv: riscvv or something related.
zhanghb97 marked 4 inline comments as done. Comment Actions
Comment Actions
Some communities tend to use RVV as the name. For example, the rvv-intrinsic-doc and OpenCV wide universal intrinsic definition: intrin_rvv.hpp. So I also use the RVV on the MLIR side at the very beginning. If the "rvv/RVV" is too general, and to be consistent with MLIR naming convention (arm_sve/ArmSVE, x86vector/X86Vector, etc.), how about using :
What do you think about these names?
Comment Actions As for the integration test, I currently encounter some problems, and I will continue to find some solutions. At the same time, I will try to move the scalable vector type into the vector dialect in the next step. And for the names, if the "rvv" is to general, we can use the following names:
This needs further confirmation.
Comment Actions
zhanghb97 added inline comments.
zhanghb97 retitled this revision from [mlir][RVV][RFC] Initial RVV Dialect to [mlir][RVV][RFC][WIP] Initial RVV Dialect.Aug 31 2021, 8:03 AM Comment Actions For the next step, I will try to give better semantics to the type of RVV:
Comment Actions
Herald added subscribers: wenzhicui, frasercrmck, apazos and 16 others. · View Herald TranscriptSep 14 2021, 1:26 AM
zhanghb97 retitled this revision from [mlir][RVV][RFC][WIP] Initial RVV Dialect to [mlir][RISCVV][RFC] Initial RISCVV Dialect.Sep 14 2021, 1:29 AM Herald added subscribers: vkmr, evandro, benna and 3 others. · View Herald TranscriptSep 14 2021, 1:29 AM Herald added a subscriber: achieveartificialintelligence. · View Herald TranscriptSep 23 2021, 12:52 AM Comment Actions
Have you made more progress on this? I realize this is a bit of a hazzle, but leaving it as a TODO has a very high risk of not being done at all... :-( Comment Actions
I also realize the risk of not having the integration test. If LLVM IR intrinsics are changed (e.g. add a argument like this patch), the unit tests on MLIR will not be affected, but there will be problems when translating to LLVM IR. I am trying to figure out why the cross-compiled lli and mlir-cpu-runner fail to identify the target with the QEMU, And I will also use a RISC-V machine to have a try. Comment Actions
WIP: integration test Comment Actions
Herald added subscribers: awarzynski, sdasgup3, VincentWu. · View Herald TranscriptJan 10 2022, 9:38 PM Comment Actions
My teammate has sent some patches hoping to support JIT for the RISC-V side.
For more details, please see his patches:
Comment Actions
Comment Actions I provide an environment setup document to show how to build the toolchain and perform the integration tests.
Revision Contents
Diff 419638 mlir/include/mlir/Conversion/Passes.td
mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h
mlir/include/mlir/Dialect/CMakeLists.txt
mlir/include/mlir/Dialect/RISCVV/CMakeLists.txt
mlir/include/mlir/Dialect/RISCVV/RISCVV.td
mlir/include/mlir/Dialect/RISCVV/RISCVVDialect.h
mlir/include/mlir/Dialect/RISCVV/Transforms.h
mlir/include/mlir/InitAllDialects.h
mlir/include/mlir/Target/LLVMIR/Dialect/All.h
mlir/include/mlir/Target/LLVMIR/Dialect/RISCVV/RISCVVToLLVMIRTranslation.h
mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp
mlir/lib/Dialect/CMakeLists.txt
mlir/lib/Dialect/RISCVV/CMakeLists.txt
mlir/lib/Dialect/RISCVV/IR/CMakeLists.txt
mlir/lib/Dialect/RISCVV/IR/RISCVVDialect.cpp
mlir/lib/Dialect/RISCVV/Transforms/CMakeLists.txt
mlir/lib/Dialect/RISCVV/Transforms/LegalizeForLLVMExport.cpp
mlir/lib/Target/LLVMIR/CMakeLists.txt
mlir/lib/Target/LLVMIR/Dialect/CMakeLists.txt
mlir/lib/Target/LLVMIR/Dialect/RISCVV/CMakeLists.txt
mlir/lib/Target/LLVMIR/Dialect/RISCVV/RISCVVToLLVMIRTranslation.cpp
mlir/test/CMakeLists.txt
mlir/test/Dialect/RISCVV/legalize-for-llvm.mlir
mlir/test/Dialect/RISCVV/roundtrip.mlir
mlir/test/Integration/Dialect/Vector/CPU/RISCVV/lit.local.cfg
mlir/test/Integration/Dialect/Vector/CPU/RISCVV/test-riscvv-arithmetic.mlir
mlir/test/Integration/Dialect/Vector/CPU/RISCVV/test-riscvv-memory.mlir
mlir/test/Integration/Dialect/Vector/CPU/RISCVV/test-riscvv-stripmining.mlir
mlir/test/lit.site.cfg.py.in
mlir/test/mlir-opt/commandline.mlir
|
Since this is not specific to RISC-V Vector, it should go along the other LLVM Dialect constraints (LLVMOpBase.td).