Automated rollback of commit a2a57c49faf351156903c843d8835e8edb48ba21

PiperOrigin-RevId: 294754341
Change-Id: I6d9467e4f4340d9a81a02f9f3b6653b961188c29
This commit is contained in:
A. Unique TensorFlower 2020-02-12 14:14:22 -08:00 committed by TensorFlower Gardener
parent f99aebca5d
commit c5765d2bab
11 changed files with 2 additions and 126 deletions

View File

@ -1933,7 +1933,6 @@ cc_library(
"//tensorflow/core/platform:prefetch", "//tensorflow/core/platform:prefetch",
"//tensorflow/core/platform:protobuf_internal", "//tensorflow/core/platform:protobuf_internal",
"//tensorflow/core/platform:regexp", "//tensorflow/core/platform:regexp",
"//tensorflow/core/platform:resource",
"//tensorflow/core/platform:scanner", "//tensorflow/core/platform:scanner",
"//tensorflow/core/platform:setround", "//tensorflow/core/platform:setround",
"//tensorflow/core/platform:stacktrace", "//tensorflow/core/platform:stacktrace",

View File

@ -24,7 +24,6 @@ limitations under the License.
#include "tensorflow/core/graph/node_builder.h" #include "tensorflow/core/graph/node_builder.h"
#include "tensorflow/core/platform/logging.h" #include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/mutex.h" #include "tensorflow/core/platform/mutex.h"
#include "tensorflow/core/platform/resource.h"
#include "tensorflow/core/profiler/lib/traceme.h" #include "tensorflow/core/profiler/lib/traceme.h"
namespace tensorflow { namespace tensorflow {
@ -571,8 +570,6 @@ void BackgroundWorker::Schedule(std::function<void()> work_item) {
} }
void BackgroundWorker::WorkerLoop() { void BackgroundWorker::WorkerLoop() {
tensorflow::ResourceTagger tag =
tensorflow::ResourceTagger(kTFDataResourceTag, "Background");
while (true) { while (true) {
std::function<void()> work_item = nullptr; std::function<void()> work_item = nullptr;
{ {
@ -609,8 +606,6 @@ namespace {
class RunnerImpl : public Runner { class RunnerImpl : public Runner {
public: public:
void Run(const std::function<void()>& f) override { void Run(const std::function<void()>& f) override {
tensorflow::ResourceTagger tag =
tensorflow::ResourceTagger(kTFDataResourceTag, "Runner");
f(); f();
// NOTE: We invoke a virtual function to prevent `f` being tail-called, and // NOTE: We invoke a virtual function to prevent `f` being tail-called, and

View File

@ -68,8 +68,6 @@ constexpr char kFullNameRandomHex[] = "60d899aa0d8ce4351e7c3b419e92d25b";
constexpr char kPipe[] = "|"; constexpr char kPipe[] = "|";
constexpr char kColon[] = ":"; constexpr char kColon[] = ":";
constexpr char kTFDataResourceTag[] = "tfdata";
class DatasetBase; class DatasetBase;
class SerializationContext; class SerializationContext;

View File

@ -21,7 +21,6 @@ limitations under the License.
#include "tensorflow/core/lib/core/threadpool.h" #include "tensorflow/core/lib/core/threadpool.h"
#include "tensorflow/core/lib/io/record_writer.h" #include "tensorflow/core/lib/io/record_writer.h"
#include "tensorflow/core/platform/file_system.h" #include "tensorflow/core/platform/file_system.h"
#include "tensorflow/core/platform/resource.h"
namespace tensorflow { namespace tensorflow {
namespace data { namespace data {
@ -57,8 +56,6 @@ class ToTFRecordOp : public AsyncOpKernel {
private: private:
Status DoCompute(OpKernelContext* ctx) { Status DoCompute(OpKernelContext* ctx) {
tensorflow::ResourceTagger tag = tensorflow::ResourceTagger(
kTFDataResourceTag, ctx->op_kernel().type_string());
tstring filename; tstring filename;
TF_RETURN_IF_ERROR( TF_RETURN_IF_ERROR(
ParseScalarArgument<tstring>(ctx, "filename", &filename)); ParseScalarArgument<tstring>(ctx, "filename", &filename));

View File

@ -47,7 +47,6 @@ limitations under the License.
#include "tensorflow/core/platform/env.h" #include "tensorflow/core/platform/env.h"
#include "tensorflow/core/platform/mutex.h" #include "tensorflow/core/platform/mutex.h"
#include "tensorflow/core/platform/refcount.h" #include "tensorflow/core/platform/refcount.h"
#include "tensorflow/core/platform/resource.h"
#include "tensorflow/core/profiler/lib/traceme.h" #include "tensorflow/core/profiler/lib/traceme.h"
#include "tensorflow/core/public/session_options.h" #include "tensorflow/core/public/session_options.h"
@ -517,8 +516,6 @@ void HybridAsyncOpKernel::Compute(OpKernelContext* ctx) {
} }
Status MakeIteratorOp::DoCompute(OpKernelContext* ctx) { Status MakeIteratorOp::DoCompute(OpKernelContext* ctx) {
tensorflow::ResourceTagger tag = tensorflow::ResourceTagger(
kTFDataResourceTag, ctx->op_kernel().type_string());
DatasetBase* dataset; DatasetBase* dataset;
TF_RETURN_IF_ERROR(GetDatasetFromVariantTensor(ctx->input(0), &dataset)); TF_RETURN_IF_ERROR(GetDatasetFromVariantTensor(ctx->input(0), &dataset));
IteratorResource* iterator_resource; IteratorResource* iterator_resource;
@ -529,8 +526,6 @@ Status MakeIteratorOp::DoCompute(OpKernelContext* ctx) {
} }
void DeleteIteratorOp::Compute(OpKernelContext* ctx) { void DeleteIteratorOp::Compute(OpKernelContext* ctx) {
tensorflow::ResourceTagger tag = tensorflow::ResourceTagger(
kTFDataResourceTag, ctx->op_kernel().type_string());
ResourceHandle handle = ctx->input(0).flat<ResourceHandle>()(0); ResourceHandle handle = ctx->input(0).flat<ResourceHandle>()(0);
// The iterator resource is guaranteed to exist because the variant tensor // The iterator resource is guaranteed to exist because the variant tensor
// wrapping the deleter is provided as an unused input to this op, which // wrapping the deleter is provided as an unused input to this op, which
@ -547,8 +542,6 @@ class ToSingleElementOp : public HybridAsyncOpKernel {
protected: protected:
Status DoCompute(OpKernelContext* ctx) override { Status DoCompute(OpKernelContext* ctx) override {
tensorflow::ResourceTagger tag = tensorflow::ResourceTagger(
kTFDataResourceTag, ctx->op_kernel().type_string());
DatasetBase* dataset; DatasetBase* dataset;
TF_RETURN_IF_ERROR(GetDatasetFromVariantTensor(ctx->input(0), &dataset)); TF_RETURN_IF_ERROR(GetDatasetFromVariantTensor(ctx->input(0), &dataset));
@ -606,8 +599,6 @@ class ReduceDatasetOp : public HybridAsyncOpKernel {
protected: protected:
Status DoCompute(OpKernelContext* ctx) override { Status DoCompute(OpKernelContext* ctx) override {
tensorflow::ResourceTagger tag = tensorflow::ResourceTagger(
kTFDataResourceTag, ctx->op_kernel().type_string());
DatasetBase* dataset; DatasetBase* dataset;
TF_RETURN_IF_ERROR(GetDatasetFromVariantTensor(ctx->input(0), &dataset)); TF_RETURN_IF_ERROR(GetDatasetFromVariantTensor(ctx->input(0), &dataset));
OpInputList inputs; OpInputList inputs;
@ -745,8 +736,6 @@ class OneShotIteratorOp : public AsyncOpKernel {
// running the initialization function, we must implement this // running the initialization function, we must implement this
// kernel as an async kernel. // kernel as an async kernel.
void ComputeAsync(OpKernelContext* ctx, DoneCallback done) override { void ComputeAsync(OpKernelContext* ctx, DoneCallback done) override {
tensorflow::ResourceTagger tag = tensorflow::ResourceTagger(
kTFDataResourceTag, ctx->op_kernel().type_string());
{ {
mutex_lock l(mu_); mutex_lock l(mu_);
if (iterator_resource_ == nullptr && initialization_status_.ok()) { if (iterator_resource_ == nullptr && initialization_status_.ok()) {
@ -909,8 +898,7 @@ Status IteratorGetNextOp::DoCompute(OpKernelContext* ctx) {
",iter_num=", ctx->frame_iter().iter_id, "#"); ",iter_num=", ctx->frame_iter().iter_id, "#");
}, },
profiler::kInfo); profiler::kInfo);
tensorflow::ResourceTagger tag = tensorflow::ResourceTagger(
kTFDataResourceTag, ctx->op_kernel().type_string());
IteratorResource* iterator; IteratorResource* iterator;
TF_RETURN_IF_ERROR(LookupResource(ctx, HandleFromInput(ctx, 0), &iterator)); TF_RETURN_IF_ERROR(LookupResource(ctx, HandleFromInput(ctx, 0), &iterator));
core::ScopedUnref unref_iterator(iterator); core::ScopedUnref unref_iterator(iterator);
@ -929,8 +917,6 @@ Status IteratorGetNextOp::DoCompute(OpKernelContext* ctx) {
} }
Status IteratorGetNextAsOptionalOp::DoCompute(OpKernelContext* ctx) { Status IteratorGetNextAsOptionalOp::DoCompute(OpKernelContext* ctx) {
tensorflow::ResourceTagger tag = tensorflow::ResourceTagger(
kTFDataResourceTag, ctx->op_kernel().type_string());
IteratorResource* iterator; IteratorResource* iterator;
TF_RETURN_IF_ERROR(LookupResource(ctx, HandleFromInput(ctx, 0), &iterator)); TF_RETURN_IF_ERROR(LookupResource(ctx, HandleFromInput(ctx, 0), &iterator));
core::ScopedUnref unref_iterator(iterator); core::ScopedUnref unref_iterator(iterator);
@ -1045,8 +1031,6 @@ SerializeIteratorOp::SerializeIteratorOp(OpKernelConstruction* ctx)
} }
void SerializeIteratorOp::Compute(OpKernelContext* ctx) { void SerializeIteratorOp::Compute(OpKernelContext* ctx) {
tensorflow::ResourceTagger tag = tensorflow::ResourceTagger(
kTFDataResourceTag, ctx->op_kernel().type_string());
const Tensor& resource_handle_t = ctx->input(0); const Tensor& resource_handle_t = ctx->input(0);
OP_REQUIRES(ctx, TensorShapeUtils::IsScalar(resource_handle_t.shape()), OP_REQUIRES(ctx, TensorShapeUtils::IsScalar(resource_handle_t.shape()),
errors::InvalidArgument("resource_handle must be a scalar")); errors::InvalidArgument("resource_handle must be a scalar"));
@ -1070,8 +1054,6 @@ void SerializeIteratorOp::Compute(OpKernelContext* ctx) {
} }
void DeserializeIteratorOp::Compute(OpKernelContext* ctx) { void DeserializeIteratorOp::Compute(OpKernelContext* ctx) {
tensorflow::ResourceTagger tag = tensorflow::ResourceTagger(
kTFDataResourceTag, ctx->op_kernel().type_string());
// Validate that the handle corresponds to a real resource, and // Validate that the handle corresponds to a real resource, and
// that it is an IteratorResource. // that it is an IteratorResource.
IteratorResource* iterator_resource; IteratorResource* iterator_resource;

View File

@ -18,7 +18,6 @@ limitations under the License.
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "tensorflow/core/lib/core/notification.h" #include "tensorflow/core/lib/core/notification.h"
#include "tensorflow/core/platform/env.h" #include "tensorflow/core/platform/env.h"
#include "tensorflow/core/platform/resource.h"
#include "tensorflow/core/platform/unbounded_work_queue.h" #include "tensorflow/core/platform/unbounded_work_queue.h"
namespace tensorflow { namespace tensorflow {
@ -69,12 +68,7 @@ std::shared_ptr<ThreadFactory> UnboundedThreadPool::get_thread_factory() {
} }
void UnboundedThreadPool::Schedule(std::function<void()> fn) { void UnboundedThreadPool::Schedule(std::function<void()> fn) {
auto tagged_fn = [fn = std::move(fn)]() { ScheduleOnWorkQueue(std::move(fn), /*done=*/nullptr);
tensorflow::ResourceTagger tag =
tensorflow::ResourceTagger("tfdata", "ThreadPool");
fn();
};
ScheduleOnWorkQueue(std::move(tagged_fn), /*done=*/nullptr);
} }
int UnboundedThreadPool::NumThreads() const { return -1; } int UnboundedThreadPool::NumThreads() const { return -1; }

View File

@ -86,7 +86,6 @@ exports_files(
"net.h", "net.h",
"numa.h", "numa.h",
"resource_loader.h", "resource_loader.h",
"resource.h",
"snappy.h", "snappy.h",
"stacktrace_handler.h", "stacktrace_handler.h",
"subprocess.h", "subprocess.h",
@ -513,14 +512,6 @@ cc_library(
], ],
) )
cc_library(
name = "resource",
hdrs = ["resource.h"],
deps = [
":platform",
] + tf_platform_deps("resource"),
)
cc_library( cc_library(
name = "resource_loader", name = "resource_loader",
testonly = 1, testonly = 1,
@ -1190,7 +1181,6 @@ filegroup(
"profile_utils/cpu_utils.h", "profile_utils/cpu_utils.h",
"profile_utils/i_cpu_utils_helper.h", "profile_utils/i_cpu_utils_helper.h",
"protobuf.h", "protobuf.h",
"resource.h",
"stacktrace.h", "stacktrace.h",
"stacktrace_handler.h", "stacktrace_handler.h",
"status.h", "status.h",
@ -1407,7 +1397,6 @@ filegroup(
"raw_coding.h", "raw_coding.h",
"refcount.h", "refcount.h",
"regexp.h", "regexp.h",
"resource.h",
"scanner.cc", "scanner.cc",
"scanner.h", "scanner.h",
"setround.cc", "setround.cc",

View File

@ -114,7 +114,6 @@ cc_library(
"//tensorflow/core/platform:platform_port", "//tensorflow/core/platform:platform_port",
"//tensorflow/core/platform:protobuf", "//tensorflow/core/platform:protobuf",
"//tensorflow/core/platform:regexp", "//tensorflow/core/platform:regexp",
"//tensorflow/core/platform:resource",
"//tensorflow/core/platform:setround", "//tensorflow/core/platform:setround",
"//tensorflow/core/platform:status", "//tensorflow/core/platform:status",
"//tensorflow/core/platform:str_util", "//tensorflow/core/platform:str_util",
@ -301,18 +300,6 @@ cc_library(
}), }),
) )
cc_library(
name = "resource",
hdrs = ["//tensorflow/core/platform:resource.h"],
tags = [
"manual",
"no_oss",
"nobuilder",
],
textual_hdrs = ["resource.h"],
deps = ["//tensorflow/core/platform"],
)
cc_library( cc_library(
name = "resource_loader", name = "resource_loader",
testonly = 1, testonly = 1,
@ -514,7 +501,6 @@ filegroup(
"port.cc", "port.cc",
"posix_file_system.cc", "posix_file_system.cc",
"posix_file_system.h", "posix_file_system.h",
"resource.h",
"stacktrace.h", "stacktrace.h",
"tracing_impl.h", "tracing_impl.h",
], ],

View File

@ -550,7 +550,6 @@ def tf_additional_lib_hdrs():
"//tensorflow/core/platform/default:mutex.h", "//tensorflow/core/platform/default:mutex.h",
"//tensorflow/core/platform/default:mutex_data.h", "//tensorflow/core/platform/default:mutex_data.h",
"//tensorflow/core/platform/default:notification.h", "//tensorflow/core/platform/default:notification.h",
"//tensorflow/core/platform/default:resource.h",
"//tensorflow/core/platform/default:stacktrace.h", "//tensorflow/core/platform/default:stacktrace.h",
"//tensorflow/core/platform/default:strong_hash.h", "//tensorflow/core/platform/default:strong_hash.h",
"//tensorflow/core/platform/default:test_benchmark.h", "//tensorflow/core/platform/default:test_benchmark.h",

View File

@ -1,29 +0,0 @@
/* 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_PLATFORM_DEFAULT_RESOURCE_H_
#define TENSORFLOW_CORE_PLATFORM_DEFAULT_RESOURCE_H_
#include "absl/strings/string_view.h"
namespace tensorflow {
class ResourceTagger {
public:
ResourceTagger(absl::string_view key, absl::string_view value) {}
};
} // namespace tensorflow
#endif // TENSORFLOW_CORE_PLATFORM_DEFAULT_RESOURCE_H_

View File

@ -1,34 +0,0 @@
/* 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_PLATFORM_RESOURCE_H_
#define TENSORFLOW_CORE_PLATFORM_RESOURCE_H_
#include "tensorflow/core/platform/platform.h"
namespace tensorflow {
// Tracks resource usage for tagged code paths.
class ResourceTagger;
} // namespace tensorflow
#if defined(PLATFORM_GOOGLE)
#include "tensorflow/core/platform/google/resource.h"
#else
#include "tensorflow/core/platform/default/resource.h"
#endif
#endif // TENSORFLOW_CORE_PLATFORM_RESOURCE_H_