[XLA] Remove dead propagate_bitcast_layouts_to_backend_config option and GPU backend_configs_cc dep from mlir_hlo_to_hlo

`MlirToHloConversionOptions::propagate_bitcast_layouts_to_backend_config` defaults to `false` and is never set or referenced anywhere in the codebase. It was added as a temporary workaround for the legacy MHLO-based XLA:GPU elemental IR emitters (which have since been removed), and was the sole reason the hardware-independent `//xla/hlo/translate/mhlo_to_hlo:mlir_hlo_to_hlo` library included `xla/service/gpu/backend_configs.proto.h` (`xla::gpu::BitcastBackendConfig`) and depended on `//xla/service/gpu:backend_configs_cc`.

Remove the dead option, its unreachable `if` branch in `ExportXlaOperator(mhlo::BitcastOp)`, and the `//xla/service/gpu:backend_configs_cc` dependency.

PiperOrigin-RevId: 987284482
This commit is contained in:
Henning Becker
2026-09-25 04:03:24 -07:00
committed by TensorFlower Gardener
parent 435103ead5
commit 420ff4c277
3 changed files with 0 additions and 30 deletions
-1
View File
@@ -253,7 +253,6 @@ cc_library(
"//xla/service:hlo_module_config",
"//xla/service:hlo_proto_cc",
"//xla/service:source_target_pairs",
"//xla/service/gpu:backend_configs_cc",
"//xla/service/spmd/shardy:constants",
"//xla/service/spmd/shardy:utils",
"//xla/service/spmd/shardy/stablehlo_round_trip:export_shardings",
@@ -105,7 +105,6 @@ limitations under the License.
#include "xla/mlir_hlo/mhlo/transforms/passes.h"
#include "xla/mlir_hlo/stablehlo_ext/transforms/passes.h"
#include "xla/mlir_hlo/utils/unregistered_attributes.h"
#include "xla/service/gpu/backend_configs.pb.h"
#include "xla/service/hlo.pb.h"
#include "xla/service/hlo_module_config.h"
#include "xla/service/source_target_pairs.h"
@@ -4815,29 +4814,6 @@ LogicalResult ExportXlaOp(BitcastOp op, OpLoweringContext ctx) {
xla::XlaOp bitcast = xla::internal::XlaBuilderFriend::BuildBitcast(
ctx.builder, operand, xla::TypeToShape(op.getType()));
value_map[op] = bitcast;
if (ctx.converter->GetOptions().propagate_bitcast_layouts_to_backend_config) {
// Encode the source and result layout of the bitcast into the XLA HLO
// backend config as a protobuf. Note that this is a temporary solution
// which will go away once XLA:GPU stops falling back to XLA HLO Elemental
// IR emitters.
xla::HloInstructionProto* bitcast_proto =
xla::internal::XlaBuilderFriend::GetInstruction(bitcast);
xla::HloInstructionProto* operand_proto =
xla::internal::XlaBuilderFriend::GetInstruction(operand);
xla::LayoutProto result_layout =
ExtractLayout(op, bitcast_proto->shape().dimensions_size(),
xla::kBitcastResultLayout)
.ToProto();
xla::LayoutProto source_layout =
ExtractLayout(op, operand_proto->shape().dimensions_size(),
xla::kBitcastSourceLayout)
.ToProto();
xla::gpu::BitcastBackendConfig bitcast_config;
*bitcast_config.mutable_source_layout() = source_layout;
*bitcast_config.mutable_result_layout() = result_layout;
*bitcast_proto->mutable_backend_config() =
bitcast_config.SerializeAsString();
}
return success();
}
@@ -44,11 +44,6 @@ struct MlirToHloConversionOptions {
// TODO(timshen): Investigate the necessity of having layouts in MHLO.
bool propagate_layouts = false;
// Propagate the source and result layouts from mhlo bitcast op into the
// backend config for the bitcast. This is required for XLA:GPU backend to
// use elemental IR emitters for fused bitcasts without propagating layouts.
bool propagate_bitcast_layouts_to_backend_config = false;
LayoutPreferenceFn layout_preference_fn;
ShapeRepresentationFn shape_representation_fn;