Commit 39587aae authored by Justin Lebar's avatar Justin Lebar Committed by TensorFlower Gardener
Browse files

[XLA] Rework debug flags for dumping HLO.

The following flags (usually passed via the XLA_FLAGS envvar) are removed:

  xla_dump_computations_to
  xla_dump_executions_to
  xla_dump_ir_to
  xla_dump_optimized_hlo_proto_to
  xla_dump_per_pass_hlo_proto_to
  xla_dump_unoptimized_hlo_proto_to
  xla_generate_hlo_graph
  xla_generate_hlo_text_to
  xla_hlo_dump_as_html
  xla_hlo_graph_path
  xla_log_hlo_text

The following new flags are added:

  xla_dump_to
  xla_dump_hlo_module_re
  xla_dump_hlo_pass_re
  xla_dump_hlo_as_text
  xla_dump_hlo_as_proto
  xla_dump_hlo_as_dot
  xla_dump_hlo_as_url
  xla_dump_hlo_as_html
  xla_dump_ir
  xla_dump_hlo_snapshots

The default is not to dump anything at all, but as soon as some dumping flag is
specified, we enable the following defaults (most of which can be overridden).

 * dump to stdout (overridden by --xla_dump_to)
 * dump HLO modules at the very beginning and end of the optimization pipeline
 * don't dump between any HLO passes (overridden by --xla_dump_hlo_pass_re)
 * dump all HLO modules (overridden by --xla_dump_hlo_module_re)
 * dump in textual format (overridden by
   --xla_dump_hlo_as_{text,proto,dot,url,html}).

For example, to dump optimized and unoptimized HLO text and protos to /tmp/foo,
pass

  --xla_dump_to=/tmp/foo --xla_dump_hlo_as_text --xla_dump_hlo_as_proto

For details on these flags' meanings, see xla.proto.

The intent of this change is to make dumping both simpler to use and more
powerful.

For example:

 * Previously there was no way to dump the HLO module during the pass pipeline
   in HLO text format; the only option was --dump_per_pass_hlo_proto_to, which
   dumped in proto format.

   Now this is --xla_dump_pass_re=.* --xla_dump_hlo_as_text.  (In fact, the
   second flag is not necessary in this case, as dumping as text is the
   default.)

 * Previously there was no way to dump HLO as a graph before and after
   compilation; the only option was --xla_generate_hlo_graph, which would dump
   before/after every pass.

   Now this is --xla_dump_hlo_as_{dot,url,html} (depending on what format you
   want the graph in).

 * Previously, there was no coordination between the filenames written by the
   various flags, so info about one module might be dumped with various
   filename prefixes.  Now the filenames are consistent and all dumps from a
   particular module are next to each other.

If you only specify some of these flags, we try to figure out what you wanted.
For example:

 * --xla_dump_to implies --xla_dump_hlo_as_text unless you specify some
   other --xla_dump_as_* flag.

 * --xla_dump_hlo_as_text or --xla_dump_ir implies dumping to stdout unless you
   specify a different --xla_dump_to directory.  You can explicitly dump to
   stdout with --xla_dump_to=-.

As part of this change, I simplified the debugging code in the HLO passes for
dumping HLO modules.  Previously, many tests explicitly VLOG'ed the HLO module
before, after, and sometimes during the pass.  I removed these VLOGs.  If you
want dumps before/during/after an HLO pass, use --xla_dump_pass_re=<pass_name>.

PiperOrigin-RevId: 237920279
parent bc8b00ad
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment