Ask questionstf_ops.cc takes 79s to compile / 4300+ lines long
This is with TensorFlow at commit 80768cb23a3a4314c52af0b48a6bcf23ca541e19. The file tensorflow/compiler/mlir/tensorflow/ir/tf_ops.cc 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: bazel-bin/tensorflow/compiler/mlir/tf-opt 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 tf_ops.cc 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.