Vengineerの妄想(準備期間)

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

TensorFlow r1.5でのXLA Compilerは、こうなる!


先週の金曜日、TensorFlow r1.5 RCが出ましたね。
あたしは、ちょっと前からr1.5のブランチが切られていたので知っていました。
そして、正月明けにはいろいろと調べていいました。

このツイートでは、
  TensorFlow XLA r1.5では、llvm_compiler.{h,cc}が導入され、
  LLVMCompilerクラスを継承するクラス(CpuCompilerとGpuCompiler)は、
  RunHloPassesメソッドとRunBackendメソッドを実装している。
と書きましたが、正確にはllvm_compiler.ccのみが追加されただけです。llvm_compiler.hはありました。

また、このツイートでは、
  TensorFlow XLAのJITに関する記事をCQ出版社のインターフェース2018年2月号に書きました。が、
  cpu_compiler.ccとgpu_compiler.ccのCompile関数の内容が r1.5では、変わってしまった。
なんですよ。

どう変わったか?

r1.5では、LLVMCompiler::Compileメソッドは、下記のようになっていて、
内部で RunHloPasses と RunBackend を呼ぶようになっています。
CPU/GPUでそれぞれこの2つのメソッドを実装しています。
StatusOr<std::vector<std::unique_ptr<Executable>>> LLVMCompiler::Compile(
    std::vector<std::unique_ptr<HloModule>> modules,
    std::vector<std::vector<perftools::gputools::StreamExecutor*>>
        stream_execs) {
  std::vector<std::unique_ptr<Executable>> result;
  for (size_t i = 0; i < modules.size(); i++) {
    if (stream_execs[i].size() != 1) {
      return Unimplemented(
          "Model partitioning not implemented for the CPU/GPU compilers!");
    }

    TF_ASSIGN_OR_RETURN(
        modules[i], RunHloPasses(std::move(modules[i]), stream_execs[i][0]));
    TF_ASSIGN_OR_RETURN(std::unique_ptr<Executable> executable,
                        RunBackend(std::move(modules[i]), stream_execs[i][0]));
    result.push_back(std::move(executable));
  }

  return {std::move(result)};
}

詳細については、今度発表するときにでも。。。

そして、おまけとして、

[XLA Remove Power architecture support from CPU backend.]にあるように、
引用
  The Power support is unused, untested, and buggy. Remove it until it is fixed.
ということで、PowerPCのサポートは無くなりました。

てか、使われていない、テストされていない、バグ有有だったようなので。