Commit Graph

197 Commits

Author SHA1 Message Date
TensorFlower Gardener
8d42a44d15 Merge pull request from vnvo2409:expose-env
PiperOrigin-RevId: 361145393
Change-Id: I6a7fc81e54994939e0334980008c50f279cf640b
2021-03-05 07:56:32 -08:00
TensorFlower Gardener
0577bbdd46 Merge pull request from Intel-tensorflow:yang/graph-api-registration
PiperOrigin-RevId: 360977145
Change-Id: I783f7923144f62168e3a9951fd0a3359913340ef
2021-03-04 12:28:33 -08:00
Feng Liu
8e97951632 Disable cuda_asan for c_api_test_gpu
PiperOrigin-RevId: 360745520
Change-Id: Idc8aabb6fca2aae86164681aa45d05ba372ed7cd
2021-03-03 13:39:12 -08:00
Võ Văn Nghĩa
cb74f46861 expose c env headers 2021-03-03 13:35:56 +01:00
Michael Delorimier
1aa07125d5 Remove //third_party/tensorflow/c/c_api_no_xla's dependency on XLA. This was accomplished by removing the dependency from kernel_and_device to xla_kernel_creator. Now //third_party/tensorflow/core/common_runtime/eager:core explicitly depends on xla_kernel_creator since users of this :core expect it to include XLA.
Because changes like this could accidentally cause TensorFlow to lose its link to XLA, I've added a check that `//third_party/tensorflow/python/eager:def_function` depends on XLA.

PiperOrigin-RevId: 354426190
Change-Id: Ie6e687fa49e3fdb62146d79f38b72e7862054083
2021-01-28 17:04:25 -08:00
Võ Văn Nghĩa
50a8abac12 Include C env API into part of the libtensorflow_framework.so 2021-01-09 09:53:27 +07:00
Yanhua Sun
2800f688ff Add python/lib BUILD and refactor python/BUILD
PiperOrigin-RevId: 346841489
Change-Id: Id8c9e27ccf012c7b9668e7fd56d5d97d3ff09370
2020-12-10 12:42:17 -08:00
TensorFlower Gardener
d163783b0a Merge pull request from Intel-tensorflow:pluggable_device_load
PiperOrigin-RevId: 346437000
Change-Id: Iaa0617de52a61b10eb9182e883b81d9274237eec
2020-12-08 16:47:36 -08:00
TensorFlower Gardener
aa22defe05 Merge pull request from Intel-tensorflow:stream_executor_C_API_extension
PiperOrigin-RevId: 344156372
Change-Id: I036a76c7ccf5f25e45767b3bf3270cbed9a56830
2020-11-24 17:04:44 -08:00
Zhoulong Jiang
b8c1ec7503 remove changes for stream executor / kernel C API since it has been moved to another PR 2020-11-17 15:34:42 +00:00
Zhoulong Jiang
a6e0bd59ad fix comments 2020-11-17 13:39:12 +00:00
Zhoulong Jiang
11adf204e8 Add stream executor c api extension 2020-11-11 08:51:08 +00:00
Yong Tang
a82cdca23e Expose Logging C API in pip package
While working on modular file systems, noticed that the logging
C API headers are not included in tensorflow pip packages.

This limit the ability for plugins to add logging in the file system.

This PR adds logging C API header in pip package.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2020-11-08 18:46:45 +00:00
Zhoulong Jiang
27dd6a502c fix merge conflict 2020-10-23 16:05:47 +00:00
Zhoulong Jiang
22d22ff5b3 Merge branch 'master' into pluggable_device_load 2020-10-23 16:03:48 +00:00
TensorFlower Gardener
31547630e0 Merge pull request from yongtang:fs_api
PiperOrigin-RevId: 337929031
Change-Id: Ia9370b1ce576cf0446bd4eaed267b9d5eaa2cdcc
2020-10-19 14:21:00 -07:00
Anna R
c0904b922d Expose stream_executor, kernel and op C APIs in pip package and tensorflow_framework shared object.
PiperOrigin-RevId: 337598160
Change-Id: I9eeffdcea14c78e14976673fc19d9f0b9d260c50
2020-10-16 16:34:50 -07:00
Zhoulong Jiang
554a5fbd72 fix the comment and change build dependency 2020-10-15 12:44:55 +00:00
Feng Liu
716e817347 Add graph decompose pass to expand composite op if it was illegal in the tf
dialect

