348d740388
* hsa multiqueuw application * cmake formatting (cmake-format) (#619) Co-authored-by: bgopesh <7112102+bgopesh@users.noreply.github.com> * source formatting (clang-format v11) (#620) Co-authored-by: bgopesh <7112102+bgopesh@users.noreply.github.com> * comppialtion fix * Update tests/bin/CMakeLists.txt Reorder `add_subdirectory` to fix (recurrent) issues with ROCTx in `CMAKE_BUILD_RPATH` * addressing early feedback * cmake updates * more cmake updates * adding queue dependency test * updating test * test updates * removed hsa_api_trace header * reformating headers to prevent clang from reordering * Fixing packaging * Fixes for hangs * source formatting (clang-format v11) (#676) Co-authored-by: bwelton <1683479+bwelton@users.noreply.github.com> * cmake formatting (cmake-format) (#673) Co-authored-by: bwelton <1683479+bwelton@users.noreply.github.com> * structure change * cmake formatting (cmake-format) (#680) Co-authored-by: bgopesh <7112102+bgopesh@users.noreply.github.com> * Adding kernel trace to test hang fix * rebased and fixed kernel-trace test * rhel clang fixes * source formatting (clang-format v11) (#685) Co-authored-by: bgopesh <7112102+bgopesh@users.noreply.github.com> * Update lib/rocprofiler-sdk-tool/helper.hpp - remove suppression of -Wshadow * Update tests/bin/hsa-queue-dependency/CMakeLists.txt - cleanup unnecessary code - GPU_LIST -> GPU_TARGETS * GPU_LIST -> GPU_TARGETS * Remove installation of test executable and libraries --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: bgopesh <7112102+bgopesh@users.noreply.github.com> Co-authored-by: Jonathan R. Madsen <jrmadsen@users.noreply.github.com> Co-authored-by: Benjamin Welton <bewelton@amd.com> Co-authored-by: bwelton <1683479+bwelton@users.noreply.github.com> Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
71 рядки
2.5 KiB
Python
71 рядки
2.5 KiB
Python
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
import pytest
|
|
|
|
|
|
def test_hsa_api_trace(hsa_trace_input_data):
|
|
functions = []
|
|
correlation_ids = []
|
|
for row in hsa_trace_input_data:
|
|
assert row["Domain"] in (
|
|
"HSA_CORE_API",
|
|
"HSA_AMD_EXT_API",
|
|
"HSA_IMAGE_EXT_API",
|
|
"HSA_FINALIZE_EXT_API",
|
|
)
|
|
assert int(row["Process_Id"]) > 0
|
|
assert int(row["Thread_Id"]) >= int(row["Process_Id"])
|
|
assert int(row["End_Timestamp"]) >= int(row["Start_Timestamp"])
|
|
functions.append(row["Function"])
|
|
correlation_ids.append(int(row["Correlation_Id"]))
|
|
|
|
correlation_ids = sorted(list(set(correlation_ids)))
|
|
|
|
# deterministic call counts
|
|
num_queue_create_calls = 2
|
|
num_queue_destroy_calls = 2
|
|
num_hsa_mem_free_calls = 2
|
|
|
|
# signal create/destroy calls
|
|
# although the app explicitly only creates 3 signals
|
|
# but hsa_init() internally calls hsa_signal_create
|
|
num_hsa_signal_create_calls = 4
|
|
num_hsa_signal_destroy_calls = 4
|
|
|
|
# all correlation ids are unique
|
|
assert len(correlation_ids) == len(hsa_trace_input_data)
|
|
|
|
functions = list(functions)
|
|
assert "hsa_shut_down" in functions
|
|
assert functions.count("hsa_queue_create") == num_queue_create_calls
|
|
assert functions.count("hsa_queue_destroy") == num_queue_destroy_calls
|
|
assert functions.count("hsa_memory_free") == num_hsa_mem_free_calls
|
|
assert functions.count("hsa_signal_create") == num_hsa_signal_create_calls
|
|
assert functions.count("hsa_signal_destroy") == num_hsa_signal_destroy_calls
|
|
|
|
|
|
def test_kernel_trace(kernel_trace_input_data):
|
|
valid_kernel_names = ("copyA", "copyB", "copyC")
|
|
|
|
assert len(kernel_trace_input_data) == 3
|
|
for row in kernel_trace_input_data:
|
|
assert row["Kind"] == "KERNEL_DISPATCH"
|
|
assert int(row["Agent_Id"]) > 0
|
|
assert int(row["Queue_Id"]) > 0
|
|
assert int(row["Kernel_Id"]) > 0
|
|
assert row["Kernel_Name"] in valid_kernel_names
|
|
assert int(row["Correlation_Id"]) > 0
|
|
assert int(row["Workgroup_Size_X"]) == 64
|
|
assert int(row["Workgroup_Size_Y"]) == 1
|
|
assert int(row["Workgroup_Size_Z"]) == 1
|
|
assert int(row["Grid_Size_X"]) == 64
|
|
assert int(row["Grid_Size_Y"]) == 1
|
|
assert int(row["Grid_Size_Z"]) == 1
|
|
assert int(row["End_Timestamp"]) >= int(row["Start_Timestamp"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
exit_code = pytest.main(["-x", __file__] + sys.argv[1:])
|
|
sys.exit(exit_code)
|