SumMag:Elixirマクロのメタプログラミングを用いた並列プログラミング拡張機構Hastegaの解析部の設計と実装

Bibliographic Information

Other Title
  • SumMag: Design and Implementation of an Analyzer an Extension Mechanism by Meta-programming Using Elixir Macros

Search this article

Abstract

我々が現在研究開発している並列最適化拡張機構Hastega(ヘイスガ)は,(1)プログラミング言語Elixir(エリクサー)で書かれたコード中のパイプライン演算子とmap関数を用いた記述部分を抽出し,(2)抽出したコードを並列化・最適化したネイティブコードにコンパイルする.本発表で提案・報告するSumMag(サムマグ)は,前者(1)をElixirマクロを用いて実装したメタプログラミングライブラリである.Elixirは,リストとタプルからなる抽象構文木(AST)を操作するようなメタプログラミング機構,Elixirマクロを提供しているので,SumMagの実装に用いた.原理としてはパイプライン化された1つ以上のmap関数の適用をまとめて抽出して関数として分離し,元のElixirコードの該当部分を抽出した関数への呼び出しに置き換える.このときにmap関数で適用される関数をElixirコードのレベルでインライン展開し,かつmap-mapフュージョンを行う.近い将来課題としては,Hastegaの残りの機能を実装してファーストリリースとして完成させOSSとして公開する.

A parallel optimization extension mechanism, Hastega, which we are researching and developing now, (1) extracts description using pipeline operators and map functions from Elixir program code and (2) compiles the extracted code into parallelized and optimized native code. SumMag, which we will propose and report in this presentation, is a meta-programming library is a part of the former (1), and is implemented using Elixir macros. Elixir provides Elixir macros, which is a meta-programming mechanism that operates abstract syntax trees (ASTs) consists of lists and tuples, and SumMag is implemented using them. SumMag works to extract one or more pipe-lined applications of map functions all together into an separated function, and to replace the part of the original code into an invocation to the separated function. At this time, SumMag applies inlining and map-map fusion of the functions applied in the map functions. In the near future, we will implement the rest of functions of Hastega, complete it as the first release, and publish it as an OSS.

Journal

Details

Report a problem

Back to top