Slide 1

Slide 1 text

Expected Application of BeamAsm Susumu Yamazaki Univ. of Kitakyushu 1 ©︎ 2021 Susumu Yamazaki

Slide 2

Slide 2 text

2 ©︎ 2021 Susumu Yamazaki BeamAsm, the Erlang JIT http://erlang.org/documentation/doc-12.0-rc1/erts-12.0/doc/html/BeamAsm.html https://www.erlang-solutions.com/blog/performance-testing-the-jit-compiler-for-the-beam-vm/ Faster + 45% + 30%

Slide 3

Slide 3 text

Expected Application of BeamAsm 1. Code generator from Enum.map or Nx to SIMD or Vector instructions 2. Application-level optimizer that is embedded into BeamAsm 3. Faster FFI than NIFs 3 ©︎ 2021 Susumu Yamazaki

Slide 4

Slide 4 text

Code generator from Enum.map or Nx to SIMD or Vector instructions • Generating SIMD or Vector instructions efficiently performs iteration with collections such as Enum.map and Nx. • The right figure shows performance improvement by Pelemay, which is a code generator from Enum.map with pipeline operators to native code including SIMD instructions. • Moreover, this is realized by a simple transformation rule, so BeamAsm can implement it without a heavy load of generating code. • We believe we can get more improvement of performance if BeamAsm will perform such optimization. 4 ©︎ 2021 Susumu Yamazaki S. Yamazaki and Y. Hisae: Performance Evaluation of SIMD Parallelization for Elixir Based on Skeletons for Data Parallelism, 130th IPSJ-SIGPRO, July, 2020.

Slide 5

Slide 5 text

Application-level optimizer that is embedded into BeamAsm • Specific applications, such as calculating linear algebra, machine learning, and image processing, require more performance. • A general-purpose code optimizer embedded in a compiler cannot generate efficient code because it requires application-specific optimization knowledge, such as formula conversion and proof. • Defining an application-level optimizer expects to bring more efficient optimization. • For robustness, such an optimizer should be managed not to generate harmful code. • This is a research challenge. 5 ©︎ 2021 Susumu Yamazaki

Slide 6

Slide 6 text

Faster FFI than NIFs • We have found that the code that calls NIFs is often slower than the equivalent Erlang or Elixir code optimized by BeamAsm. • EPC WG at EEF (see the right figure) faces this issue. • We hypotheses that foreign native code embedded by BeamAsm will be faster than NIFs. • Such foreign native code should be safe both in terms of type and execution time. • These are also research challenges. 6 ©︎ 2021 Susumu Yamazaki https://erlef.org/wg/epc

Slide 7

Slide 7 text

Summary and Future works • BeamAsm brings more performance to Erlang and BEAM languages. • The applications of BeamAsm that we expect are as follows: 1. Code generator from Enum.map or Nx to SIMD or Vector instructions 2. Application-level optimizer that is embedded into BeamAsm 3. Faster FFI than NIFs • The application-level optimizer and the faster FFI than NIFs have research challenges. 7 ©︎ 2021 Susumu Yamazaki