Commit Graph

73 Commits

Author SHA1 Message Date
Gunhan Gulsoy
4c6e31c085 Remove depencencies on unnecessary aliases in tensorflow/core
Also remove the aforementioned aliases.

PiperOrigin-RevId: 336902647
Change-Id: I6695049d389b48c890329a0262408f9bbae7d3b1
2020-10-13 10:28:00 -07:00
Wenhao Jia
8f1362de18 Add target environment constraints to a subset of TensorFlow packages and targets.
PiperOrigin-RevId: 332884872
Change-Id: I65691fa2021c065e6c2ab57815d5a2b342d30ee2
2020-09-21 10:57:01 -07:00
Gunhan Gulsoy
2256faa6b7 Remove the alias for tensorflow/core/framework:tensor_testutil
PiperOrigin-RevId: 321271557
Change-Id: I7267ee3cd1d87868f7641136bc6d7cb7047b7eca
2020-07-14 17:51:59 -07:00
Derek Murray
7f09d08f5d [BUILD] Clean up unused aliases left over the "common_runtime/BUILD" split.
PiperOrigin-RevId: 304650362
Change-Id: Ifc27d8d87d7c7319462235f661668467494dd252
2020-04-03 11:07:56 -07:00
A. Unique TensorFlower
4b1c4564e1 [TensorFlow PE] Fix static analysis warnings in grappler: std::set<NodeDef*> does not make sense, since ordering of pointers is not deterministic. Switch to using absl::flat_hash_set, which is also faster. Add a method GetOutputsOrderedByNodeName for uses where deterministic ordering is required.
This, combined with inlining the methods of NodeMap also gives a ~4.8% speedup of grappler on a large inference graph.

PiperOrigin-RevId: 304515494
Change-Id: Ia834d2019a142b470333dc8dd4b8151694a6510d
2020-04-02 18:11:47 -07:00
A. Unique TensorFlower
eb0998340c [Grappler] Micro optimizations:
1. Use flat_hash_{map,set}, keyed on string_view, in shape inference code and a few grappler utility functions.
2. Get rid of an unnecessary graph copy in remapper.

Speeds up constant folding by about 6.6% and remapper by ~20% on a large inference graph. Total speedup for grappler optimization is about 4.6%

PiperOrigin-RevId: 304428686
Change-Id: I1b83916f2080fa1f86130b250828518faaa03362
2020-04-02 10:36:54 -07:00
A. Unique TensorFlower
87dff7f00d [Grappler] Split common subgraph elimination out into a separate Grappler optimizer. This allows us to run it before constant folding and function optimizer to reduce the size of the graph earlier and save time spent in grappler. In particular, this reduces the size of the graph for which we run static shape inference, which is very expensive.
Change NodeMap to use absl::node_hash_map instead of std::unordered_map.

On a particular model with 215k nodes and 255k edges, I measure a 25% speedup of the Grappler MetaOptimizer overall.

PiperOrigin-RevId: 299413265
Change-Id: I741e8f22fa8169044d3d51b81e08d20df301d506
2020-03-06 12:38:21 -08:00
A. Unique TensorFlower
2885967db2 Appears to trigger an infinite loop in shape inference on
PiperOrigin-RevId: 299244045
Change-Id: Ibc253b8775c9b96e7b222657ce10e95a8ec036f5
2020-03-05 18:18:55 -08:00
A. Unique TensorFlower
c216cfa871 [Grappler] Split common subgraph elimination out into a separate Grappler optimizer. This allows us to run it before constant folding and function optimizer to reduce the size of the graph earlier and save time spent in grappler. In particular, this reduces the size of the graph for which we run static shape inference, which is very expensive.
Change NodeMap to use absl::node_hash_map instead of std::unordered_map.

On a particular model with 215k nodes and 255k edges, I measure a 25% speedup of the Grappler MetaOptimizer overall.