The pass is registered globally and only invoked when the op was not
registered. If the composition of the op is available, the original op will be
expanded.

PiperOrigin-RevId: 336921199
Change-Id: Ie2d509a1a565c04844e73f00b991942208db8e88
2020-10-13 11:47:21 -07:00
Feng Liu
5c0ffc8413 Add node expansion pass to expand composite op if its kernel was not found
The pass is registered globally and only invoked when the kernel was not found
for the op. If the composition of the op is available, the original op will be
rewritten to a function call op, which calls to the function derived from the
composition. Inside the pass, the function def is added to the eager context.
After the pass is returned, the new op will do a device placement again to
locate the function def.

The op expansion is cached for the op with the same attributes, so we should do
the op expansion repeately.

PiperOrigin-RevId: 336888128
Change-Id: If6a35c599d224d927d2f98e90c6d65dab9c1c74c
2020-10-13 09:18:01 -07:00
Zhoulong Jiang
b8a26f2d74 address review comments 2020-10-09 20:36:59 +00:00
Yong Tang
7699824d80 Expose TF_RegisterFilesystemPlugin C API
This PR is part of the effort for modular file system.
In modular file system `RegisterFilesystemPlugin` was a C++
API and there is no directly way to call this API through python.

This PR exposes C API `TF_RegisterFilesystemPlugin`, so that
it can be used in python bindings.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2020-10-09 19:22:06 +00:00
Brian Zhao
1f63a2e610 Adding an opaque TF_Shape type to the C API. This is necessary to represent shapes for TF_TensorSpec.
PiperOrigin-RevId: 334495752
Change-Id: I707f8c6b2f8568c7187e638d426e983dc3484412
2020-09-29 17:25:41 -07:00
Zhoulong Jiang
f599aed5d8 [PluggableDevice] add load mechanism and refactor streamexecutor C API 2020-09-28 09:04:52 +00: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
George Karpenkov
eeeb6ca25f [TF2XLA] experimental_get_compiler_ir API: compiled IR at a given stage for a function for fixed input
```
In [1]: import tensorflow as tf
In [2]: @tf.function(experimental_compile=True)
   ...: def f(x):
   ...:   return x + 1
In [3]: a = tf.random.normal([10, 10])
In [6]: print(f.experimental_get_compiler_ir(a, stage='hlo'))
HloModule a_inference_f_13__.9

ENTRY %a_inference_f_13__.9 (arg0.1: f32[10,10]) -> f32[10,10] {
  %arg0.1 = f32[10,10]{1,0} parameter(0), parameter_replication={false}, metadata={op_name="XLA_Args"}
  %reshape.2 = f32[10,10]{1,0} reshape(f32[10,10]{1,0} %arg0.1)
  %constant.3 = f32[] constant(1), metadata={op_type="AddV2" op_name="add"}
  %broadcast.4 = f32[10,10]{1,0} broadcast(f32[] %constant.3), dimensions={}, metadata={op_type="AddV2" op_name="add"}
  %add.5 = f32[10,10]{1,0} add(f32[10,10]{1,0} %reshape.2, f32[10,10]{1,0} %broadcast.4), metadata={op_type="AddV2" op_name="add"}
  %reshape.6 = f32[10,10]{1,0} reshape(f32[10,10]{1,0} %add.5), metadata={op_name="XLA_Retvals"}
  %tuple.7 = (f32[10,10]{1,0}) tuple(f32[10,10]{1,0} %reshape.6), metadata={op_name="XLA_Retvals"}
  ROOT %get-tuple-element.8 = f32[10,10]{1,0} get-tuple-element((f32[10,10]{1,0}) %tuple.7), index=0, metadata={op_name="XLA_Retvals"}
}
```

PiperOrigin-RevId: 332325845
Change-Id: Ifafaf629e5c4e4d7e0c42d18da4bcbb503c6ae02
2020-09-17 15:21:17 -07:00
Ran Chen
440b9778f7 Add Python binding for CheckPeerHealth
This will be used to check health of peers for MultiWorkerMirroredStrategy. I chose to add a python binding instead of an Op because I don't it to be exposed in tf.raw_ops, nor be subject to GraphDef compatibility requirement.

