@@ -63,6 +63,7 @@ limitations under the License.
6363#include " mlir/Support/LLVM.h"
6464#include " xla/backends/gpu/codegen/triton/support.h"
6565#include " xla/backends/gpu/runtime/sequential_thunk.h"
66+ #include " xla/hlo/analysis/alias_info.h"
6667#include " xla/hlo/analysis/hlo_dataflow_analysis.h"
6768#include " xla/hlo/ir/hlo_casting_utils.h"
6869#include " xla/hlo/ir/hlo_computation.h"
@@ -430,9 +431,14 @@ GpuThunkAotCompilationResult::buffer_assignment() const {
430431 };
431432
432433 // Recreate BufferAssignment from proto.
434+ // Technically, we should pass the proper GpuAliasInfo, but the FromProto()
435+ // method does not actually make use of the MayAlias function. And for now, we
436+ // don't have backend-specific MustAlias rules.
437+ // TODO(b/424109294): This needs to be fixed when we implement
438+ // backend-specific MustAlias rules.
439+ AliasInfo alias_info;
433440 return BufferAssignment::FromProto (proto_.buffer_assignment (), module_.get (),
434- buffer_size_bytes_function,
435- /* can_share_buffer=*/ nullptr );
441+ buffer_size_bytes_function, &alias_info);
436442}
437443
438444absl::StatusOr<std::unique_ptr<Executable>>
@@ -444,12 +450,6 @@ GpuThunkAotCompilationResult::LoadExecutable(
444450 std::unique_ptr<HloModule> hlo_module,
445451 HloModule::CreateFromProtoWithConfig (proto_.hlo_module_with_config ()));
446452
447- // Recreate BufferAssignment from proto.
448- TF_ASSIGN_OR_RETURN (
449- std::unique_ptr<BufferAssignment> buffer_assignment,
450- BufferAssignment::FromProto (proto_.buffer_assignment (), hlo_module.get (),
451- compiler->BufferSizeBytesFunction (),
452- /* can_share_buffer=*/ nullptr ));
453453
454454 ExecutionStreamAssignment execution_stream_assignment (hlo_module.get ());
455455
@@ -472,6 +472,16 @@ GpuThunkAotCompilationResult::LoadExecutable(
472472 auto llvm_module = std::make_unique<llvm::Module>(" " , llvm_context);
473473 llvm_module->setTargetTriple (llvm::Triple (gpu_compiler->target_triple ()));
474474 llvm_module->setDataLayout (gpu_compiler->data_layout ());
475+
476+ // Recreate BufferAssignment from proto.
477+ std::unique_ptr<GpuAliasInfo> alias_info =
478+ gpu_compiler->GetAliasInfo (gpu_device_info);
479+ TF_ASSIGN_OR_RETURN (
480+ std::unique_ptr<BufferAssignment> buffer_assignment,
481+ BufferAssignment::FromProto (proto_.buffer_assignment (), hlo_module.get (),
482+ compiler->BufferSizeBytesFunction (),
483+ alias_info.get ()));
484+
475485 IrEmitterContext ir_emitter_context (
476486 hlo_module.get (), buffer_assignment.get (), &execution_stream_assignment,
477487 platform_name, gpu_device_info, mlir_context.get (), llvm_module.get (),
0 commit comments