PiperOrigin-RevId: 299200501
Change-Id: Ib105f9e8a60318b4559db4b3d9c0bd92f0934ba1
2020-03-05 15:01:00 -08:00
Amit Patankar
e3e22538e8 Export grappler code from C++ to Python with pybind11 instead of swig. Adding pywrap_required_hdrs to downstream grappler build files which will go away with bazel first class shared library support.
PiperOrigin-RevId: 292986813
Change-Id: I24cbeba85e593fcb4604913874c0ac01eac73e4d
2020-02-03 13:13:08 -08:00
Juhyun Lee
350808980c Make a couple of targets in grappler buildable for Android.
PiperOrigin-RevId: 286665297
Change-Id: If2baec2147f43a3a485978add8e22aa7549a433c
2019-12-20 17:31:31 -08:00
Juhyun Lee
17f3e8ad39 Make a couple of targets in grappler buildable for Android.
PiperOrigin-RevId: 283612146
Change-Id: If64befd6fcd53500413c98c0978111b5abc06bcd
2019-12-03 13:41:59 -08:00
Adrian Kuegel
7cb4c8ee35 internal BUILD file cleanup
PiperOrigin-RevId: 278834455
Change-Id: If70cd6865dff91b46c14e284eff4de2255869783
2019-11-06 05:14:40 -08:00
Adrian Kuegel
35f8f8abab Let cc_proto_library create proto libraries with _protogen instead of _cc_protogen suffix.
This is motivated by making this more similar to the internal build system.

PiperOrigin-RevId: 278584449
Change-Id: I0545dbb8c0b03af44eac7dc0f90acba8eb036710
2019-11-05 03:09:35 -08:00
Andiry Xu
419849a5ea Remove using _output_shapes for shape annotation.
PiperOrigin-RevId: 276082558
Change-Id: I8b440ea6c3b94f12260e8526295828786c4856f2
2019-10-22 09:56:32 -07:00
Ashwin Murthy
7d8ee44de4 Move SetTransitiveFaninGraph and ComputeTransitiveFaninGraph as grappler utils and reuse within model_pruner optimizer. This change is NFC
PiperOrigin-RevId: 275066975
Change-Id: I430022b469f4b0938c283bf6deae428d80e7ba5b
2019-10-16 11:07:35 -07:00
Andiry Xu
7f9dbeed24 Use _output_shapes as shape annotation for tf-sim with aggressive shape
inference.

