Publishing tpu_op_consts to tpu kernels library.

PiperOrigin-RevId: 317202394
Change-Id: Ib6a1f350af7384513a3744084a9959ed86278d1f
This commit is contained in:
Henry Tan 2020-06-18 16:15:22 -07:00 committed by TensorFlower Gardener
parent 67544cd4bb
commit 4aea552e06
4 changed files with 74 additions and 5 deletions

View File

@ -321,6 +321,7 @@ cc_library(
":tpu_compile_c_api_hdrs",
":tpu_compile_op_support",
":tpu_mesh_state_interface",
":tpu_op_consts",
":tpu_program_group",
":tpu_util",
":trace_util_hdrs",
@ -433,7 +434,6 @@ cc_library(
"//tensorflow/compiler/xla/client:compile_only_client",
"//tensorflow/core:lib",
"//tensorflow/core:protos_all_cc",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings",
],
alwayslink = 1,
@ -461,3 +461,12 @@ cc_library(
"@com_google_absl//absl/synchronization",
],
)
cc_library(
name = "tpu_op_consts",
srcs = ["tpu_op_consts.cc"],
hdrs = ["tpu_op_consts.h"],
deps = [
"@com_google_absl//absl/base:core_headers",
],
)

View File

@ -38,15 +38,12 @@ limitations under the License.
#include "tensorflow/core/tpu/kernels/tpu_compile_c_api.h"
#include "tensorflow/core/tpu/kernels/tpu_compile_op_support.h"
#include "tensorflow/core/tpu/kernels/tpu_mesh_state_interface.h"
#include "tensorflow/core/tpu/kernels/tpu_op_consts.h"
#include "tensorflow/core/tpu/kernels/tpu_program_group.h"
namespace tensorflow {
namespace tpu {
constexpr char kCompilationCacheResourceName[] = "tpu_compilation_cache";
constexpr char kCompilationCacheUnloaderResourceName[] =
"tpu_compilation_cache_unloader";
class TpuCompilationCacheExternal : public TpuCompilationCacheInterface {
public:
using Status = ::stream_executor::port::Status;

View File

@ -0,0 +1,24 @@
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/core/tpu/kernels/tpu_op_consts.h"
namespace tensorflow {
namespace tpu {
const char kCompilationCacheResourceName[] = "tpu_compilation_cache";
const char kCompiledProtoCacheResourceName[] = "tpu_proto_cache";
const char kCompilationCacheUnloaderResourceName[] =
"tpu_compilation_cache_unloader";
} // namespace tpu
} // namespace tensorflow

View File

@ -0,0 +1,39 @@
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_CORE_TPU_KERNELS_TPU_OP_CONSTS_H_
#define TENSORFLOW_CORE_TPU_KERNELS_TPU_OP_CONSTS_H_
#include "absl/base/attributes.h"
namespace tensorflow {
namespace tpu {
// Resource names in the ResourceMgr.
//
// Name of cache for compiled TPU ISA protos. CompilationCache is created by
// ConfigureDistributedTpuOp, so only the master has a CompilationCache.
ABSL_CONST_INIT extern const char kCompilationCacheResourceName[];
// Name of base class allowing Execute Ops to look up ISA protos.
// CompiledProtoCache is created by InitializeHostForDistributedTpuOp, so each
// tpu_worker has a CompiledProtoCache.
ABSL_CONST_INIT extern const char kCompiledProtoCacheResourceName[];
// Name of cache unloader for compiled TPU ISA protos. Cache unloader should be
// put into TPU_SYSTEM device resource manager. Inference may use it to unload
// cache entries created during lifetime of a DirectSession.
ABSL_CONST_INIT extern const char kCompilationCacheUnloaderResourceName[];
} // namespace tpu
} // namespace tensorflow
#endif // TENSORFLOW_CORE_TPU_KERNELS_TPU_OP_CONSTS_H_