Ask takes 79s to compile / 4300+ lines long

This is with TensorFlow at commit 80768cb23a3a4314c52af0b48a6bcf23ca541e19. The file tensorflow/compiler/mlir/tensorflow/ir/ is about 4300 lines long and takes nearly 79s by itself to compile on a fast workstation (Intel Skylake-based Core i7 8700K 3.70GHz) with a typical bazel config below. It'll be great to split this file into two.

bazel build --linkopt="-fuse-ld=lld" -j 11    //tensorflow/compiler/mlir:tf-opt
gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)
On an Fedora Core 31 x86-64 Linux, Intel Core i7 8700K 3.70 GHz, 32 GB DDR4 RAM.
INFO: Analyzed target //tensorflow/compiler/mlir:tf-opt (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //tensorflow/compiler/mlir:tf-opt up-to-date:
INFO: Elapsed time: 79.099s, Critical Path: 78.93s
INFO: 2 processes: 2 local.
INFO: Build completed successfully, 3 total actions

To reproduce, please change and rebuild tf-opt as shown above. The linkopt shouldn't make a difference here.


Answer questions jpienaar

We are working on that ;-) But the good thing is I could split it again (we'll hit point of diminishing returns quickly, but splitting is much easier vs the first split) and check.

I'll close for now as speeding up can be a bit unbounded as a task.


Related questions

ModuleNotFoundError: No module named 'tensorflow.contrib' hot 9
Tf.Keras metrics issue hot 8
Error occurred when finalizing GeneratorDataset iterator hot 7
Error loading tensorflow hot 6
module 'tensorflow' has no attribute 'ConfigProto' hot 6
TF 2.0 'Tensor' object has no attribute 'numpy' while using .numpy() although eager execution enabled by default hot 6
tensorflow-gpu CUPTI errors
Lossy conversion from float32 to uint8. Range [0, 1]. Convert image to uint8 prior to saving to suppress this warning.
ModuleNotFoundError: No module named 'tensorflow.contrib'
When importing TensorFlow, error loading Hadoop
OSError: SavedModel file does not exist at: saved_model_dir/{saved_model.pbtxt|saved_model.pb}
AttributeError: module 'tensorflow.python.framework.op_def_registry' has no attribute 'register_op_list'
tf.keras.layers.Conv1DTranspose ?
[TF 2.0] tf.keras.optimizers.Adam hot 4
TF2.0 AutoGraph issue hot 4
Github User Rank List