Skip to content

Latest commit

 

History

History
657 lines (525 loc) · 49.6 KB

2022-10-01.md

File metadata and controls

657 lines (525 loc) · 49.6 KB

PLCT开源进展·第38期·2022年10月01日

卷首语

秋天是舒适和收获的季节。对于许多城市的伙伴而言,炎热的夏天终于过去,拉闸限电的恐惧也得以解除。PLCT实验室和TARSIER团队在过去的一个月,是忙碌且喜悦的:PLCT的创始人吴伟当选为新一届的LLVM基金会理事,任期2年;从2020年开始移植的 AOSP RISC-V 项目开始被 Google Android 团队逐步接收;PLCT新的调试器的课程开始筹备并将于10月开始连载;Spidermonkey 的 RISC-V JIT porting 正在顺利进行;LuaJIT 的 RISC-V porting 也开始有了起色,有可能在8周之后完成;RISC-V集群的搭建还处于筹备状态,看起来十月份要加油了。

在10月份,我们开始准备两个新的工作:2023年的 PLCT Roadmap 要开始准备,aka 许愿池2023计划要开始启动了。另一项工作是TARSIER团队开始认真的考虑维护一个RV32GC的Linux发行版。

祝福大家长假快乐,并期待在这个长假中各位都能有很好的收获。

本期亮点

PLCT创始人吴伟当选LLVM基金会理事

在2022年8月份的LLVM基金会理事会(Board of Directors, BoD)换届选举中,来自PLCT实验室的吴伟成功当选为新一届理事。这(应该)是LLVM基金会自2014年组建以来第一次有中国或东亚地区的成员进入理事会。

LLVM基金会自2014年组建以来,共设置9个理事席位,其中有包含创始人 Chris Lattner 在内的6名常任理事和3名非常任理事。非常任理事每两年改选一次。吴伟先生的任期将从2022年10月开始至2024年10月结束。请注意,LLVM基金会并不直接干预LLVM社区的技术演进方向,主要在社区运营、基础设施、法务等方面进行协调决策。

详细报道

RISC-V架构补丁开始被AOSP官方接收

AOSP官方社区接收了第一个 RISC-V 移植相关的代码补丁。这标志着RISC-V架构开始进入 Android 上游(upstream)生态支持。这一成果的取得并非轻松。RISC-V 社区移植AOSP的(公开)努力从2020年开始,历经了 Android 10 和Android 12 两个版本的 out-of-tree 的移植维护,多家成员单位投入了大量的资源和精力。

PLCT实验室是第一个公开进行AOSP移植工作的团队。从2020年8月份开始,2020年11月完成了初步的移植工作。阿里巴巴平头哥最早完成AOSP整体移植,并在2021年1月21日宣布进行开源。之后,AOSP的移植项目开始转由 RISC-V 国际基金会进行管理和协调。中科院软件所逐步将自己的移植汇总到了RISC-V国际基金会托管下的移植工程里。而RISC-V国际基金会开始积极、长期地与 Google Android 团队进行沟通,商讨AOSP项目官方支持RISC-V的时机和必要的技术前提。

目前还有很多工作需要完成,如果你对 AOSP for RISC-V 项目感兴趣,欢迎找汪辰老师聊一聊。汪辰老师是最早(公开)发起 AOSP for RISC-V 项目的开发者。他的邮箱是 [email protected]

最后,再次感谢所有参与 AOSP for RISC-V 开源项目的开发者和团队!

详细报道

[10月新课预告] 进击的调试器:调试器内部原理与RISC-V架构支持

调试器(例如gdb/lldb)在软件开发过程中被广泛使用,但是有能力和机会从事调试器开发的技术专家非常稀有。PLCT实验室致力于RISC-V相关的移植优化工作,在对GNU工具链、Clang/LLVM工具链进行功能扩展和知识梳理时,注意到国内外关于调试器原理及实现相关的教学课程处于近似空白状态。因此,决定开设系列讨论课程并将内容免费公开。欢迎广大技术爱好者参与学习和讨论,期待大家的共同进步。

PLCT实验室一直致力于国内编译器、虚拟机等重要基础软件的教学工作及人才培养。在过去三年已经逐步积累完成了编译器、模拟器、虚拟机、RISC-V操作系统等系列课程的制作和推广。本次调试器课程的推出,将使得PLCT实验室的公开教学体系更加完善。

详细报道

V8 for RISC-V

