|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| g3doc/ | | 03-May-2024 | - | 2,085 | 1,775 |
| hlo/ | | 03-May-2024 | - | 5,035 | 4,138 |
| lite/ | | 03-May-2024 | - | 97,550 | 76,926 |
| python/ | | 03-May-2024 | - | 1,099 | 773 |
| quantization/tensorflow/ | | 03-May-2024 | - | 15,036 | 11,548 |
| tensorflow/ | | 03-May-2024 | - | 169,783 | 131,554 |
| tf2xla/ | | 03-May-2024 | - | 145 | 69 |
| tfjs/ | | 03-May-2024 | - | 1,670 | 1,210 |
| tfr/ | | 03-May-2024 | - | 10,527 | 7,848 |
| tfrt/ | | 03-May-2024 | - | 52,080 | 39,057 |
| tools/kernel_gen/ | | 03-May-2024 | - | 9,830 | 7,546 |
| tosa/ | | 03-May-2024 | - | 20,704 | 14,615 |
| utils/ | | 03-May-2024 | - | 258 | 130 |
| xla/ | | 03-May-2024 | - | 49,094 | 38,318 |
| BUILD | D | 03-May-2024 | 9 KiB | 269 | 248 |
| README.md | D | 03-May-2024 | 1.6 KiB | 46 | 35 |
| glob_lit_test.bzl | D | 03-May-2024 | 4.3 KiB | 117 | 104 |
| init_mlir.cc | D | 03-May-2024 | 2 KiB | 62 | 37 |
| init_mlir.h | D | 03-May-2024 | 1.4 KiB | 40 | 13 |
| mlir_graph_optimization_pass.cc | D | 03-May-2024 | 17.2 KiB | 441 | 318 |
| mlir_graph_optimization_pass.h | D | 03-May-2024 | 8 KiB | 213 | 113 |
| mlir_graph_optimization_pass_registration.cc | D | 03-May-2024 | 1.2 KiB | 31 | 10 |
| mlir_graph_optimization_pass_test.cc | D | 03-May-2024 | 8.5 KiB | 220 | 161 |
| op_or_arg_name_mapper.cc | D | 03-May-2024 | 5.3 KiB | 141 | 90 |
| op_or_arg_name_mapper.h | D | 03-May-2024 | 3.6 KiB | 103 | 41 |
| runlit.cfg.py | D | 03-May-2024 | 3.2 KiB | 82 | 42 |
| runlit.site.cfg.py | D | 03-May-2024 | 3.1 KiB | 81 | 51 |
| tf_mlir_opt_main.cc | D | 03-May-2024 | 3.8 KiB | 77 | 57 |
| tf_mlir_reduce_main.cc | D | 03-May-2024 | 3.3 KiB | 82 | 55 |
| tf_mlir_translate_main.cc | D | 03-May-2024 | 6.9 KiB | 177 | 129 |
README.md
1# MLIR dialects and utilities for TensorFlow, TensorFlow Lite and XLA.
2
3This module contains the MLIR
4([Multi-Level Intermediate Representation](https://mlir.llvm.org))
5dialects and utilities for
6
71. TensorFlow
82. XLA
93. TF Lite
10
11See [MLIR's website](https://mlir.llvm.org) for complete documentation.
12
13## Getting started
14
15Building dialects and utilities here follow the standard approach using
16`bazel` as the rest of TensorFlow.
17
18### Using local LLVM repo
19
20To develop across MLIR core and TensorFlow, it is useful to override the repo
21to use a local version instead of fetching from head. This can be achieved by
22setting up your local repository for Bazel build. For this you will need a
23temporary directory that will be "overlaid" with you LLVM source directory and
24the Bazel files:
25
26```sh
27LLVM_SRC=... # this the path to the LLVM local source directory you intend to use.
28LLVM_BAZEL_OVERLAY=${LLVM_SRC}/bazel # Note: this can be anywhere
29mkdir -p ${LLVM_BAZEL_OVERLAY}
30# This will symlink your LLVM sources with the BUILD files to be usable by Bazel.
31python ${LLVM_SRC}/utils/bazel/overlay_directories.py \
32 --src ${LLVM_SRC} \
33 --overlay ${LLVM_SRC}/utils/bazel/llvm-project-overlay/ \
34 --target ${LLVM_BAZEL_OVERLAY}
35touch ${LLVM_BAZEL_OVERLAY}/BUILD.bazel ${LLVM_BAZEL_OVERLAY}/WORKSPACE
36# The complete list is "AArch64", "AMDGPU", "ARM", "NVPTX", "PowerPC", "RISCV", "SystemZ", "X86"
37echo 'llvm_targets = ["X86"]' > ${LLVM_BAZEL_OVERLAY}/llvm/targets.bzl
38```
39
40You can then use this overlay to build TensorFlow:
41
42```
43bazel build --override_repository=llvm-project=$LLVM_BAZEL_OVERLAY \
44 -c opt tensorflow/compiler/mlir:tf-opt
45```
46