STT-tensorflow/tensorflow/compiler/mlir
Sanjoy Das b459be827a Avoid making order of C++ arg evaluation influence generated IR
This looks like a footgun, is there a way to systematically smoke bugs like
these out?

This one was pretty benign, but I can imagine more serious instances of this.

PiperOrigin-RevId: 352485514
Change-Id: I7f9629a21847817cc40b0381c9e1a9f9b08fcd18
2021-01-18 20:32:08 -08:00
..
g3doc Op documentation update. 2021-01-08 06:30:59 -08:00
hlo [MLIR][KernelGen] Add erf kernel and missing lowering for f16 type 2021-01-18 08:24:43 -08:00
lite Do not add unranked type to the while's non tensor list variant arguments while 2021-01-18 02:54:19 -08:00
python Integrated grappler into SavedModel importer, and added unit test coverage for TFRT. 2021-01-13 14:15:46 -08:00
tensorflow Fix HLO->TF legalization for R3 mhlo.dot operartions 2021-01-18 05:27:01 -08:00
tfjs Integrated grappler into SavedModel importer, and added unit test coverage for TFRT. 2021-01-13 14:15:46 -08:00
tfr PY2 removal cleanup 2021-01-15 16:48:57 -08:00
tools/kernel_gen [MLIR][KernelGen] Add test for tf.Erf operation 2021-01-18 05:11:35 -08:00
tosa NFC: Simplify Tosa build and layering. 2020-12-11 18:35:42 -08:00
utils Support nested CallSiteLoc's when generating names from Location. 2020-11-17 18:50:20 -08:00
xla Avoid making order of C++ arg evaluation influence generated IR 2021-01-18 20:32:08 -08:00
BUILD Split out dialect hooks into separate targets 2020-12-14 12:04:38 -08:00
glob_lit_test.bzl Introduce tfjs-opt test utility and remove TFJSDialect static registration 2020-08-24 11:28:39 -07:00
init_mlir.cc Print a TensorFlow URL instead of LLVM on crashes 2020-09-28 15:57:01 -07:00
init_mlir.h
mlir_bridge_rollout_policy.cc [MLIR] Set unsupported feature stats only when checking graph eligibility for dark launch of the first phase of the MLIR TF2XLA bridge. 2021-01-12 20:16:48 -08:00
mlir_bridge_rollout_policy.h [MLIR] Set unsupported feature stats only when checking graph eligibility for dark launch of the first phase of the MLIR TF2XLA bridge. 2021-01-12 20:16:48 -08:00
mlir_graph_optimization_pass_registration.cc [TF:MLIR] Add generic MLIR pass registration mechanism. 2020-03-10 16:04:53 -07:00
mlir_graph_optimization_pass_test.cc Do not round trip to MLIR in the MLIR bridge if no TPUs are found 2021-01-13 14:31:09 -08:00
mlir_graph_optimization_pass.cc Do not round trip to MLIR in the MLIR bridge if no TPUs are found 2021-01-13 14:31:09 -08:00
mlir_graph_optimization_pass.h Do not round trip to MLIR in the MLIR bridge if no TPUs are found 2021-01-13 14:31:09 -08:00
op_or_arg_name_mapper.cc Fix comment typo. 2020-11-13 10:35:52 -08:00
op_or_arg_name_mapper.h Add an interface to add separator before appending numbers in OpOrArgNameMapper. 2020-04-21 19:02:02 -07:00
README.md Add missing word 2020-10-05 16:10:24 -07:00
runlit.cfg.py Integrate LLVM at llvm/llvm-project@26750a1264 2020-10-26 15:24:20 -07:00
runlit.site.cfg.py [MLIR][KERNEL_GEN] Add TFFramework MLIR dialect. 2020-07-27 06:17:32 -07:00
tf_mlir_opt_main.cc Migrate TF MLIR shape inference pass to use declarative pass registration instead of manually defined pass registration (NFC). 2020-12-14 11:34:31 -08:00
tf_mlir_translate_main.cc Integrated grappler into SavedModel importer, and added unit test coverage for TFRT. 2021-01-13 14:15:46 -08: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