[Build cleanup] Split "core_cpu_impl" into fine-grained targets (2/n).
This change splits the executor-related targets into separate cc_library targets. PiperOrigin-RevId: 307915231 Change-Id: I641dafb6723b4ea77b1ab984c28ab56c3f09eec3
This commit is contained in:
parent
f21a440cde
commit
a9c4cbb424
@ -218,16 +218,14 @@ filegroup(
|
||||
"debugger_state_interface.h",
|
||||
"device_resolver_local.h",
|
||||
"dma_helper.h",
|
||||
"entry.h",
|
||||
"executor.h",
|
||||
"executor_factory.h",
|
||||
"function_optimization_registry.h",
|
||||
"graph_optimizer.h",
|
||||
"graph_view.h",
|
||||
"immutable_executor_state.h",
|
||||
"input_colocation_exemption_registry.h",
|
||||
"isolate_placer_inspection_required_ops_pass.h",
|
||||
"local_device.h",
|
||||
"local_executor_params.h",
|
||||
"lower_function_call_op.h",
|
||||
"lower_if_op.h",
|
||||
"lower_case_op.h",
|
||||
@ -236,14 +234,11 @@ filegroup(
|
||||
"memory_types.h",
|
||||
"mkl_cpu_allocator.h",
|
||||
"optimization_registry.h",
|
||||
"pending_counts.h",
|
||||
"partitioning_utils.h",
|
||||
"placer.h",
|
||||
"process_util.h",
|
||||
"inspecting_placer.h",
|
||||
"profile_handler.h",
|
||||
"propagator_debug_utils.h",
|
||||
"propagator_state.h",
|
||||
"renamed_device.h",
|
||||
"rendezvous_mgr.h",
|
||||
"rendezvous_util.h",
|
||||
@ -252,7 +247,6 @@ filegroup(
|
||||
"ring_alg.h",
|
||||
"ring_gatherer.h",
|
||||
"session_factory.h",
|
||||
"simple_propagator_state.h",
|
||||
"single_threaded_cpu_device.h",
|
||||
"stats_publisher_interface.h",
|
||||
"step_stats_collector.h",
|
||||
@ -487,6 +481,49 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "executor",
|
||||
srcs = ["executor.cc"],
|
||||
hdrs = ["executor.h"],
|
||||
copts = tf_copts(),
|
||||
deps = [
|
||||
":costmodel_manager",
|
||||
":device",
|
||||
":entry",
|
||||
":executor_factory",
|
||||
":graph_view",
|
||||
":immutable_executor_state",
|
||||
":local_executor_params",
|
||||
":pending_counts",
|
||||
":propagator_state",
|
||||
":renamed_device",
|
||||
":simple_propagator_state",
|
||||
":step_stats_collector",
|
||||
"//tensorflow/core:framework",
|
||||
"//tensorflow/core:framework_internal",
|
||||
"//tensorflow/core:graph",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core:lib_internal",
|
||||
"//tensorflow/core:protos_all_cc",
|
||||
"//tensorflow/core/profiler/lib:annotated_traceme",
|
||||
"//tensorflow/core/profiler/lib:scoped_annotation",
|
||||
"//tensorflow/core/profiler/lib:traceme",
|
||||
"@com_google_absl//absl/memory",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "executor_factory",
|
||||
srcs = ["executor_factory.cc"],
|
||||
hdrs = ["executor_factory.h"],
|
||||
copts = tf_copts(),
|
||||
deps = [
|
||||
"//tensorflow/core:graph",
|
||||
"//tensorflow/core:lib",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "graph_view",
|
||||
srcs = ["graph_view.cc"],
|
||||
@ -538,6 +575,23 @@ cc_library(
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "immutable_executor_state",
|
||||
srcs = ["immutable_executor_state.cc"],
|
||||
hdrs = ["immutable_executor_state.h"],
|
||||
copts = tf_copts(),
|
||||
deps = [
|
||||
":graph_view",
|
||||
":local_executor_params",
|
||||
":pending_counts",
|
||||
"//tensorflow/core:framework",
|
||||
"//tensorflow/core:framework_internal",
|
||||
"//tensorflow/core:graph",
|
||||
"//tensorflow/core:lib",
|
||||
"@com_google_absl//absl/memory",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "input_colocation_exemption_registry",
|
||||
srcs = ["input_colocation_exemption_registry.cc"],
|
||||
@ -564,6 +618,16 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "local_executor_params",
|
||||
hdrs = ["local_executor_params.h"],
|
||||
copts = tf_copts(),
|
||||
deps = [
|
||||
"//tensorflow/core:framework",
|
||||
"//tensorflow/core:lib",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "memory_types",
|
||||
srcs = ["memory_types.cc"],
|
||||
@ -688,6 +752,36 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "propagator_debug_utils",
|
||||
srcs = ["propagator_debug_utils.cc"],
|
||||
hdrs = ["propagator_debug_utils.h"],
|
||||
copts = tf_copts(),
|
||||
deps = [
|
||||
":entry",
|
||||
":graph_view",
|
||||
"//tensorflow/core:framework",
|
||||
"//tensorflow/core:lib",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "propagator_state",
|
||||
srcs = ["propagator_state.cc"],
|
||||
hdrs = ["propagator_state.h"],
|
||||
copts = tf_copts(),
|
||||
deps = [
|
||||
":entry",
|
||||
":graph_view",
|
||||
":immutable_executor_state",
|
||||
":pending_counts",
|
||||
":propagator_debug_utils",
|
||||
"//tensorflow/core:framework",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core/profiler/lib:traceme",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "renamed_device",
|
||||
srcs = ["renamed_device.cc"],
|
||||
@ -856,6 +950,23 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "simple_propagator_state",
|
||||
srcs = ["simple_propagator_state.cc"],
|
||||
hdrs = ["simple_propagator_state.h"],
|
||||
copts = tf_copts(),
|
||||
deps = [
|
||||
":entry",
|
||||
":graph_view",
|
||||
":immutable_executor_state",
|
||||
":pending_counts",
|
||||
":propagator_debug_utils",
|
||||
"//tensorflow/core:framework",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core/profiler/lib:traceme",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "single_threaded_cpu_device",
|
||||
srcs = ["single_threaded_cpu_device.cc"],
|
||||
@ -952,13 +1063,10 @@ tf_cuda_library(
|
||||
"colocation_graph.cc",
|
||||
"composite_device.cc",
|
||||
"constant_folding.cc",
|
||||
"executor.cc",
|
||||
"executor_factory.cc",
|
||||
"function.cc",
|
||||
"function_optimization_registry.cc",
|
||||
"graph_optimizer.cc",
|
||||
"graph_runner.cc",
|
||||
"immutable_executor_state.cc",
|
||||
"inspecting_placer.cc",
|
||||
"isolate_placer_inspection_required_ops_pass.cc",
|
||||
"lower_case_op.cc",
|
||||
@ -970,9 +1078,6 @@ tf_cuda_library(
|
||||
"placer_inspection_required_ops_utils.cc",
|
||||
"placer_inspection_required_ops_utils.h",
|
||||
"process_function_library_runtime.cc",
|
||||
"propagator_debug_utils.cc",
|
||||
"propagator_state.cc",
|
||||
"simple_propagator_state.cc",
|
||||
"//tensorflow/core/graph:core_cpu_impl_srcs",
|
||||
],
|
||||
hdrs = [":core_cpu_lib_headers"],
|
||||
@ -980,10 +1085,17 @@ tf_cuda_library(
|
||||
deps = [
|
||||
":device",
|
||||
":entry",
|
||||
":executor",
|
||||
":executor_factory",
|
||||
":graph_view",
|
||||
":local_executor_params",
|
||||
":immutable_executor_state",
|
||||
":input_colocation_exemption_registry",
|
||||
":pending_counts",
|
||||
":propagator_debug_utils",
|
||||
":propagator_state",
|
||||
":session_options",
|
||||
":simple_propagator_state",
|
||||
":single_threaded_cpu_device",
|
||||
"//tensorflow/core:graph",
|
||||
"//tensorflow/core:framework",
|
||||
@ -1277,6 +1389,7 @@ tf_cc_tests(
|
||||
":core_cpu",
|
||||
":core_cpu_internal",
|
||||
":direct_session_internal",
|
||||
":pending_counts",
|
||||
"//tensorflow/cc:cc_ops",
|
||||
"//tensorflow/cc:cc_ops_internal",
|
||||
"//tensorflow/cc:function_ops",
|
||||
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||
#define TENSORFLOW_CORE_COMMON_RUNTIME_EXECUTOR_H_
|
||||
|
||||
#include "tensorflow/core/common_runtime/device.h"
|
||||
#include "tensorflow/core/common_runtime/rendezvous_mgr.h"
|
||||
#include "tensorflow/core/common_runtime/local_executor_params.h"
|
||||
#include "tensorflow/core/framework/rendezvous.h"
|
||||
#include "tensorflow/core/framework/session_state.h"
|
||||
#include "tensorflow/core/framework/tensor.h"
|
||||
@ -131,23 +131,6 @@ class Executor {
|
||||
//
|
||||
// "params" provides a set of context for the executor. We expect that
|
||||
// different context would provide different implementations.
|
||||
struct LocalExecutorParams {
|
||||
Device* device;
|
||||
|
||||
const SessionMetadata* session_metadata = nullptr;
|
||||
|
||||
// The library runtime support.
|
||||
FunctionLibraryRuntime* function_library = nullptr;
|
||||
|
||||
// create_kernel returns an instance of op kernel based on NodeDef.
|
||||
// delete_kernel is called for every kernel used by the executor
|
||||
// when the executor is deleted.
|
||||
std::function<Status(const std::shared_ptr<const NodeProperties>&,
|
||||
OpKernel**)>
|
||||
create_kernel;
|
||||
std::function<void(OpKernel*)> delete_kernel;
|
||||
};
|
||||
|
||||
::tensorflow::Status NewLocalExecutor(const LocalExecutorParams& params,
|
||||
const Graph& graph, Executor** executor);
|
||||
|
||||
|
@ -16,8 +16,8 @@ limitations under the License.
|
||||
#include "tensorflow/core/common_runtime/immutable_executor_state.h"
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "tensorflow/core/common_runtime/metrics.h"
|
||||
#include "tensorflow/core/framework/function.h"
|
||||
#include "tensorflow/core/framework/metrics.h"
|
||||
#include "tensorflow/core/framework/node_def_util.h"
|
||||
#include "tensorflow/core/graph/edgeset.h"
|
||||
#include "tensorflow/core/graph/graph.h"
|
||||
|
@ -20,8 +20,8 @@ limitations under the License.
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "tensorflow/core/common_runtime/executor.h"
|
||||
#include "tensorflow/core/common_runtime/graph_view.h"
|
||||
#include "tensorflow/core/common_runtime/local_executor_params.h"
|
||||
#include "tensorflow/core/common_runtime/pending_counts.h"
|
||||
#include "tensorflow/core/framework/tensor.h"
|
||||
#include "tensorflow/core/lib/core/status.h"
|
||||
|
54
tensorflow/core/common_runtime/local_executor_params.h
Normal file
54
tensorflow/core/common_runtime/local_executor_params.h
Normal file
@ -0,0 +1,54 @@
|
||||
/* Copyright 2015 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_COMMON_RUNTIME_LOCAL_EXECUTOR_PARAMS_H_
|
||||
#define TENSORFLOW_CORE_COMMON_RUNTIME_LOCAL_EXECUTOR_PARAMS_H_
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
namespace tensorflow {
|
||||
|
||||
class Device;
|
||||
class StepStatsCollector;
|
||||
class SessionMetadata;
|
||||
class FunctionLibraryRuntime;
|
||||
class NodeProperties;
|
||||
class OpKernel;
|
||||
class Status;
|
||||
|
||||
// LocalExecutorParams provides arguments that will be shared by all invocations
|
||||
// of an executor. We expect that different contexts would provide different
|
||||
// implementations (e.g. local versus distributed).
|
||||
struct LocalExecutorParams {
|
||||
Device* device;
|
||||
|
||||
const SessionMetadata* session_metadata = nullptr;
|
||||
|
||||
// The library runtime support.
|
||||
FunctionLibraryRuntime* function_library = nullptr;
|
||||
|
||||
// create_kernel returns an instance of op kernel based on NodeDef.
|
||||
// delete_kernel is called for every kernel used by the executor
|
||||
// when the executor is deleted.
|
||||
std::function<Status(const std::shared_ptr<const NodeProperties>&,
|
||||
OpKernel**)>
|
||||
create_kernel;
|
||||
std::function<void(OpKernel*)> delete_kernel;
|
||||
};
|
||||
|
||||
} // end namespace tensorflow
|
||||
|
||||
#endif // TENSORFLOW_CORE_COMMON_RUNTIME_LOCAL_EXECUTOR_PARAMS_H_
|
@ -14,11 +14,12 @@ limitations under the License.
|
||||
==============================================================================*/
|
||||
#include "tensorflow/core/common_runtime/propagator_debug_utils.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "tensorflow/core/common_runtime/entry.h"
|
||||
#include "tensorflow/core/common_runtime/immutable_executor_state.h"
|
||||
#include "tensorflow/core/common_runtime/graph_view.h"
|
||||
#include "tensorflow/core/framework/op_kernel.h"
|
||||
#include "tensorflow/core/framework/tensor.h"
|
||||
#include "tensorflow/core/platform/logging.h"
|
||||
#include "tensorflow/core/platform/strcat.h"
|
||||
|
||||
namespace tensorflow {
|
||||
|
||||
@ -39,10 +40,8 @@ const Tensor* GetTensorValueForDump(const Entry& input) {
|
||||
}
|
||||
}
|
||||
|
||||
void DumpPendingNodeState(const ImmutableExecutorState& immutable_state,
|
||||
const int node_id, const Entry* input_vector,
|
||||
void DumpPendingNodeState(const NodeItem& node_item, const Entry* input_vector,
|
||||
const bool show_nodes_with_no_ready_inputs) {
|
||||
const NodeItem& node_item = immutable_state.graph_view().node_ref(node_id);
|
||||
const int input_base = node_item.input_start;
|
||||
if (!show_nodes_with_no_ready_inputs) {
|
||||
bool has_ready_input = false;
|
||||
@ -73,9 +72,7 @@ void DumpPendingNodeState(const ImmutableExecutorState& immutable_state,
|
||||
}
|
||||
}
|
||||
|
||||
void DumpActiveNodeState(const ImmutableExecutorState& immutable_state,
|
||||
const int node_id, const Entry* input_vector) {
|
||||
const NodeItem& node_item = immutable_state.graph_view().node_ref(node_id);
|
||||
void DumpActiveNodeState(const NodeItem& node_item, const Entry* input_vector) {
|
||||
LOG(WARNING) << " Active Node: " << node_item.DebugString();
|
||||
const int input_base = node_item.input_start;
|
||||
for (int i = 0; i < node_item.num_inputs; ++i) {
|
||||
|
@ -18,22 +18,20 @@ limitations under the License.
|
||||
namespace tensorflow {
|
||||
|
||||
struct Entry;
|
||||
class ImmutableExecutorState;
|
||||
struct NodeItem;
|
||||
class Tensor;
|
||||
|
||||
// Returns a pointer to the tensor in `input` if one exists, or `nullptr`.
|
||||
const Tensor* GetTensorValueForDump(const Entry& input);
|
||||
|
||||
// Writes a LOG(WARNING) message describing the state of the pending node
|
||||
// `node_id` in the graph described by `immutable_state`.
|
||||
void DumpPendingNodeState(const ImmutableExecutorState& immutable_state,
|
||||
const int node_id, const Entry* input_vector,
|
||||
// Writes a LOG(WARNING) message describing the state of the given pending node
|
||||
// in the graph described by `immutable_state`.
|
||||
void DumpPendingNodeState(const NodeItem& node_item, const Entry* input_vector,
|
||||
const bool show_nodes_with_no_ready_inputs);
|
||||
|
||||
// Writes a LOG(WARNING) message describing the state of the active node
|
||||
// `node_id` in the graph described by `immutable_state`.
|
||||
void DumpActiveNodeState(const ImmutableExecutorState& immutable_state,
|
||||
const int node_id, const Entry* input_vector);
|
||||
// Writes a LOG(WARNING) message describing the state of the given active node
|
||||
// in the graph described by `immutable_state`.
|
||||
void DumpActiveNodeState(const NodeItem& node_item, const Entry* input_vector);
|
||||
|
||||
} // namespace tensorflow
|
||||
|
||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||
|
||||
#include "tensorflow/core/common_runtime/graph_view.h"
|
||||
#include "tensorflow/core/common_runtime/propagator_debug_utils.h"
|
||||
#include "tensorflow/core/framework/op_kernel.h"
|
||||
#include "tensorflow/core/lib/hash/hash.h"
|
||||
#include "tensorflow/core/profiler/lib/traceme.h"
|
||||
|
||||
@ -177,8 +178,7 @@ void PropagatorState::DumpIterationState(const FrameState* frame,
|
||||
immutable_state_.pending_ids()[node->node_id];
|
||||
if (iteration->node_state(pending_id) == PendingCounts::PENDING_NOTREADY ||
|
||||
iteration->node_state(pending_id) == PendingCounts::PENDING_READY) {
|
||||
DumpPendingNodeState(immutable_state_, node->node_id,
|
||||
iteration->input_tensors, false);
|
||||
DumpPendingNodeState(*node, iteration->input_tensors, false);
|
||||
}
|
||||
}
|
||||
// Then the active nodes.
|
||||
@ -186,8 +186,7 @@ void PropagatorState::DumpIterationState(const FrameState* frame,
|
||||
PendingCounts::Handle pending_id =
|
||||
immutable_state_.pending_ids()[node->node_id];
|
||||
if (iteration->node_state(pending_id) == PendingCounts::STARTED) {
|
||||
DumpActiveNodeState(immutable_state_, node->node_id,
|
||||
iteration->input_tensors);
|
||||
DumpActiveNodeState(*node, iteration->input_tensors);
|
||||
}
|
||||
}
|
||||
// Show all input tensors in use.
|
||||
|
@ -33,7 +33,6 @@ limitations under the License.
|
||||
|
||||
namespace tensorflow {
|
||||
|
||||
typedef gtl::InlinedVector<TensorValue, 4> TensorValueVec;
|
||||
typedef gtl::InlinedVector<AllocatorAttributes, 4> AllocatorAttributeVec;
|
||||
|
||||
// Represents the ephemeral "edge state" associated with one invocation of
|
||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||
#include <atomic>
|
||||
|
||||
#include "tensorflow/core/common_runtime/propagator_debug_utils.h"
|
||||
#include "tensorflow/core/framework/op_kernel.h"
|
||||
#include "tensorflow/core/profiler/lib/traceme.h"
|
||||
|
||||
namespace tensorflow {
|
||||
@ -107,15 +108,13 @@ void SimplePropagatorState::DumpState() {
|
||||
// Dump any waiting nodes that are holding on to tensors.
|
||||
for (const NodeItem* node : *nodes_) {
|
||||
if (pending_[node->node_id]) {
|
||||
DumpPendingNodeState(immutable_state_, node->node_id,
|
||||
input_tensors_.data(), false);
|
||||
DumpPendingNodeState(*node, input_tensors_.data(), false);
|
||||
}
|
||||
}
|
||||
// Then the active nodes.
|
||||
for (const NodeItem* node : *nodes_) {
|
||||
if ((*active_)[node->node_id]) {
|
||||
DumpActiveNodeState(immutable_state_, node->node_id,
|
||||
input_tensors_.data());
|
||||
DumpActiveNodeState(*node, input_tensors_.data());
|
||||
}
|
||||
}
|
||||
// Show all input tensors in use.
|
||||
|
@ -170,6 +170,7 @@ cc_library(
|
||||
"//tensorflow/core:core_cpu",
|
||||
"//tensorflow/core:core_cpu_internal",
|
||||
"//tensorflow/core:lib",
|
||||
"//tensorflow/core/common_runtime:local_executor_params",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user