[TF:XLA] Clean up unused XLA options and functions.
PiperOrigin-RevId: 175217850
This commit is contained in:
parent
b11a790328
commit
9abe08570f
tensorflow/compiler
@ -257,7 +257,6 @@ void XlaLocalLaunchOp::Compute(OpKernelContext* ctx) {
|
||||
options.flib_def = ctx->function_library()->GetFunctionLibraryDefinition();
|
||||
options.graph_def_version = ctx->function_library()->graph_def_version();
|
||||
options.allow_cpu_custom_calls = (platform_id_ == gpu::host::kHostPlatformId);
|
||||
options.local_executable_has_hybrid_result = true;
|
||||
|
||||
const XlaCompiler::CompilationResult* kernel;
|
||||
xla::LocalExecutable* executable;
|
||||
|
@ -227,10 +227,7 @@ Status XlaCompilationCache::BuildExecutable(
|
||||
}
|
||||
xla::ExecutableBuildOptions build_options;
|
||||
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_has_hybrid_result(
|
||||
options.local_executable_has_hybrid_result);
|
||||
|
||||
auto compile_result =
|
||||
client_->Compile(*result.computation, argument_layouts, build_options);
|
||||
|
@ -236,12 +236,6 @@ class XlaCompiler {
|
||||
// to the computation.
|
||||
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
|
||||
// compilation device's resource manager when the compilation
|
||||
// device is created, and can be used to create metadata objects
|
||||
|
@ -27,16 +27,6 @@ namespace se = ::perftools::gputools;
|
||||
|
||||
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(
|
||||
int device_ordinal) {
|
||||
device_ordinal_ = device_ordinal;
|
||||
@ -56,16 +46,6 @@ const Shape* ExecutableBuildOptions::result_layout() const {
|
||||
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 {
|
||||
StatusOr<Backend::StreamPtr> BorrowStreamForDevice(int device_ordinal,
|
||||
Backend* backend) {
|
||||
|
@ -37,14 +37,6 @@ namespace xla {
|
||||
// LocalClient::Compile.
|
||||
class ExecutableBuildOptions {
|
||||
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
|
||||
// device_ordinal values are: 0 to # of devices - 1. These values are
|
||||
// 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);
|
||||
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:
|
||||
perftools::gputools::Platform* platform_ = nullptr;
|
||||
int device_ordinal_ = -1;
|
||||
Shape result_layout_;
|
||||
bool result_layout_set_ = false;
|
||||
bool has_hybrid_result_ = true;
|
||||
};
|
||||
|
||||
class LocalExecutable {
|
||||
|
@ -39,8 +39,8 @@ void HloModuleConfig::SetDefaultComputationLayout(
|
||||
}
|
||||
|
||||
string HloModuleConfig::compilation_cache_key() const {
|
||||
string key = tensorflow::strings::StrCat("profiling=", hlo_profiling_enabled_,
|
||||
"::hybrid=", has_hybrid_result_);
|
||||
string key =
|
||||
tensorflow::strings::StrCat("profiling=", hlo_profiling_enabled_);
|
||||
StrAppend(&key, "::(");
|
||||
std::vector<string> params;
|
||||
for (const ShapeLayout& param_layout :
|
||||
|
@ -104,16 +104,6 @@ class HloModuleConfig {
|
||||
// Whether to enable HLO-level profiling.
|
||||
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.
|
||||
uint64 seed_ = 0;
|
||||
|
||||
|
@ -68,26 +68,6 @@ LocalService::LocalService(const ServiceOptions& options,
|
||||
std::unique_ptr<Backend> 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(
|
||||
const ComputationHandle& computation,
|
||||
const tensorflow::gtl::ArraySlice<const Shape*> argument_layouts,
|
||||
|
@ -272,8 +272,6 @@ class Service : public ServiceInterface {
|
||||
|
||||
// Create a Hlo module config for the given program shape and arguments.
|
||||
// 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(
|
||||
const ProgramShape& program_shape,
|
||||
tensorflow::gtl::ArraySlice<const Shape*> argument_shapes,
|
||||
|
Loading…
Reference in New Issue
Block a user