[TF:XLA] Clean up unused XLA options and functions.

PiperOrigin-RevId: 175217850
This commit is contained in:
A. Unique TensorFlower 2017-11-09 15:00:15 -08:00 committed by TensorFlower Gardener
parent b11a790328
commit 9abe08570f
9 changed files with 2 additions and 80 deletions

View File

@ -257,7 +257,6 @@ void XlaLocalLaunchOp::Compute(OpKernelContext* ctx) {
options.flib_def = ctx->function_library()->GetFunctionLibraryDefinition(); options.flib_def = ctx->function_library()->GetFunctionLibraryDefinition();
options.graph_def_version = ctx->function_library()->graph_def_version(); options.graph_def_version = ctx->function_library()->graph_def_version();
options.allow_cpu_custom_calls = (platform_id_ == gpu::host::kHostPlatformId); options.allow_cpu_custom_calls = (platform_id_ == gpu::host::kHostPlatformId);
options.local_executable_has_hybrid_result = true;
const XlaCompiler::CompilationResult* kernel; const XlaCompiler::CompilationResult* kernel;
xla::LocalExecutable* executable; xla::LocalExecutable* executable;

View File

@ -227,10 +227,7 @@ Status XlaCompilationCache::BuildExecutable(
} }
xla::ExecutableBuildOptions build_options; xla::ExecutableBuildOptions build_options;
build_options.set_device_ordinal(client_->default_device_ordinal()); build_options.set_device_ordinal(client_->default_device_ordinal());
build_options.set_platform(client_->platform());
build_options.set_result_layout(result.xla_output_shape); build_options.set_result_layout(result.xla_output_shape);
build_options.set_has_hybrid_result(
options.local_executable_has_hybrid_result);
auto compile_result = auto compile_result =
client_->Compile(*result.computation, argument_layouts, build_options); client_->Compile(*result.computation, argument_layouts, build_options);

View File