修复bug

  1. 修复没有正确插入 vsetvli指令的问题 3917324: [riscv] Fix not calling vsetvli to set vtype correctly after branch | https://chromium-review.googlesource.com/c/v8/v8/+/3917324
  2. 修复在rv32平台当移位量小于-32时结果不正确 3912629: [riscv] Fix shift error when the shift amount is less than or equal to -32 | https://chromium-review.googlesource.com/c/v8/v8/+/3912629
  3. 修复rv64平台遇到uint32 compare时,source location不准确的问题 3903733: [riscv] Don't cover when node is Trap and uint32 compare | https://chromium-review.googlesource.com/c/v8/v8/+/3903733

Port上游更新

  1. 3905856: [riscv] Port 3904233: Remove unused RelocInfo::Mode
  2. 3867138: [riscv] Port [wasm] Keep call_indirect index on the stack | https://chromium-review.googlesource.com/c/v8/v8/+/3867138
  3. 3885380: [riscv] Port [log][compiler] Enable first-execution logging | https://chromium-review.googlesource.com/c/v8/v8/+/3885380
  4. 3886478: [riscv] Port [wasm][liftoff] Fix and cleanup tracing of return value | https://chromium-review.googlesource.com/c/v8/v8/+/3886478

OpenJDK for RV32GC(史宁宁)

代码提交:

  1. Remove the lShiftL_regI_immGE32 openjdk-riscv/jdk11u#498
  2. Fix the lShiftL_reg_reg openjdk-riscv/jdk11u#499
  3. Rewrite the lShiftL_reg_reg and fix the lShiftL_reg_imm openjdk-riscv/jdk11u#500
  4. Remove the comment of subI_reg_imm openjdk-riscv/jdk11u#501
  5. Remove smulI and coments of mulI openjdk-riscv/jdk11u#502
  6. Fix the mulHiL_rReg openjdk-riscv/jdk11u#503
  7. Fix the signExtractL openjdk-riscv/jdk11u#504
  8. Fix the urShiftP_reg_imm openjdk-riscv/jdk11u#506
  9. Fix the urShiftL_reg_reg/imm openjdk-riscv/jdk11u#507
  10. Fix the rShiftL_reg_reg/imm openjdk-riscv/jdk11u#508
  11. Fix the regL_not_reg openjdk-riscv/jdk11u#509
  12. Fix the andL_reg_reg/imm openjdk-riscv/jdk11u#510
  13. Clean the code of orL&&xorL openjdk-riscv/jdk11u#511
  14. Refactor the grevw system openjdk-riscv/jdk11u#512
  15. Fix the bytes_reverse_int/long openjdk-riscv/jdk11u#513
  16. Fix the convUI2L_reg_reg openjdk-riscv/jdk11u#514
  17. Fix the format of convP2I in riscv32.ad openjdk-riscv/jdk11u#515
  18. Fix the MoveD2L_stack_reg openjdk-riscv/jdk11u#516
  19. Fix the MoveL2D_reg_stack openjdk-riscv/jdk11u#517
  20. Fix the MoveD2L/MoveL2D_reg_reg openjdk-riscv/jdk11u#518
  21. Fix the cmpL3_reg_reg openjdk-riscv/jdk11u#519
  22. Fix the reg params of string_compareXXX openjdk-riscv/jdk11u#520
  23. Fix the get_and_addLXXX openjdk-riscv/jdk11u#523
  24. Fix the get_and_addLXXXAcq openjdk-riscv/jdk11u#524
  25. Fix the ALU_COST of get_and_addLXXX_ALU_COST openjdk-riscv/jdk11u#525
  26. Fix the loadConL openjdk-riscv/jdk11u#526
  27. Fix the addL_reg_imm openjdk-riscv/jdk11u#527
  28. Fix the subL_reg_imm openjdk-riscv/jdk11u#528
  29. Fix the L2F/F2L openjdk-riscv/jdk11u#529
  30. Fix the D2L/L2D using the call_vm openjdk-riscv/jdk11u#530
  31. Remove the get_and_setL/addL openjdk-riscv/jdk11u#532
  32. Remove the get_and_addLAcq instructs openjdk-riscv/jdk11u#533
  33. add long cmp framework in the MacroAssembler openjdk-riscv/jdk11u#534
  34. Add the insns of long compare funs in C2 openjdk-riscv/jdk11u#535
  35. Add ulong compare funcs openjdk-riscv/jdk11u#536
  36. Add is_far param for some long compare funcs openjdk-riscv/jdk11u#537
  37. Use the long_cmp_branch to instead of the cmp_branch openjdk-riscv/jdk11u#538
  38. Remove the error comment openjdk-riscv/jdk11u#539

