[XLA] Don't print LLVM IR to stdout if the user specifies just --xla_dump_hlo_as_url.

This flag alone means you probably just want the rendered HLO graphs printed to
stdout and nothing more.  If you do want the LLVM IR printed to stdout, just
add --xla_dump_hlo_as_text.

PiperOrigin-RevId: 257213859
This commit is contained in:
Justin Lebar 2019-07-09 09:51:48 -07:00 committed by TensorFlower Gardener
parent 67fc29f8fb
commit a13443841d

View File

@ -48,22 +48,27 @@ struct CanonicalDebugOptions {
// function we treat this struct's members as write-only, and read only from
// `opts`.
// If dump_to is empty, default to dumping to stdout.
if (opts.xla_dump_to().empty()) {
dump_to = "-";
}
// Did the user specifiy an explicit format for dumping?
bool output_format_specified =
bool output_format_other_than_url_specified =
opts.xla_dump_hlo_as_text() || opts.xla_dump_hlo_as_proto() ||
opts.xla_dump_hlo_as_dot() || opts.xla_dump_hlo_as_html() ||
opts.xla_dump_hlo_as_url() || opts.xla_dump_hlo_snapshots();
opts.xla_dump_hlo_snapshots();
bool output_format_specified =
output_format_other_than_url_specified || opts.xla_dump_hlo_as_url();
// If we haven't specified an output format, default to dumping as text.
if (!output_format_specified) {
dump_as_text = true;
}
// If dump_to is empty, default to dumping to stdout, so long as some dump
// format other than dump-as-url was specified. If the user only specified
// --xla_dump_hlo_as_url, then don't dump to stdout, that is likely noise
// they don't want.
if (opts.xla_dump_to().empty() && output_format_other_than_url_specified) {
dump_to = "-";
}
// If we specified a regular expression restricting which modules to dump,
// respect that.
//
@ -143,6 +148,10 @@ void DumpToFileInDirImpl(string_view filename, string_view contents,
return;
}
if (opts.dump_to.empty()) {
return;
}
const string& dir = opts.dump_to;
VLOG(1) << "Dumping " << filename << " to " << dir;