07537b6231
* Update include/rocprofiler-sdk
- defines.h
- ROCPROFILER_VERSION_10_0 -> ROCPROFILER_SDK_VERSION_0_0
- fwd.h
- rocprofiler_counter_record_kind_t
- rocprofiler_kernel_dispatch_info_t
- rocprofiler_record_counter_t
- has dispatch id instead of correlation id
- rocprofiler_counter_info_v0_t
- added rocprofiler_counter_id_t field
- added is_constant field
- reordered better packing
- dispatch_profile.h
- added rocprofiler_profile_counting_dispatch_record_t for use as a header record for rocprofiler_profile_counting_dispatch_data_t
- callback_tracing.h
- rocprofiler_callback_tracing_kernel_dispatch_data_t uses rocprofiler_kernel_dispatch_info_t
- buffer_tracing.h
- rocprofiler_buffer_tracing_kernel_dispatch_record_t uses rocprofiler_kernel_dispatch_info_t
* Update lib/rocprofiler-sdk/*
- transition to rocprofiler_kernel_dispatch_info_t
- set id and is_constant values for rocprofiler_counter_info_v0_t in rocprofiler_query_counter_info
* Update lib/rocprofiler-sdk-tool
- transition to rocprofiler_kernel_dispatch_info_t
* Update lib/rocprofiler-sdk/counters/tests/core.cpp
- transition to rocprofiler_kernel_dispatch_info_t
* Update samples
- transition to rocprofiler_kernel_dispatch_info_t
- transition to rocprofiler_counter_record_kind_t
* Update tests
- transition to rocprofiler_kernel_dispatch_info_t
- transition to rocprofiler_counter_record_kind_t
- improve integration test validation for counter-collection
- update serialization for new/additional types
* Fix tests/counter-collection/validate.py
- loosen restrictions on the length of counter description
* Update include/rocprofiler-sdk/buffer_tracing.h
- remove accidental packed attribute
* Update lib/rocprofiler-sdk/counters/xml/derived_counters.xml
- Add description for TCC_TAG_STALL_sum (reference: https://rocm.docs.amd.com/en/develop/conceptual/gpu-arch/mi300-mi200-performance-counters.html)
* Update tests/page-migration/validate.py
74 lines
2.5 KiB
Python
74 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
import pytest
|
|
|
|
|
|
# helper function
|
|
def node_exists(name, data, min_len=1):
|
|
assert name in data
|
|
assert data[name] is not None
|
|
assert len(data[name]) >= min_len
|
|
|
|
|
|
def test_data_structure(input_data):
|
|
"""verify minimum amount of expected data is present"""
|
|
node_exists("rocprofiler-sdk-json-tool", input_data)
|
|
rocp_data = input_data
|
|
node_exists("names", rocp_data["rocprofiler-sdk-json-tool"]["buffer_records"])
|
|
node_exists(
|
|
"counter_collection", rocp_data["rocprofiler-sdk-json-tool"]["buffer_records"]
|
|
)
|
|
|
|
|
|
def test_counter_values(input_data):
|
|
data = input_data["rocprofiler-sdk-json-tool"]
|
|
agent_data = data["agents"]
|
|
counter_info = data["counter_info"]
|
|
counter_data = data["buffer_records"]["counter_collection"]
|
|
|
|
for itr in counter_info:
|
|
if itr["is_constant"] == 1 and itr["name"] == "size":
|
|
continue
|
|
assert itr["id"]["handle"] > 0, f"{itr}"
|
|
assert itr["is_constant"] in (0, 1), f"{itr}"
|
|
assert itr["is_derived"] in (0, 1), f"{itr}"
|
|
assert len(itr["name"]) >= 4, f"{itr}"
|
|
assert len(itr["description"]) >= 4, f"{itr}"
|
|
if itr["is_constant"] == 0:
|
|
if itr["is_derived"] == 0:
|
|
assert len(itr["block"]) > 0, f"{itr}"
|
|
if itr["is_derived"] == 1:
|
|
assert len(itr["expression"]) > 0, f"{itr}"
|
|
|
|
def get_agent(agent_id):
|
|
for itr in agent_data:
|
|
if itr["id"]["handle"] == agent_id["handle"]:
|
|
return itr
|
|
return None
|
|
|
|
def get_scaling_factor(agent_id):
|
|
agent = get_agent(agent_id)
|
|
assert agent is not None, f"id={agent_id}"
|
|
if agent["type"] == 2 and agent["wave_front_size"] > 0:
|
|
return 64 / agent["wave_front_size"]
|
|
return 0
|
|
|
|
for itr in counter_data:
|
|
assert itr["num_records"] == len(itr["records"]), f"itr={itr}"
|
|
agent_id = itr["dispatch_info"]["agent_id"]
|
|
agent = get_agent(agent_id)
|
|
scaling_factor = get_scaling_factor(agent_id)
|
|
assert agent is not None, f"itr={itr}\nagent={agent}"
|
|
for ritr in itr["records"]:
|
|
value = ritr["counter_value"]
|
|
if int(round(value, 0)) > 0:
|
|
assert int(round(value, 0)) == int(
|
|
round(1 * scaling_factor, 0)
|
|
), f"itr={itr}\nagent={agent}"
|
|
|
|
|
|
if __name__ == "__main__":
|
|
exit_code = pytest.main(["-x", __file__] + sys.argv[1:])
|
|
sys.exit(exit_code)
|