rocDecode Buffer Tracing Support (#315)

* Added buffer tracing support for rocdecode and updated tests to work with buffer tracing

* Updated perfetto to output args individually rather than as a string list

* Updated docstrings and operation type, changed OTF2 code to remove warning due to change in operation type

* Updated tests for review comments

* Test args exist and return value

* Updated to use string entry

* Change function name

* Updated PR to reflect review comments

* Updated for PR review comments

* Change function name
This commit is contained in:
Trowbridge, Ian
2025-04-11 16:56:36 -05:00
کامیت شده توسط GitHub
والد 379d760fc1
کامیت 077723337a
28فایلهای تغییر یافته به همراه391 افزوده شده و 146 حذف شده
+23 -7
مشاهده پرونده
@@ -32,12 +32,11 @@ def test_data_structure(input_data):
node_exists("buffer_records", sdk_data)
node_exists("names", sdk_data["callback_records"])
# Uncomment when rocprofiler register mainline supports rocdecode
# node_exists("rocdecode_api_traces", sdk_data["callback_records"])
node_exists("rocdecode_api_traces", sdk_data["callback_records"])
node_exists("names", sdk_data["buffer_records"])
# Uncomment when rocprofiler register mainline supports rocdecode
# node_exists("rocdecode_api_traces", sdk_data["buffer_records"])
node_exists("rocdecode_api_traces", sdk_data["buffer_records"])
node_exists("rocdecode_api_ext_traces", sdk_data["buffer_records"])
def test_size_entries(input_data):
@@ -88,6 +87,11 @@ def test_timestamps(input_data):
for itr in sdk_data["buffer_records"][titr]:
assert itr["start_timestamp"] <= itr["end_timestamp"]
for itr in sdk_data["buffer_records"]["rocdecode_api_ext_traces"]:
assert itr["start_timestamp"] < itr["end_timestamp"]
assert itr["start_timestamp"] > 0
assert itr["end_timestamp"] > 0
def test_internal_correlation_ids(input_data):
"""Assure correlation ids are unique"""
@@ -135,12 +139,11 @@ def test_rocdecode_traces(input_data):
rocdecode_bf_traces = sdk_data["buffer_records"]["rocdecode_api_traces"]
rocdecode_api_bf_ops = get_operation(buffer_records, "ROCDECODE_API")
assert len(rocdecode_api_bf_ops[1]) == 16
assert len(rocdecode_bf_traces) > 0
rocdecode_cb_traces = sdk_data["callback_records"]["rocdecode_api_traces"]
rocdecode_api_cb_ops = get_operation(callback_records, "ROCDECODE_API")
# If rocDecode tracing is not supported, end early
if len(rocdecode_bf_traces) == 0:
return pytest.skip("rocdecode tracing unavailable")
assert (
rocdecode_api_bf_ops[1] == rocdecode_api_cb_ops[1]
and len(rocdecode_api_cb_ops[1]) == 16
@@ -177,6 +180,19 @@ def test_rocdecode_traces(input_data):
]:
assert call in api_calls
rocdecode_ext_bf_traces = sdk_data["buffer_records"]["rocdecode_api_ext_traces"]
assert len(rocdecode_ext_bf_traces) > 0
# Ensure that the input file path has the correct string saved
assert len(rocdecode_ext_bf_traces[0].args) > 1
assert rocdecode_ext_bf_traces[0].args[1].name == "input_file_path"
assert (
rocdecode_ext_bf_traces[0].args[1].value.split("/")[-1]
== "AMD_driving_virtual_20-H265.265"
)
for api_call in rocdecode_ext_bf_traces:
assert len(api_call["args"]) > 0
assert (api_call.retval.uint64_t_retval in [0, 1], "Unexpected return values")
def test_retired_correlation_ids(input_data):
data = input_data