@@ -43,6 +43,7 @@ limitations under the License.
4343#include " xla/service/buffer_assignment.h"
4444#include " xla/service/buffer_value.h"
4545#include " xla/service/compiler.h"
46+ #include " xla/service/cpu/buffer_info_util.h"
4647#include " xla/service/cpu/cpu_executable.h"
4748#include " xla/service/cpu/executable.pb.h"
4849#include " xla/service/executable.h"
@@ -56,6 +57,7 @@ limitations under the License.
5657#include " xla/util.h"
5758
5859namespace xla ::cpu {
60+ using BufferInfo = cpu_function_runtime::BufferInfo;
5961
6062CpuAotCompilationOptions::CpuAotCompilationOptions (
6163 std::string triple, std::string cpu_name, std::string features,
@@ -86,10 +88,14 @@ CpuAotCompilationResult::Create(
8688 TF_ASSIGN_OR_RETURN (ThunkSequenceProto thunk_proto,
8789 thunk_sequence_serdes.ToProto (thunks));
8890
91+ std::vector<cpu_function_runtime::BufferInfo> buffer_infos;
8992 std::vector<cpu::BufferAllocationInfo> buffer_allocation_infos;
9093 std::optional<size_t > temp_allocation_index;
9194
9295 if (buffer_assignment) {
96+ buffer_infos =
97+ CreateBufferInfosFromBufferAssignment (*hlo_module, *buffer_assignment);
98+
9399 buffer_allocation_infos =
94100 CreateBufferAllocationInfos (*hlo_module, *buffer_assignment);
95101
@@ -108,19 +114,21 @@ CpuAotCompilationResult::Create(
108114 return absl::WrapUnique (new CpuAotCompilationResult (
109115 hlo_module, buffer_assignment, function_name, std::move (obj_files),
110116 std::move (symbols), thunk_proto, std::move (temp_allocation_index),
111- std::move (buffer_allocation_infos ), std::move (function_library ),
112- std::move (hlo_profile_printer_data)));
117+ std::move (buffer_infos ), std::move (buffer_allocation_infos ),
118+ std::move (function_library), std::move ( hlo_profile_printer_data)));
113119}
114120
115121CpuAotCompilationResult::CpuAotCompilationResult (
116122 const HloModule* hlo_module, const BufferAssignment* buffer_assignment,
117123 absl::string_view function_name, std::vector<ObjFileProto> obj_files,
118124 std::vector<SymbolProto> symbols, const ThunkSequenceProto& thunks,
119125 std::optional<size_t > temp_allocation_index,
126+ std::vector<cpu_function_runtime::BufferInfo> buffer_infos,
120127 std::vector<BufferAllocationInfo> buffer_allocation_infos,
121128 std::unique_ptr<FunctionLibrary> function_library,
122129 std::unique_ptr<HloProfilePrinterData> hlo_profile_printer_data)
123130 : temp_allocation_index_(temp_allocation_index),
131+ buffer_infos_(std::move(buffer_infos)),
124132 buffer_allocation_infos_(std::move(buffer_allocation_infos)),
125133 function_library_(std::move(function_library)),
126134 hlo_profile_printer_data_(std::move(hlo_profile_printer_data)) {
0 commit comments