文章:

  1. OpenJDK RISC-V架构的宏汇编器和汇编器的实现 https://zhuanlan.zhihu.com/p/567690611

OpenJDK upstream (Mostly RV64-related)

  1. Merged jdk-mainline PRs:
  • openjdk/jdk#10368 (8294083: RISC-V: Minimal build failed with --disable-precompiled-headers)
  • openjdk/jdk#10382 (8294183: AArch64: Wrong macro check in SharedRuntime::generate_deopt_blob)
  • openjdk/jdk#10439 (8294430: RISC-V: Small refactoring for movptr_with_offset)
  • openjdk/jdk#10137 (8293290: RISC-V: Explicitly pass a third temp register to MacroAssembler::store_heap_oop)
  • openjdk/jdk#10194 (8293474: RISC-V: Unify the way of moving function pointer)
  • openjdk/jdk#10210 (8293524: RISC-V: Use macro-assembler functions as appropriate)
  • openjdk/jdk#10261 (8293769: RISC-V: Add a second temporary register for BarrierSetAssembler::load_at)
  1. Reviewed jdk-mainline PRs:
  1. Sponsored jdk-mainline PRs:
  • openjdk/jdk#10095 (8293100: RISC-V: Need to save and restore callee-saved FloatRegisters in StubGenerator::generate_call_stub)
  1. Reviewed/Discussed RISC-V Foreign-API & RVC:
  1. Loom RISCV Port:

OpenJDK upstream(张定立)

OpenJDK upstream(曹贵)

  1. Vector-API support
  1. Vector-API doc, test, discussion

OpenJDK8 backporting (章翔)

1、Fix some type errors and add files such as jvm.cfg for debug

2、Fix undefined symbol and make slowdebug

3、The discussion of aarch64 on JDK8

Clang/LLVM for RISC-V 相关工作

gollvm 相关工作

mold 相关工作

GNU Toolchain for RISC-V 相关工作

  1. gcc相关工作
  1. binutils相关工作
  1. RVI社区相关工作
  1. GNU Cauldron会议信息

AOSP for RISC-V

Arch Linux for RISC-V

Gentoo for RISC-V

Nixpkgs for RISC-V

Firefox (Spidermonkey) on RV64GCV

Jittest status

9096个通过 715个失败 26个超时 通过率92.4%

