diff --git a/build_tools/github_actions/fetch_test_configurations.py b/build_tools/github_actions/fetch_test_configurations.py index 1e3ea39a34d..09152e0043e 100644 --- a/build_tools/github_actions/fetch_test_configurations.py +++ b/build_tools/github_actions/fetch_test_configurations.py @@ -74,6 +74,14 @@ def _get_script_path(script_name: str) -> str: ], }, }, + "origami": { + "job_name": "origami", + "fetch_artifact_args": "--blas --tests", + "timeout_minutes": 5, + "test_script": f"python {_get_script_path('test_origami.py')}", + "platform": ["linux", "windows"], + "total_shards": 1, + }, "hipblas": { "job_name": "hipblas", "fetch_artifact_args": "--blas --tests", diff --git a/build_tools/github_actions/test_executable_scripts/test_origami.py b/build_tools/github_actions/test_executable_scripts/test_origami.py new file mode 100755 index 00000000000..09cf3876019 --- /dev/null +++ b/build_tools/github_actions/test_executable_scripts/test_origami.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +""" +Test script for origami C++ and Python tests. + +Origami uses Catch2 for C++ tests and pytest for Python tests. +Both test types are registered with CTest and run via ctest command. +""" + +import logging +import os +import shlex +import subprocess +import sys +from pathlib import Path + +THEROCK_BIN_DIR = os.getenv("THEROCK_BIN_DIR") +SCRIPT_DIR = Path(__file__).resolve().parent +THEROCK_DIR = SCRIPT_DIR.parent.parent.parent + +logging.basicConfig(level=logging.INFO, format="%(message)s") + +# Environment setup +environ_vars = os.environ.copy() +platform = os.getenv("RUNNER_OS", "linux").lower() +is_windows = platform == "windows" + +bin_dir = Path(THEROCK_BIN_DIR).resolve() +lib_dir = bin_dir.parent / "lib" +origami_test_dir = bin_dir / "origami" + +# Path separator is different on Windows vs Linux +path_sep = ";" if is_windows else ":" + +# The origami Python package is installed to lib/pythonX.Y/site-packages/origami/ +site_packages_dir = ( + lib_dir + / f"python{sys.version_info.major}.{sys.version_info.minor}" + / "site-packages" +) + +# LD_LIBRARY_PATH is needed for Python tests to find liborigami.so +if not is_windows: + ld_paths = [ + str(lib_dir), + environ_vars.get("LD_LIBRARY_PATH", ""), + ] + environ_vars["LD_LIBRARY_PATH"] = path_sep.join(p for p in ld_paths if p) +else: + dll_paths = [ + str(bin_dir), + str(lib_dir), + environ_vars.get("PATH", ""), + ] + environ_vars["PATH"] = path_sep.join(p for p in dll_paths if p) + +# Set PYTHONPATH so Python can find the origami package in site-packages +python_paths = [ + str(site_packages_dir), + environ_vars.get("PYTHONPATH", ""), +] +environ_vars["PYTHONPATH"] = path_sep.join(p for p in python_paths if p) + +logging.info(f"LD_LIBRARY_PATH: {environ_vars.get('LD_LIBRARY_PATH', '')}") +logging.info(f"PYTHONPATH: {environ_vars.get('PYTHONPATH', '')}") + +# CTest runs both C++ (Catch2) tests and Python (pytest) tests +cmd = [ + "ctest", + "--test-dir", + str(origami_test_dir), + "--output-on-failure", + "--parallel", + "8", +] + +if is_windows: + cmd.extend(["-R", "origami-tests"]) + +logging.info(f"++ Exec [{THEROCK_DIR}]$ {shlex.join(cmd)}") +subprocess.run(cmd, cwd=THEROCK_DIR, check=True, env=environ_vars) diff --git a/build_tools/packaging/linux/package.json b/build_tools/packaging/linux/package.json index a503283db7e..66acff51838 100644 --- a/build_tools/packaging/linux/package.json +++ b/build_tools/packaging/linux/package.json @@ -460,7 +460,14 @@ "doc" ] }, - + { + "Name": "origami", + "Components": [ + "lib", + "run", + "doc" + ] + }, { "Name": "hipBLASLt", "Components": [ diff --git a/build_tools/packaging/python/templates/rocm/src/rocm_sdk/_dist_info.py b/build_tools/packaging/python/templates/rocm/src/rocm_sdk/_dist_info.py index 2d4c72cbf8b..033338217be 100644 --- a/build_tools/packaging/python/templates/rocm/src/rocm_sdk/_dist_info.py +++ b/build_tools/packaging/python/templates/rocm/src/rocm_sdk/_dist_info.py @@ -245,6 +245,8 @@ def determine_target_family() -> str: LibraryEntry("hipsolver", "libraries", "libhipsolver.so*", "hipsolver*.dll") LibraryEntry("rccl", "libraries", "librccl.so*", "") LibraryEntry("miopen", "libraries", "libMIOpen.so*", "MIOpen*.dll") +LibraryEntry("origami", "libraries", "liborigami.so*", "origami*.dll") + # Others we may want: # hiprtc-builtins diff --git a/math-libs/BLAS/CMakeLists.txt b/math-libs/BLAS/CMakeLists.txt index 559a22c91df..d080f83354b 100644 --- a/math-libs/BLAS/CMakeLists.txt +++ b/math-libs/BLAS/CMakeLists.txt @@ -90,6 +90,37 @@ if(_enable_rocRoller) endif() +############################################################################## +# origami +############################################################################## + +therock_cmake_subproject_declare(origami + EXTERNAL_SOURCE_DIR "${THEROCK_ROCM_LIBRARIES_SOURCE_DIR}/shared/origami" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/origami" + BACKGROUND_BUILD + CMAKE_ARGS + -DHIP_PLATFORM=amd + -DORIGAMI_BUILD_SHARED_LIBS=ON + -DORIGAMI_BUILD_TESTING=${THEROCK_BUILD_TESTING} + -DORIGAMI_ENABLE_PYTHON=ON + -DORIGAMI_ENABLE_FETCH=OFF + COMPILER_TOOLCHAIN + amd-hip + BUILD_DEPS + rocm-cmake + therock-catch2 + RUNTIME_DEPS + hip-clr +) +therock_cmake_subproject_glob_c_sources(origami + SUBDIRS + . +) +therock_cmake_subproject_provide_package(origami origami lib/cmake/origami) +therock_cmake_subproject_activate(origami) +list(APPEND _blas_subproject_names origami) + + ############################################################################## # hipBLASLt ############################################################################## @@ -146,6 +177,7 @@ therock_cmake_subproject_declare(hipBLASLt ${hipBLASLt_rocRoller_build_deps} RUNTIME_DEPS hip-clr + origami therock-host-blas ${hipBLASLt_rocRoller_runtime_deps} ${hipBLASLt_runtime_deps} diff --git a/math-libs/BLAS/artifact-blas.toml b/math-libs/BLAS/artifact-blas.toml index 674a054ea84..02baf463629 100644 --- a/math-libs/BLAS/artifact-blas.toml +++ b/math-libs/BLAS/artifact-blas.toml @@ -19,6 +19,19 @@ include = [ ] optional = true +# origami +[components.dbg."math-libs/BLAS/origami/stage"] +[components.dev."math-libs/BLAS/origami/stage"] +[components.lib."math-libs/BLAS/origami/stage"] +include = [ + "lib/**", +] +[components.test."math-libs/BLAS/origami/stage"] +include = [ + "bin/origami-tests*", + "bin/origami/**", +] + # hipBLAS [components.dbg."math-libs/BLAS/hipBLAS/stage"] [components.dev."math-libs/BLAS/hipBLAS/stage"] diff --git a/rocm-libraries b/rocm-libraries index 9e9e9009cdf..c0a7ea081ff 160000 --- a/rocm-libraries +++ b/rocm-libraries @@ -1 +1 @@ -Subproject commit 9e9e9009cdf2fe5b7ae0ed41d7c0d1b09f09c93e +Subproject commit c0a7ea081fff497224a68b6ae846036f73dae1f6