fix the wrong number of channels of TCC counters to put in pmc txt file (#633)

[ROCm/rocprofiler-compute commit: 7c1f14123a]
This commit is contained in:
ywang103-amd
2025-03-27 18:15:41 -04:00
committed by GitHub
parent 79a333231c
commit ad070d94db
3 changed files with 117 additions and 71 deletions
@@ -49,7 +49,7 @@ DEFAULT_ABS_DIFF = 15
DEFAULT_REL_DIFF = 50
MAX_REOCCURING_COUNT = 28
ALL_CSVS = sorted(
ALL_CSVS_MI100 = sorted(
[
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
@@ -62,10 +62,12 @@ ALL_CSVS = sorted(
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"sysinfo.csv",
"timestamps.csv",
]
)
ALL_CSVS_MI200 = sorted(
[
"SQ_IFETCH_LEVEL.csv",
@@ -484,7 +486,7 @@ def test_path(binary_handler_profile_rocprof_compute):
file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels)
if soc == "MI100":
assert sorted(list(file_dict.keys())) == ALL_CSVS
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI100
elif soc == "MI200":
assert sorted(list(file_dict.keys())) == sorted(ALL_CSVS_MI200)
elif "MI300" in soc:
@@ -499,28 +501,28 @@ def test_path(binary_handler_profile_rocprof_compute):
@pytest.mark.misc
def test_kernel_names(binary_handler_profile_rocprof_compute):
def test_roof_kernel_names(binary_handler_profile_rocprof_compute):
if soc == "MI100":
# roofline is not supported on MI100
assert True
# Do not continue testing
return
options = ["--device", "0", "--roof-only", "--kernel-names"]
workload_dir = test_utils.get_output_dir()
returncode = binary_handler_profile_rocprof_compute(
config, workload_dir, options, check_success=False, roof=True
)
if soc == "MI100":
# assert that it did not run
assert returncode >= 1
# Do not continue testing
return
# assert successful run
assert returncode == 0
file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels)
if soc == "MI200" or "MI300" in soc:
assert sorted(list(file_dict.keys())) == sorted(
ROOF_ONLY_FILES + ["kernelName_legend.pdf"]
)
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI100
validate(
inspect.stack()[0][3],
@@ -539,7 +541,7 @@ def test_device_filter(binary_handler_profile_rocprof_compute):
file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels)
if soc == "MI100":
assert sorted(list(file_dict.keys())) == ALL_CSVS
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI100
elif soc == "MI200":
assert sorted(list(file_dict.keys())) == sorted(ALL_CSVS_MI200)
elif "MI300" in soc:
@@ -567,7 +569,7 @@ def test_kernel(binary_handler_profile_rocprof_compute):
file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels)
if soc == "MI100":
assert sorted(list(file_dict.keys())) == ALL_CSVS
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI100
elif soc == "MI200":
assert sorted(list(file_dict.keys())) == sorted(ALL_CSVS_MI200)
elif "MI300" in soc:
@@ -749,11 +751,27 @@ def test_block_TCP(binary_handler_profile_rocprof_compute):
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"sysinfo.csv",
"timestamps.csv",
]
if soc == "MI100" or soc == "MI200":
expected_csvs = [
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"sysinfo.csv",
"timestamps.csv",
]
assert sorted(list(file_dict.keys())) == sorted(expected_csvs)
validate(
@@ -782,10 +800,32 @@ def test_block_TCC(binary_handler_profile_rocprof_compute):
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"pmc_perf_10.csv",
"pmc_perf_11.csv",
"sysinfo.csv",
"timestamps.csv",
]
if soc == "MI100" or soc == "MI200":
expected_csvs = [
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"pmc_perf_6.csv",
"pmc_perf_7.csv",
"pmc_perf_8.csv",
"pmc_perf_9.csv",
"pmc_perf_10.csv",
"sysinfo.csv",
"timestamps.csv",
]
assert sorted(list(file_dict.keys())) == sorted(expected_csvs)
validate(
@@ -1094,6 +1134,25 @@ def test_block_SQ_SPI_TA_TCC_CPF(binary_handler_profile_rocprof_compute):
"sysinfo.csv",
"timestamps.csv",
]
if soc == "MI100":
expected_csvs = [
"SQ_IFETCH_LEVEL.csv",
"SQ_INST_LEVEL_LDS.csv",
"SQ_INST_LEVEL_SMEM.csv",
"SQ_INST_LEVEL_VMEM.csv",
"SQ_LEVEL_WAVES.csv",
"pmc_perf.csv",
"pmc_perf_0.csv",
"pmc_perf_1.csv",
"pmc_perf_2.csv",
"pmc_perf_3.csv",
"pmc_perf_4.csv",
"pmc_perf_5.csv",
"sysinfo.csv",
"timestamps.csv",
]
if soc == "MI200" or "MI300" in soc:
expected_csvs = [
"SQ_IFETCH_LEVEL.csv",
@@ -1132,7 +1191,7 @@ def test_dispatch_0(binary_handler_profile_rocprof_compute):
file_dict = test_utils.check_csv_files(workload_dir, num_devices, 1)
if soc == "MI100":
assert sorted(list(file_dict.keys())) == ALL_CSVS
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI100
elif soc == "MI200":
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
elif "MI300" in soc:
@@ -1162,7 +1221,7 @@ def test_dispatch_0_1(binary_handler_profile_rocprof_compute):
file_dict = test_utils.check_csv_files(workload_dir, num_devices, 2)
if soc == "MI100":
assert sorted(list(file_dict.keys())) == ALL_CSVS
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI100
elif soc == "MI200":
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
elif "MI300" in soc:
@@ -1189,7 +1248,7 @@ def test_dispatch_2(binary_handler_profile_rocprof_compute):
file_dict = test_utils.check_csv_files(workload_dir, num_devices, 1)
if soc == "MI100":
assert sorted(list(file_dict.keys())) == ALL_CSVS
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI100
elif soc == "MI200":
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
elif "MI300" in soc:
@@ -1219,7 +1278,7 @@ def test_join_type_grid(binary_handler_profile_rocprof_compute):
file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels)
if soc == "MI100":
assert sorted(list(file_dict.keys())) == ALL_CSVS
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI100
elif soc == "MI200":
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
elif "MI300" in soc:
@@ -1246,7 +1305,7 @@ def test_join_type_kernel(binary_handler_profile_rocprof_compute):
file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels)
if soc == "MI100":
assert sorted(list(file_dict.keys())) == ALL_CSVS
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI100
elif soc == "MI200":
assert sorted(list(file_dict.keys())) == ALL_CSVS_MI200
elif "MI300" in soc:
@@ -1265,29 +1324,25 @@ def test_join_type_kernel(binary_handler_profile_rocprof_compute):
@pytest.mark.sort
def test_sort_dispatches(binary_handler_profile_rocprof_compute):
def test_roof_sort_dispatches(binary_handler_profile_rocprof_compute):
# only test 1 device for roofline
if soc == "MI100":
# roofline is not supported on MI100
assert True
# Do not continue testing
return
options = ["--device", "0", "--roof-only", "--sort", "dispatches"]
workload_dir = test_utils.get_output_dir()
returncode = binary_handler_profile_rocprof_compute(
config, workload_dir, options, check_success=False, roof=True
)
if soc == "MI100":
# assert that it did not run
assert returncode >= 1
# Do not continue testing
return
# assert successful run
assert returncode == 0
file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels)
if soc == "MI200" or "MI300" in soc:
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
validate(
inspect.stack()[0][3],
@@ -1299,28 +1354,25 @@ def test_sort_dispatches(binary_handler_profile_rocprof_compute):
@pytest.mark.sort
def test_sort_kernels(binary_handler_profile_rocprof_compute):
def test_roof_sort_kernels(binary_handler_profile_rocprof_compute):
# only test 1 device for roofline
if soc == "MI100":
# roofline is not supported on MI100
assert True
# Do not continue testing
return
options = ["--device", "0", "--roof-only", "--sort", "kernels"]
workload_dir = test_utils.get_output_dir()
returncode = binary_handler_profile_rocprof_compute(
config, workload_dir, options, check_success=False, roof=True
)
if soc == "MI100":
# assert that it did not run
assert returncode >= 1
# Do not continue testing
return
# assert successful run
assert returncode == 0
file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels)
if soc == "MI200" or "MI300" in soc:
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
validate(
inspect.stack()[0][3],
@@ -1332,28 +1384,25 @@ def test_sort_kernels(binary_handler_profile_rocprof_compute):
@pytest.mark.mem
def test_mem_levels_vL1D(binary_handler_profile_rocprof_compute):
def test_roof_mem_levels_vL1D(binary_handler_profile_rocprof_compute):
# only test 1 device for roofline
if soc == "MI100":
# roofline is not supported on MI100
assert True
# Do not continue testing
return
options = ["--device", "0", "--roof-only", "--mem-level", "vL1D"]
workload_dir = test_utils.get_output_dir()
returncode = binary_handler_profile_rocprof_compute(
config, workload_dir, options, check_success=False, roof=True
)
if soc == "MI100":
# assert that it did not run
assert returncode >= 1
# Do not continue testing
return
# assert successful run
assert returncode == 0
file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels)
if soc == "MI200" or "MI300" in soc:
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
validate(
inspect.stack()[0][3],
@@ -1365,28 +1414,25 @@ def test_mem_levels_vL1D(binary_handler_profile_rocprof_compute):
@pytest.mark.mem
def test_mem_levels_LDS(binary_handler_profile_rocprof_compute):
def test_roof_mem_levels_LDS(binary_handler_profile_rocprof_compute):
# only test 1 device for roofline
if soc == "MI100":
# roofline is not supported on MI100
assert True
# Do not continue testing
return
options = ["--device", "0", "--roof-only", "--mem-level", "LDS"]
workload_dir = test_utils.get_output_dir()
returncode = binary_handler_profile_rocprof_compute(
config, workload_dir, options, check_success=False, roof=True
)
if soc == "MI100":
# assert that it did not run
assert returncode >= 1
# Do not continue testing
return
# assert successful run
assert returncode == 0
file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels)
if soc == "MI200" or "MI300" in soc:
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
else:
assert sorted(list(file_dict.keys())) == ALL_CSVS
assert sorted(list(file_dict.keys())) == ROOF_ONLY_FILES
validate(
inspect.stack()[0][3],