当前位置:首页 > 报告详情

LLVM中RISC-V Vector代码生成功能的改进.pdf

上传人: c** 编号:955300 2025-10-27 19页 345.91KB

1、Improvements to RISC-V Vector code generation in LLVMLuke Lau,Alex BradburyRISC-V Summit Europe 2025RVV codegen developmentImprovements to RISC-V Vector Codegen in LLVMAlex Bradbury,Luke Lau,RISC-V Summit Europe 2025Basic experimental RVV enablement Enablement of RVV codegen by default Expansion of

2、additional RVV extension support Further tuning of performance of generated code We are hereImproving RVV code generationImprovements to RISC-V Vector Codegen in LLVMAlex Bradbury,Luke Lau,RISC-V Summit Europe 2025Objective:faster execution time!Might be achieved by:Avoiding vectorisation when it is

3、nt profitableReducing overhead such as CSR switchingMinimising spillingBetter exploiting capabilities of RVV.Note:this talk gives an overview of recent improvements covering contributions from many companies.Non-power-of-two vectorizationImprovements to RISC-V Vector Codegen in LLVMAlex Bradbury,Luk

4、e Lau,RISC-V Summit Europe 2025Unique to RVV,the vl vector length register can handle vectors of arbitrary(not just power of two)sizesNew in LLVM 20:Support for non-power-of-2 vector widths in the SLP(Superword Level Parallelism)vectorizerImprovements to RISC-V Vector Codegen in LLVMAlex Bradbury,Lu

5、ke Lau,RISC-V Summit Europe 2025struct rgb float r,g,b;void brighten(struct rgb*x,float f)x-r*=f;x-g*=f;x-b*=f;vsetivli zero,2,e32,mf2,ta,mavle32.v v8,(a0)flw fa5,8(a0)vfmul.vf v8,v8,fa0fmul.s fa5,fa0,fa5vse32.v v8,(a0)fsw fa5,8(a0)vsetivli zero,3,e32,m1,ta,mavle32.v v8,(a0)vfmul.vf v8,v8,fa0vse32.v

6、 v8,(a0)clang-O3-march=rva23u64clang-O3-march=rva23u64-mllvm-slp-vectorize-non-power-of-2Non-power-of-two vectorizationvl tail foldingImprovements to RISC-V Vector Codegen in LLVMAlex Bradbury,Luke Lau,RISC-V Summit Europe 2025GCC already performs tail folding=Avoid the need for a separate loop to h

word格式文档无特别注明外均可编辑修改,预览文件经过压缩,下载原文更清晰!
三个皮匠报告文库所有资源均是客户上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作商用。
根据报告的内容,全文主要内容概括如下: - **RVV代码生成改进**:LLVM对RISC-V向量指令集(RVV)的代码生成进行了多项改进,包括基本启用、默认启用、扩展支持以及性能优化。 - **非2的幂次向量化**:LLVM 20版本支持非2的幂次向量宽度,提高了向量化的灵活性。 - **尾折叠优化**:通过使用vl寄存器,LLVM实现了尾折叠,优化了循环的向量化。 - **libcall扩展**:LLVM扩展了对memcpy和memcmp等库函数的向量化支持,减少了函数调用开销。 - **新扩展支持**:LLVM增加了对FP16和BF16等新RVV扩展的支持。 - **优化和工具**:引入了vl优化器、支持llvm-exegesis工具等,提高了代码生成效率和微架构基准测试。 - **测试和未来工作**:增加了新的CI构建器,并计划进一步优化和默认启用更多功能。 核心数据包括: - RVV代码生成性能提升。 - 支持非2的幂次向量宽度。 - 尾折叠优化可减少循环的最小迭代次数。 - 新的libcall扩展减少了函数调用开销。
**RVV向量优化新进展** **LLVM如何提升RISC-V向量性能** **RISC-V向量指令优化挑战与机遇**
客服
商务合作
小程序
服务号
折叠