Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Expected Application of BeamAsm

Expected Application of BeamAsm

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.

Susumu Yamazaki (ZACKY)

August 26, 2021
Tweet

More Decks by Susumu Yamazaki (ZACKY)

Other Decks in Research

Transcript

  1. 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%
  2. 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
  3. 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.
  4. 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
  5. 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
  6. 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