Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[benchmarks] Add IR dump option. #7927

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions benchmarks/experiment_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ def generate_and_run_all_configs(self):
xla_flags = f"{xla_flags} {new_xla_flags}"
process_env["XLA_FLAGS"] = xla_flags

if self._args.save_ir_format:
path = self._get_results_file_path(experiment_cfg, model_cfg, "dump",
self._args.save_ir_format)
process_env["XLA_SAVE_TENSORS_FMT"] = self._args.save_ir_format
process_env["XLA_SAVE_TENSORS_FILE"] = str(path)

# Launch subprocess.
try:
command = [sys.executable] + sys.argv + [
Expand Down Expand Up @@ -1006,6 +1012,11 @@ def __str__(self):
type=int,
help="Defines the duration of the profiling when `profile-xla` flag is set.",
)
parser.add_argument(
"--save-ir-format",
choices=["text", "hlo", "stablehlo"],
help="Save intermediate IR.",
)
return parser.parse_args(args)


Expand Down
Loading