Files
TheRock/rocm-systems/projects/rocprofiler-sdk/tests/rocprofv3/hip-graph-attribution-test/validate.py
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

204 lines
6.9 KiB
Python

#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2024-2025 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"""HIP graph attribution validators against rocprofv3 CSV output.
Direct CSV (and OTF2, Perfetto) output from rocprofv3 is deprecated for HIP
graph attribution: graph_exec_id / graph_node_id and the HIP_GRAPH summary
record flow only to JSON and the rocpd SQLite database. See validate_json.py
for the JSON-side semantic checks.
The tests in this file remain named as before (ctest IDs are stable) but now
verify that the deprecated CSV columns are absent.
"""
import sys
import pytest
# ---------------------------------------------------------------------------
# CSV column absence (deprecation guard)
# ---------------------------------------------------------------------------
def test_columns_present(kernel_input_data):
"""Graph_Exec_Id / Graph_Node_Id columns must NOT appear on kernel CSV.
Direct CSV graph attribution was removed; use JSON or rocpd."""
row = kernel_input_data[0]
assert "Graph_Exec_Id" not in row, list(row.keys())
assert "Graph_Node_Id" not in row, list(row.keys())
def test_non_graph_rows_render_empty(kernel_input_data):
pytest.skip("graph attribution columns removed from kernel CSV; see JSON / rocpd")
def test_total_graph_dispatch_count(
kernel_input_data,
expected_iterations,
expected_execs,
expected_kernel_nodes_per_launch,
):
pytest.skip("graph attribution columns removed from kernel CSV; see JSON / rocpd")
def test_two_distinct_exec_ids(kernel_input_data, expected_execs):
pytest.skip("graph attribution columns removed from kernel CSV; see JSON / rocpd")
def test_graph_node_id_range_per_launch(
kernel_input_data,
expected_kernel_nodes_per_launch,
expected_iterations,
expected_execs,
):
pytest.skip("graph attribution columns removed from kernel CSV; see JSON / rocpd")
def test_graph_node_id_stable_per_exec(kernel_input_data, expected_nodes_per_launch):
pytest.skip("graph attribution columns removed from kernel CSV; see JSON / rocpd")
def test_distinct_kernel_nodes_remain_distinct(
kernel_input_data, expected_distinct_kernels
):
pytest.skip("graph attribution columns removed from kernel CSV; see JSON / rocpd")
# ---------------------------------------------------------------------------
# HIP_GRAPH summary record (CSV path removed)
# ---------------------------------------------------------------------------
def test_graph_launch_record_count(
graph_launch_input_data, expected_iterations, expected_execs
):
pytest.skip("HIP_GRAPH CSV output removed; see JSON / rocpd")
def test_graph_launch_dispatch_counts(
graph_launch_input_data, expected_kernel_nodes_per_launch
):
pytest.skip("HIP_GRAPH CSV output removed; see JSON / rocpd")
def test_graph_launch_exec_ids_match_kernel_csv(
graph_launch_input_data, kernel_input_data, expected_execs
):
pytest.skip("HIP_GRAPH CSV output removed; see JSON / rocpd")
def test_graph_launch_correlation_joins_to_hip_api(
graph_launch_input_data, hip_api_input_data
):
pytest.skip("HIP_GRAPH CSV output removed; see JSON / rocpd")
# ---------------------------------------------------------------------------
# Memory copy CSV (graph columns removed)
# ---------------------------------------------------------------------------
def test_memcpy_columns_present(memory_copy_input_data):
"""Graph_Exec_Id / Graph_Node_Id must NOT appear on memory_copy CSV."""
row = memory_copy_input_data[0]
assert "Graph_Exec_Id" not in row, list(row.keys())
assert "Graph_Node_Id" not in row, list(row.keys())
def test_memcpy_graph_attribution_count(
memory_copy_input_data,
expected_iterations,
expected_execs,
expected_memcpy_nodes_per_launch,
):
pytest.skip(
"graph attribution columns removed from memory_copy CSV; see JSON / rocpd"
)
def test_memcpy_exec_ids_match_kernel_csv(
memory_copy_input_data, kernel_input_data, expected_execs
):
pytest.skip(
"graph attribution columns removed from memory_copy CSV; see JSON / rocpd"
)
def test_non_graph_memcpy_rows_render_empty(memory_copy_input_data):
pytest.skip(
"graph attribution columns removed from memory_copy CSV; see JSON / rocpd"
)
# ---------------------------------------------------------------------------
# Cross-CSV / per-exec checks (all CSV-based — now skipped)
# ---------------------------------------------------------------------------
def test_graph_node_id_range_per_launch_full_topology(
kernel_input_data,
request,
expected_nodes_per_launch,
expected_iterations,
expected_execs,
):
pytest.skip("graph attribution columns removed from kernel CSV; see JSON / rocpd")
def test_per_exec_kernel_launch_counts(
kernel_input_data, expected_iterations, expected_kernel_nodes_per_launch
):
pytest.skip("graph attribution columns removed from kernel CSV; see JSON / rocpd")
def test_per_launch_node_sequence_stable(kernel_input_data):
pytest.skip("graph attribution columns removed from kernel CSV; see JSON / rocpd")
def test_graph_launch_per_exec_record_counts(
graph_launch_input_data, expected_iterations, expected_execs
):
pytest.skip("HIP_GRAPH CSV output removed; see JSON / rocpd")
def test_graph_launch_timestamps_sane(graph_launch_input_data):
pytest.skip("HIP_GRAPH CSV output removed; see JSON / rocpd")
def test_graph_launch_agent_id_nonzero(graph_launch_input_data):
pytest.skip("HIP_GRAPH CSV output removed; see JSON / rocpd")
def test_graph_launch_correlation_unique(graph_launch_input_data):
pytest.skip("HIP_GRAPH CSV output removed; see JSON / rocpd")
def test_graph_kernels_carry_stream_id(kernel_input_data):
pytest.skip("graph attribution columns removed from kernel CSV; see JSON / rocpd")
if __name__ == "__main__":
exit_code = pytest.main(["-x", __file__] + sys.argv[1:])
sys.exit(exit_code)