Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
13 changes: 13 additions & 0 deletions mlir/test/perf-scripts/runtime/tuningRunner-gemm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Using a tiny GEMM with --debug-quick-tune-data. This emits a `.debug`
# TSV of the per-config table entries (PerfConfig + TFlops) but, unlike the
# full ``--debug`` flag, omits the heavy per-iteration ``MeasurementsMs``
# arrays. Verify the debug file is produced, has the expected header and
# per-config rows, and that the measurements column is absent.
# RUN: rm -f %t2.tsv %t2.tsv.state %t2.tsv.debug
# RUN: tuningRunner.py --op gemm --tuning-space=quick --debug-quick-tune-data \
# RUN: --config='-g 1 -m 64 -n 64 -k 64 -t f32 -out_datatype f32 -transA 0 -transB 0' \
# RUN: -q -o %t2.tsv
# RUN: FileCheck %s --check-prefix=DEBUG --implicit-check-not=MeasurementsMs < %t2.tsv.debug
#
# DEBUG: PerfConfig{{.*}}TFlops
# DEBUG: {{v[0-9]+:}}
15 changes: 12 additions & 3 deletions mlir/utils/performance/tuningRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def get_gpu_logger(gpu_id: int) -> logging.LoggerAdapter:
class Options:
"""Configuration options for the tuning process."""
debug: bool
debug_quick_tune_data: bool
Comment thread
erizheng-amd marked this conversation as resolved.
tuning_space_kind: str
quiet: bool
verbose: bool
Expand Down Expand Up @@ -1640,8 +1641,9 @@ def tune_configs(ctx: TuningContext, status_only: bool) -> bool:

has_errors = False

debug_enabled = ctx.options.debug and ctx.options.output != '-'
if ctx.options.debug and not debug_enabled:
debug_requested = ctx.options.debug or ctx.options.debug_quick_tune_data
debug_enabled = debug_requested and ctx.options.output != '-'
if debug_requested and not debug_enabled:
logger.warning("Debug output disabled when writing to stdout")

with (OutputFileWriter(ctx.options.output, ctx.options) as results_writer,
Expand Down Expand Up @@ -1939,7 +1941,13 @@ def parse_arguments(gpu_topology: GpuTopology,
"--debug",
action='store_true',
default=False,
help="Enable debug output including detailed measurements")
help="Enable debug output including detailed per-iteration measurements")

parser.add_argument("--debug-quick-tune-data",
action='store_true',
default=False,
help="Enable debug output for quick tuning data generation without the "
"detailed per-iteration measurement arrays")

parser.add_argument("--tuning-space",
default="full",
Expand Down Expand Up @@ -2125,6 +2133,7 @@ def main(args=None):
num_cu=num_cu,
num_chiplets=num_chiplets,
debug=parsed_args.debug,
debug_quick_tune_data=parsed_args.debug_quick_tune_data,
quiet=parsed_args.quiet,
verbose=parsed_args.verbose,
tuning_space_kind=parsed_args.tuning_space,
Expand Down
Loading