From 2235e084ab965bcb1884a993a8718cff0ad83788 Mon Sep 17 00:00:00 2001 From: Yuting Jiang Date: Wed, 22 Nov 2023 20:52:22 +0800 Subject: [PATCH] Benchmarks: Micro benchmark - add initialization options for rocm gemm flops (#578) **Description** add initialization options for rocm gemm flops. --- .../micro_benchmarks/rocm_gemm_flops_performance.py | 9 +++++++++ .../micro_benchmarks/test_rocm_gemm_flops_performance.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/superbench/benchmarks/micro_benchmarks/rocm_gemm_flops_performance.py b/superbench/benchmarks/micro_benchmarks/rocm_gemm_flops_performance.py index 5615fb88..03c73594 100644 --- a/superbench/benchmarks/micro_benchmarks/rocm_gemm_flops_performance.py +++ b/superbench/benchmarks/micro_benchmarks/rocm_gemm_flops_performance.py @@ -91,6 +91,14 @@ class RocmGemmFlopsBenchmark(GemmFlopsBenchmark): required=False, help='Specifies the scalar beta.', ) + self._parser.add_argument( + '--initialization', + type=str, + default='hpl', + choices=['rand_int', 'trig_float', 'hpl'], + required=False, + help='Initialize with random integers, trig functions sin and cos, or hpl-like input.', + ) def _preprocess(self): """Preprocess/preparation operations before the benchmarking. @@ -110,6 +118,7 @@ class RocmGemmFlopsBenchmark(GemmFlopsBenchmark): command += ' --lda {} --ldb {} --ldc {} --ldd {}'.format( self._args.lda, self._args.ldb, self._args.ldc, self._args.ldd ) + command += ' --initialization {}'.format(self._args.initialization) self._commands.append(command) return True diff --git a/tests/benchmarks/micro_benchmarks/test_rocm_gemm_flops_performance.py b/tests/benchmarks/micro_benchmarks/test_rocm_gemm_flops_performance.py index 010a305a..9b00785f 100644 --- a/tests/benchmarks/micro_benchmarks/test_rocm_gemm_flops_performance.py +++ b/tests/benchmarks/micro_benchmarks/test_rocm_gemm_flops_performance.py @@ -43,7 +43,7 @@ class RocmGemmFlopsTest(BenchmarkTestCase, unittest.TestCase): assert (benchmark._args.k == 8192) params = '--transposeA N --transposeB T -m 7680 -n 8192 -k 8192' + \ - ' --alpha 1 --beta 0 --lda 8384 --ldb 8384 --ldc 8384 --ldd 8384' + ' --alpha 1 --beta 0 --lda 8384 --ldb 8384 --ldc 8384 --ldd 8384 --initialization hpl' # Check command list expected_command = [ 'rocblas-bench -r f64_r -f gemm ' + params,