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

Method GetUniqueSlice

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

Source from the content-addressed store, hash-verified

466}
467
468StatusOr<BufferAllocation::Slice> BufferAssignment::GetUniqueSlice(
469 const HloInstruction* instruction, const ShapeIndex& index) const {
470 VLOG(3) << "Trying to find unique slice for " << instruction->name() << " ["
471 << index << "]";
472 BufferAllocation::Slice result;
473 for (const HloValue* value :
474 dataflow_analysis().GetValueSet(instruction, index).values()) {
475 VLOG(3) << "Examining value " << *value;
476 if (HasAllocation(*value)) {
477 VLOG(3) << "Has allocation";
478 const BufferAllocation::Slice slice =
479 GetAssignedAllocation(*value).GetSlice(*value);
480 if (result.allocation() == nullptr) {
481 result = slice;
482 } else if (result != slice) {
483 return FailedPrecondition(
484 "BufferAllocation::Slice for instruction %s at index %s cannot "
485 "be determined at compile-time.",
486 instruction->name(), index.ToString());
487 }
488 } else {
489 VLOG(3) << "No allocation";
490 }
491 }
492 if (result.allocation() == nullptr) {
493 return FailedPrecondition(
494 "BufferAllocation::Slice not assigned for instruction %s at index %s",
495 instruction->name(), index.ToString());
496 }
497 return result;
498}
499
500StatusOr<BufferAllocation::Slice> BufferAssignment::GetUniqueTopLevelSlice(
501 const HloInstruction* instruction) const {

Callers 11

TEST_FFunction · 0.80
HandleAllReduceMethod · 0.80
GetHloBufferSlicesFunction · 0.80
GetAllocationSliceMethod · 0.80
HandleWhileMethod · 0.80

Calls 6

FailedPreconditionFunction · 0.85
nameMethod · 0.65
valuesMethod · 0.45
GetSliceMethod · 0.45
allocationMethod · 0.45
ToStringMethod · 0.45

Tested by 1

TEST_FFunction · 0.64