From 66f517ab27de99b0eb7f481e4cd8c88412331ccb Mon Sep 17 00:00:00 2001 From: Giovanni LB Date: Mon, 11 Dec 2023 17:31:59 -0300 Subject: [PATCH] SWDEV-409155: Fixing tests for att/pmc Change-Id: I036f45502e6ff18518dcdb954161d09ce3546fe0 [ROCm/rocprofiler commit: b8b870328bba4012107c61ec21482b7e6c33758e] --- projects/rocprofiler/CHANGELOG.md | 2 +- projects/rocprofiler/plugin/att/stitch.py | 37 ++++++++++--------- .../profiler/att_correctness_tests.cmake | 4 +- .../profiler/counter_correctness_tests.cmake | 2 +- .../profiler/counter_validation_tests.cmake | 2 +- .../profiler/test_att_vectoradd.py | 6 +-- 6 files changed, 28 insertions(+), 25 deletions(-) diff --git a/projects/rocprofiler/CHANGELOG.md b/projects/rocprofiler/CHANGELOG.md index 96d3b0a963..b53057ac04 100644 --- a/projects/rocprofiler/CHANGELOG.md +++ b/projects/rocprofiler/CHANGELOG.md @@ -307,7 +307,7 @@ Example for file plugin output: - Added Plugin Versioning way in rocprofv2. See README for more details. - Added --version in the rocprof and rocprofv2 to be able to see the current rocprof/v2 version along with ROCm version information. -## ROCprofiler for rocm 6.2 +## ROCprofiler for rocm 6.1 ### Added diff --git a/projects/rocprofiler/plugin/att/stitch.py b/projects/rocprofiler/plugin/att/stitch.py index 4bf77f1c87..c388dc1bbd 100644 --- a/projects/rocprofiler/plugin/att/stitch.py +++ b/projects/rocprofiler/plugin/att/stitch.py @@ -195,7 +195,7 @@ class PCTranslator: symbol = "Unkown symbol at 0x" + hex(addr) last_line = self.raw_code[-1] - newline = ['; ' + symbol, 100, last_line[2], 0, last_line[4], last_line[5], -1, 0, 0] + newline = ['; ' + symbol, 100, last_line[2], 0, last_line[4], last_line[5], 0, 0, 0] self.raw_code.append(newline) def getcode(self, addr): @@ -355,7 +355,7 @@ def stitch(insts, raw_code, jumps, gfxv, bIsAuto, codeservice): else: line = 0 lineincrement = 1 - watchlist = RegisterWatchList(labels=labels, code=code, jump_map=jump_map) + watchlist = RegisterWatchList(labels=labels, code=code, jump_map=jump_map, insts=insts) N = len(insts) @@ -381,7 +381,9 @@ def stitch(insts, raw_code, jumps, gfxv, bIsAuto, codeservice): elif 'scratch_' in as_line[0]: watchlist.scratch(as_line[0]) - if as_line[1] == GETPC: + if as_line[1] == DONT_KNOW: + matched = False + elif as_line[1] == GETPC: try: watchlist.getpc(as_line[0], watchlist.getcode(next)[0]) matched = inst.type in [SALU, JUMP] @@ -538,20 +540,21 @@ def stitch(insts, raw_code, jumps, gfxv, bIsAuto, codeservice): print('WARNING: Parsing terminated at:', as_line) break - if matched: - inst.asmline = reverse_map[line] - result.append(inst) - i += 1 - num_failed_stitches = 0 - elif inst.type == IMMED and line != next and (not bGFX9 or 's_barrier' in as_line[0]): - skipped_immed += 1 - inst.asmline = reverse_map[line] - result.append(inst) - if 's_barrier' in as_line[0]: - next = line + lineincrement - i += 1 - else: - num_failed_stitches += 1 + if as_line[1] != DONT_KNOW: + if matched: + inst.asmline = reverse_map[line] + result.append(inst) + i += 1 + num_failed_stitches = 0 + elif inst.type == IMMED and line != next and (not bGFX9 or 's_barrier' in as_line[0]): + skipped_immed += 1 + inst.asmline = reverse_map[line] + result.append(inst) + if 's_barrier' in as_line[0]: + next = line + lineincrement + i += 1 + else: + num_failed_stitches += 1 maxline = max(reverse_map[line], maxline) line = next diff --git a/projects/rocprofiler/tests-v2/featuretests/profiler/att_correctness_tests.cmake b/projects/rocprofiler/tests-v2/featuretests/profiler/att_correctness_tests.cmake index bf7487b276..ff4776168d 100644 --- a/projects/rocprofiler/tests-v2/featuretests/profiler/att_correctness_tests.cmake +++ b/projects/rocprofiler/tests-v2/featuretests/profiler/att_correctness_tests.cmake @@ -5,7 +5,7 @@ add_test( ${PROJECT_BINARY_DIR}/rocprofv2 -i ${PROJECT_BINARY_DIR}/tests-v2/featuretests/profiler/apps/goldentraces/att_vadd.txt -d /tmp/tests-v2/att/ -o /tmp/tests-v2/att/vadd - --plugin att auto --mode csv tests-v2/featuretests/profiler/apps/att_vectoradd.cpp + --plugin att auto --mode csv tests-v2/featuretests/profiler/apps/att_vectoradd WORKING_DIRECTORY "${PROJECT_BINARY_DIR}") set_tests_properties( @@ -26,6 +26,6 @@ set_tests_properties( PASS_REGULAR_EXPRESSION "Test Passed" FAIL_REGULAR_EXPRESSION - "Test Failed" + "AssertionError" SKIP_REGULAR_EXPRESSION "Skipped") diff --git a/projects/rocprofiler/tests-v2/featuretests/profiler/counter_correctness_tests.cmake b/projects/rocprofiler/tests-v2/featuretests/profiler/counter_correctness_tests.cmake index 2d79212c3d..c70d12cca6 100644 --- a/projects/rocprofiler/tests-v2/featuretests/profiler/counter_correctness_tests.cmake +++ b/projects/rocprofiler/tests-v2/featuretests/profiler/counter_correctness_tests.cmake @@ -57,6 +57,6 @@ set_tests_properties( PASS_REGULAR_EXPRESSION "Test Passed" FAIL_REGULAR_EXPRESSION - "Test Failed" + "AssertionError" SKIP_REGULAR_EXPRESSION "Skipped") diff --git a/projects/rocprofiler/tests-v2/featuretests/profiler/counter_validation_tests.cmake b/projects/rocprofiler/tests-v2/featuretests/profiler/counter_validation_tests.cmake index ff319780f1..dac091a65b 100644 --- a/projects/rocprofiler/tests-v2/featuretests/profiler/counter_validation_tests.cmake +++ b/projects/rocprofiler/tests-v2/featuretests/profiler/counter_validation_tests.cmake @@ -27,6 +27,6 @@ set_tests_properties( PASS_REGULAR_EXPRESSION "Test Passed" FAIL_REGULAR_EXPRESSION - "Test Failed" + "AssertionError" SKIP_REGULAR_EXPRESSION "Skipped") diff --git a/projects/rocprofiler/tests-v2/featuretests/profiler/test_att_vectoradd.py b/projects/rocprofiler/tests-v2/featuretests/profiler/test_att_vectoradd.py index 8b92a69618..fe0c2f7884 100644 --- a/projects/rocprofiler/tests-v2/featuretests/profiler/test_att_vectoradd.py +++ b/projects/rocprofiler/tests-v2/featuretests/profiler/test_att_vectoradd.py @@ -6,7 +6,7 @@ MAX_WAVE_SIZE = 64 MAXIMUM_ATT_HITS = 256*128//MAX_WAVE_SIZE//MAX_CU kernel_name = "vectoradd_att" -csv_filename = "att_output_" + kernel_name + "_v0.csv" +csv_filename = "vadd_" + kernel_name + "_v0.csv" output_folder = "/tmp/tests-v2/att" @@ -18,7 +18,7 @@ def test_hitcount(csv): def test_addr(csv): - addrs = np.array([int(addr, 16) for addr in csv['Addr'] if len(addr) != 0 and addr[0] != '-']) + addrs = np.array([int(addr, 16) for addr in csv['Addr'] if addr != '0x0']) print('addrs', addrs) assert(addrs.max() - addrs.min() > 32) # 32 bytes is a safe minimum value assert(addrs.max() - addrs.min() < 2**24) # Kernels are not anywhere near that large @@ -69,4 +69,4 @@ if __name__ == "__main__": test_mean_cycles(csv) test_memory_cycles(csv) - print("All ATT correctness tests passed.") + print("Test Passed: All ATT correctness tests passed.")