@ -236,12 +236,6 @@ class XlaCompiler {
// to the computation. // to the computation.
bool allow_cpu_custom_calls = false; bool allow_cpu_custom_calls = false;
// If 'local_executable_has_hybrid_result', the top-level pointers of the
// result tuple of compiled programs are stored in host memory and the
// nested buffers in device memory, otherwise the whole result tuple is
// stored in device memory.
bool local_executable_has_hybrid_result = false;
// If not nullptr, populate_resource_manager is called with the // If not nullptr, populate_resource_manager is called with the
// compilation device's resource manager when the compilation // compilation device's resource manager when the compilation
// device is created, and can be used to create metadata objects // device is created, and can be used to create metadata objects

View File

@ -27,16 +27,6 @@ namespace se = ::perftools::gputools;
namespace xla { namespace xla {
ExecutableBuildOptions& ExecutableBuildOptions::set_platform(
perftools::gputools::Platform* platform) {
platform_ = platform;
return *this;
}
perftools::gputools::Platform* ExecutableBuildOptions::platform() const {
return platform_;
}
ExecutableBuildOptions& ExecutableBuildOptions::set_device_ordinal( ExecutableBuildOptions& ExecutableBuildOptions::set_device_ordinal(
int device_ordinal) { int device_ordinal) {
device_ordinal_ = device_ordinal; device_ordinal_ = device_ordinal;
@ -56,16 +46,6 @@ const Shape* ExecutableBuildOptions::result_layout() const {
return result_layout_set_ ? &result_layout_ : nullptr; return result_layout_set_ ? &result_layout_ : nullptr;
} }
ExecutableBuildOptions& ExecutableBuildOptions::set_has_hybrid_result(
bool has_hybrid_result) {
has_hybrid_result_ = has_hybrid_result;
return *this;
}
bool ExecutableBuildOptions::has_hybrid_result() const {
return has_hybrid_result_;
}
namespace { namespace {
StatusOr<Backend::StreamPtr> BorrowStreamForDevice(int device_ordinal, StatusOr<Backend::StreamPtr> BorrowStreamForDevice(int device_ordinal,
Backend* backend) { Backend* backend) {

View File

@ -37,14 +37,6 @@ namespace xla {
// LocalClient::Compile. // LocalClient::Compile.
class ExecutableBuildOptions { class ExecutableBuildOptions {
public: public:
// If set, this is the platform to build the computation for. This must match
// the underlying platform of the service. A value of nullptr indicates the
// option has not been set.
//
// TODO(b/28616830): Support multiple platforms.
ExecutableBuildOptions& set_platform(perftools::gputools::Platform* platform);
perftools::gputools::Platform* platform() const;
// If set, this is the device to build the computation for. Valid // If set, this is the device to build the computation for. Valid
// device_ordinal values are: 0 to # of devices - 1. These values are // device_ordinal values are: 0 to # of devices - 1. These values are
// identical to the device ordinal values used by StreamExecutor. The built // identical to the device ordinal values used by StreamExecutor. The built
@ -61,18 +53,10 @@ class ExecutableBuildOptions {
ExecutableBuildOptions& set_result_layout(const Shape& shape_with_layout); ExecutableBuildOptions& set_result_layout(const Shape& shape_with_layout);
const Shape* result_layout() const; const Shape* result_layout() const;
// If set, the executable will be built to output a hybrid
// ShapedBuffer with top-level tuple pointers in host memory and
// result buffers in device memory.
ExecutableBuildOptions& set_has_hybrid_result(bool has_hybrid_result);
bool has_hybrid_result() const;
private: private:
perftools::gputools::Platform* platform_ = nullptr;
int device_ordinal_ = -1; int device_ordinal_ = -1;
Shape result_layout_; Shape result_layout_;
bool result_layout_set_ = false; bool result_layout_set_ = false;
bool has_hybrid_result_ = true;
}; };
class LocalExecutable { class LocalExecutable {

View File

@ -39,8 +39,8 @@ void HloModuleConfig::SetDefaultComputationLayout(
} }
string HloModuleConfig::compilation_cache_key() const { string HloModuleConfig::compilation_cache_key() const {
string key = tensorflow::strings::StrCat("profiling=", hlo_profiling_enabled_, string key =
"::hybrid=", has_hybrid_result_); tensorflow::strings::StrCat("profiling=", hlo_profiling_enabled_);
StrAppend(&key, "::("); StrAppend(&key, "::(");
std::vector<string> params; std::vector<string> params;
for (const ShapeLayout& param_layout : for (const ShapeLayout& param_layout :

View File

@ -104,16 +104,6 @@ class HloModuleConfig {
// Whether to enable HLO-level profiling. // Whether to enable HLO-level profiling.
bool hlo_profiling_enabled_ = false; bool hlo_profiling_enabled_ = false;
// If this flag is true, the generated executable will return a ShapedBuffer
// holding the result of the computation. In a ShapedBuffer, tuples have their
// structure held in host memory and the element arrays (leaves of the tuple
// structure) stored in device memory. The ShapedBuffer is considered "hybrid"
// because its leaves are on device but its structure is stored on
// host. Otherwise, if this flag is false, the generated executable will
// return a DeviceMemoryBase where the result is held entirely in device
// memory.
bool has_hybrid_result_ = false;
// Module/graph-level seed handle. // Module/graph-level seed handle.
uint64 seed_ = 0; uint64 seed_ = 0;

View File

@ -68,26 +68,6 @@ LocalService::LocalService(const ServiceOptions& options,
std::unique_ptr<Backend> execute_backend) std::unique_ptr<Backend> execute_backend)
: Service(options, std::move(execute_backend)) {} : Service(options, std::move(execute_backend)) {}
namespace {
// Returns the space required to allocate a shape. If
// allocate_space_for_deep_copy the space includes all sub-buffers of
// a tuple.
int64 RequiredSpace(const Shape& shape, bool allocate_space_for_deep_copy,
TransferManager* transfer_manager) {
int64 size = 0;
// TODO(b/33492279) remove once no devices represent result tuples as
// contiguous buffers.
if (allocate_space_for_deep_copy) {
ShapeUtil::ForEachSubshape(
shape, [&size, transfer_manager](const Shape& subshape,
const ShapeIndex& /*index*/) {
size += transfer_manager->GetByteSizeRequirement(subshape);
});
}
return size;
}
} // namespace
StatusOr<std::unique_ptr<Executable>> LocalService::CompileExecutable( StatusOr<std::unique_ptr<Executable>> LocalService::CompileExecutable(
const ComputationHandle& computation, const ComputationHandle& computation,
const tensorflow::gtl::ArraySlice<const Shape*> argument_layouts, const tensorflow::gtl::ArraySlice<const Shape*> argument_layouts,

View File

@ -272,8 +272,6 @@ class Service : public ServiceInterface {
// Create a Hlo module config for the given program shape and arguments. // Create a Hlo module config for the given program shape and arguments.
// execution_options is optional; if not given a default is used. // execution_options is optional; if not given a default is used.
// has_hybrid_result is used to initialize the same-named field in
// HloModuleConfig -- see that class for documentation.
StatusOr<std::unique_ptr<HloModuleConfig>> CreateModuleConfig( StatusOr<std::unique_ptr<HloModuleConfig>> CreateModuleConfig(
const ProgramShape& program_shape, const ProgramShape& program_shape,
tensorflow::gtl::ArraySlice<const Shape*> argument_shapes, tensorflow::gtl::ArraySlice<const Shape*> argument_shapes,