Fix HIP Streams Duplication Error (#313)

* Fix stream duplication and fixed tests

* Added comments to explain stream.cpp code, change stream nullptr check to occur in update table to prevent readding null stream, simplified hip-streams bin file code, add destroyStreams to hip-streams bin file code

* Removed roctx from CMakeLists.txt

* Updated documentation

* Fix documentation

* Removed update_table for HIP compiler table and updated stream.cpp to remove support for HIP compiler table

* Added runtime initialization check for HIP

* Changed tool name, working on fixing memory management

* Added context for counter collection kernel rename combination

* Changed name from map to set and changed description

* Fix documentation description for group-by-queue

* Merged memory copy and kernel operations onto a single track when on the same stream

* Updated perfetto output to remove hardware information from track name to merge all memory copy and kernel operations on the same stream to the same track:

* Most pr comments addressed

* Added filter for counter collection and removed kernel buffer tracing hack

* Added PR comment fixes

---------

Co-authored-by: Madsen, Jonathan <Jonathan.Madsen@amd.com>
このコミットが含まれているのは:
Trowbridge, IanとMadsen, Jonathan authored and GitHub committed 2025-05-01 00:56:15 -05:00
1 親 4f03ebc360
コミット e626df43eb
26ファイル変更
+465 -287

検索条件に一致するファイルはありません

+6 -7
ファイルの表示
@@ -29,7 +29,6 @@ project(
VERSION 0.0.0)
find_package(rocprofiler-sdk REQUIRED)
find_package(rocDecode)
rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py)
@@ -41,9 +40,9 @@ set(hip-stream-display-env "${PRELOAD_ENV}")
add_test(
NAME rocprofv3-test-hip-stream-display-execute
COMMAND
$<TARGET_FILE:rocprofiler-sdk::rocprofv3> --kernel-rename -d
$<TARGET_FILE:rocprofiler-sdk::rocprofv3> --kernel-rename -s -d
${CMAKE_CURRENT_BINARY_DIR}/%tag%-trace -o out --output-format json pftrace
--log-level env -- $<TARGET_FILE:transpose>)
--log-level env -- $<TARGET_FILE:hip-streams>)
set_tests_properties(
rocprofv3-test-hip-stream-display-execute
@@ -56,14 +55,14 @@ set_tests_properties(
FAIL_REGULAR_EXPRESSION
"threw an exception"
DISABLED
$<NOT:$<TARGET_EXISTS:transpose>>)
$<NOT:$<TARGET_EXISTS:hip-streams>>)
add_test(
NAME rocprofv3-test-hip-stream-display-validate
COMMAND
${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input
${CMAKE_CURRENT_BINARY_DIR}/hip-stream-display/out_results.json --pftrace-input
${CMAKE_CURRENT_BINARY_DIR}/hip-stream-display/out_results.pftrace)
${CMAKE_CURRENT_BINARY_DIR}/hip-streams-trace/out_results.json --pftrace-input
${CMAKE_CURRENT_BINARY_DIR}/hip-streams-trace/out_results.pftrace)
set_tests_properties(
rocprofv3-test-hip-stream-display-validate
@@ -76,4 +75,4 @@ set_tests_properties(
FAIL_REGULAR_EXPRESSION
"AssertionError"
DISABLED
$<NOT:$<TARGET_EXISTS:transpose>>)
$<NOT:$<TARGET_EXISTS:hip-streams>>)
+11 -7
ファイルの表示
@@ -54,15 +54,17 @@ def test_stream_trace(json_data):
buffer_records = data["buffer_records"]
kernel_dispatch_data = buffer_records["kernel_dispatch"]
memory_copies_data = buffer_records["memory_copies"]
memory_copies_data = buffer_records["memory_copy"]
assert len(kernel_dispatch_data) > 0
assert len(memory_copies_data) > 0
# Expect stream ids to be set to 1 or 2 for transpose executable
expected_stream_ids = set((1, 2))
# Expect stream ids to be set between 1 and 8 inclusive for transpose executable
expected_stream_ids = set([i for i in range(1, 9)])
# check buffering data
for titr in (kernel_dispatch_data, memory_copies_data):
for node in rocdecode_data:
stream_id_set = set()
for node in titr:
assert "size" in node
assert "kind" in node
assert "operation" in node
@@ -70,7 +72,7 @@ def test_stream_trace(json_data):
assert "end_timestamp" in node
assert "start_timestamp" in node
assert "thread_id" in node
assert "_stream_id" in node
assert "stream_id" in node
assert node.size > 0
assert node.thread_id > 0
@@ -78,13 +80,15 @@ def test_stream_trace(json_data):
assert node.end_timestamp > 0
assert node.start_timestamp < node.end_timestamp
assert node._stream_id.handle in expected_stream_ids
stream_id = node.stream_id.handle
stream_id_set.add(stream_id)
assert stream_id_set == expected_stream_ids
def test_perfetto_data(pftrace_data, json_data):
import rocprofiler_sdk.tests.rocprofv3 as rocprofv3
assert pftrace_data != None
assert pftrace_data.empty == False
rocprofv3.test_perfetto_data(
pftrace_data,
json_data,