From 1264ffeb452b3d6740063d1bcce1495f67d417e9 Mon Sep 17 00:00:00 2001 From: "Kandula, Venkateshwar reddy" Date: Thu, 24 Apr 2025 19:55:45 -0500 Subject: [PATCH] [PSDB] [CI] SWDEV-528922: Modify summary MEMORY_ALLOCATION kind tests to account new hip runtime memory manger (#368) * Modify summary MEMORY_ALLOCATION kind tests to account new hip runtime new memory manager which adds memory pools allocations. * address comments. --------- Co-authored-by: Venkateshwar Reddy Kandula [ROCm/rocprofiler-sdk commit: 176f8aea6707ec66e1aac27e2b5d182db8943280] --- .../tests/rocprofv3/summary/validate.py | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/summary/validate.py b/projects/rocprofiler-sdk/tests/rocprofv3/summary/validate.py index d1112f89f1..fee66d2f2b 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/summary/validate.py +++ b/projects/rocprofiler-sdk/tests/rocprofv3/summary/validate.py @@ -219,7 +219,30 @@ def test_summary_data(json_data): # HIP may decompose memory copies into more than one HSA memory copy assert itr.stats.count >= 4 and (itr.stats.count % 4) == 0 elif itr.domain == "MEMORY_ALLOCATION": - assert itr.stats.count >= 10 and itr.stats.count <= 30 + memory_allocation_allocate_count = 0 + memory_allocation_free_count = 0 + memory_allocation_vmem_allocate_count = 0 + memory_allocation_vmem_free_count = 0 + for operation in itr.stats.operations: + if operation.key == "MEMORY_ALLOCATION_ALLOCATE": + memory_allocation_allocate_count = operation.value.count + elif operation.key == "MEMORY_ALLOCATION_FREE": + memory_allocation_free_count = operation.value.count + elif operation.key == "MEMORY_ALLOCATION_VMEM_ALLOCATE": + memory_allocation_vmem_allocate_count = operation.value.count + elif operation.key == "MEMORY_ALLOCATION_VMEM_FREE": + memory_allocation_vmem_free_count = operation.value.count + memory_allocation_allocate_and_free_count = ( + memory_allocation_allocate_count + memory_allocation_free_count + ) + assert ( + memory_allocation_allocate_and_free_count >= 10 + and memory_allocation_allocate_and_free_count <= 30 + ) + # check if hip-runtime memory management pools through virtual memory allocation count is equal to free count. + assert ( + memory_allocation_vmem_allocate_count == memory_allocation_vmem_free_count + ) elif itr.domain == "MARKER_API": assert itr.stats.count == 1106 expected = dict(