Vengineerの戯言

人生は短いけど、長いです。人生を楽しみましょう!

Dynamically loadable XLA plugin proposal


Intel Nervana nGraphC++バージョンが公開されたということを
2018年3月19日のブログIntel nGraph C++ Version公開に書きました。

その時は、TensorFlow r1.3版のXLAでしたが。。。

その後、XLAのGoggle Group : XLA development
に、IntelのAvijit ChakrabortyさんからDynamically loadable XLA pluginというスレッドが立ち、
A dynamically loadable XLA plugin proposalという資料がアップされました。

引用(3ページ目)
 • Just a normal dynamic shared object library, loaded at run time (using dlopen)
  • The plugin is written using c++ and located outside of TensorFlow source tree
  • Depends on include files from TF installation (i.e., from Python site packages/tensorflow/include)
  • Links with libtensorflow_framework.so
  • The plugin is placed in a well known location
  • For example TF installation/plugins directory
  • May have an optional configuration file (co-located)
  • This idea is very similar to TensorFlow “Adding a New Op

これに対応するTensorFlowのコードは、github にて公開されています。

また、4頁目の
引用
 • TensorFlow will have a plugin “adapter” that will connect with one or more plugin DSO libraries
 • The adapter will be initialized statically and will discover the plugin(s)
  • Load the plugin (.so), configure it, and query necessary data
 • If successful, register the plugin device with various TF registries
 • Platform, Compiler, Transfer Manager, Device
 • Connect the corresponding implementation components from the plugin DSO
 • At run time, user scripts requests computation placement on this plugin device
  • Will follow the usual TensorFlow computation placement and execution

の部分は、ここに、Adapter、Platform、Compiler、Transfer Manager、Device のコードもあります。

そして、このAdapter経由で呼び出されるのが、
Bridge TensorFlow*/XLA to run on Intel® nGraph™ backendsにあります。

ここに書いてある内容を実行すると、nGraph を利用する TensorFlow XLAをビルドできます。

P.S

TensorFlow r1.3ベースのnGraphソースコードは既に公開されていないのですが、
実はソースコード解析はある程度終わっています。

また、dynamically loadable XLA plugin のソースコード部の解析もほぼ終わっています。

どこかで、資料公開したいのですが、どこか、いい機会ありませんかね。。