From 7045a4c689616d83b27a30e72cf47a7e4b792ded Mon Sep 17 00:00:00 2001 From: "Vaddireddy, Sushma" Date: Thu, 22 May 2025 13:35:38 -0700 Subject: [PATCH] Unit test fix - calculate aggregate sum based on instance size (#410) * Unit test fix- calculate aggregate sum based on instance size * Update GRBM instance size * aggregate sum --------- Co-authored-by: Sushma Vaddireddy --- tests/rocprofv3/counter-collection/input1/validate.py | 9 ++++++--- .../counter-collection/kernel_filtering/validate.py | 8 +++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/rocprofv3/counter-collection/input1/validate.py b/tests/rocprofv3/counter-collection/input1/validate.py index 7b2814d0f7..dc5ec2fd93 100644 --- a/tests/rocprofv3/counter-collection/input1/validate.py +++ b/tests/rocprofv3/counter-collection/input1/validate.py @@ -112,6 +112,8 @@ def test_validate_counter_collection_pmc1_json(json_data): dispatch_ids.append(dispatch_data["dispatch_id"]) if not re.search(r"__amd_rocclr_.*", kernel_name): + # Collect all SQ_WAVES values + sq_waves_values = [] for record in counter["records"]: counter = get_counter(record["counter_id"]) assert counter is not None, f"record:\n\t{record}" @@ -119,9 +121,10 @@ def test_validate_counter_collection_pmc1_json(json_data): counter["name"] == "SQ_WAVES" ), f"record:\n\t{record}\ncounter:\n\t{counter}" if agent["name"] not in skip_gfx: - assert ( - record["value"] > 0 - ), f"record: {record}\ncounter: {counter}\nagent: {agent}" + sq_waves_values.append(record["value"]) + + # Check aggregate sum + assert sum(sq_waves_values) > 0, f"SQ_WAVES value is not > 0" di_uniq = list(set(sorted(dispatch_ids))) # make sure the dispatch ids are unique and ordered diff --git a/tests/rocprofv3/counter-collection/kernel_filtering/validate.py b/tests/rocprofv3/counter-collection/kernel_filtering/validate.py index 446b4b2875..819404dd54 100644 --- a/tests/rocprofv3/counter-collection/kernel_filtering/validate.py +++ b/tests/rocprofv3/counter-collection/kernel_filtering/validate.py @@ -102,6 +102,7 @@ def validate_json(json_data, counter_name, check_dispatch): dispatch_ids.append(dispatch_data["dispatch_id"]) if not re.search(r"__amd_rocclr_.*", kernel_name): + values = [] for record in counter["records"]: counter = get_counter(record["counter_id"]) assert counter is not None, f"record:\n\t{record}" @@ -109,9 +110,10 @@ def validate_json(json_data, counter_name, check_dispatch): counter["name"] == counter_name ), f"record:\n\t{record}\ncounter:\n\t{counter}" if agent["name"] not in skip_gfx: - assert ( - record["value"] > 0 - ), f"record: {record}\ncounter: {counter}\nagent: {agent}" + values.append(record["value"]) + + # Check aggregate sum + assert sum(values) > 0, f"{counter_name} value is not > 0" if check_dispatch: di_uniq = list(set(sorted(dispatch_ids)))