Remove SharedMemoryConfig since it is not used anywhere.

PiperOrigin-RevId: 326154532
Change-Id: I13be21f577226c48c7e0d5bfc7efb787f0422e85
This commit is contained in:
Anna R 2020-08-11 19:56:45 -07:00 committed by TensorFlower Gardener
parent 9636571807
commit 642db2faf5
11 changed files with 54 additions and 247 deletions

View File

@ -38,7 +38,6 @@ limitations under the License.
#include "tensorflow/stream_executor/launch_dim.h"
#include "tensorflow/stream_executor/plugin.h"
#include "tensorflow/stream_executor/rng.h"
#include "tensorflow/stream_executor/shared_memory_config.h"
#include "tensorflow/stream_executor/stream.h"
#include "tensorflow/stream_executor/stream_executor.h"
#include "tensorflow/stream_executor/stream_executor_internal.h"
@ -182,15 +181,6 @@ class XlaInterpreterExecutor : public internal::StreamExecutorInterface {
return true;
}
SharedMemoryConfig GetDeviceSharedMemoryConfig() override {
return SharedMemoryConfig::kDefault;
}
port::Status SetDeviceSharedMemoryConfig(SharedMemoryConfig config) override {
return port::Status{port::error::UNIMPLEMENTED,
"Shared memory not supported"};
}
std::unique_ptr<internal::EventInterface> CreateEventImplementation()
override {
return nullptr;

View File

@ -67,7 +67,6 @@ cc_library(
"plugin.h",
"plugin_registry.h",
"rng.h",
"shared_memory_config.h",
"stream_executor_pimpl.h",
"temporary_device_memory.h",
"temporary_memory_manager.h",
@ -123,7 +122,6 @@ cc_library(
"multi_platform_manager.h",
"platform.h",
"plugin_registry.h",
"shared_memory_config.h",
"stream_executor.h",
"stream_executor_internal.h",
"timer.h",
@ -173,11 +171,6 @@ cc_library(
],
)
cc_library(
name = "shared_memory_config",
hdrs = ["shared_memory_config.h"],
)
# Aliases for backwards compatibility.
alias(
name = "stream_header",
@ -343,7 +336,6 @@ cc_library(
"kernel_cache_config.h",
"kernel_spec.h",
"platform.h",
"shared_memory_config.h",
"stream.h",
"stream_executor_internal.h",
"trace_listener.h",
@ -455,7 +447,6 @@ cc_library(
"stream_executor_internal.cc",
],
hdrs = [
"shared_memory_config.h",
"stream_executor_internal.h",
],
deps = [
@ -484,7 +475,6 @@ cc_library(
"dnn.h",
"kernel.h",
"kernel_cache_config.h",
"shared_memory_config.h",
"stream_executor_pimpl.h",
],
visibility = ["//visibility:public"],
@ -569,7 +559,6 @@ cc_library(
"plugin.h",
"plugin_registry.h",
"rng.h",
"shared_memory_config.h",
"stream.h",
"stream_executor.h",
"stream_executor_internal.h",
@ -619,7 +608,6 @@ cc_library(
"plugin.h",
"plugin_registry.h",
"rng.h",
"shared_memory_config.h",
"stream.h",
"stream_executor.h",
"stream_executor_internal.h",

View File

@ -370,8 +370,8 @@ port::Status GpuExecutor::LoadModule(const MultiModuleLoaderSpec& spec,
absl::MutexLock lock{&in_memory_modules_mu_};
TF_RETURN_IF_ERROR(
LoadModuleFromPtx(spec.cuda_ptx_in_memory(), &cu_module));
*module_handle = ModuleHandle(const_cast<void *>(
static_cast<const void *>(spec.cuda_ptx_in_memory())));
*module_handle = ModuleHandle(
const_cast<void*>(static_cast<const void*>(spec.cuda_ptx_in_memory())));
return port::Status::OK();
}
return port::InternalError("No method of loading CUDA module provided");
@ -812,47 +812,6 @@ port::Status GpuExecutor::EnablePeerAccessTo(StreamExecutorInterface* other) {
return GpuDriver::EnablePeerAccess(context_, cuda_other->context_);
}
SharedMemoryConfig GpuExecutor::GetDeviceSharedMemoryConfig() {
port::StatusOr<CUsharedconfig> cuda_config =
GpuDriver::ContextGetSharedMemConfig(context_);
if (!cuda_config.ok()) {
// Don't log; the failed call will log necessary output.
return SharedMemoryConfig::kDefault;
}
switch (cuda_config.ValueOrDie()) {
case CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE:
return SharedMemoryConfig::kDefault;
case CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE:
return SharedMemoryConfig::kFourByte;
case CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE:
return SharedMemoryConfig::kEightByte;
default:
LOG(FATAL) << "Invalid shared memory configuration returned: "
<< cuda_config.ValueOrDie();
}
}
port::Status GpuExecutor::SetDeviceSharedMemoryConfig(
SharedMemoryConfig config) {
CUsharedconfig cuda_config;
switch (config) {
case SharedMemoryConfig::kDefault:
cuda_config = CU_SHARED_MEM_CONFIG_DEFAULT_BANK_SIZE;
break;
case SharedMemoryConfig::kFourByte:
cuda_config = CU_SHARED_MEM_CONFIG_FOUR_BYTE_BANK_SIZE;
break;
case SharedMemoryConfig::kEightByte:
cuda_config = CU_SHARED_MEM_CONFIG_EIGHT_BYTE_BANK_SIZE;
break;
default:
LOG(FATAL) << "Invalid shared memory configuration specified: "
<< static_cast<int>(config);
}
return GpuDriver::ContextSetSharedMemConfig(context_, cuda_config);
}
bool GpuExecutor::DeviceMemoryUsage(int64* free, int64* total) const {
return GpuDriver::GetDeviceMemoryInfo(context_, free, total);
}
@ -980,7 +939,8 @@ static int TryToReadNumaNode(const std::string& pci_bus_id,
if (port::safe_strto32(content, &value)) {
if (value < 0) { // See http://b/18228951 for details on this path.
LOG(INFO) << "successful NUMA node read from SysFS had negative value ("
<< value << "), but there must be at least one NUMA node"
<< value
<< "), but there must be at least one NUMA node"
", so returning NUMA node zero";
fclose(file);
return 0;

View File

@ -188,10 +188,6 @@ class GpuExecutor : public internal::StreamExecutorInterface {
bool CanEnablePeerAccessTo(StreamExecutorInterface* other) override;
SharedMemoryConfig GetDeviceSharedMemoryConfig() override;
port::Status SetDeviceSharedMemoryConfig(SharedMemoryConfig config) override;
bool DeviceMemoryUsage(int64* free, int64* total) const override;
// Search for the symbol and returns a device pointer and size.

View File

@ -148,20 +148,6 @@ class HostExecutor : public internal::StreamExecutorInterface {
return true;
}
SharedMemoryConfig GetDeviceSharedMemoryConfig() override {
LOG(INFO) << "Shared memory configuration is unsupported for host "
<< "executors.";
return SharedMemoryConfig::kDefault;
}
port::Status SetDeviceSharedMemoryConfig(SharedMemoryConfig config) override {
std::string error_msg{
"Shared memory configuration is unsupported for host "
"executors."};
LOG(INFO) << error_msg;
return port::Status(port::error::UNIMPLEMENTED, error_msg);
}
bool SupportsBlas() const override;
blas::BlasSupport *CreateBlas() override;

View File

@ -720,47 +720,6 @@ port::Status GpuExecutor::EnablePeerAccessTo(StreamExecutorInterface* other) {
return GpuDriver::EnablePeerAccess(context_, rocm_other->context_);
}
SharedMemoryConfig GpuExecutor::GetDeviceSharedMemoryConfig() {
port::StatusOr<hipSharedMemConfig> rocm_config =
GpuDriver::ContextGetSharedMemConfig(context_);
if (!rocm_config.ok()) {
// Don't log; the failed call will log necessary output.
return SharedMemoryConfig::kDefault;
}
switch (rocm_config.ValueOrDie()) {
case hipSharedMemBankSizeDefault:
return SharedMemoryConfig::kDefault;
case hipSharedMemBankSizeFourByte:
return SharedMemoryConfig::kFourByte;
case hipSharedMemBankSizeEightByte:
return SharedMemoryConfig::kEightByte;
default:
LOG(FATAL) << "Invalid shared memory configuration returned: "
<< rocm_config.ValueOrDie();
}
}
port::Status GpuExecutor::SetDeviceSharedMemoryConfig(
SharedMemoryConfig config) {
hipSharedMemConfig rocm_config;
switch (config) {
case SharedMemoryConfig::kDefault:
rocm_config = hipSharedMemBankSizeDefault;
break;
case SharedMemoryConfig::kFourByte:
rocm_config = hipSharedMemBankSizeFourByte;
break;
case SharedMemoryConfig::kEightByte:
rocm_config = hipSharedMemBankSizeEightByte;
break;
default:
LOG(FATAL) << "Invalid shared memory configuration specified: "
<< static_cast<int>(config);
}
return GpuDriver::ContextSetSharedMemConfig(context_, rocm_config);
}
bool GpuExecutor::DeviceMemoryUsage(int64* free, int64* total) const {
return GpuDriver::GetDeviceMemoryInfo(context_, free, total);
}

View File

@ -1,34 +0,0 @@
/* 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.
==============================================================================*/
// This file defines a uniform interface to configuration options for shared
// memory for supported devices. As with many StreamExecutor-supported features,
// support for the options defined herein is device-dependent.
#ifndef TENSORFLOW_STREAM_EXECUTOR_SHARED_MEMORY_CONFIG_H_
#define TENSORFLOW_STREAM_EXECUTOR_SHARED_MEMORY_CONFIG_H_
namespace stream_executor {
// SharedMemoryConfig enum describes potential widths of shared memory banks for
// a device or kernel.
enum class SharedMemoryConfig {
kDefault, // Use the device default configuration.
kFourByte, // Sets shared memory banks to be four bytes wide.
kEightByte, // Sets shared memory banks to be eight bytes wide.
};
} // namespace stream_executor
#endif // TENSORFLOW_STREAM_EXECUTOR_SHARED_MEMORY_CONFIG_H_

View File

@ -44,7 +44,6 @@ limitations under the License.
#include "tensorflow/stream_executor/platform.h"
#include "tensorflow/stream_executor/platform/port.h"
#include "tensorflow/stream_executor/plugin_registry.h"
#include "tensorflow/stream_executor/shared_memory_config.h"
#include "tensorflow/stream_executor/trace_listener.h"
namespace stream_executor {
@ -267,9 +266,6 @@ class StreamExecutorInterface {
virtual int PlatformDeviceCount() = 0;
virtual port::Status EnablePeerAccessTo(StreamExecutorInterface *other) = 0;
virtual bool CanEnablePeerAccessTo(StreamExecutorInterface *other) = 0;
virtual SharedMemoryConfig GetDeviceSharedMemoryConfig() = 0;
virtual port::Status SetDeviceSharedMemoryConfig(
SharedMemoryConfig config) = 0;
virtual int64 GetDeviceLoad() { return -1; }

View File

@ -230,23 +230,6 @@ port::Status StreamExecutor::EnablePeerAccessTo(StreamExecutor *other) {
return implementation_->EnablePeerAccessTo(other->implementation_.get());
}
SharedMemoryConfig StreamExecutor::GetDeviceSharedMemoryConfig() {
return implementation_->GetDeviceSharedMemoryConfig();
}
port::Status StreamExecutor::SetDeviceSharedMemoryConfig(
SharedMemoryConfig config) {
if (config != SharedMemoryConfig::kDefault &&
config != SharedMemoryConfig::kFourByte &&
config != SharedMemoryConfig::kEightByte) {
std::string error_msg = absl::StrFormat(
"Invalid shared memory config specified: %d", static_cast<int>(config));
LOG(ERROR) << error_msg;
return port::Status(port::error::INVALID_ARGUMENT, error_msg);
}
return implementation_->SetDeviceSharedMemoryConfig(config);
}
const DeviceDescription &StreamExecutor::GetDeviceDescription() const {
absl::MutexLock lock(&mu_);
if (device_description_ != nullptr) {

View File

@ -35,7 +35,6 @@ limitations under the License.
#include "tensorflow/stream_executor/platform/logging.h"
#include "tensorflow/stream_executor/platform/port.h"
#include "tensorflow/stream_executor/rng.h"
#include "tensorflow/stream_executor/shared_memory_config.h"
#include "tensorflow/stream_executor/stream.h"
#include "tensorflow/stream_executor/stream_executor_internal.h"
#include "tensorflow/stream_executor/trace_listener.h"
@ -54,8 +53,8 @@ struct AllocRecord {
};
// Forward declaration of private friend class.
template <typename BeginCallT, typename CompleteCallT,
typename ReturnT, typename... BeginArgsT>
template <typename BeginCallT, typename CompleteCallT, typename ReturnT,
typename... BeginArgsT>
class ScopedTracer;
// A StreamExecutor manages a single device, in terms of executing work (kernel
@ -322,14 +321,6 @@ class StreamExecutor {
// this is more an up-front test as to whether it's expressly forbidden.
bool CanEnablePeerAccessTo(StreamExecutor *other);
// Gets the preferred shared memory configuration for the device to which this
// executor is bound.
SharedMemoryConfig GetDeviceSharedMemoryConfig();
// Sets the preferred shared memory configuration for the device to which this
// executor is bound.
port::Status SetDeviceSharedMemoryConfig(SharedMemoryConfig config);
// Obtains metadata about the underlying device.
// The value is cached on first use.
const DeviceDescription &GetDeviceDescription() const;
@ -522,8 +513,8 @@ class StreamExecutor {
StreamExecutorMemoryAllocator *GetAllocator() { return &allocator_; }
private:
template <typename BeginCallT, typename CompleteCallT,
typename ReturnT, typename... BeginArgsT>
template <typename BeginCallT, typename CompleteCallT, typename ReturnT,
typename... BeginArgsT>
friend class ScopedTracer;
friend class Event;
friend class Stream;

View File

@ -96,8 +96,7 @@ class TpuExecutor : public tensorflow::tpu::TpuExecutorInterface {
void DequeueOutfeed(int32 outfeed_queue_index, absl::Span<uint8> bytes,
StatusCallback done);
Status EnqueueInfeed(int32 infeed_queue_index,
absl::Span<const uint8> bytes);
Status EnqueueInfeed(int32 infeed_queue_index, absl::Span<const uint8> bytes);
absl::optional<stream_executor::AllocatorStats> GetAllocatorStats() override;
@ -175,10 +174,6 @@ class TpuExecutor : public tensorflow::tpu::TpuExecutorInterface {
LOG(FATAL) << "Not yet implemented";
}
stream_executor::SharedMemoryConfig GetDeviceSharedMemoryConfig() override {
LOG(FATAL) << "not yet implemented";
}
void* GetSubBuffer(DeviceMemoryBase* parent, uint64 offset,
uint64 size) override {
LOG(FATAL) << "not yet implemented";
@ -197,10 +192,7 @@ class TpuExecutor : public tensorflow::tpu::TpuExecutorInterface {
bool CanEnablePeerAccessTo(StreamExecutorInterface* other) override {
LOG(FATAL) << "not yet implemented";
}
Status SetDeviceSharedMemoryConfig(
stream_executor::SharedMemoryConfig config) override {
LOG(FATAL) << "not yet implemented";
}
void* HostMemoryAllocate(uint64 size) override {
LOG(FATAL) << "not yet implemented";
}