Skip to content

Commit

Permalink
Add the ability to verify assumptions about layout assignment after p…
Browse files Browse the repository at this point in the history
…ropagation

is done.

PiperOrigin-RevId: 158696212
  • Loading branch information
tensorflower-gardener committed Jun 12, 2017
1 parent b085231 commit 9456bcf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tensorflow/compiler/xla/service/layout_assignment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,9 @@ Status LayoutAssignment::AssignLayouts(const LayoutConstraints& constraints,
TF_RETURN_IF_ERROR(SetFusionLayouts(instruction));
}

// Execute extra verification step once the layout has been finalized.
TF_RETURN_IF_ERROR(Verify(instruction));

// Verify all layouts in the shape have been set.
TF_RET_CHECK(LayoutUtil::HasLayout(instruction->shape()));
}
Expand Down
6 changes: 6 additions & 0 deletions tensorflow/compiler/xla/service/layout_assignment.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ class LayoutAssignment : public HloPassInterface {
const ResultLayoutConstraint& layout_constraint,
LayoutConstraints* constraints);

// Called after layouts of an instruction have been finalized to allow
// subclasses to check for platform specific assumptions.
virtual Status Verify(const HloInstruction* instruction) {
return Status::OK();
}

// Propagates a buffer layout constraint into the operands that use it.
Status PropagateBufferConstraintToUses(
const BufferLayoutConstraint& layout_constraint,
Expand Down

0 comments on commit 9456bcf

Please sign in to comment.