Deepmind opened code S6, libraries with implementation of JIT compiler for CPYTHON

DeepMind, which was famous for its developments in the field of artificial intelligence, opened the initial texts of the project s6 , which developed a JIT comparator for Python language . The project is interesting to design in the form of a library, integrated with the standard CPYTHON, which provides full compatibility with CPYTHON and does not require modification of the interpreter code. The project has developed since 2019, but unfortunately it has been riveted and is no longer developing. Since the created developments can be useful to improve Python, it was decided to open the original texts. The JIT-compile code is written in C ++, based on Cpython 3.7. and open under the license Apache 2.0.

In terms of solved problems, the S6 for Python is compared with the V8 engine for JavaScript. The library is replaced by the existing processor of the CEVAL.C bytcode interpreter with its own implementation using JIT-compilation to accelerate execution. S6 checks whether the current function has already been compiled and, if yes, executes the compiled code, and if not, it starts the function in the interpretation mode of the bytcode, similar to the interpreter of the CPYTHON. During the interpretation, the number of performed instructions and appeals associated with the processed function is calculated. After reaching a certain line, to accelerate the frequently performed code, the compilation process is initiated. Compilation is made in an intermediate representation of Strongjit, which after optimization is converted into the machine instructions of the target system using the library asmjit .

..

Depending on the nature of the load, S6 under optimal conditions demonstrates an increase in the speed of testing to 9.5 times compared to the usual CPYTHON. When you start 100 iterations of the test set richads 7 times, and when the test is launched radiote , in which is present a large volume of mathematical calculations – 3-4.5 times.

of the tasks that are poorly optimized using S6, are called projects using with API, such as Numpy, as well as operations related to the need to check the types of a large number of values. Low performance is also observed for single calls of resource-intensive functions due to the use of the Python interpreter in the S6 of its own non-optimized implementation (development has not reached the optimization of the interpretation mode). For example, in the test

/Media reports.