Exclusive debut! openEuler mainline integrates LuaJIT RISC-V JIT technology

The RISC-V SIG expects that the innovative version of openEuler 23.09 released with the mainline will integrate LuaJIT RISC-V support. This release will provide a RISC-V environment with complete LuaJIT support and support from related software such as openResty.

As the RISC-V SIG mainline promotion work progresses, support for LuaJIT and related software under the RISC-V architecture has also been incorporated into the openEuler mainline code. This marks that openEuler will become the first mainstream distribution to provide RISC-V architecture support for LuaJIT in the mainline branch.

Advantages and features of LuaJIT

LuaJIT is an efficient Lua5.1 implementation with an efficient interpreter and elegant just-in-time compilation engine. It has an average performance several times that of the original Lua5.1. Not only that, it also has features such as FFI, Bitop extensions and some high-end Lua versions. characteristics. For the above reasons, LuaJIT is widely used and has become the de facto Lua5.1/5.2 runtime.

LuaJIT RISC-V project background

LuaJIT RISC-V (LJRV for short) is a project to port LuaJIT to the 64-bit RISC-V platform. It aims to provide an efficient Lua runtime for the RISC-V platform, so that projects that rely on LuaJIT can also run on the RISC-V platform. Can operate without any hindrance. Previously, related work was still a technical blank in various open source distribution platforms at home and abroad.

Technical challenges and work progress

Since the core part of LuaJIT is written in assembly, porting to different instruction set platforms is very complex. In particular, the JIT part of LuaJIT does not rely on general compilation frameworks such as LLVM. Previously, it has only been transplanted on x86, ARM and other platforms, and the transplantation work of the RISC-V instruction set has not yet begun. A large number of software packages that rely on LuaJIT are in the RISC-V architecture. It may not run on various distributions, or it may only use the low-speed original Lua5.1.

At present, the Institute of Software of the Chinese Academy of Sciences has successfully transplanted most functions of LuaJIT, including the DynASM dynamic assembler, interpreter runtime and RISC-V backend, and has now passed the PUC Lua5.1 regression test and LuaJIT regression test. At the same time, programs that rely on LuaJIT that can be run on the RISC-V 64 platform include Sysbench, Neovim, OpenResty, LÖVE, etc. The known problem is that the Unwinding function has not been fully ported, and some unknown bugs may appear in the JIT. After the relevant work is completed and repaired, the project will be further integrated into the upstream.

In addition, on the openEuler main line, some packages that rely on luajit are deeply integrated, such as openResty, wrk, etc., and the transplantation work requires further adaptation.

Integrate into openEuler main line

Based on the LuaJIT transplant results, RISC-V SIG packages relevant patches and merges them into the LuaJIT master branch of openEuler. This means that starting from the upcoming innovative version of openEuler 23.09, openEuler will natively support LuaJIT of the RISC-V platform and related ecological software packages. This will be the first mainstream release to provide RISC-V architecture support for LuaJIT in the mainline branch.

At the same time, based on LuaJIT development work, RISC-V SIG also provides corresponding support for openResty and other software packages that LuaJIT strongly depends on, and has now been integrated into the main line. The picture below is a demonstration diagram of the operation of Minetest, an open source game that relies on LuaJIT. The environment based on it is the openEuler RISC-V platform and the Unmatched development board. According to user test feedback, the game screen is smooth and the operation delay is low.

picture

Performance comparison and result display

We used PUC Lua5.1, LJRV to turn off JIT, and LJRV to turn on JIT on VisionFive 2 and LicheePi 4A respectively, and ran Lua-Benchmarks. The results in TH1520 and JH7110 environments are as follows:

picture

picture

Guess you like

Origin blog.csdn.net/openEuler_/article/details/132599432