更新的PR:

  • f465697b3235a Fix condition signed (#31)
  • c228b0324ab2a fix tramploine emit (#30)
  • db01d9cf3b474 Implement macro assembler (#29)
  • 581addf2cf15d Enbale codegen (#28)
  • a84789fc7f509 Enbale codegen (#26)
  • dab9cfa2ef081 Enable simulator (#25)
  • 90d208478e705 enable spew (#24)
  • edf51d6187c79 Create runtime successfully (#23)
  • b955dad4a3141 Implement partlt func (#21)
  • 676253d9b149c delete obj (#22)
  • 56c1347a9e5b2 fix build (#20)
  • 4e2c8da9432a3 add cross build (#18)
  • 9145e82ce2f6c fix build (#16)
  • 3312c423c71d3 Implement some func (#40)
  • e55c9aa55a3b1 fix block (#39)
  • 76d629b36f056 fix float reg alloc (#38)
  • 295c061e92a98 fix-osi (#37)
  • 272b49b480c08 fix asmjs (#36)
  • 3826c654a3e6f fix WriteLoad64Instructions (#35)
  • 9c0c93b5e5421 fix ror/rol (#34)
  • ef8c23b7402e7 [wasm] add ptr patch call (#33)
  • cd4090eac5d48 Fix unbox (#32)

Enable DynamoRIO running on RV64GC

当前 DynamoRIO 进度处在初期支持阶段,目前已经能在 RV64GC 上进行编译(无功能)。

对 DynamoRIO 的支持可以分五个大阶段进行:

  1. 添加 RISC-V 平台独立的函数(框架)/定义等,以满足「可在 RISC-V 上成功编译」的目标 (基本完成)
  2. 为 RISC-V 设置 CI 以进行自动化编译和测试 (正在进行)
  3. 完善 RISC-V 相关函数/定义,对于一个简单程序,使得 DynamoRIO 在自带示例工具下工作 (正在进行)
  4. 完善 RISC-V 相关单元测试/功能测试,设置 CI 以执行自动化测试,为后续维护提供方便
  5. 继续提升对 RISC-V 的支持以适用更复杂的程序,以及长期的维护工作

更详细的进度及 todo 列表,请查阅 https://gist.github.com/bekcpear/7c9e710ee5b674888fcf5e5d8445dc16

OpenCV for RV64GCV

Google Summer of Code (GSoC) 2022 已经完结,在今年的 GSoC 中,我们 1.扩展了现有 Universal Intrinsic 的设计,使其支持可变长向量体系结构;2.在新的 Universal Intrinsic 框架下实现了新的 RISC-V Vector(RVV) 后端,相较于原有的 RVV 后端,新的后端支持了可变长的寄存器宽度,并解决了生成冗余 Load/Store 指令的问题; 3. 使用新的 Universal Intrinsic 改写了部分 SIMD 循环,从而获得 RVV 平台上的性能数据.

以图像处理中常用的中值滤波为例,使用 PLCT 实验室的 gem5 模拟器观测指令的执行条数和执行周期数,在指令执行条数和周期数方面均获得了60%以上的性能提升:

scalar vector Reduction
Number of instructions committed 2.82E+08 9.81E+07 65.23%
Number of ticks simulated 1.70E+11 6.20E+10 63.56%

相关Patch:

  • PR #22179: New universal intrinsic backend for RVV.
  • PR #22278: Fix compile errors.
  • PR #22292: Fix compilation errors and warnings when using MSVC on Windows.
  • PR #22353: Add more universal intrinsic implementations for RVV.
  • PR #22429: Add remaining universal intrinsic implementations for RVV.
  • PR #22463: Redesign the SIMD macro.
  • PR #22520: Modify the SIMD loop in color_hsv.
  • PR #22558: Fix v_signmask for RISC-V Vector.

关于该项目的更多信息:

Experimental/simd in LIBCXX

  • 使用Clang vector builtins优化reduce相关接口
  • 修复了simd.cast模块下的所有接口
  • 修复了simd_mask内置类型初始化,统一了mask的内部表示形式并修正相关测试
  • 修复了scalar ABI下的operators相关接口

LuaJIT RV64G porting

gem5

V 扩展支持工作

  • 新增 Stride Store 系列指令
  • 新增 Index Load/Store 系列指令
  • 新增 v*.m 系列指令

Spike

QEMU

Other Support for RISC-V International

SAIL/ACT

在方舟开源编译器社区的工作

PLCT实验室的史宁宁依然每周在更新方舟编译器社区周报(OpenArkCompiler Weekly),目前已经更新到第132期。

方舟编译器周报每周日晚上通过Repo、知乎、Bilibili和邮件列表发布。

MLIR

Upstream RVV Dialect Proposal

OSPP Mentorship

Buddy Compiler OSPP 2022 开发阶段完成,进入 Review 阶段:

Buddy Compiler

Buddy Compiler Website

buddy-mlir

https://github.com/buddy-compiler/buddy-mlir

New features:

  • Add VP intrinsic memory examples for fixed and scalable vector type.
  • Add VP intrinsic fma examples for scalable vector type.

Chisel / FIRRTL (CAAT小队)

coreboot for riscv

本期没有新的进展

openocd

  • riscv断点设置添加match napot和match range支持,并在不支持时回退;并把trigger类型的检测前移到trigger的枚举中,减少查找空闲trigger对tselect和tdata1的读写。#725

opensbi

  • Andes平台的更新,移除一些专有设备代码使用fdt设备驱动,移除cache相关的初始化在uboot-spl中已实现,通过fdt获取平台名称和核心数目。link
  • 修正sbi_strnlen的一个bug。link
  • fdt_pmu_\setup添加错误处理。link
  • 添加文档,用于检测防止payload太大被fdt覆盖。link
  • 给riscv添加semihosting支持用于早期通过调试器打印错误信息,借鉴了arm实现,通过ebreak指令进入调试异常和主机通信。link
  • 文档修正一些拼写错误。link
  • SBI Debug Trigger Extension 扩展的讨论。link

u-boot

本期没有新的进展

Aya Theorem Prover

Watch Aya Prover

Watch Aya Intellij Plugin

RISCV平台测试测评工作

RVLab相关工作

1.linux kernel CI相关,包括:

2.rvlab基础设施搭建

  • 给1台unmatched安装debian新镜像
  • 在rvlab内网的中的一台x86电脑上部署了rvlab硬件管理平台,目前可以实现的功能是远程开机/关机/重启
  • 对一台因文件系统损坏而无法正常启动的unmatched进行修复,让其可以正常启动并登录

3.其他

openEuler for RISC-V

Debian for RISC-V

  • 已经改为双周报形式,直接在 debian-riscv 邮件列表中发布。

参考链接