pc sampling unit tests (#194)

このコミットが含まれているのは:
ywang103-amd
2025-08-23 10:13:22 -04:00
committed by GitHub
コミット 2a216ecbc1
5個のファイルの変更101行の追加1行の削除
+8
ファイルの表示
@@ -244,6 +244,14 @@ add_test(
${PROJECT_SOURCE_DIR}/tests/test_profile_general.py
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
add_test(
NAME test_profile_pc_sampling
COMMAND
${Python3_EXECUTABLE} -m pytest -s -m pc_sampling
--junitxml=tests/test_profile_pc_sampling.xml ${COV_OPTION}
${PROJECT_SOURCE_DIR}/tests/test_profile_general.py
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
add_test(
NAME test_profile_sets_func
COMMAND
+2 -1
ファイルの表示
@@ -87,5 +87,6 @@ markers = [
"num_xcds_spec_class",
"num_xcds_cli_output",
"sets_func",
"sets_perf"
"sets_perf",
"pc_sampling",
]
+6
ファイルの表示
@@ -30,3 +30,9 @@ set_source_files_properties(${VRAND_SOURCES} PROPERTIES LANGUAGE HIP)
add_executable(vrandom_access ${VRAND_SOURCES})
set_target_properties(vrandom_access PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_SOURCE_DIR}/tests)
set(OCCUPANCY ../sample/occupancy.hip)
set_source_files_properties(${OCCUPANCY} PROPERTIES LANGUAGE HIP)
add_executable(occupancy ${OCCUPANCY})
set_target_properties(occupancy PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_SOURCE_DIR}/tests)
+83
ファイルの表示
@@ -60,6 +60,7 @@ CHIP_IDS = {
config = {}
config["kernel_name_1"] = "vecCopy"
config["app_1"] = ["./tests/vcopy", "-n", "1048576", "-b", "256", "-i", "3"]
config["app_occupancy"] = ["./tests/occupancy"]
config["cleanup"] = True
config["COUNTER_LOGGING"] = False
config["METRIC_COMPARE"] = False
@@ -165,6 +166,24 @@ ROOF_ONLY_FILES = sorted([
"timestamps.csv",
])
PC_SAMPLING_HOST_TRAP_FILES = sorted([
"pmc_perf_0.csv",
"pmc_perf.csv",
"ps_file_agent_info.csv",
"ps_file_pc_sampling_host_trap.csv",
"ps_file_results.json",
"sysinfo.csv",
])
PC_SAMPLING_STOCHASTIC_FILES = sorted([
"pmc_perf_0.csv",
"pmc_perf.csv",
"ps_file_agent_info.csv",
"ps_file_pc_sampling_stochastic.csv",
"ps_file_results.json",
"sysinfo.csv",
])
METRIC_THRESHOLDS = {
"2.1.12": {"absolute": 0, "relative": 8},
"3.1.1": {"absolute": 0, "relative": 10},
@@ -1658,6 +1677,70 @@ def test_comprehensive_error_paths():
assert "coll_level can not be None" in str(e)
@pytest.mark.pc_sampling
def test_pc_sampling_host_trap(binary_handler_profile_rocprof_compute):
if soc in ("MI100"):
assert True
return
options = [
"--block",
"21",
"--pc-sampling-method",
"host_trap",
"--pc-sampling-interval",
"1048576",
]
workload_dir = test_utils.get_output_dir()
_ = binary_handler_profile_rocprof_compute(
config,
workload_dir,
options,
check_success=True,
roof=False,
app_name="app_occupancy",
)
file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels)
assert sorted(list(file_dict.keys())) == sorted(PC_SAMPLING_HOST_TRAP_FILES)
validate(inspect.stack()[0][3], workload_dir, file_dict)
test_utils.clean_output_dir(config["cleanup"], workload_dir)
@pytest.mark.pc_sampling
def test_pc_sampling_stochastic(binary_handler_profile_rocprof_compute):
if soc in ("MI100") or soc in ("MI200"):
assert True
return
options = [
"--block",
"21",
"--pc-sampling-method",
"stochastic",
"--pc-sampling-interval",
"1048576",
]
workload_dir = test_utils.get_output_dir()
_ = binary_handler_profile_rocprof_compute(
config,
workload_dir,
options,
check_success=True,
roof=False,
app_name="app_occupancy",
)
file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels)
assert sorted(list(file_dict.keys())) == sorted(PC_SAMPLING_STOCHASTIC_FILES)
validate(inspect.stack()[0][3], workload_dir, file_dict)
test_utils.clean_output_dir(config["cleanup"], workload_dir)
@pytest.mark.sets_func
class TestSetsIntegration:
def test_memory_throughput_set(self, binary_handler_profile_rocprof_compute):
+2
ファイルの表示
@@ -162,6 +162,8 @@ def check_csv_files(output_dir, num_devices, num_kernels):
assert len(file_dict[file].index) >= num_kernels
elif file.endswith(".pdf"):
file_dict[file] = "pdf"
elif file.endswith(".json"):
file_dict[file] = "json"
return file_dict