Alexander Grund 956025aa53 Rename exec_tools to tools
Follow up to #43156
Based on
https://github.com/bazelbuild/bazel/issues/12059#issuecomment-725641997
exec_tools might no longer be needed and hence can be replaced by tools.
This fixes various build failures caused by missing environment
variables in environments where they are required, e.g. using custom
compilers.
2020-11-23 15:41:54 -08:00
..
2020-11-23 15:41:54 -08:00
2020-10-05 16:10:24 -07:00

MLIR dialects and utilities for TensorFlow, TensorFlow Lite and XLA.

This module contains the MLIR (Multi-Level Intermediate Representation) dialects and utilities for

  1. TensorFlow
  2. XLA
  3. TF Lite

See MLIR's website for complete documentation.

Getting started

Building dialects and utilities here follow the standard approach using bazel as the rest of TensorFlow.

Using local LLVM repo

To develop across MLIR core and TensorFlow, it is useful to override the repo to use a local version instead of fetching from head. This can be achieved as below but note, the BUILD files are not automatically generated from or CMake used, so if your change requires a BUILD file change (or you are using a different version of LLVM than set in tensorflow/workspace.bzl's LLVM_COMMIT) then manual BUILD file changes may be required.

LLVM_SRC=...

# Create basic workspace file
echo 'workspace(name = "llvm-project")' > $LLVM_SRC/WORKSPACE
# and copy over the bazel BUILD files.
cp third_party/llvm/llvm.autogenerated.BUILD $LLVM_SRC/llvm/BUILD
cp third_party/mlir/BUILD $LLVM_SRC/mlir
cp third_party/mlir/test.BUILD $LLVM_SRC/mlir/test/BUILD

bazel build --override_repository=llvm-project=$LLVM_SRC \
  -c opt tensorflow/compiler/mlir:tf-opt