aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler
diff options
context:
space:
mode:
authorGravatar Yuanzhong Xu <yuanzx@google.com>2018-10-03 21:41:43 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-03 21:46:07 -0700
commitd3ced638f0496c70c3a063be82b30b358179e369 (patch)
tree924e86d1c63c0019fb51adedf77a3ab6b4fd368e /tensorflow/compiler
parent8a437200e14c8e09fcc8e952679d489909f175c8 (diff)
[XLA] Delete IsInplaceSlice.
PiperOrigin-RevId: 215681153
Diffstat (limited to 'tensorflow/compiler')
-rw-r--r--tensorflow/compiler/xla/service/hlo_dataflow_analysis.cc24
-rw-r--r--tensorflow/compiler/xla/service/hlo_dataflow_analysis.h1
-rw-r--r--tensorflow/compiler/xla/service/hlo_instruction.cc4
-rw-r--r--tensorflow/compiler/xla/service/hlo_instruction.h3
-rw-r--r--tensorflow/compiler/xla/service/hlo_instructions.h14
-rw-r--r--tensorflow/compiler/xla/service/tuple_points_to_analysis.cc23
-rw-r--r--tensorflow/compiler/xla/service/tuple_points_to_analysis.h1
7 files changed, 4 insertions, 66 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_dataflow_analysis.cc b/tensorflow/compiler/xla/service/hlo_dataflow_analysis.cc
index 44cde4a3d2..c22adcdd8d 100644
--- a/tensorflow/compiler/xla/service/hlo_dataflow_analysis.cc
+++ b/tensorflow/compiler/xla/service/hlo_dataflow_analysis.cc
@@ -356,23 +356,6 @@ bool HloDataflowAnalysis::UpdateBitcastValueSet(HloInstruction* bitcast) {
return false;
}
-bool HloDataflowAnalysis::UpdateSliceValueSet(HloInstruction* slice) {
- CHECK_EQ(slice->opcode(), HloOpcode::kSlice);
- if (!slice->IsInPlaceSlice()) {
- return false;
- }
- // If this slice is lowered to an in-place version, then it forwards the
- // operand value to the output.
- const InstructionValueSet& operand_set =
- GetInstructionValueSet(slice->operand(0));
- InstructionValueSet& slice_set = GetInstructionValueSet(slice);
- if (operand_set != slice_set) {
- slice_set = operand_set;
- return true;
- }
- return false;
-}
-
bool HloDataflowAnalysis::UpdateSendValueSet(HloInstruction* send) {
CHECK_EQ(send->opcode(), HloOpcode::kSend);
bool changed = false;
@@ -641,8 +624,6 @@ bool HloDataflowAnalysis::UpdateInstructionValueSet(
switch (instruction->opcode()) {
case HloOpcode::kBitcast:
return UpdateBitcastValueSet(instruction);
- case HloOpcode::kSlice:
- return UpdateSliceValueSet(instruction);
case HloOpcode::kDomain:
return UpdateDomainValueSet(instruction);
case HloOpcode::kCopy:
@@ -814,11 +795,6 @@ Status HloDataflowAnalysis::InitializeInstructionValueSets() {
define_all_values();
}
break;
- case HloOpcode::kSlice:
- if (!instruction->IsInPlaceSlice()) {
- define_all_values();
- }
- break;
case HloOpcode::kWhile:
case HloOpcode::kCall:
case HloOpcode::kConditional:
diff --git a/tensorflow/compiler/xla/service/hlo_dataflow_analysis.h b/tensorflow/compiler/xla/service/hlo_dataflow_analysis.h
index e62c1c2ac8..abac398c04 100644
--- a/tensorflow/compiler/xla/service/hlo_dataflow_analysis.h
+++ b/tensorflow/compiler/xla/service/hlo_dataflow_analysis.h
@@ -182,7 +182,6 @@ class HloDataflowAnalysis {
// Updates the value set for a particular instruction type. Returns whether
// the instruction value set changed.
bool UpdateBitcastValueSet(HloInstruction* bitcast);
- bool UpdateSliceValueSet(HloInstruction* slice);
bool UpdateCallValueSet(HloInstruction* call);
bool UpdateConditionalValueSet(HloInstruction* conditional);
bool UpdateCopyValueSet(HloInstruction* copy);
diff --git a/tensorflow/compiler/xla/service/hlo_instruction.cc b/tensorflow/compiler/xla/service/hlo_instruction.cc
index 8bddaa8c96..fb91adc302 100644
--- a/tensorflow/compiler/xla/service/hlo_instruction.cc
+++ b/tensorflow/compiler/xla/service/hlo_instruction.cc
@@ -3076,10 +3076,6 @@ const std::vector<int64>& HloInstruction::slice_strides() const {
return Cast<HloSliceInstruction>(this)->slice_strides();
}
-bool HloInstruction::IsInPlaceSlice() const {
- return Cast<HloSliceInstruction>(this)->IsInPlaceSlice();
-}
-
const Literal& HloInstruction::literal() const {
return Cast<HloConstantInstruction>(this)->literal();
}
diff --git a/tensorflow/compiler/xla/service/hlo_instruction.h b/tensorflow/compiler/xla/service/hlo_instruction.h
index 9deed20e5d..374862c4b6 100644
--- a/tensorflow/compiler/xla/service/hlo_instruction.h
+++ b/tensorflow/compiler/xla/service/hlo_instruction.h
@@ -1330,9 +1330,6 @@ class HloInstruction {
int64 slice_strides(int64 dimension) const;
const std::vector<int64>& slice_strides() const;
- // Delegates to HloSliceInstruction::IsInPlaceSlice.
- bool IsInPlaceSlice() const;
-
// Returns the literal associated with this instruction.
const Literal& literal() const;
diff --git a/tensorflow/compiler/xla/service/hlo_instructions.h b/tensorflow/compiler/xla/service/hlo_instructions.h
index c929867bb9..ab168800f6 100644
--- a/tensorflow/compiler/xla/service/hlo_instructions.h
+++ b/tensorflow/compiler/xla/service/hlo_instructions.h
@@ -546,17 +546,6 @@ class HloSliceInstruction : public HloInstruction {
}
const std::vector<int64>& slice_strides() const { return slice_strides_; }
- // Returns the flag that describes whether a slice must be lowered into an
- // offset into the original operand.
- bool IsInPlaceSlice() const { return is_in_place_slice_; }
-
- // Sets and returns the flag that describes whether a slice must be lowered
- // into an offset into the original operand.
- bool SetIsInPlaceSlice(bool value) {
- is_in_place_slice_ = value;
- return value;
- }
-
private:
std::vector<string> ExtraAttributesToStringImpl(
const HloPrintOptions& options) const override;
@@ -573,9 +562,6 @@ class HloSliceInstruction : public HloInstruction {
std::vector<int64> slice_starts_;
std::vector<int64> slice_limits_;
std::vector<int64> slice_strides_;
-
- // Describes whether the slice can be lowered to an offset into the operand.
- bool is_in_place_slice_ = false;
};
class HloConstantInstruction : public HloInstruction {
diff --git a/tensorflow/compiler/xla/service/tuple_points_to_analysis.cc b/tensorflow/compiler/xla/service/tuple_points_to_analysis.cc
index 6fed7c76d0..811ac55e2d 100644
--- a/tensorflow/compiler/xla/service/tuple_points_to_analysis.cc
+++ b/tensorflow/compiler/xla/service/tuple_points_to_analysis.cc
@@ -280,16 +280,6 @@ Status TuplePointsToAnalysis::HandleDomain(HloInstruction* domain) {
return Status::OK();
}
-Status TuplePointsToAnalysis::HandleSlice(HloInstruction* slice) {
- // A kSlice instruction aliases its operand if the backend lowers it to an
- // in-place implementation.
- if (slice->IsInPlaceSlice()) {
- CreateCopiedPointsToSet(slice, slice->operand(0));
- return Status::OK();
- }
- return DefaultAction(slice);
-}
-
Status TuplePointsToAnalysis::HandleRecvDone(HloInstruction* recv_done) {
// RecvDone aliases its input (Recv) tuple element {0} to element {0} of its
// output. The other indices ({} and {1}) define their own buffers.
@@ -455,15 +445,10 @@ bool TuplePointsToAnalysis::InstructionDefinesBufferAtIndex(
Status TuplePointsToAnalysis::VerifyBuffer(const LogicalBuffer& buffer) const {
if (!InstructionDefinesBufferAtIndex(buffer.instruction(), buffer.index())) {
- // kSlice ops that are lowered to an in-place version are expected to not
- // define their output buffer.
- if (buffer.instruction()->opcode() != HloOpcode::kSlice ||
- !buffer.instruction()->IsInPlaceSlice()) {
- return FailedPrecondition(
- "LogicalBuffer %s is ill-defined: instruction %s does not define a "
- "buffer at that index",
- buffer.ToString(), buffer.instruction()->name());
- }
+ return FailedPrecondition(
+ "LogicalBuffer %s is ill-defined: instruction %s does not define a "
+ "buffer at that index",
+ buffer.ToString(), buffer.instruction()->name());
}
if (buffer.id() < 0 ||
diff --git a/tensorflow/compiler/xla/service/tuple_points_to_analysis.h b/tensorflow/compiler/xla/service/tuple_points_to_analysis.h
index 64ad1dc80e..30c365053c 100644
--- a/tensorflow/compiler/xla/service/tuple_points_to_analysis.h
+++ b/tensorflow/compiler/xla/service/tuple_points_to_analysis.h
@@ -247,7 +247,6 @@ class TuplePointsToAnalysis : public DfsHloVisitorWithDefault {
Status HandleGetTupleElement(HloInstruction* get_tuple_element) override;
Status HandleBitcast(HloInstruction* bitcast) override;
Status HandleDomain(HloInstruction* domain) override;
- Status HandleSlice(HloInstruction* slice) override;
Status HandleCopy(HloInstruction* copy) override;
Status HandleRecvDone(HloInstruction* recv_done) override;
Status HandleSend(HloInstruction* send) override;