This difference between this and the existing ContextCheckAlive is that this is specific to multi client training. We need to tell if a worker has failed and restarted. EagerContext uses context_id for this purpose, but in MWMS we don't create EagerContext on peers. Collectives tracks device incarnations of peers, so we use that instead.

For now the check health will be in an all-to-all style, we can use more complicated topology in the future if needed.

PiperOrigin-RevId: 328843814
Change-Id: Id1281074cf0a79d1339bb4fd73caa6f6e68f518f
2020-08-27 16:57:37 -07:00
Amit Patankar
8145595a35 Convert tensorflow/c:pywrap_required_headers from a filegroup to textual headers cc_library target.
PiperOrigin-RevId: 327511112
Change-Id: I22edce440f1f1a3c45512265f4412c4828251ba4
2020-08-19 14:53:42 -07:00
TensorFlower Gardener
c907d687a2 Merge pull request from vnvo2409:s3-filesystem-log
PiperOrigin-RevId: 326549560
Change-Id: I3d26fcb789249e56a7bf03f531aab775434eb895
2020-08-13 16:48:59 -07:00
TensorFlower Gardener
efa82dd9a7 Merge pull request from dnguyen28061:allocate_temp
PiperOrigin-RevId: 326305159
Change-Id: Ic95dcb86e7bc58ced1666c7adcbddb9cc99dd2f4
2020-08-12 14:08:54 -07:00
Vo Van Nghia
22609c8683 Add log to s3 filesystem 2020-08-13 00:16:34 +07:00
Daniel Nguyen
a7e4df9246 switched from unsigned char to TF_Bool. Added input checking for TF_AllocatorAttributes 2020-08-11 23:11:36 +00:00
Daniel Nguyen
1182974cc1 clean up 2020-08-05 23:26:25 +00:00
Daniel Nguyen
8ef70baf37 moved TF_OFFSET_OF_END to c_api_macros 2020-08-04 20:25:26 +00:00
Vo Van Nghia
043c4d515f Use c_api_macros instead of c_api 2020-08-04 01:26:23 +07:00
Vo Van Nghia
49bb08c055 Add c interface for core/platform:logging 2020-08-04 01:14:26 +07:00
Dero Gharibian
24f835217f Eliminate unnecessary packing/unpacking of string tensors across the C-API and language bindings.
With the std::string -> tensorflow::tstring migration in tensorflow core complete, we now have an ABI stable string type with associated C accessors/modifiers. The packing/unpacking of string tensors across the C-API is now superfluous and can be removed.  This is an ABI breaking change; updates to language bindings in tensorflow/ are included in this CL.

PiperOrigin-RevId: 318933001
Change-Id: I3c99cf70834ba0b6cefc4ba39a35d6c168e880db
2020-06-29 18:16:59 -07:00
A. Unique TensorFlower
ea7c98c040 Tighten some core dependencies, so that code that is only interested in (de)serializing Tensors doesn't require all of XLA and all TF kernels.
PiperOrigin-RevId: 318109428
Change-Id: Ibc6129213267432e1c9425a93106fe7188ba452a
2020-06-24 12:10:40 -07:00
Mehdi Amini
f0ef163443 Add an MLIR tracing implementation to the C unified API
This is plumbing just enough to pass all the unit-tests.
The conversion to the function library is quite inefficient, but it isn't
clear if we want to optimize this or just focus on TFRT moving forward.

