diff --git a/.github/workflows/test_component.yml b/.github/workflows/test_component.yml index 3814bc48a1d..3785e0ff2b3 100644 --- a/.github/workflows/test_component.yml +++ b/.github/workflows/test_component.yml @@ -128,6 +128,12 @@ jobs: run: | python ./build_tools/print_driver_gpu_info.py + - name: Setup Additional Requirements + if: ${{ fromJSON(inputs.component).additional_requirements_files != '' }} + run: | + python ./build_tools/install_additional_requirements.py \ + --requirements-files=${{ join(fromJSON(inputs.component).additional_requirements_files, ',') }} + - name: Test timeout-minutes: ${{ fromJSON(inputs.component).timeout_minutes }} env: diff --git a/build_tools/github_actions/fetch_test_configurations.py b/build_tools/github_actions/fetch_test_configurations.py index 1e3ea39a34d..5aa77d4d343 100644 --- a/build_tools/github_actions/fetch_test_configurations.py +++ b/build_tools/github_actions/fetch_test_configurations.py @@ -293,6 +293,19 @@ def _get_script_path(script_name: str) -> str: "platform": ["linux", "windows"], "total_shards": 5, }, + # rocprofiler-compute tests + "rocprofiler-compute": { + "job_name": "rocprofiler_compute", + "fetch_artifact_args": "--rocprofiler-compute --rocprofiler-sdk --tests", + "timeout_minutes": 60, + "additional_requirements_files": [ + "libexec/rocprofiler-compute/requirements.txt", + "libexec/rocprofiler-compute/requirements-test.txt", + ], + "test_script": f"python {_get_script_path('test_rocprofiler_compute.py')} -v", + "platform": ["linux"], + "total_shards": 2, + }, # libhipcxx hipcc tests "libhipcxx_hipcc": { "job_name": "libhipcxx_hipcc", diff --git a/build_tools/github_actions/test_executable_scripts/test_rocprofiler_compute.py b/build_tools/github_actions/test_executable_scripts/test_rocprofiler_compute.py new file mode 100644 index 00000000000..39a10557419 --- /dev/null +++ b/build_tools/github_actions/test_executable_scripts/test_rocprofiler_compute.py @@ -0,0 +1,89 @@ +import logging +import os +import shlex +import subprocess +from pathlib import Path + +# Resolve paths +THEROCK_BIN_DIR = os.getenv("THEROCK_BIN_DIR") +OUTPUT_ARTIFACTS_DIR = os.getenv("OUTPUT_ARTIFACTS_DIR") +SCRIPT_DIR = Path(__file__).resolve().parent +THEROCK_DIR = SCRIPT_DIR.parent.parent.parent + +THEROCK_BIN_PATH = Path(THEROCK_BIN_DIR).resolve() +THEROCK_PATH = THEROCK_BIN_PATH.parent +THEROCK_LIB_PATH = str(THEROCK_PATH / "lib") +ROCPROFILER_COMPUTE_DIRECTORY = THEROCK_PATH / "libexec" / "rocprofiler-compute" + +# Set up ROCM_PATH +environ_vars = os.environ.copy() +environ_vars["ROCM_PATH"] = str(THEROCK_PATH) + +# Set up PATH +old_path = os.getenv("PATH", "") +rocm_bin = str(THEROCK_BIN_PATH) +if old_path: + environ_vars["PATH"] = f"{rocm_bin}:{old_path}" +else: + environ_vars["PATH"] = rocm_bin + +# Set up LD_LIBRARY_PATH +old_ld_lib_path = os.getenv("LD_LIBRARY_PATH", "") +sysdeps_path = f"{THEROCK_LIB_PATH}/rocm_sysdeps/lib" +if old_ld_lib_path: + environ_vars["LD_LIBRARY_PATH"] = ( + f"{THEROCK_LIB_PATH}:{sysdeps_path}:{old_ld_lib_path}" + ) +else: + environ_vars["LD_LIBRARY_PATH"] = f"{THEROCK_LIB_PATH}:{sysdeps_path}" + +# Set up excluded tests (include Jiras) +# AIPROFSDK-36: rocr issue causing test to fail +EXCLUDED_TESTS = [ + "test_profile_pc_sampling", +] + +# Sharding +shard_index = int(os.getenv("SHARD_INDEX", "1")) - 1 +total_shards = int(os.getenv("TOTAL_SHARDS", "1")) + +# Smoke Tests Setup +SMOKE_TESTS = [ + "test_autogen_config", + "test_utils", + "test_num_xcds_cli_output", + "test_num_xcds_spec_class", + "test_L1_cache_counters", + "test_analyze_workloads", + "test_analyze_commands", + "test_metric_validation", + "test_profile_iteration_multiplexing_1", +] + +# Run tests +cmd = [ + "ctest", + "--test-dir", + f"{ROCPROFILER_COMPUTE_DIRECTORY}", + "--output-on-failure", + "--verbose", + "--exclude-regex", + f"{"|".join(EXCLUDED_TESTS)}", + "--tests-information", + f"{shard_index},,{total_shards}", +] + +# If smoke tests are enabled, we run smoke tests only. +# Otherwise, we run the normal test suite +test_type = os.getenv("TEST_TYPE", "full") +if test_type == "smoke": + cmd.append("--tests-regex") + cmd.append("|".join(SMOKE_TESTS)) + +logging.info(f"++ Exec [{THEROCK_PATH}]$ {shlex.join(cmd)}") +subprocess.run( + cmd, + cwd=THEROCK_PATH, + check=True, + env=environ_vars, +) diff --git a/build_tools/install_additional_requirements.py b/build_tools/install_additional_requirements.py new file mode 100644 index 00000000000..1f4385e2247 --- /dev/null +++ b/build_tools/install_additional_requirements.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +import argparse +import logging +import os +import shlex +import subprocess +from pathlib import Path +import sys + +SCRIPT_DIR = Path(__file__).resolve().parent +THEROCK_DIR = SCRIPT_DIR.parent +THEROCK_OUTPUT_DIR = str(THEROCK_DIR / "build") + + +def install_requirements(input: str): + environ_vars = os.environ.copy() + + requirements_files = input.split(",") + + for file in requirements_files: + cmd = [ + "uv", + "pip", + "install", + "-r", + f"{THEROCK_OUTPUT_DIR}/{file}", + ] + logging.info(f"++ Exec [{THEROCK_DIR}]$ {shlex.join(cmd)}") + subprocess.run(cmd, cwd=THEROCK_DIR, check=True, env=environ_vars) + + +def main(argv): + parser = argparse.ArgumentParser() + parser.add_argument( + "--requirements-files", + type=str, + default="", + help="A comma separated list of requirements.txt files to install", + ) + args = parser.parse_args(argv) + if not args.requirements_files: + logging.info( + "No requirements file(s) provided. Exiting install_additional_requirements.py..." + ) + sys.exit(0) + + install_requirements(str(args.requirements_files)) + + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/build_tools/install_rocm_from_artifacts.py b/build_tools/install_rocm_from_artifacts.py index ee0708e337d..af384d63cbe 100644 --- a/build_tools/install_rocm_from_artifacts.py +++ b/build_tools/install_rocm_from_artifacts.py @@ -32,6 +32,7 @@ [--rocdecode | --no-rocdecode] [--rocjpeg | --no-rocjpeg] [--rocprofiler-compute | --no-rocprofiler-compute] + [--rocprofiler-sdk | --no-rocprofiler-sdk ] [--rocprofiler-systems | --no-rocprofiler-systems] [--rocrtst | --no-rocrtst] [--rocwmma | --no-rocwmma] @@ -352,6 +353,7 @@ def retrieve_artifacts_by_run_id(args): args.rocdecode, args.rocjpeg, args.rocprofiler_compute, + args.rocprofiler_sdk, args.rocprofiler_systems, args.rocrtst, args.rocwmma, @@ -752,16 +754,16 @@ def main(argv): ) artifacts_group.add_argument( - "--rocprofiler-systems", + "--rocprofiler-sdk", default=False, - help="Include 'rocprofiler-systems' artifacts", + help="Include 'rocprofiler-sdk' artifacts", action=argparse.BooleanOptionalAction, ) artifacts_group.add_argument( - "--rocprofiler-sdk", + "--rocprofiler-systems", default=False, - help="Include 'rocprofiler-sdk' artifacts", + help="Include 'rocprofiler-systems' artifacts", action=argparse.BooleanOptionalAction, ) diff --git a/cmake/therock_amdgpu_targets.cmake b/cmake/therock_amdgpu_targets.cmake index 0314ec3e9e7..35601f35fcf 100644 --- a/cmake/therock_amdgpu_targets.cmake +++ b/cmake/therock_amdgpu_targets.cmake @@ -48,6 +48,7 @@ therock_add_amdgpu_target(gfx906 "Radeon VII / MI50 CDNA" FAMILY dgpu-all gfx90X hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 composable_kernel # https://github.com/ROCm/TheRock/issues/1245 rocWMMA # https://github.com/ROCm/TheRock/issues/1944 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) therock_add_amdgpu_target(gfx908 "MI100 CDNA" FAMILY gfx90X-all dcgpu-all gfx90X-dcgpu EXCLUDE_TARGET_PROJECTS @@ -71,6 +72,7 @@ therock_add_amdgpu_target(gfx1010 "AMD RX 5700" FAMILY dgpu-all gfx101X-all gfx1 hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 composable_kernel # https://github.com/ROCm/TheRock/issues/1245 rocWMMA # https://github.com/ROCm/TheRock/issues/1944 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) therock_add_amdgpu_target(gfx1011 "AMD Radeon Pro V520" FAMILY dgpu-all gfx101X-all gfx101X-dgpu EXCLUDE_TARGET_PROJECTS @@ -78,13 +80,16 @@ therock_add_amdgpu_target(gfx1011 "AMD Radeon Pro V520" FAMILY dgpu-all gfx101X- hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 composable_kernel # https://github.com/ROCm/TheRock/issues/1245 rocWMMA # https://github.com/ROCm/TheRock/issues/1944 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) + therock_add_amdgpu_target(gfx1012 "AMD RX 5500" FAMILY dgpu-all gfx101X-all gfx101X-dgpu EXCLUDE_TARGET_PROJECTS hipBLASLt # https://github.com/ROCm/TheRock/issues/1062 hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 composable_kernel # https://github.com/ROCm/TheRock/issues/1245 rocWMMA # https://github.com/ROCm/TheRock/issues/1944 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) # gfx103X family @@ -93,6 +98,7 @@ therock_add_amdgpu_target(gfx1030 "AMD RX 6800 / XT" FAMILY dgpu-all gfx103X-all hipBLASLt # https://github.com/ROCm/TheRock/issues/1062 hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 rocWMMA # https://github.com/ROCm/TheRock/issues/1944 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) therock_add_amdgpu_target(gfx1031 "AMD RX 6700 / XT" FAMILY dgpu-all gfx103X-all gfx103X-dgpu EXCLUDE_TARGET_PROJECTS @@ -105,6 +111,7 @@ therock_add_amdgpu_target(gfx1032 "AMD RX 6600" FAMILY dgpu-all gfx103X-all gfx1 hipBLASLt # https://github.com/ROCm/TheRock/issues/1062 hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 rocWMMA # https://github.com/ROCm/TheRock/issues/1944 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) therock_add_amdgpu_target(gfx1033 "AMD Van Gogh iGPU" FAMILY igpu-all gfx103X-all gfx103X-igpu EXCLUDE_TARGET_PROJECTS @@ -124,31 +131,37 @@ therock_add_amdgpu_target(gfx1035 "AMD Radeon 680M Laptop iGPU" FAMILY igpu-all hipBLASLt # https://github.com/ROCm/TheRock/issues/1062 hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 rocWMMA # https://github.com/ROCm/TheRock/issues/1944 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) therock_add_amdgpu_target(gfx1036 "AMD Raphael iGPU" FAMILY igpu-all gfx103X-all gfx103X-igpu EXCLUDE_TARGET_PROJECTS hipBLASLt # https://github.com/ROCm/TheRock/issues/1062 hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 rocWMMA # https://github.com/ROCm/TheRock/issues/1944 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) # gfx110X family therock_add_amdgpu_target(gfx1100 "AMD RX 7900 XTX" FAMILY dgpu-all gfx110X-all gfx110X-dgpu EXCLUDE_TARGET_PROJECTS hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) therock_add_amdgpu_target(gfx1101 "AMD RX 7800 XT" FAMILY dgpu-all gfx110X-all gfx110X-dgpu EXCLUDE_TARGET_PROJECTS hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) therock_add_amdgpu_target(gfx1102 "AMD RX 7700S/Framework Laptop 16" FAMILY dgpu-all gfx110X-all gfx110X-dgpu EXCLUDE_TARGET_PROJECTS hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) therock_add_amdgpu_target(gfx1103 "AMD Radeon 780M Laptop iGPU" FAMILY igpu-all gfx110X-all gfx110X-igpu EXCLUDE_TARGET_PROJECTS hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 rccl # https://github.com/ROCm/TheRock/issues/150 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) # gfx115X family @@ -156,31 +169,37 @@ therock_add_amdgpu_target(gfx1150 "AMD Strix Point iGPU" FAMILY igpu-all gfx115X EXCLUDE_TARGET_PROJECTS hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 rccl # https://github.com/ROCm/TheRock/issues/150 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) therock_add_amdgpu_target(gfx1151 "AMD Strix Halo iGPU" FAMILY igpu-all gfx115X-all gfx115X-igpu EXCLUDE_TARGET_PROJECTS hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 rccl # https://github.com/ROCm/TheRock/issues/150 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) therock_add_amdgpu_target(gfx1152 "AMD Krackan 1 iGPU" FAMILY igpu-all gfx115X-all gfx115X-igpu EXCLUDE_TARGET_PROJECTS hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 rccl # https://github.com/ROCm/TheRock/issues/150 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) therock_add_amdgpu_target(gfx1153 "AMD Radeon 820M iGPU" FAMILY igpu-all gfx115X-all gfx115X-igpu EXCLUDE_TARGET_PROJECTS hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 rccl # https://github.com/ROCm/TheRock/issues/150 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) # gfx120X family therock_add_amdgpu_target(gfx1200 "AMD RX 9060 / XT" FAMILY dgpu-all gfx120X-all EXCLUDE_TARGET_PROJECTS hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) therock_add_amdgpu_target(gfx1201 "AMD RX 9070 / XT" FAMILY dgpu-all gfx120X-all EXCLUDE_TARGET_PROJECTS hipSPARSELt # https://github.com/ROCm/TheRock/issues/2042 + rocprofiler-compute # https://github.com/ROCm/TheRock/issues/2892 ) # Optional extension targets (used for out of tree target development). diff --git a/profiler/CMakeLists.txt b/profiler/CMakeLists.txt index de446e145d8..49536160404 100644 --- a/profiler/CMakeLists.txt +++ b/profiler/CMakeLists.txt @@ -122,8 +122,13 @@ endif(THEROCK_BUILD_TESTING) EXTERNAL_SOURCE_DIR "${THEROCK_ROCM_SYSTEMS_SOURCE_DIR}/projects/rocprofiler-compute" BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/rocprofiler-compute" BACKGROUND_BUILD + DEFAULT_GPU_TARGETS + gfx942 CMAKE_ARGS -DHIP_PLATFORM=amd + -DENABLE_TESTS=${THEROCK_BUILD_TESTING} + -DINSTALL_TESTS=${THEROCK_BUILD_TESTING} + -DTEST_FROM_INSTALL=${THEROCK_BUILD_TESTING} -DCHECK_PYTHON_DEPS=OFF CMAKE_INCLUDES therock_explicit_finders.cmake @@ -193,6 +198,7 @@ endif(THEROCK_BUILD_TESTING) doc lib run + test SUBPROJECT_DEPS aqlprofile rocprofiler-sdk @@ -214,8 +220,6 @@ endif(THEROCK_BUILD_TESTING) aqlprofile rocprofiler-sdk rocprofiler-compute - roctracer - ${_rocprofiler_sdk_optional_deps} ) ##############################################################################