tf_1.8_xla_doc
List of all members
xla::ReshapeMover Class Reference

#include <reshape_mover.h>

Inherits HloPassInterface.

Detailed Description

Google docs:

A pass which moves Reshapes and Transposes to let later passes combine them. This now only moves them outputward across elementwise ops all whose operands are equivalent Reshapes or Transposes, but in future could potentially move them inputward also.

Implementation note from Google doc:

The general idea behind this pass is that we're converting from this:

%param.A = OldShape
%param.B = OldShape
%reshape.A = NewShape reshape(%param.A)
%reshape.B = NewShape reshape(%param.B)
%instruction = NewShape instruction(%reshape.A, %reshape.B)

To this:

%param.A = OldShape
%param.B = OldShape
%instruction = OldShape instruction(%param.A, %param.B)
%reshape = NewShape reshape(%instruction)

Where the instruction must be elementwise, and both reshapes and transposes are moved.

Most elementwise instructions support implicit broadcast of scalar operands, but select is a special-case. The signature is Select(Pred, A, B), and the only implicit scalar broadcast is on Pred, not on A or B. Since reshapes or transposes to a scalar should be cheap, we simply never move them.


The documentation for this class was generated from the following files: