aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler
diff options
context:
space:
mode:
authorGravatar Bixia Zheng <bixia@google.com>2018-10-02 14:54:08 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-02 15:04:08 -0700
commit44f273e853360042ee14def03eba85d1e04a7272 (patch)
tree4d2f9cc5e235bfe83a2241864f6d61367193e56d /tensorflow/compiler
parent664f3dde67bfa436e5216ae54ee256761c7c6962 (diff)
[XLA] A test that disables layout assignment should only contain layout
consistent HLO instructions. Fix a dot test that disables layout assignment pass to not generate layout inconsistent HLO instructions. This includes only adding the dot result to an addend with the same layout, and disabling algebraic simplification which may transform a dot to a multiplication with inconsistent layouts. PiperOrigin-RevId: 215463477
Diffstat (limited to 'tensorflow/compiler')
-rw-r--r--tensorflow/compiler/xla/tests/dot_operation_test.cc19
1 files changed, 5 insertions, 14 deletions
diff --git a/tensorflow/compiler/xla/tests/dot_operation_test.cc b/tensorflow/compiler/xla/tests/dot_operation_test.cc
index 0171f51583..6c0847a875 100644
--- a/tensorflow/compiler/xla/tests/dot_operation_test.cc
+++ b/tensorflow/compiler/xla/tests/dot_operation_test.cc
@@ -394,6 +394,10 @@ class ParametricDotTestWithoutLayoutAssignment : public ParametricDotTest {
ParametricDotTestWithoutLayoutAssignment() {
execution_options_.mutable_debug_options()->add_xla_disable_hlo_passes(
"layout-assignment");
+ // Disable algebraic simplification because the pass may replace a dot
+ // instruction with a layout-changing multiplication instruction.
+ execution_options_.mutable_debug_options()->add_xla_disable_hlo_passes(
+ "algsimp");
}
};
@@ -404,31 +408,18 @@ std::vector<DotTestParam> CreateNoLayoutAssignmentDotTestParameters() {
for (bool lhs_row_major : {true, false}) {
for (bool rhs_row_major : {true, false}) {
for (bool has_addend : {true, false}) {
+ // The addend needs to be row major to match the result of the dot.
params.push_back({/*m=*/1, /*k=*/k, /*n=*/n,
/*dot_lhs_row_major=*/lhs_row_major,
/*dot_rhs_row_major=*/rhs_row_major,
/*has_addend=*/has_addend,
/*addend_row_major=*/true});
- if (has_addend) {
- params.push_back({/*m=*/1, /*k=*/k, /*n=*/n,
- /*dot_lhs_row_major=*/lhs_row_major,
- /*dot_rhs_row_major=*/rhs_row_major,
- /*has_addend=*/has_addend,
- /*addend_row_major=*/false});
- }
if (n != 1) {
params.push_back({/*m=*/n, /*k=*/k, /*n=*/1,
/*dot_lhs_row_major=*/lhs_row_major,
/*dot_rhs_row_major=*/rhs_row_major,
/*has_addend=*/has_addend,
/*addend_row_major=*/true});
- if (has_addend) {
- params.push_back({/*m=*/n, /*k=*/k, /*n=*/1,
- /*dot_lhs_row_major=*/lhs_row_major,
- /*dot_rhs_row_major=*/rhs_row_major,
- /*has_addend=*/has_addend,
- /*addend_row_major=*/false});
- }
}
}
}