MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ToProto

Method ToProto

tensorflow/compiler/xla/service/buffer_assignment.cc:266–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266BufferAllocationProto BufferAllocation::ToProto() const {
267 BufferAllocationProto proto;
268 proto.set_index(index_);
269 proto.set_size(size_);
270 proto.set_is_thread_local(is_thread_local_);
271 proto.set_is_tuple(is_tuple_);
272 proto.set_color(color_.value());
273 if (is_entry_computation_parameter_) {
274 proto.set_is_entry_computation_parameter(true);
275 for (int64 idx : param_shape_index()) {
276 proto.add_parameter_shape_index(idx);
277 }
278 proto.set_parameter_number(parameter_number_);
279 }
280 proto.set_is_constant(is_constant_);
281 proto.set_maybe_live_out(maybe_live_out_);
282 for (const auto& buffer_offset_size : assigned_buffers_) {
283 BufferAllocationProto::Assigned* proto_assigned = proto.add_assigned();
284 proto_assigned->set_logical_buffer_id(buffer_offset_size.first->id());
285 proto_assigned->set_offset(buffer_offset_size.second.offset);
286 proto_assigned->set_size(buffer_offset_size.second.size);
287 }
288 absl::c_sort(*proto.mutable_assigned(),
289 [](const BufferAllocationProto::Assigned& assign1,
290 const BufferAllocationProto::Assigned& assign2) {
291 return assign1.logical_buffer_id() <
292 assign2.logical_buffer_id();
293 });
294 return proto;
295}
296
297static bool CompareHloValuesById(const HloValue* a, const HloValue* b) {
298 return a->id() < b->id();

Callers

nothing calls this directly

Calls 15

set_is_thread_localMethod · 0.80
set_is_tupleMethod · 0.80
set_colorMethod · 0.80
set_maybe_live_outMethod · 0.80
set_offsetMethod · 0.80
HeapTracesMethod · 0.80
set_indexMethod · 0.45
set_sizeMethod · 0.45
valueMethod · 0.45
idMethod · 0.45
sizeMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected