Remove unused StreamExecutorFactory

PiperOrigin-RevId: 244956772
This commit is contained in:
Gaurav Jain 2019-04-23 17:26:10 -07:00 committed by TensorFlower Gardener
parent a15ab60741
commit 88e0e42fdd
6 changed files with 2 additions and 106 deletions

View File

@ -1139,14 +1139,6 @@ DeviceDescription* GpuExecutor::PopulateDeviceDescription() const {
} // namespace gpu
void initialize_cuda_gpu_executor() {
*internal::MakeCUDAExecutorImplementation() = [](const PluginConfig& config) {
return new gpu::GpuExecutor{config};
};
}
} // namespace stream_executor
REGISTER_MODULE_INITIALIZER(cuda_gpu_executor, {
stream_executor::initialize_cuda_gpu_executor();
});
REGISTER_MODULE_INITIALIZER(cuda_gpu_executor, {});

View File

@ -961,14 +961,6 @@ DeviceDescription* GpuExecutor::PopulateDeviceDescription() const {
} // namespace gpu
void initialize_rocm_gpu_executor() {
*internal::MakeROCMExecutorImplementation() = [](const PluginConfig& config) {
return new gpu::GpuExecutor{config};
};
}
} // namespace stream_executor
REGISTER_MODULE_INITIALIZER(rocm_gpu_executor, {
stream_executor::initialize_rocm_gpu_executor();
});
REGISTER_MODULE_INITIALIZER(rocm_gpu_executor, {});

View File

@ -18,31 +18,6 @@ limitations under the License.
namespace stream_executor {
namespace internal {
// -- CUDA
StreamExecutorFactory* MakeCUDAExecutorImplementation() {
static StreamExecutorFactory instance;
return &instance;
}
// -- ROCm
StreamExecutorFactory* MakeROCMExecutorImplementation() {
static StreamExecutorFactory instance;
return &instance;
}
// -- OpenCL
StreamExecutorFactory* MakeOpenCLExecutorImplementation() {
static StreamExecutorFactory instance;
return &instance;
}
// -- Host
StreamExecutorFactory MakeHostExecutorImplementation;
// The default implementation just calls the other HostCallback method.
// It should make all existing code that uses a void() callback still work.
bool StreamExecutorInterface::HostCallback(Stream* stream,

View File

@ -383,21 +383,6 @@ class StreamExecutorInterface {
SE_DISALLOW_COPY_AND_ASSIGN(StreamExecutorInterface);
};
using StreamExecutorFactory =
std::function<StreamExecutorInterface *(const PluginConfig &)>;
using EventFactory = std::function<EventInterface *(StreamExecutor *)>;
using StreamFactory = std::function<StreamInterface *(StreamExecutor *)>;
using TimerFactory = std::function<TimerInterface *(StreamExecutor *)>;
using KernelFactory = std::function<KernelInterface*()>;
StreamExecutorFactory *MakeCUDAExecutorImplementation();
StreamExecutorFactory *MakeROCMExecutorImplementation();
StreamExecutorFactory *MakeOpenCLExecutorImplementation();
extern StreamExecutorFactory MakeHostExecutorImplementation;
} // namespace internal
} // namespace stream_executor

View File

@ -60,37 +60,6 @@ void BlockOnThreadExecutor(port::ThreadPool *executor) {
n.WaitForNotification();
}
internal::StreamExecutorInterface *StreamExecutorImplementationFromPlatformKind(
PlatformKind platform_kind, const PluginConfig &plugin_config) {
// Note: we use this factory-assignment-in-switch pattern instead of just
// invoking the callable in case linkage is messed up -- instead of invoking a
// nullptr std::function (due to failed registration) we give a nice
// LOG(FATAL) message.
internal::StreamExecutorFactory factory;
switch (platform_kind) {
case PlatformKind::kCuda:
factory = *internal::MakeCUDAExecutorImplementation();
break;
case PlatformKind::kROCm:
factory = *internal::MakeROCMExecutorImplementation();
break;
case PlatformKind::kOpenCL:
factory = *internal::MakeOpenCLExecutorImplementation();
break;
case PlatformKind::kHost:
factory = internal::MakeHostExecutorImplementation;
break;
default:
factory = nullptr;
}
if (factory == nullptr) {
LOG(FATAL)
<< "cannot create StreamExecutor implementation for platform kind: "
<< PlatformKindString(platform_kind);
}
return factory(plugin_config);
}
std::atomic_int_fast64_t correlation_id_generator(0);
} // namespace
@ -154,20 +123,6 @@ MakeScopedTracer(StreamExecutor *stream_exec, BeginCallT begin_call,
/* static */ mutex StreamExecutor::static_mu_{LINKER_INITIALIZED};
StreamExecutor::StreamExecutor(PlatformKind platform_kind,
const PluginConfig &plugin_config)
: platform_(nullptr),
implementation_(StreamExecutorImplementationFromPlatformKind(
platform_kind, plugin_config)),
platform_kind_(platform_kind),
device_ordinal_(-1),
background_threads_(new port::ThreadPool(
port::Env::Default(), "stream_executor", kNumBackgroundThreads)),
live_stream_count_(0),
tracing_enabled_(false) {
CheckPlatformKindIsValid(platform_kind);
}
// Get per-device memory limit in bytes. Returns 0 if
// TF_PER_DEVICE_MEMORY_LIMIT_MB environment variable is not set.
static int64 GetMemoryLimitBytes() {

View File

@ -70,9 +70,6 @@ class ScopedTracer;
// StreamExecutor interface should not be invoked from a signal handler.
class StreamExecutor {
public:
explicit StreamExecutor(PlatformKind kind,
const PluginConfig &plugin_config = PluginConfig());
StreamExecutor(
const Platform *platform,
std::unique_ptr<internal::StreamExecutorInterface> implementation);