aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/hlo_constant_folding.cc
diff options
context:
space:
mode:
authorGravatar Jacques Pienaar <jpienaar@google.com>2018-02-28 00:07:55 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-02-28 00:11:59 -0800
commit503d9b522e28272e032bc45a10e3c0f21398a16e (patch)
tree1c635afe83ac48ed0180f5975e1fa75dbf022124 /tensorflow/compiler/xla/service/hlo_constant_folding.cc
parentc38a16dbcc5de5fa5579a3e48ec12be316a2cb3f (diff)
[XLA:Evaluator] Handle while loop.
* Add while loop support to HloEvaluator; * Add a max_loop_iteration argument to the interpreter's constructor to limit the number of loop iterations that will be evaluated (or no bound if -1). Maintain current constant propagation behavior by setting limit to 0 for evaluators used for CP. PiperOrigin-RevId: 187287574
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_constant_folding.cc')
-rw-r--r--tensorflow/compiler/xla/service/hlo_constant_folding.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_constant_folding.cc b/tensorflow/compiler/xla/service/hlo_constant_folding.cc
index 53450991b6..35ecd4428d 100644
--- a/tensorflow/compiler/xla/service/hlo_constant_folding.cc
+++ b/tensorflow/compiler/xla/service/hlo_constant_folding.cc
@@ -35,7 +35,10 @@ limitations under the License.
namespace xla {
StatusOr<bool> HloConstantFolding::Run(HloModule* module) {
- auto evaluator = MakeUnique<HloEvaluator>();
+ // Limit the constant folding to 0 iterations to skip folding loops. This
+ // retains the behavior from before while loop support in HloEvaluator and may
+ // be revised.
+ auto evaluator = MakeUnique<HloEvaluator>(/*max_loop_iterations=*/0);
XLA_VLOG_LINES(2,
"HloConstantFolding::Run(), before:\n" + module->ToString());