[misc] Unify bench seed default to 42 and rename --profile-filename-prefix to --profile-prefix (#28576)
This commit is contained in:
@@ -206,7 +206,7 @@ class BenchArgs:
|
||||
profile_record_shapes: bool = False
|
||||
profile_activities: Tuple[str] = ("CPU", "GPU")
|
||||
profile_stage: str = "all"
|
||||
profile_filename_prefix: str = "profile"
|
||||
profile_prefix: str = "profile"
|
||||
profile_start_step: Optional[int] = None
|
||||
profile_steps: Optional[int] = None
|
||||
|
||||
@@ -258,11 +258,13 @@ class BenchArgs:
|
||||
help="Which stage to profile: all, prefill, or decode only.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--profile-filename-prefix",
|
||||
"--profile-prefix",
|
||||
"--profile-filename-prefix", # deprecated alias, kept for back-compat
|
||||
dest="profile_prefix",
|
||||
type=str,
|
||||
default=BenchArgs.profile_filename_prefix,
|
||||
default=BenchArgs.profile_prefix,
|
||||
help="Prefix of the profiling file names. The full profiling result file(s) be "
|
||||
'"[profile_filename_prefix]_batch[batch_size]_input[input_len]_output[output_len].trace.json.gz"',
|
||||
'"[profile_prefix]_batch[batch_size]_input[input_len]_output[output_len].trace.json.gz"',
|
||||
)
|
||||
parser.add_argument(
|
||||
"--profile-start-step",
|
||||
@@ -612,10 +614,10 @@ def _get_torch_profiler_output_dir():
|
||||
|
||||
|
||||
def _create_torch_profiler_filename(
|
||||
profile_filename_prefix, batch_size, input_len, output_len, stage
|
||||
profile_prefix, batch_size, input_len, output_len, stage
|
||||
):
|
||||
output_dir = _get_torch_profiler_output_dir()
|
||||
filename = f"{profile_filename_prefix}_batch{batch_size}_input{input_len}_output{output_len}_{stage}.trace.json.gz"
|
||||
filename = f"{profile_prefix}_batch{batch_size}_input{input_len}_output{output_len}_{stage}.trace.json.gz"
|
||||
return os.path.join(output_dir, filename)
|
||||
|
||||
|
||||
@@ -701,7 +703,7 @@ def latency_test_run_once(
|
||||
profile,
|
||||
profile_record_shapes,
|
||||
profile_activities,
|
||||
profile_filename_prefix,
|
||||
profile_prefix,
|
||||
profile_stage,
|
||||
tp_rank,
|
||||
profile_start_step=None,
|
||||
@@ -730,7 +732,7 @@ def latency_test_run_once(
|
||||
trace_filename_prefill = None
|
||||
if enable_profile_prefill:
|
||||
trace_filename_prefill = _create_torch_profiler_filename(
|
||||
profile_filename_prefix, batch_size, input_len, output_len, "prefill"
|
||||
profile_prefix, batch_size, input_len, output_len, "prefill"
|
||||
)
|
||||
profiler = start_profile(
|
||||
profile_activities,
|
||||
@@ -777,7 +779,7 @@ def latency_test_run_once(
|
||||
# Start profiler at the specified step
|
||||
if enable_profile_decode and i == profile_start:
|
||||
trace_filename_decode = _create_torch_profiler_filename(
|
||||
profile_filename_prefix, batch_size, input_len, output_len, "decode"
|
||||
profile_prefix, batch_size, input_len, output_len, "decode"
|
||||
)
|
||||
profiler = start_profile(
|
||||
profile_activities,
|
||||
@@ -875,7 +877,7 @@ def latency_test(
|
||||
profile=False,
|
||||
profile_record_shapes=False,
|
||||
profile_activities=("CPU", "GPU"),
|
||||
profile_filename_prefix="",
|
||||
profile_prefix="",
|
||||
profile_stage="all",
|
||||
tp_rank=tp_rank,
|
||||
profile_start_step=None,
|
||||
@@ -926,7 +928,7 @@ def latency_test(
|
||||
bench_args.profile if tp_rank == 0 else None,
|
||||
bench_args.profile_record_shapes if tp_rank == 0 else None,
|
||||
bench_args.profile_activities,
|
||||
bench_args.profile_filename_prefix,
|
||||
bench_args.profile_prefix,
|
||||
bench_args.profile_stage,
|
||||
tp_rank,
|
||||
bench_args.profile_start_step,
|
||||
|
||||
Reference in New Issue
Block a user