PiperOrigin-RevId: 273783850
2019-10-09 13:18:45 -07:00
A. Unique TensorFlower
71cc471b2d Clean up Grappler build file.
PiperOrigin-RevId: 271020175
2019-09-24 17:28:16 -07:00
A. Unique TensorFlower
cd48ba6db5 Save unnecessary lookup in NodeMap constructor.
Run on XXXX (72 X 2991 MHz CPUs); 2019-09-16T15:05:55.08629839-07:00
CPU: Intel Skylake Xeon with HyperThreading (36 cores) dL1:32KB dL2:1024KB dL3:24MB
Benchmark                          Base (ns)  New (ns) Improvement
------------------------------------------------------------------
BM_NodeMapConstruct/8                   1504      1324    +12.0%
BM_NodeMapConstruct/64                 20784     17478    +15.9%
BM_NodeMapConstruct/512               213301    178139    +16.5%
BM_NodeMapConstruct/4k               2200710   1871703    +15.0%
BM_NodeMapConstruct/32k             25063213  22232692    +11.3%
BM_NodeMapConstruct/256k            370569289  326468834    +11.9%
BM_NodeMapConstruct/1M              1832415652  1596115918    +12.9%
PiperOrigin-RevId: 269444504
2019-09-16 16:56:15 -07:00
A. Unique TensorFlower
7b77d4868a Adjust structure of all BUILD files to recommended style (https://docs.bazel.build/versions/master/skylark/build-style.html#file-structure), moving loads to top.
PiperOrigin-RevId: 252055555
2019-06-07 08:48:03 -07:00
A. Unique TensorFlower
0b125cf53e Apply 'buildozer fix moveLicensesAndDistribs movePackageToTop' to all BUILD files.
PiperOrigin-RevId: 249804869
2019-05-24 03:24:14 -07:00
Andy Ly
0993d774a8 [Grappler] GraphView (immutable) benchmarks.
PiperOrigin-RevId: 238314797
2019-03-13 15:14:12 -07:00
Andy Ly
43f47645a8 [Grappler] Add initial support for DT_QINT32, DT_QINT16, DT_QUINT16, DT_QINT8, and DT_QUINT8 to ConstantFolding.
PiperOrigin-RevId: 234072895
2019-02-14 19:38:25 -08:00
Eugene Zhulenev
fca403f459 [Grappler] Add functions from the subgraph to the main graph
PiperOrigin-RevId: 230606789
2019-01-23 14:50:55 -08:00
Andy Ly
2db14a0ffc [Grappler] Add validation in MutableGraphView.DeleteNodes().
PiperOrigin-RevId: 229781551
2019-01-17 11:28:13 -08:00
Andy Ly
d6f6485eae [Grappler] Improve MutableGraphView tests by checking graph and node connectivity with GraphView, and checking node fanins and fanouts explicitly.
PiperOrigin-RevId: 229601739
2019-01-16 12:40:01 -08:00
Andy Ly
6fd7a5c291 [Grappler] Change MutableGraphView mutations to return Status.
PiperOrigin-RevId: 229263687
2019-01-14 15:17:23 -08:00
Eugene Zhulenev
bd2610f638 [Grappler] Remapper for GPU Conv2d+BiasAdd+Activation
PiperOrigin-RevId: 228214620
2019-01-07 13:24:01 -08:00
Eugene Zhulenev
9585116b80 Add GraphTopologyView to efficiently traverse node-to-node connections.
+ Remove SimpleGraphView from topological sorting.

PiperOrigin-RevId: 226932668
2018-12-26 10:48:16 -08:00
Andy Ly
6744f3c0fe [Grappler] Add helper methods for controlling fanin deduping and adding of controlling fanins for Switch ops in MutableGraphView.
PiperOrigin-RevId: 226194053
2018-12-19 16:20:41 -08:00
Andy Ly
0b0dea8cf1 [Grappler] Add node fanin mutations in MutableGraphView.
PiperOrigin-RevId: 225474536
2018-12-13 19:07:52 -08:00
Eugene Zhulenev
50204e4205 Run placer for the inlined function body.
PiperOrigin-RevId: 223878376
2018-12-03 15:58:35 -08:00
Andy Ly
ac5311fcf6 Switch to using Eigen::NumTraits instead of std::numeric_limits when checking bounds.
PiperOrigin-RevId: 222891638
2018-11-26 15:10:24 -08:00
Benjamin Kramer
50397855a8 Add missing build dependencies.
PiperOrigin-RevId: 220020507
2018-11-04 15:39:56 -08:00
Eugene Zhulenev
8a91e6adc6 [Grappler] MutableGraphView: Update fanouts.
Current implementation if ReplaceInputs is half done/broken. Add UpdateFanouts functions that properly takes care of control dependencies, and updates internal state.

PiperOrigin-RevId: 219884693
2018-11-02 17:01:37 -07:00
Eugene Zhulenev
3eeaf9f1e1 [Grappler] Preserve constness of the GraphDef in GraphView.
1. Split GrapView into GraphView and MutableGraphView with separate {Input/Output}Port types with different node pointer constness.

2. Properly use GraphView and MutableGraphView in graph properties, and get rid of const_cast.

3. Remove const_cast in function optimizer.

4. Migrate GraphView to absl containers and hash

PiperOrigin-RevId: 219488040
2018-10-31 09:47:36 -07:00
A. Unique TensorFlower
3f7d60ca9d Cleanup: Don't crash when querying node for non-existing attributes.
PiperOrigin-RevId: 217420663
2018-10-16 18:00:53 -07:00
Peter Hawkins
3f23f4ddea Automated rollback of commit 6fa6bd045c
PiperOrigin-RevId: 217173355
2018-10-15 11:22:32 -07:00
Peter Hawkins
6fa6bd045c Replace references to tensorflow::StringPiece with absl::string_view. No functional changes.
PiperOrigin-RevId: 217170781
2018-10-15 11:01:32 -07:00
Piotr Padlewski
45aa4e968f MutableGraphView and other graph utils
MutableGraphView was implemented so that the view could be updated when new nodes are added or connections changed. The current passes do not require it only because they do not do any optimization on already optimized nodes, but optimizations like MapFusion require it.

PiperOrigin-RevId: 206046420
2018-07-25 13:41:05 -07:00
Martin Wicke
bb582f1b6f Remove all_opensource_files. It's not needed any more.
PiperOrigin-RevId: 190878279
2018-03-28 20:49:47 -07:00
A. Unique TensorFlower
566df46de2 Fix support for functions to grappler items.
PiperOrigin-RevId: 179429486
2017-12-18 11:42:31 -08:00
A. Unique TensorFlower
c4ec569953 Get rid of some code duplication in Grappler optimizers by refactoring some utilities to a shared location.
Generalize the GetTailOfXXXChain to a more generic graph walker that takes a predicate functor that controls when to stop.

PiperOrigin-RevId: 176577743
2017-11-21 16:29:11 -08:00
Benoit Steiner
be4295e796 Created new shared IsFreeOfSideEffect and ModifiedFrameInfo functions.
PiperOrigin-RevId: 176124088
2017-11-17 10:15:03 -08:00
Benoit Steiner
552614db9e Added support for control dependencies
PiperOrigin-RevId: 174415690
2017-11-02 19:49:08 -07:00
Benoit Steiner
ccd413a0d8 Add heuristics to trigger swapping
PiperOrigin-RevId: 174376046
2017-11-02 14:00:42 -07:00
Max Galkin
3601966630 Add an option to apply ModelPruner when building a grappler item and an option to provide specific feed nodes to the item builder.
PiperOrigin-RevId: 171758733
2017-10-10 17:26:35 -07:00
A. Unique TensorFlower
0d86463016 Move GPU-specific dependencies of core/grappler:devices into
cuda_deps.

Fix #includes and deps of contrib/verbs:verbs_util, in particular
removing an unnecessary #include of gpu_util.h that relied on a
transitive dependency through :devices.

PiperOrigin-RevId: 169732234
2017-09-22 14:01:12 -07:00
Yao Zhang
57498a86c1 Fold fetch nodes.
PiperOrigin-RevId: 169604180
2017-09-21 14:55:13 -07:00
Allen Lavoie
5c7f9e316d Remove RTLD_GLOBAL when loading pywrap_tensorflow
Splits out a shared object (//tensorflow/libtensorflow_framework.so) with core TensorFlow functionality but neither ops nor kernels. This object does include registries for ops, kernels, filesystems, etc. The expectation is that shared objects containing custom ops will have a runtime dependency on this framework shared object: TensorFlow will load the custom op shared object, and the custom op shared object will use the symbols from the framework shared object to register its ops/kernels/etc. rather than (as before this change) relying on those symbols being in the global symbol table.

In this mode, TensorFlow artifacts (_pywrap_tensorflow.so for Python, libtensorflow.so for the C API; currently excluding Android artifacts) will depend on the framework shared object, which will be packaged with the Python pip package and other language distributions. This means that custom ops targeting the framework shared object will work in any language (C++, Java, Go; previously custom ops in these languages required custom Bazel builds).

Adds a config option which reproduces the old behavior (--config=monolithic), which for Python means building a monolithic pywrap_tensorflow shared object and loading its symbols into the global symbol table (with RTLD_GLOBAL). As before, there will be no extra-Bazel custom op support for other languages when compiling in this mode.

Does not change behavior on Windows; the cmake build is still monolithic.

Requires using tf_cc_binary, tf_cc_test, and (rarely) tf_cc_shared_object rules to link in the framework shared object when adding new TensorFlow build rules.

PiperOrigin-RevId: 169572746
2017-09-21 11:33:40 -07:00