PiperOrigin-RevId: 313356850
Change-Id: I83815317d4958786d0103168b5d88498f89511ed
2020-05-27 03:00:08 -07:00
Anna R
b6284742e4 Converting some of the dependencies in tensorflow/c/BUILD to use portable_tensorflow_lib_lite_no_runtime.
PiperOrigin-RevId: 311814443
Change-Id: I42e75403c81babba32d4b9bb99ab4eed21e6ba44
2020-05-15 15:43:45 -07:00
Anna R
e6c2a5a212 Change more libraries in third_party/tensorflow/c/BUILD to depend on portable_tensorflow_lib_lite_no_runtime to support effort to reduce dependencies on mobile.
PiperOrigin-RevId: 311632630
Change-Id: I5061b458f894bccb9c0e23791d265f6ee95bdd38
2020-05-14 16:56:40 -07:00
A. Unique TensorFlower
5d3c548620 Resolve trivial aliases for portable TensorFlow targets.
PiperOrigin-RevId: 311548335
Change-Id: I837aa5a62500682783607841f0c993c2b6c238ed
2020-05-14 09:39:36 -07:00
A. Unique TensorFlower
9043e994c7 Remove op_gen_lib and distributed runtime dependency for Cast.
PiperOrigin-RevId: 310214149
Change-Id: Ife06f480397ed1ffabd01397e0af6efc1f2b39b2
2020-05-06 13:17:58 -07:00
Allen Lavoie
6e3bea20a1 Less pointer indirection for TFE_OpAttrs, add TFE_OpGetAttrs
We'll want this for implementing copy for `TF_AbstractOp`s backed by `TFE_Op`s (since we want to copy the type/attributes but not the inputs).

PiperOrigin-RevId: 309756974
Change-Id: I07a8c48f50ab6d3c8a7d7db972fb60202b86434d
2020-05-04 09:24:03 -07:00
Mihai Maruseac
7c26347d2e Disable broken Windows test
PiperOrigin-RevId: 309344035
Change-Id: I3f02013acd6e274afec64bc95e423dfcc9965247
2020-04-30 19:17:04 -07:00
Gaurav Jain
9ec6997dfb Avoid pointer indirection in handle, context & op
Since the struct lifetime is bound to the wrapped pointer this is fine.

PiperOrigin-RevId: 308941521
Change-Id: I0604fff4fcba6a03cc4a2242ab9f182fbfbf8bae
2020-04-28 18:58:17 -07:00
Derek Murray
d6027bd76a [Build cleanup] Split "core_cpu_impl" into fine-grained targets (3/n).
This change splits many (but not all) of the function-related targets into separate cc_library targets. The main changes are:

* Move "graph/graph_constructor.{h,cc}" to "common_runtime/graph_constructor.{h,cc}" and leave a forwarding header. This code depends on common_runtime and is built as part of it, so it makes sense to move it across. The "graph_constructor" library includes "shape_refiner.{h,cc}", "graph_runner.{h,cc}", and "eval_const_tensor.{h,cc}" because of a circular dependency between these modules.

* Split "function.{h,cc}" into "function_body.{h,cc}", "function_utils.{h,cc}", and "inline_function_utils.{h,cc}" (plus the original, slimmed-down module). This enables other targets in common_runtime to depend on just the function utilities they need, without the whole runtime, which breaks some cycles.

* New fine-grained targets for "constant_folding", "function_optimization_registry", and "graph_optimizer".

PiperOrigin-RevId: 308651243
Change-Id: Iac59c1db4ebdd16609f89d6caee6b7e6ba7ff0a1
2020-04-27 10:43:23 -07:00
TensorFlower Gardener
436323c564 Merge pull request from Intel-tensorflow:agramesh/enable_cpu_tests
PiperOrigin-RevId: 308412644
Change-Id: I5367d98259227ff75644c460de5a5e827915e007
2020-04-25 07:02:39 -07:00
Brian Zhao
49bbcbb109 Adding tf_copts() to SavedModel libraries exporting public C symbols. Missing this will cause Windows to add a dllimport attribute instead of the dllexport attribute.
PiperOrigin-RevId: 308312688
Change-Id: I05ee941796c4eac7b2036aabe3ec8b8a17620900
2020-04-24 13:21:55 -07:00
Brian Zhao
a92488b55c Initial checkin of stub implementation for TF C/C++ SavedModel API. See RFC https://github.com/tensorflow/community/pull/207.
This commit contains:
1. the C API headers (under tf/c/experimental/saved_model/public),
2. the C -> C++ implementation glue code  (under tf/c/experimental/saved_model/internal)
3. the C++ implementation  (under tf/c/experimental/saved_model/core)

The C++ implementation (3) is currently a stub.

Please note: The C++ header-only API wrapping the C API will be added in a subsequent change.

Certain aspects of this C API are expected to change heavily (mainly regarding ConcreteFunction execution).

PiperOrigin-RevId: 307419836
Change-Id: I6755fca97394d47c09799c534236ac17a30410d1
2020-04-20 10:00:01 -07:00