aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/common_runtime
diff options
context:
space:
mode:
authorGravatar Revan Sopher <rsopher@google.com>2018-09-27 16:16:20 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-27 16:21:41 -0700
commitf41573b7956871b4142c97eb85ddf163ad641976 (patch)
treed29d3a1ba427d4f44d606c767e75c3b9cc30096b /tensorflow/core/common_runtime
parentd8a370274d6ab8c68edcce66849b4e96aed2fa0d (diff)
Automated rollback of commit 750466c6e6624d279de7f9a43accd682d487509c
PiperOrigin-RevId: 214853846
Diffstat (limited to 'tensorflow/core/common_runtime')
-rw-r--r--tensorflow/core/common_runtime/direct_session.cc49
-rw-r--r--tensorflow/core/common_runtime/direct_session.h3
-rw-r--r--tensorflow/core/common_runtime/direct_session_test.cc28
3 files changed, 6 insertions, 74 deletions
diff --git a/tensorflow/core/common_runtime/direct_session.cc b/tensorflow/core/common_runtime/direct_session.cc
index 458e133b68..841181f8c3 100644
--- a/tensorflow/core/common_runtime/direct_session.cc
+++ b/tensorflow/core/common_runtime/direct_session.cc
@@ -40,7 +40,6 @@ limitations under the License.
#include "tensorflow/core/framework/graph_def_util.h"
#include "tensorflow/core/framework/log_memory.h"
#include "tensorflow/core/framework/node_def.pb.h"
-#include "tensorflow/core/framework/run_handler.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/framework/versions.pb.h"
#include "tensorflow/core/graph/algorithm.h"
@@ -245,21 +244,6 @@ void DirectSession::SchedClosure(thread::ThreadPool* pool,
#endif // __ANDROID__
}
-static RunHandlerPool* GetOrCreateRunHandlerPool(
- const SessionOptions& options) {
- static RunHandlerPool* pool =
- new RunHandlerPool(NumInterOpThreadsFromSessionOptions(options));
- return pool;
-}
-
-bool DirectSession::ShouldUseRunHandlerPool() const {
- if (options_.config.session_inter_op_thread_pool_size() > 0 ||
- options_.config.use_per_session_threads()) {
- return false;
- }
- return true;
-}
-
DirectSession::DirectSession(const SessionOptions& options,
const DeviceMgr* device_mgr,
DirectSessionFactory* const factory)
@@ -598,37 +582,16 @@ Status DirectSession::RunInternal(int64 step_id, const RunOptions& run_options,
}
}
- std::unique_ptr<RunHandler> handler;
- if (ShouldUseRunHandlerPool() &&
- run_options.experimental().use_run_handler_pool()) {
- // Non-null only when a global inter-op pool is used.
- VLOG(1) << "Using RunHandler to scheduler inter-op closures.";
- handler = GetOrCreateRunHandlerPool(options_)->Get();
- }
- auto* handler_ptr = handler.get();
-
- Executor::Args::Runner default_runner = nullptr;
-
- if (pool == nullptr) {
- default_runner = [](Executor::Args::Closure c) { c(); };
- } else if (handler_ptr != nullptr) {
- default_runner = [handler_ptr](Executor::Args::Closure c) {
- handler_ptr->ScheduleInterOpClosure(std::move(c));
- };
- } else {
- default_runner = [this, pool](Executor::Args::Closure c) {
- SchedClosure(pool, std::move(c));
- };
- }
-
+ Executor::Args::Runner default_runner = [this,
+ pool](Executor::Args::Closure c) {
+ SchedClosure(pool, std::move(c));
+ };
for (const auto& item : executors_and_keys->items) {
- // TODO(azaks): support partial run.
- // TODO(azaks): if the device picks its own threadpool, we need to assign
+ // TODO(zhengxq): support partial run.
+ // TODO(zhengxq): if the device picks its own threadpool, we need to assign
// less threads to the main compute pool by default.
thread::ThreadPool* device_thread_pool =
item.device->tensorflow_device_thread_pool();
- // TODO(crk): Investigate usage of RunHandlerPool when using device specific
- // thread pool(s).
if (!device_thread_pool) {
args.runner = default_runner;
} else {
diff --git a/tensorflow/core/common_runtime/direct_session.h b/tensorflow/core/common_runtime/direct_session.h
index 3a168bbe3f..4a6a921ea7 100644
--- a/tensorflow/core/common_runtime/direct_session.h
+++ b/tensorflow/core/common_runtime/direct_session.h
@@ -247,9 +247,6 @@ class DirectSession : public Session {
ExecutorsAndKeys* executors_and_keys,
RunMetadata* run_metadata);
- // Returns whether inter-op execution uses a global pool.
- bool ShouldUseRunHandlerPool() const;
-
::tensorflow::Status ExtendLocked(const GraphDef& graph)
EXCLUSIVE_LOCKS_REQUIRED(graph_state_lock_);
diff --git a/tensorflow/core/common_runtime/direct_session_test.cc b/tensorflow/core/common_runtime/direct_session_test.cc
index e3e431f800..65e816c202 100644
--- a/tensorflow/core/common_runtime/direct_session_test.cc
+++ b/tensorflow/core/common_runtime/direct_session_test.cc
@@ -625,34 +625,6 @@ TEST_F(DirectSessionMinusAXTest, RunSimpleNetworkWithOpts_Callable) {
EXPECT_EQ(run_metadata.step_stats().dev_stats_size(), 2);
}
-TEST_F(DirectSessionMinusAXTest, UseRunHandlerPool) {
- Initialize({3, 2, -1, 0});
- auto session = CreateSession();
- ASSERT_TRUE(session != nullptr);
- TF_ASSERT_OK(session->Create(def_));
- std::vector<std::pair<string, Tensor>> inputs;
-
- // Request two targets: one fetch output and one non-fetched output.
- std::vector<string> output_names = {y_ + ":0"};
- std::vector<string> target_nodes = {y_neg_};
- std::vector<Tensor> outputs;
-
- // Prepares RunOptions and RunMetadata
- RunOptions run_options;
- run_options.mutable_experimental()->set_use_run_handler_pool(true);
-
- Status s = session->Run(run_options, inputs, output_names, target_nodes,
- &outputs, nullptr);
- TF_ASSERT_OK(s);
-
- ASSERT_EQ(1, outputs.size());
- // The first output should be initialized and have the correct
- // output.
- auto mat = outputs[0].matrix<float>();
- ASSERT_TRUE(outputs[0].IsInitialized());
- EXPECT_FLOAT_EQ(5.0, mat(0, 0));
-}
-
TEST(DirectSessionTest, KeepsStateAcrossRunsOfSession) {
GraphDef def;
Graph g(OpRegistry::Global());