diff --git a/superbench/benchmarks/micro_benchmarks/cudnn_function.py b/superbench/benchmarks/micro_benchmarks/cudnn_function.py index 3bc601742..dbe535c70 100644 --- a/superbench/benchmarks/micro_benchmarks/cudnn_function.py +++ b/superbench/benchmarks/micro_benchmarks/cudnn_function.py @@ -139,7 +139,7 @@ def __init__(self, name, parameters=''): 'mode': 1 }, { 'name': 'cudnnConvolutionBackwardData', - 'algo': 4, + 'algo': 1, 'filterDims': [32, 128, 3, 3], 'inputType': 0, 'inputDims': [32, 32, 14, 14], @@ -232,7 +232,7 @@ def __init__(self, name, parameters=''): 'tensorOp': False, 'inputType': 0, 'convType': 0, - 'algo': 6 + 'algo': 1 }, { 'name': 'cudnnConvolutionForward', 'inputDims': [32, 128, 14, 14], diff --git a/tests/benchmarks/micro_benchmarks/test_cudnn_function.py b/tests/benchmarks/micro_benchmarks/test_cudnn_function.py index d6ca117c2..1e7ab424e 100644 --- a/tests/benchmarks/micro_benchmarks/test_cudnn_function.py +++ b/tests/benchmarks/micro_benchmarks/test_cudnn_function.py @@ -3,6 +3,7 @@ """Tests for cudnn-functions benchmark.""" +import math import numbers from tests.helper import decorator @@ -16,34 +17,15 @@ def test_cudnn_functions(): context = BenchmarkRegistry.create_benchmark_context( 'cudnn-function', platform=Platform.CUDA, parameters='--num_warmup 10 --num_steps 10 --num_in_step 100' ) - - assert (BenchmarkRegistry.is_benchmark_context_valid(context)) - benchmark = BenchmarkRegistry.launch_benchmark(context) - - # Check basic information. - assert (benchmark) - assert (benchmark.name == 'cudnn-function') - assert (benchmark.type == BenchmarkType.MICRO) - - # Check parameters specified in BenchmarkContext. - assert (benchmark._args.num_warmup == 10) - assert (benchmark._args.num_steps == 10) - assert (benchmark._args.num_in_step == 100) - - # Check results and metrics. - assert (benchmark.run_count == 1) - assert (benchmark.return_code == ReturnCode.SUCCESS) - assert ('raw_output_0' in benchmark.raw_data) - assert (len(benchmark.raw_data['raw_output_0']) == 1) - assert (isinstance(benchmark.raw_data['raw_output_0'][0], str)) - - assert (18 <= len(benchmark.result)) - for metric in list(benchmark.result.keys()): - assert (len(benchmark.result[metric]) == 1) - assert (isinstance(benchmark.result[metric][0], numbers.Number)) - if metric != 'return_code': - assert (len(benchmark.raw_data[metric][0]) == benchmark._args.num_steps) + assert benchmark.return_code == ReturnCode.SUCCESS + + timings = {metric: values for metric, values in benchmark.result.items() if metric.endswith('_time')} + assert len(timings) == 18 + for metric, values in timings.items(): + # Unsupported convolutions still emit a timing metric with value -1. + assert len(values) == 1 and 0 < values[0] < math.inf, metric + assert len(benchmark.raw_data[metric][0]) == benchmark._args.num_steps, metric # Test for custom configuration custom_config_str = '{"algo":0,"arrayLength":2,"convType":0,"dilationA":[1,1],"filterStrideA":[1,1],' \