diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-03-14 13:47:22 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-03-14 13:55:47 -0700 |
commit | 16632df29d09b3bbe5cc75df39f5ec720225e6d1 (patch) | |
tree | 3dfe1ffb7d5c8a4fc0cb6f9f8f6ae1fc4145464a /tensorflow/tensorflow.bzl | |
parent | 4ff81a7d891c2affadb9c9068cf37fdb109c0e77 (diff) |
Remove nsync header files from tensorflow/core/platform/default/mutex.h
The implementation of tensorflow/core/platform/default/mutex.h uses the nsync
library, so mutex.h has included nsync header files.
This has been awkward, because each TensorFlow build (bazel, cmake, make, plus
the instructions for compiling individual custom ops, on all the various
platforms) has needed to handle the include paths correctly, reaching into a
package that is downloaded separately from TensorFlow itself.
This change avoids that awkwardness, instead taking on two different
irritations:
- mutex.h now defines two structs that are large enough and aligned enough to
contain an nsync_mu and an nsync_cv. This is an abstraction violation,
because TensorFlow's source should not need to know how big these data
structures are. However, this is unlikely to cause problems because:
1) this is checked by a static assertion in mutex.cc, so we will notice
immediately should a change be needed, and
2) this will likely never fail because we have no intent of allowing nsync's
data strcutures to get bigger.
- The methods of mutex and condition_variable can no longer be inlined, because
that too would require mutex.h to include the nsync header files. (Or we'd
need to declare the nsync functions directly in mutex.h, which would be
another abstraction violation.) However, this is a small imposition
because the overhead of a procedure call is typically small.
The assumption behind this CL is that these irritations are less important than
the ongoing frustration of maintaining the complex include path in multiple build
systems.
PiperOrigin-RevId: 189079523
Diffstat (limited to 'tensorflow/tensorflow.bzl')
-rw-r--r-- | tensorflow/tensorflow.bzl | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl index 818d67f7b5..ae305a28e0 100644 --- a/tensorflow/tensorflow.bzl +++ b/tensorflow/tensorflow.bzl @@ -1158,22 +1158,6 @@ def transitive_hdrs(name, deps=[], **kwargs): # the libraries in deps. def cc_header_only_library(name, deps=[], includes=[], **kwargs): _transitive_hdrs(name=name + "_gather", deps=deps) - - # We could generalize the following, but rather than complicate things - # here, we'll do the minimal use case for now, and hope bazel comes up - # with a better solution before too long. We'd expect it to compute - # the right include path by itself, but it doesn't, possibly because - # _transitive_hdrs lost some information about the include path. - if "@nsync//:nsync_headers" in deps: - # Buiding tensorflow from @org_tensorflow finds this two up. - nsynch = "../../external/nsync/public" - # Building tensorflow from elsewhere finds it four up. - # Note that native.repository_name() is not yet available in TF's Kokoro. - if REPOSITORY_NAME != "@": - nsynch = "../../" + nsynch - includes = includes[:] - includes.append(nsynch) - native.cc_library(name=name, hdrs=[":" + name + "_gather"], includes=includes, @@ -1182,7 +1166,6 @@ def cc_header_only_library(name, deps=[], includes=[], **kwargs): def tf_custom_op_library_additional_deps(): return [ "@protobuf_archive//:protobuf_headers", - "@nsync//:nsync_headers", clean_dep("//third_party/eigen3"), clean_dep("//tensorflow/core:framework_headers_lib"), ] |