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
98 lines
2.7 KiB
Python
98 lines
2.7 KiB
Python
# Copyright (c) Advanced Micro Devices, Inc.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
"""
|
|
Annotate tests
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
import pytest
|
|
from conftest import RocprofsysTest
|
|
|
|
pytestmark = [pytest.mark.annotate]
|
|
|
|
# =============================================================================
|
|
# Annotate fixtures
|
|
# =============================================================================
|
|
|
|
|
|
@pytest.fixture
|
|
def annotate_papi_condition(rocprof_config) -> bool:
|
|
"""Check if PAPI is available and usable."""
|
|
caps = rocprof_config.capabilities
|
|
return caps.papi_availability and caps.perf_events_usable
|
|
|
|
|
|
@pytest.fixture
|
|
def annotate_env(annotate_papi_condition) -> dict[str, str]:
|
|
"""Environment variables for Annotate tests."""
|
|
env = {
|
|
"ROCPROFSYS_USE_SAMPLING": "OFF",
|
|
}
|
|
if annotate_papi_condition:
|
|
env["ROCPROFSYS_TIMEMORY_COMPONENTS"] = "thread_cpu_clock papi_array"
|
|
env["ROCPROFSYS_PAPI_EVENTS"] = "perf::PERF_COUNT_SW_CPU_CLOCK"
|
|
else:
|
|
env["ROCPROFSYS_TIMEMORY_COMPONENTS"] = "thread_cpu_clock"
|
|
return env
|
|
|
|
|
|
# =============================================================================
|
|
# Annotate tests
|
|
# =============================================================================
|
|
|
|
|
|
@pytest.mark.annotate
|
|
@pytest.mark.parametrize("mode", ["sampling", "binary_rewrite", "sys_run"])
|
|
class TestAnnotate(RocprofsysTest):
|
|
BINARY_REWRITE_ARGS = [
|
|
"-e",
|
|
"-v",
|
|
"2",
|
|
"-R",
|
|
"run",
|
|
"--allow-overlapping",
|
|
"--print-available",
|
|
"functions",
|
|
"--print-overlapping",
|
|
"functions",
|
|
"--print-excluded",
|
|
"functions",
|
|
"--print-instrumented",
|
|
"functions",
|
|
"--print-instructions",
|
|
]
|
|
RUN_ARGS = ["30", "2", "200"]
|
|
|
|
def test_parallel_overhead(self, mode, annotate_env, annotate_papi_condition):
|
|
|
|
result = self.run_test(
|
|
mode,
|
|
"parallel-overhead",
|
|
env=annotate_env,
|
|
binary_rewrite_args=self.BINARY_REWRITE_ARGS,
|
|
run_args=self.RUN_ARGS,
|
|
)
|
|
self.assert_regex(result)
|
|
|
|
if mode == "sampling":
|
|
self.assert_perfetto(
|
|
result,
|
|
key_names=["thread_cpu_clock"],
|
|
key_counts=[6],
|
|
)
|
|
|
|
if mode == "binary_rewrite":
|
|
if annotate_papi_condition:
|
|
key_names = ["perf::PERF_COUNT_SW_CPU_CLOCK", "thread_cpu_clock"]
|
|
key_counts = [8, 8]
|
|
else:
|
|
key_names = ["thread_cpu_clock"]
|
|
key_counts = [8]
|
|
|
|
self.assert_perfetto(
|
|
result,
|
|
key_names=key_names,
|
|
key_counts=key_counts,
|
|
)
|