From 190396d92dbb13dae79159c72c41ad20da1960b8 Mon Sep 17 00:00:00 2001 From: Zhewen Yu Date: Fri, 13 Dec 2024 22:44:11 +0000 Subject: [PATCH] [Tests] Add a time unit flag for performance runs (#988) According to https://github.com/iree-org/iree/pull/9843, `iree-benchmark-module` only shows the latency for two digits after the decimal point. Set `us` as default. --- build_tools/ci/cpu_comparison/run.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/build_tools/ci/cpu_comparison/run.py b/build_tools/ci/cpu_comparison/run.py index aafa2777a..7b4d95bb8 100755 --- a/build_tools/ci/cpu_comparison/run.py +++ b/build_tools/ci/cpu_comparison/run.py @@ -813,7 +813,14 @@ def generate_aie_output(config, aie_vmfb, input_args, function_name, name, outpu def benchmark_aie_kernel_time( - config, aie_vmfb, input_args, function_name, name, n_repeats, n_kernel_runs + config, + aie_vmfb, + input_args, + function_name, + name, + n_repeats, + n_kernel_runs, + time_unit, ): """ Benchmark a compiled AIE module's (aie_vmfb) kernel time, average over the specified number of runs. @@ -828,6 +835,7 @@ def benchmark_aie_kernel_time( f"--benchmark_repetitions={n_repeats}", f"--batch_size={n_kernel_runs}", f"--xrt_lite_n_kernel_runs={n_kernel_runs}", + f"--time_unit={time_unit}", ] if function_name: run_args += [f"--function={function_name}"] @@ -1199,6 +1207,7 @@ def benchmark_aie( n_repeats, n_kernel_runs, seed=1, + time_unit="us", ): """ Arguments to the function are: @@ -1224,6 +1233,8 @@ def benchmark_aie( functions). seed: The seed to be used for generating the inputs. + time_unit: + The time unit to be shown in the benchmark output (ns, us, ms). """ if ( "--iree-amdaie-enable-infinite-loop-around-core-block=true" @@ -1265,6 +1276,7 @@ def benchmark_aie( name, n_repeats, n_kernel_runs, + time_unit, ) if config.verbose: