This is a preparation step to remove those methods from OpState. PiperOrigin-RevId: 348642408 Change-Id: I2982f5516216e4956b1d0f7023445ef7622a545a |
||
---|---|---|
.. | ||
g3doc | ||
hlo | ||
lite | ||
python | ||
tensorflow | ||
tfjs | ||
tfr | ||
tools/kernel_gen | ||
tosa | ||
utils | ||
xla | ||
BUILD | ||
glob_lit_test.bzl | ||
init_mlir.cc | ||
init_mlir.h | ||
mlir_bridge_rollout_policy.cc | ||
mlir_bridge_rollout_policy.h | ||
mlir_graph_optimization_pass_registration.cc | ||
mlir_graph_optimization_pass_test.cc | ||
mlir_graph_optimization_pass.cc | ||
mlir_graph_optimization_pass.h | ||
op_or_arg_name_mapper.cc | ||
op_or_arg_name_mapper.h | ||
README.md | ||
runlit.cfg.py | ||
runlit.site.cfg.py | ||
tf_mlir_opt_main.cc | ||
tf_mlir_translate_main.cc |
MLIR dialects and utilities for TensorFlow, TensorFlow Lite and XLA.
This module contains the MLIR (Multi-Level Intermediate Representation) dialects and utilities for
- TensorFlow
- XLA
- 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