Vengineerの妄想(準備期間)

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

Tenstorrent : TT-Buda : PyBuda Compiler Architecture とは?

はじめに

Tenstoorentのソフトウェアとしては、TT-Buda というものがあります。下図は、Tenstoorentのサイトから引用しています。

TT-Buda は、Tenstorrent の github にて、公開されています

github.com

TT-Buda の実態は、PyBuda です。PyBuda のドキュメントは、下記にあります。

docs.tenstorrent.com

PyBuda Computer Architecture

下図は、docs/public/advanced_user_guide.rst にある、PyBuda Computer Architecture の図です。説明のために引用します。

左側が Frontend Compiler、右側が Backend Compiler です。

Frontent Compilerでは、TVMから Netlist を生成し、Backend Compilerでは、Netlist から Model Binrary を生成しています。

Frontent Compiler において、GPUと違うのは 最後の Balancer/Placer です。下記が Balancer/Placer の説明です。

Balancer/Placer: Finally, our graph is ready to be scheduled onto the HW. Balancer and Placer are tightly coupled datastructures that together determine how operations will be laid out onto the device core grid and how many resources to assign to each operation.

Backend Compilerでは、Kerlen Compilation とRouting/Pipe Generation に分かれます。Kernel Compilation では Compute Tile で実行する計算のKernelをコンパイルします。一方、Routing/Pipe Generation は各 Kernel を実行する Tile の位置を決め、Tile間の接続を行います。下記が Kerlen Compilation とRouting/Pipe Generation の説明です。

Kernel Compilation: This path walks the netlist and extracts the set of operations specified and compiles the associated kernel implementations. Compilation here means compiling High Level Kernels (HLKs) implemented in C++ and using a kernel programming library called LLK (low level kernel) via a RISCV compiler toolchain. This is the actual machine code that will run on the Tensix core hardware.

Routing/Pipe Generation: This path first flows through net2pipe which extracts the op connectivity information from the netlist and generates a data movement program. This program is expressed in an IR that feeds into pipegen, the backend of this compile stage which implements the lowering of this IR into an executable that runs on a piece of hardware called overlay.

おわりに

一般的には、Frontent Compiler はオープンソースにするのですが、Backend Compiler はオープンソースにはしません。何故なら?ハードウェアの中身がわかっちゃうからです。

で、なんで、Tenstorrent は、Backend Compiler までオープンソースにしたのでしょうか?