From ae27e874c0b7be0655c02c5c3d368972089b77e7 Mon Sep 17 00:00:00 2001 From: Zichuan Guan Date: Mon, 27 Jul 2026 10:33:38 -0400 Subject: [PATCH 1/4] Cleanup arch filtering & Fix LLVM library path (#492) * Filter rocprof-compute to supported archs instead of skipping Previously rocprof-compute skipped the entire example if any requested architecture was unsupported. Use the shared filter_hip_architectures helper to build for the supported subset and emit a warning listing the skipped architectures, matching the ComposableKernel/hipTensor examples. Co-Authored-By: Claude Opus 4 * Warn instead of silently noting when CK/rocAL/rocCV are missing ComposableKernel, rocAL, and rocCV emitted a STATUS message when the library could not be found, so their examples were skipped without a visible warning in CI. Use WARNING to match every other library and surface the skip. Co-Authored-By: Claude Opus 4 * Fix LLVM lib/bin paths in TheRock CI env setup The LLVM toolchain (including libomp.so) lives under ${ROCM_PATH}/lib/llvm, not ${ROCM_PATH}/llvm. Correct PATH and LD_LIBRARY_PATH for both the tarball and wheel install methods so runtime dependencies like libomp.so resolve. Co-Authored-By: Claude Opus 4 --------- Co-authored-by: Claude Opus 4 --- .github/build_tools/setup_whl_env.py | 4 ++-- .../workflows/build-rocm-examples-reusable.yml | 4 ++-- Libraries/ComposableKernel/CMakeLists.txt | 2 +- Libraries/rocAL/CMakeLists.txt | 2 +- Libraries/rocCV/CMakeLists.txt | 2 +- Tools/rocprof-compute/CMakeLists.txt | 16 +++++++--------- 6 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.github/build_tools/setup_whl_env.py b/.github/build_tools/setup_whl_env.py index 6a4f35a9b..6d5d66090 100644 --- a/.github/build_tools/setup_whl_env.py +++ b/.github/build_tools/setup_whl_env.py @@ -15,11 +15,11 @@ f.write(f"HIP_PLATFORM=amd\n") f.write(f"HIP_PATH={rocm}\n") f.write(f"HIP_DEVICE_LIB_PATH={rocm}/lib/llvm/amdgcn/bitcode\n") - f.write(f"PATH={rocm}/bin:{rocm}/llvm/bin:{venv}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n") + f.write(f"PATH={rocm}/bin:{rocm}/lib/llvm/bin:{venv}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n") f.write(f"CPATH={rocm}/include\n") f.write(f"PKG_CONFIG_PATH={rocm}/lib/pkgconfig\n") f.write(f"LIBRARY_PATH={rocm}/lib:{rocm}/lib64\n") - f.write(f"LD_LIBRARY_PATH={core}:{libs}:{rocm}/lib:{rocm}/llvm/lib\n") + f.write(f"LD_LIBRARY_PATH={core}:{libs}:{rocm}/lib:{rocm}/lib/llvm/lib\n") # whl-multi-arch omits amdllvm needed for OpenMP GPU offloading f.write("ENABLE_OPENMP=OFF\n") # hipDNN headers require C++20; system g++ on AlmaLinux 8 is too old diff --git a/.github/workflows/build-rocm-examples-reusable.yml b/.github/workflows/build-rocm-examples-reusable.yml index ce53d44e8..448cae3e5 100644 --- a/.github/workflows/build-rocm-examples-reusable.yml +++ b/.github/workflows/build-rocm-examples-reusable.yml @@ -96,8 +96,8 @@ jobs: echo "HIP_PATH=${ROCM_PATH}" >> $GITHUB_ENV echo "HIP_PLATFORM=amd" >> $GITHUB_ENV echo "HIP_DEVICE_LIB_PATH=${ROCM_PATH}/lib/llvm/amdgcn/bitcode" >> $GITHUB_ENV - echo "PATH=${ROCM_PATH}/bin:${ROCM_PATH}/llvm/bin:${PATH}" >> $GITHUB_ENV - echo "LD_LIBRARY_PATH=${ROCM_PATH}/lib:${ROCM_PATH}/llvm/lib:${ROCM_PATH}/lib/rocprofiler-systems:${LD_LIBRARY_PATH}" >> $GITHUB_ENV + echo "PATH=${ROCM_PATH}/bin:${ROCM_PATH}/lib/llvm/bin:${PATH}" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=${ROCM_PATH}/lib:${ROCM_PATH}/lib/llvm/lib:${ROCM_PATH}/lib/rocprofiler-systems:${LD_LIBRARY_PATH}" >> $GITHUB_ENV echo "ENABLE_OPENMP=ON" >> $GITHUB_ENV echo "HIPCC_COMPILE_FLAGS_APPEND=--offload-arch=${{ matrix.gpu_config.gpu_target }}" >> $GITHUB_ENV diff --git a/Libraries/ComposableKernel/CMakeLists.txt b/Libraries/ComposableKernel/CMakeLists.txt index e65ea3645..626986bd6 100644 --- a/Libraries/ComposableKernel/CMakeLists.txt +++ b/Libraries/ComposableKernel/CMakeLists.txt @@ -51,7 +51,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/../../Common/ROCmPath.cmake") find_package(composable_kernel) if(NOT composable_kernel_FOUND) - message(STATUS "Composable Kernel could not be found, not building Composable Kernel examples") + message(WARNING "Composable Kernel could not be found, not building Composable Kernel examples") else() add_subdirectory(attention) add_subdirectory(basic) diff --git a/Libraries/rocAL/CMakeLists.txt b/Libraries/rocAL/CMakeLists.txt index a81a20e97..2806805eb 100644 --- a/Libraries/rocAL/CMakeLists.txt +++ b/Libraries/rocAL/CMakeLists.txt @@ -39,7 +39,7 @@ find_library(ROCAL_LIBRARY ) if(NOT ROCAL_LIBRARY) - message(STATUS "rocAL could not be found, not building rocAL examples") + message(WARNING "rocAL could not be found, not building rocAL examples") return() endif() diff --git a/Libraries/rocCV/CMakeLists.txt b/Libraries/rocCV/CMakeLists.txt index b8a49ff80..5831c58b7 100644 --- a/Libraries/rocCV/CMakeLists.txt +++ b/Libraries/rocCV/CMakeLists.txt @@ -41,7 +41,7 @@ find_library(ROCCV_LIBRARY ) if(NOT ROCCV_LIBRARY) - message(STATUS "rocCV could not be found, not building rocCV examples") + message(WARNING "rocCV could not be found, not building rocCV examples") return() endif() diff --git a/Tools/rocprof-compute/CMakeLists.txt b/Tools/rocprof-compute/CMakeLists.txt index 5244fdbb9..86267e6c1 100644 --- a/Tools/rocprof-compute/CMakeLists.txt +++ b/Tools/rocprof-compute/CMakeLists.txt @@ -33,15 +33,6 @@ set(example_occupancy ${example_name}-occupancy) cmake_minimum_required(VERSION 3.21 FATAL_ERROR) project(${example_name} LANGUAGES CXX) -set(ROCPROF_COMPUTE_SUPPORTED_ARCH gfx908 gfx90a gfx940 gfx941 gfx942 gfx950) - -foreach(ARCH ${CMAKE_HIP_ARCHITECTURES}) - if(NOT ARCH IN_LIST ROCPROF_COMPUTE_SUPPORTED_ARCH) - message(WARNING "${example_name} does not support architecture ${ARCH}. Not building ${example_name} examples") - return() - endif() -endforeach() - include("${CMAKE_CURRENT_LIST_DIR}/../../Common/HipPlatform.cmake") select_gpu_language() enable_language(${ROCM_EXAMPLES_GPU_LANGUAGE}) @@ -52,6 +43,13 @@ if(ROCM_EXAMPLES_GPU_LANGUAGE STREQUAL "CUDA") return() endif() +set(ROCPROF_COMPUTE_SUPPORTED_ARCH gfx908 gfx90a gfx940 gfx941 gfx942 gfx950) +include("${CMAKE_CURRENT_LIST_DIR}/../../Common/FilterHIPArchitectures.cmake") +filter_hip_architectures("${example_name}" "${ROCPROF_COMPUTE_SUPPORTED_ARCH}" SHOULD_SKIP) +if(SHOULD_SKIP) + return() +endif() + include("${CMAKE_CURRENT_LIST_DIR}/../../Common/ROCmPath.cmake") find_package(hip REQUIRED) From f142531866cee40241b0c0d25a8e9a2db92f5508 Mon Sep 17 00:00:00 2001 From: Jacob Lambert Date: Mon, 27 Jul 2026 13:27:37 -0600 Subject: [PATCH 2/4] fix(monte_carlo_pi): migrate off hipcub iterators removed in CUB 3.0 (#493) * fix(monte_carlo_pi): migrate off hipcub iterators removed in CUB 3.0 hipCUB's CCCL 3.0 update (ROCm/rocm-libraries#9931) removed the CUB-style iterator headers (counting/constant/transform/discard) that Applications/monte_carlo_pi included, breaking its build against current hipCUB. Switch to the portable Thrust iterators, which is the replacement CUB 3.0 itself points to. Changes: - main.hip: replace hipcub::CountingInputIterator / TransformInputIterator with thrust::counting_iterator / thrust::make_transform_iterator; drop the unused discard_output_iterator include. hipcub::DeviceReduce::Sum is unchanged and accepts Thrust iterators. - CMakeLists.txt: find + link rocThrust on the AMD path (roc::rocthrust); NVIDIA gets the Thrust headers from the already-required CUDA Toolkit. * Apply suggestion from @idubinov Co-authored-by: idubinov --------- Co-authored-by: idubinov --- Applications/monte_carlo_pi/CMakeLists.txt | 4 +++- Applications/monte_carlo_pi/main.hip | 12 +++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Applications/monte_carlo_pi/CMakeLists.txt b/Applications/monte_carlo_pi/CMakeLists.txt index 029b27491..754776434 100644 --- a/Applications/monte_carlo_pi/CMakeLists.txt +++ b/Applications/monte_carlo_pi/CMakeLists.txt @@ -39,10 +39,12 @@ include("${CMAKE_CURRENT_LIST_DIR}/../../Common/ROCmPath.cmake") find_package(hipcub REQUIRED) find_package(hiprand REQUIRED) # Workaround for hipRAND, requires manual linking with backend. +# rocThrust provides the iterators on AMD; NVIDIA gets Thrust from CUDAToolkit. if(ROCM_EXAMPLES_HIP_PLATFORM STREQUAL "nvidia") find_package(CUDAToolkit REQUIRED) else() find_package(rocrand REQUIRED) + find_package(rocthrust REQUIRED) endif() add_executable(${example_name} main.hip) @@ -53,7 +55,7 @@ target_link_libraries(${example_name} PRIVATE hip::hipcub hip::hiprand) if(ROCM_EXAMPLES_HIP_PLATFORM STREQUAL "nvidia") target_link_libraries(${example_name} PRIVATE CUDA::curand) else() - target_link_libraries(${example_name} PRIVATE roc::rocrand) + target_link_libraries(${example_name} PRIVATE roc::rocrand roc::rocthrust) endif() target_include_directories( ${example_name} diff --git a/Applications/monte_carlo_pi/main.hip b/Applications/monte_carlo_pi/main.hip index 8ea49de2a..e7d95c36c 100644 --- a/Applications/monte_carlo_pi/main.hip +++ b/Applications/monte_carlo_pi/main.hip @@ -25,11 +25,11 @@ #include "hiprand_utils.hpp" #include -#include -#include -#include #include +#include +#include + #include #include @@ -66,13 +66,11 @@ float calculate_pi(int sample_count, float* d_data) // 4. Set up the input and output iterator for hipCUB's Sum. // Represents the samples' index. - auto input_counting = hipcub::CountingInputIterator(0); + auto input_counting = thrust::counting_iterator(0); // Converts the sample's index to a 0 or 1, indicating whether the sample lies within the disk. conversion_op convert_op(sample_count, d_data); - auto input = hipcub::TransformInputIterator( - input_counting, - convert_op); + auto input = thrust::make_transform_iterator(input_counting, convert_op); int* d_output{}; HIP_CHECK(hipMalloc(&d_output, sizeof(int))); From d6017851e7d0cb860b6a78b8d2016735a31dcc01 Mon Sep 17 00:00:00 2001 From: Zichuan Guan Date: Thu, 30 Jul 2026 09:48:00 -0400 Subject: [PATCH 3/4] Add unified manifest-driven skip mechanism for CI builds and tests (#494) * Add unified manifest-driven skip mechanism for CI builds and tests Introduce a single source of truth (.github/build_tools/skip_manifest.py) feeding all four skip consumers: ctest (skip_tests.txt), CMake build (Common/SkipExamples.cmake via CMAKE_PROJECT_INCLUDE_BEFORE), make build (SKIP_FROM_BUILD), and make test (SKIP_FROM_TEST). Migrates the previously scattered static Makefile skips (hipFFT/rocFFT callback, all rocDecode examples) into the manifest. Skips carry repo-relative paths so a shared leaf name like `callback` (present under hipFFT, rocFFT, and rocProfiler-SDK/counter_collection) only skips the intended example. A --channel {stable,nightly} flag plus per-entry `channels` filter scopes a skip to the pinned rocm:7.14 native workflows or the TheRock multi-arch nightly workflow independently. Co-Authored-By: Claude Opus 4 * ci: dedupe CI step summary sections Drop the redundant "## Skipped tests" block from the Run tests step: the Generate skip lists step already reports the full skip manifest (scope + reason) to the step summary, so cat-ing skip_tests.txt only re-listed the two ctest names. Drop the duplicate "## ROCm Version" echo from the Wheel sanity check step; setup_whl_env.py already emits the labeled version line and feeds the rocm_version output used for artifact naming. The sanity-check step's rocm_version output was unreferenced. Co-Authored-By: Claude Opus 4 * ci: add install-method skip filter to distinguish nightly whl vs tarball The nightly whl and tarball installs share the "nightly" channel but ship different payloads, so channel alone can't scope a skip to one of them. Add an orthogonal install_methods filter (matched against --install-method, passed from matrix.install_method) and scope the rocDecode make-test skip to the whl install only -- the stable image and nightly tarball carry the video data, so their tests run. Co-Authored-By: Claude Opus 4 --------- Co-authored-by: Claude Opus 4 --- .github/build_tools/generate_skip_tests.py | 193 +++++++++++++----- .github/build_tools/skip_manifest.py | 143 +++++++++++++ .../build-rocm-examples-reusable.yml | 32 ++- .github/workflows/build_applications.yml | 7 +- .github/workflows/build_hip_basic.yml | 7 +- .github/workflows/build_hip_documentation.yml | 7 +- .github/workflows/build_libraries.yml | 7 +- .github/workflows/build_programming_guide.yml | 7 +- .github/workflows/build_systems.yml | 7 +- .github/workflows/build_tools.yml | 7 +- .gitignore | 7 +- Common/SkipExamples.cmake | 64 ++++++ Libraries/hipFFT/Makefile | 18 +- Libraries/rocDecode/Makefile | 23 ++- Libraries/rocFFT/Makefile | 20 +- 15 files changed, 448 insertions(+), 101 deletions(-) create mode 100644 .github/build_tools/skip_manifest.py create mode 100644 Common/SkipExamples.cmake diff --git a/.github/build_tools/generate_skip_tests.py b/.github/build_tools/generate_skip_tests.py index cf064cbd4..e5bb870ab 100644 --- a/.github/build_tools/generate_skip_tests.py +++ b/.github/build_tools/generate_skip_tests.py @@ -1,84 +1,179 @@ #!/usr/bin/env python3 -"""Generate skip_tests.txt for rocm-examples CI. +"""Generate CI skip artifacts for rocm-examples from the unified manifest. -Output file is used by ctest --exclude-from-file in the workflow. -Run from repo root or with --output-dir pointing at .github/build_tools. +Reads ``skip_manifest.SKIP_MANIFEST`` (the single source of truth) and, filtered +by the requested channel/target/distro, emits: + + * ``skip_tests.txt`` -- ctest names (scope contains "test", ctest key set). + Consumed by ``ctest --exclude-from-file``. + * ``skip_build.txt`` -- repo-relative paths (scope contains "build"). + Consumed by ``Common/SkipExamples.cmake``. + * ``SKIP_FROM_TEST`` -- space-separated repo-relative leaf paths (scope test). + * ``SKIP_FROM_BUILD`` -- space-separated repo-relative leaf paths (scope build). + +``SKIP_FROM_*`` carry full paths (e.g. ``Libraries/hipFFT/callback``), not bare +dir names, so a shared leaf name like ``callback`` — which exists under hipFFT, +rocFFT, AND rocProfiler-SDK/counter_collection — only skips the intended one. The +participating parent Makefiles match these paths against their own directory; all +other Makefiles filter bare names and therefore ignore the path entries. + +The two ``SKIP_FROM_*`` values are echoed to stdout and, when running under +GitHub Actions, appended to ``$GITHUB_ENV`` so the build/test steps can pass them +on the ``make`` command line. A human-readable summary is printed and, when +available, appended to ``$GITHUB_STEP_SUMMARY``. + +NOTE: a bare local ``make``/``make test`` (without running this generator) skips +nothing — CI passes the generated lists explicitly. To reproduce a CI skip +locally, run this script and pass the echoed SKIP_FROM_* on the make line. """ import argparse import os -# Tests to skip unconditionally on all targets/distros (upstream bugs in TheRock nightlies). -GLOBAL_SKIP_TESTS = [ - # ROCm/rocm-systems#7263: HIP CLR cannot resolve static device symbols via hipModuleGetGlobal. - # rocFFT's default store callback (store_cb_default_complex_double) is a static local - # function whose .static. mangled name causes an abort at runtime. - "hipfft_callback", - "rocfft_callback", -] - -# Tests to skip per GPU target (one list per target that has skips) -SKIP_TESTS = { - # Add more targets as needed, e.g.: - # "gfx1100": [], -} - -# Tests to skip for a specific GPU target + distro combination. -# Keys are ":", e.g. "gfx1151:sles-15.7". -DISTRO_SKIP_TESTS = { - # Example: - # "gfx1151:sles-15.7": ["some_test"], -} +from skip_manifest import SKIP_MANIFEST + + +def _entry_applies(entry, channel, target, distro, install_method): + """Return True if this manifest entry applies to the requested context. + + A filter that is absent from the entry matches everything. A filter that is + present must contain the requested value. + """ + if "channels" in entry and channel not in entry["channels"]: + return False + if target and "targets" in entry and target not in entry["targets"]: + return False + if distro and "distros" in entry and distro not in entry["distros"]: + return False + if ( + install_method + and "install_methods" in entry + and install_method not in entry["install_methods"] + ): + return False + return True def main(): parser = argparse.ArgumentParser( - description="Generate skip_tests.txt for rocm-examples CI." + description="Generate CI skip artifacts for rocm-examples." ) parser.add_argument( "--output-dir", default=os.path.join(os.path.dirname(__file__)), - help="Directory to write skip_tests.txt (default: script dir)", + help="Directory to write skip_tests.txt / skip_build.txt (default: script dir)", ) parser.add_argument( - "--target", + "--channel", required=True, - help="GPU target whose skip list to write (e.g. gfx1151)", + choices=["stable", "nightly"], + help="CI channel: 'stable' = pinned rocm:7.14 native workflows, " + "'nightly' = TheRock multi-arch reusable workflow", + ) + parser.add_argument( + "--target", + default="", + help="GPU target for target-specific skips (e.g. gfx1100)", ) parser.add_argument( "--distro", default="", - help="Distro key for distro-specific skips (e.g. sles-15.7)", + help="Distro key for distro-specific skips (e.g. ubuntu-24.04)", + ) + parser.add_argument( + "--install-method", + default="", + help="Install method for method-specific skips (e.g. whl-multi-arch, " + "tarball-multi-arch, preinstalled). whl and tarball are both the " + "'nightly' channel but ship different payloads.", ) args = parser.parse_args() - lines = list(GLOBAL_SKIP_TESTS) - for test in SKIP_TESTS.get(args.target, []): - if test not in lines: - lines.append(test) + applicable = [ + e + for e in SKIP_MANIFEST + if _entry_applies( + e, args.channel, args.target, args.distro, args.install_method + ) + ] - if args.distro: - combo_key = f"{args.target}:{args.distro}" - distro_lines = DISTRO_SKIP_TESTS.get(combo_key, []) - for test in distro_lines: - if test not in lines: - lines.append(test) + # Preserve manifest order, de-dup while keeping first occurrence. + def _unique(seq): + seen = set() + out = [] + for x in seq: + if x not in seen: + seen.add(x) + out.append(x) + return out + + skip_tests = _unique( + e["ctest"] + for e in applicable + if "test" in e["scope"] and e.get("ctest") + ) + skip_build_paths = _unique( + e["path"] for e in applicable if "build" in e["scope"] + ) + skip_from_test = _unique( + e["path"] for e in applicable if "test" in e["scope"] + ) + skip_from_build = _unique( + e["path"] for e in applicable if "build" in e["scope"] + ) os.makedirs(args.output_dir, exist_ok=True) - path = os.path.join(args.output_dir, "skip_tests.txt") - with open(path, "w") as f: - if lines: - f.write("\n".join(lines)) - f.write("\n") - label = args.target + tests_path = os.path.join(args.output_dir, "skip_tests.txt") + with open(tests_path, "w") as f: + if skip_tests: + f.write("\n".join(skip_tests) + "\n") + + build_path = os.path.join(args.output_dir, "skip_build.txt") + with open(build_path, "w") as f: + if skip_build_paths: + f.write("\n".join(skip_build_paths) + "\n") + + skip_from_test_str = " ".join(skip_from_test) + skip_from_build_str = " ".join(skip_from_build) + + # Echo the make variables so they can be captured / eyeballed. + print(f"SKIP_FROM_TEST={skip_from_test_str}") + print(f"SKIP_FROM_BUILD={skip_from_build_str}") + + github_env = os.environ.get("GITHUB_ENV") + if github_env: + with open(github_env, "a") as f: + f.write(f"SKIP_FROM_TEST={skip_from_test_str}\n") + f.write(f"SKIP_FROM_BUILD={skip_from_build_str}\n") + + # Human-readable summary. + label_bits = [f"channel={args.channel}"] + if args.target: + label_bits.append(f"target={args.target}") if args.distro: - label = f"{args.target} + {args.distro}" + label_bits.append(f"distro={args.distro}") + if args.install_method: + label_bits.append(f"install_method={args.install_method}") + label = ", ".join(label_bits) - if not lines: - print(f"No tests to skip for {label}.") + summary_lines = [f"### rocm-examples skip manifest ({label})", ""] + if applicable: + summary_lines.append("| example | scope | reason |") + summary_lines.append("| --- | --- | --- |") + for e in applicable: + summary_lines.append( + f"| `{e['path']}` | {'+'.join(e['scope'])} | {e['reason']} |" + ) else: - print(f"Wrote {path} ({len(lines)} tests for {label})") + summary_lines.append("_No examples skipped._") + summary = "\n".join(summary_lines) + print(summary) + + step_summary = os.environ.get("GITHUB_STEP_SUMMARY") + if step_summary: + with open(step_summary, "a") as f: + f.write(summary + "\n") if __name__ == "__main__": diff --git a/.github/build_tools/skip_manifest.py b/.github/build_tools/skip_manifest.py new file mode 100644 index 000000000..c20986286 --- /dev/null +++ b/.github/build_tools/skip_manifest.py @@ -0,0 +1,143 @@ +#!/usr/bin/env python3 +"""Single source of truth for rocm-examples CI skips. + +Every skip in the repo — whether it applies to the ctest run, the `make test` +run, the CMake build, or the `make` build — is one entry in ``SKIP_MANIFEST``. +The generator (``generate_skip_tests.py``) reads this list and produces the +per-consumer artifacts: + + * ``skip_tests.txt`` -> consumed by ``ctest --exclude-from-file`` + * ``skip_build.txt`` -> consumed by ``Common/SkipExamples.cmake`` + * ``SKIP_FROM_TEST`` -> passed on the ``make test`` command line + * ``SKIP_FROM_BUILD`` -> passed on the ``make`` command line + +Entry fields +------------ +ctest : str | None + The leaf ``example_name`` (globally unique CMake target / ctest name, set at + ``/CMakeLists.txt`` line 23, e.g. ``rocfft_callback``). Used ONLY by + ctest: it is what goes into ``skip_tests.txt`` for ``ctest + --exclude-from-file``. ``None`` when the example registers no ctest test, or + when ctest already self-guards the test (rocDecode guards on test-data + existence via ``if(EXISTS ...)``) -- then there is nothing for ctest to skip. +path : str + Repo-root-relative path to the leaf (e.g. ``Libraries/hipFFT/callback``). + Used by everything EXCEPT ctest: the ``make`` skip (``SKIP_FROM_*``, matched + per-directory in the Makefiles) and the CMake ``add_subdirectory`` override + (exact match). It disambiguates the three ``callback`` directories so a skip + never hits the wrong one (e.g. rocProfiler-SDK's callback stays built). +scope : list[str] + Subset of {"build", "test"}. "build" removes the example from compilation + (CMake + make); "test" removes it only from the test run (ctest + make test). +reason : str + Human-readable justification (shown in the CI step summary). + +Optional filters (absent = applies everywhere) +---------------------------------------------- +channels : list[str] -- subset of {"stable", "nightly"}. "stable" = the pinned + native workflows; "nightly" = the TheRock multi-arch reusable workflow. Use + this to scope a skip to only one CI channel. +targets : list[str] -- match against the --target value (e.g. "gfx1100"). +distros : list[str] -- match against the --distro value (e.g. "ubuntu-24.04"). +install_methods : list[str] -- match against the --install-method value (e.g. + "whl-multi-arch", "tarball-multi-arch", "preinstalled"). Use this to scope a + skip to a specific packaging: whl and tarball are both the "nightly" channel + but ship different payloads, so this axis is orthogonal to ``channels``. + +How to add a skip +----------------- +``path`` is essentially always required -- it drives make (both build and test) +and the CMake build. ``ctest`` is only added on top when you are skipping a test +that the ctest run actually registers. + +A BUILD skip implies a TEST skip everywhere -- scope = ["build"] is enough. +On the ctest side the CMake override makes add_test never register. On the make +side the `test:` target filters out SKIP_FROM_BUILD in addition to +SKIP_FROM_TEST (an example that isn't built can't be tested), so `make test` +won't try to rebuild+run a build-skipped example. You only need scope "test" +when you want to skip a test WITHOUT skipping its build (the example compiles +fine but the test itself must not run). + +Pick the row that matches what you want: + + * Skip the BUILD (example won't compile on this image/target): + scope = ["build"], set ``path``, leave ``ctest`` = None. + -> CMake override + `make` (SKIP_FROM_BUILD) drop it from the build; + ctest skips it implicitly (add_test never registers) and `make test` + skips it too (its `test:` target also filters SKIP_FROM_BUILD). + + * Skip only the TEST, and the test IS registered in ctest (runs and fails): + scope = ["test"], set ``path`` AND ``ctest``. + -> ctest --exclude-from-file (via ctest) + `make test` (via path). + + * Skip only the TEST, but CMake self-guards add_test (e.g. `if(EXISTS ...)`, + like rocDecode) so ctest never sees it: + scope = ["test"], set ``path``, leave ``ctest`` = None. + -> only `make test` needs skipping (via path); ctest has nothing to skip. + +Then optionally narrow with channels / targets / distros (absent = +applies everywhere). Always include a ``reason``. +""" + +# rocDecode leaf directories. All ten need the video test data + utility sources +# under $ROCM_PATH/share/rocdecode. The pinned stable image ships these via the +# amdrocm-decode-test package, and the nightly tarball carries them too, so +# rocDecode builds and its tests run in both. The nightly whl install does NOT +# carry the data, so the make-test skip is scoped to that install method. +# ctest self-guards each on `if(EXISTS ...)`, so the ctest key is None (ctest +# auto-skips where the data is absent); only the `make test` path needs the +# explicit, install-method-scoped skip. +_ROCDECODE_DIRS = [ + "rocdec_decode", + "video_decode", + "video_decode_batch", + "video_decode_mem", + "video_decode_multi_files", + "video_decode_perf", + "video_decode_pic_files", + "video_decode_raw", + "video_decode_rgb", + "video_to_sequence", +] + +SKIP_MANIFEST = [ + # --- FFT callbacks: test-only, all channels --------------------------- + # ROCm/rocm-systems#7263: HIP CLR cannot resolve static device symbols via + # hipModuleGetGlobal; the default store callback aborts at runtime. + { + "ctest": "hipfft_callback", + "path": "Libraries/hipFFT/callback", + "scope": ["test"], + "reason": "ROCm/rocm-systems#7263 static device symbol abort at runtime", + }, + { + "ctest": "rocfft_callback", + "path": "Libraries/rocFFT/callback", + "scope": ["test"], + "reason": "ROCm/rocm-systems#7263 static device symbol abort at runtime", + }, + # --- rocDecode: test-only, nightly whl install only, no ctest key ----- + # The stable image (amdrocm-decode-test) and the nightly tarball carry the + # video data, so their tests run; the nightly whl install doesn't, so skip + # make test only there. + *[ + { + "ctest": None, + "path": f"Libraries/rocDecode/{d}", + "scope": ["test"], + "channels": ["nightly"], + "install_methods": ["whl-multi-arch"], + "reason": "video test data absent from the TheRock nightly whl install (present on the stable image via amdrocm-decode-test and in the nightly tarball)", + } + for d in _ROCDECODE_DIRS + ], + # --- Stable-only build skip ------------ + # hip_scan.h is absent from the pinned 7.14 stable image + { + "ctest": None, + "path": "HIP-Basic/cooperative_groups_prefix_sum", + "scope": ["build"], + "channels": ["stable"], + "reason": "hip_scan.h not present in the pinned 7.14 stable image", + }, +] diff --git a/.github/workflows/build-rocm-examples-reusable.yml b/.github/workflows/build-rocm-examples-reusable.yml index 448cae3e5..96dfe09e5 100644 --- a/.github/workflows/build-rocm-examples-reusable.yml +++ b/.github/workflows/build-rocm-examples-reusable.yml @@ -60,9 +60,6 @@ jobs: id: sanity-check continue-on-error: true run: | - ROCM_VERSION=$(rocm-sdk version) - echo "rocm_version=${ROCM_VERSION}" >> $GITHUB_OUTPUT - echo "## ROCm Version: ${ROCM_VERSION}" >> $GITHUB_STEP_SUMMARY rocm-sdk init rocm-sdk test @@ -101,15 +98,23 @@ jobs: echo "ENABLE_OPENMP=ON" >> $GITHUB_ENV echo "HIPCC_COMPILE_FLAGS_APPEND=--offload-arch=${{ matrix.gpu_config.gpu_target }}" >> $GITHUB_ENV + - name: Generate skip lists + run: | + python3 .github/build_tools/generate_skip_tests.py \ + --channel nightly \ + --target "${{ matrix.gpu_config.gpu_target }}" \ + --distro "${{ inputs.distro }}" \ + --install-method "${{ matrix.install_method }}" + - name: Makefile build run: | ./Scripts/configure.sh --rocm-path="${ROCM_PATH}" - make -j HIP_ARCHITECTURES="${{ matrix.gpu_config.gpu_target }}" + make -j HIP_ARCHITECTURES="${{ matrix.gpu_config.gpu_target }}" SKIP_FROM_BUILD="$SKIP_FROM_BUILD" - name: CMake configure if: ${{ !cancelled() }} run: | - cmake -S . -B build -DCMAKE_HIP_ARCHITECTURES="${{ matrix.gpu_config.gpu_target }}" -DCMAKE_BUILD_RPATH="${ROCM_PATH}/lib" -DROCM_EXAMPLES_ENABLE_OPENMP="${ENABLE_OPENMP}" 2> >(tee cmake_error.log >&2) + cmake -S . -B build -DCMAKE_HIP_ARCHITECTURES="${{ matrix.gpu_config.gpu_target }}" -DCMAKE_BUILD_RPATH="${ROCM_PATH}/lib" -DROCM_EXAMPLES_ENABLE_OPENMP="${ENABLE_OPENMP}" -DCMAKE_PROJECT_INCLUDE_BEFORE="${GITHUB_WORKSPACE}/Common/SkipExamples.cmake" 2> >(tee cmake_error.log >&2) - name: CMake configure error summary if: ${{ !cancelled() }} @@ -177,20 +182,9 @@ jobs: - name: Run tests if: ${{ !cancelled() }} run: | - python3 .github/build_tools/generate_skip_tests.py --target ${{ matrix.gpu_config.gpu_target }} --distro ${{ inputs.distro }} - + # skip_tests.txt was produced by the "Generate skip lists" step, + # which also reports the full skip manifest to the step summary. SKIP_FILE="${GITHUB_WORKSPACE}/.github/build_tools/skip_tests.txt" - if [ -s "${SKIP_FILE}" ]; then - echo "## Skipped tests" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - cat "${SKIP_FILE}" >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - else - echo "No tests skipped." >> $GITHUB_STEP_SUMMARY - fi - ctest --test-dir build --output-on-failure --exclude-from-file "${SKIP_FILE}" 2>&1 | tee ctest_output.log - name: Test summary @@ -244,7 +238,7 @@ jobs: - name: Makefile test if: ${{ !cancelled() }} run: | - make test HIP_ARCHITECTURES="${{ matrix.gpu_config.gpu_target }}" 2>&1 | tee makefile_test_output.log + make test HIP_ARCHITECTURES="${{ matrix.gpu_config.gpu_target }}" SKIP_FROM_TEST="$SKIP_FROM_TEST" 2>&1 | tee makefile_test_output.log - name: Upload Makefile test logs if: ${{ !cancelled() }} diff --git a/.github/workflows/build_applications.yml b/.github/workflows/build_applications.yml index 1943ec2d9..b85090764 100644 --- a/.github/workflows/build_applications.yml +++ b/.github/workflows/build_applications.yml @@ -31,12 +31,15 @@ jobs: shell: bash steps: - uses: actions/checkout@v4 + - name: Generate skip lists + run: | + python3 .github/build_tools/generate_skip_tests.py --channel stable --target "${GPU_TARGETS%%;*}" - name: CMake Configure and Build run: | cd Applications - cmake -DCMAKE_HIP_ARCHITECTURES="${GPU_TARGETS}" -S . -B build + cmake -DCMAKE_HIP_ARCHITECTURES="${GPU_TARGETS}" -DCMAKE_PROJECT_INCLUDE_BEFORE="${GITHUB_WORKSPACE}/Common/SkipExamples.cmake" -S . -B build cmake --build build -j - name: Make run: | cd Applications - make -j + make -j SKIP_FROM_BUILD="$SKIP_FROM_BUILD" diff --git a/.github/workflows/build_hip_basic.yml b/.github/workflows/build_hip_basic.yml index d7dc0b8a8..0dae9c777 100644 --- a/.github/workflows/build_hip_basic.yml +++ b/.github/workflows/build_hip_basic.yml @@ -31,12 +31,15 @@ jobs: shell: bash steps: - uses: actions/checkout@v4 + - name: Generate skip lists + run: | + python3 .github/build_tools/generate_skip_tests.py --channel stable --target "${GPU_TARGETS%%;*}" - name: CMake Configure and Build run: | cd HIP-Basic - cmake -DCMAKE_HIP_ARCHITECTURES="${GPU_TARGETS}" -S . -B build + cmake -DCMAKE_HIP_ARCHITECTURES="${GPU_TARGETS}" -DCMAKE_PROJECT_INCLUDE_BEFORE="${GITHUB_WORKSPACE}/Common/SkipExamples.cmake" -S . -B build cmake --build build -j - name: Make run: | cd HIP-Basic - make -j + make -j SKIP_FROM_BUILD="$SKIP_FROM_BUILD" diff --git a/.github/workflows/build_hip_documentation.yml b/.github/workflows/build_hip_documentation.yml index 4ba33c911..8f60add0b 100644 --- a/.github/workflows/build_hip_documentation.yml +++ b/.github/workflows/build_hip_documentation.yml @@ -31,15 +31,18 @@ jobs: shell: bash steps: - uses: actions/checkout@v4 + - name: Generate skip lists + run: | + python3 .github/build_tools/generate_skip_tests.py --channel stable --target "${GPU_TARGETS%%;*}" - name: CMake Configure and Build # The CMAKE_POLICY_VERSION_MINIMUM environment variable can be removed once the CMake updates from ROCm 7.0 are available run: | cd HIP-Doc export CMAKE_POLICY_VERSION_MINIMUM="3.5" - cmake -DCMAKE_HIP_ARCHITECTURES="${GPU_TARGETS}" -S . -B build + cmake -DCMAKE_HIP_ARCHITECTURES="${GPU_TARGETS}" -DCMAKE_PROJECT_INCLUDE_BEFORE="${GITHUB_WORKSPACE}/Common/SkipExamples.cmake" -S . -B build cmake --build build -j - name: Make run: | cd HIP-Doc export HSA_XNACK=1 - make -j + make -j SKIP_FROM_BUILD="$SKIP_FROM_BUILD" diff --git a/.github/workflows/build_libraries.yml b/.github/workflows/build_libraries.yml index c1ca37f4f..88f97dc0e 100644 --- a/.github/workflows/build_libraries.yml +++ b/.github/workflows/build_libraries.yml @@ -58,15 +58,18 @@ jobs: fi echo "ENABLE_CK=${ENABLE_CK}" >> $GITHUB_ENV echo "ROCM_EXAMPLES_ENABLE_CK=${ENABLE_CK}" + - name: Generate skip lists + run: | + python3 .github/build_tools/generate_skip_tests.py --channel stable --target "${GPU_TARGETS%%;*}" - name: CMake Configure and Build run: | cd Libraries - cmake -DCMAKE_BUILD_TYPE=Release -DGPU_TARGETS="${GPU_TARGETS}" -DCMAKE_HIP_ARCHITECTURES="${GPU_TARGETS}" -DROCM_EXAMPLES_ENABLE_CK=${ENABLE_CK} -DROCM_EXAMPLES_ENABLE_OPENMP=ON -S . -B build + cmake -DCMAKE_BUILD_TYPE=Release -DGPU_TARGETS="${GPU_TARGETS}" -DCMAKE_HIP_ARCHITECTURES="${GPU_TARGETS}" -DROCM_EXAMPLES_ENABLE_CK=${ENABLE_CK} -DROCM_EXAMPLES_ENABLE_OPENMP=ON -DCMAKE_PROJECT_INCLUDE_BEFORE="${GITHUB_WORKSPACE}/Common/SkipExamples.cmake" -S . -B build cmake --build build --parallel $(nproc) - name: Make run: | cd Libraries - make -j $(nproc) ROCM_EXAMPLES_ENABLE_CK=${ENABLE_CK} HIP_ARCHITECTURES="${GPU_TARGETS}" + make -j $(nproc) ROCM_EXAMPLES_ENABLE_CK=${ENABLE_CK} HIP_ARCHITECTURES="${GPU_TARGETS}" SKIP_FROM_BUILD="$SKIP_FROM_BUILD" # Clean the workspace here since other jobs may not have the permissions to do so later # (needed for self-hosted runners) diff --git a/.github/workflows/build_programming_guide.yml b/.github/workflows/build_programming_guide.yml index 57055e5eb..ee6638844 100644 --- a/.github/workflows/build_programming_guide.yml +++ b/.github/workflows/build_programming_guide.yml @@ -31,12 +31,15 @@ jobs: shell: bash steps: - uses: actions/checkout@v4 + - name: Generate skip lists + run: | + python3 .github/build_tools/generate_skip_tests.py --channel stable --target "${GPU_TARGETS%%;*}" - name: CMake Configure and Build run: | cd Programming-Guide - cmake -DCMAKE_HIP_PLATFORM=amd -DCMAKE_HIP_ARCHITECTURES="${GPU_TARGETS}" -S . -B build + cmake -DCMAKE_HIP_PLATFORM=amd -DCMAKE_HIP_ARCHITECTURES="${GPU_TARGETS}" -DCMAKE_PROJECT_INCLUDE_BEFORE="${GITHUB_WORKSPACE}/Common/SkipExamples.cmake" -S . -B build cmake --build build -j - name: Make run: | cd Programming-Guide - make -j + make -j SKIP_FROM_BUILD="$SKIP_FROM_BUILD" diff --git a/.github/workflows/build_systems.yml b/.github/workflows/build_systems.yml index 49e5389af..60a7906de 100644 --- a/.github/workflows/build_systems.yml +++ b/.github/workflows/build_systems.yml @@ -31,12 +31,15 @@ jobs: shell: bash steps: - uses: actions/checkout@v4 + - name: Generate skip lists + run: | + python3 .github/build_tools/generate_skip_tests.py --channel stable --target "${GPU_TARGETS%%;*}" - name: CMake Configure and Build run: | cd Systems - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_HIP_ARCHITECTURES="${GPU_TARGETS}" -S . -B build + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_HIP_ARCHITECTURES="${GPU_TARGETS}" -DCMAKE_PROJECT_INCLUDE_BEFORE="${GITHUB_WORKSPACE}/Common/SkipExamples.cmake" -S . -B build cmake --build build -j $(nproc) - name: Make run: | cd Systems - make -j $(nproc) + make -j $(nproc) SKIP_FROM_BUILD="$SKIP_FROM_BUILD" diff --git a/.github/workflows/build_tools.yml b/.github/workflows/build_tools.yml index cca733dc5..44dd0a9f6 100644 --- a/.github/workflows/build_tools.yml +++ b/.github/workflows/build_tools.yml @@ -30,12 +30,15 @@ jobs: shell: bash steps: - uses: actions/checkout@v4 + - name: Generate skip lists + run: | + python3 .github/build_tools/generate_skip_tests.py --channel stable --target "${GPU_TARGETS%%;*}" - name: CMake Configure and Build run: | cd Tools - cmake -DCMAKE_HIP_ARCHITECTURES="${GPU_TARGETS}" -S . -B build + cmake -DCMAKE_HIP_ARCHITECTURES="${GPU_TARGETS}" -DCMAKE_PROJECT_INCLUDE_BEFORE="${GITHUB_WORKSPACE}/Common/SkipExamples.cmake" -S . -B build cmake --build build -j - name: Make run: | cd Tools - make -j + make -j SKIP_FROM_BUILD="$SKIP_FROM_BUILD" diff --git a/.gitignore b/.gitignore index d8244c445..d7d00487a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,9 @@ CMakeUserPresets.json .cline_storage config.mk -.claude/ \ No newline at end of file +.claude/ + +# Generated at CI time by .github/build_tools/generate_skip_tests.py +.github/build_tools/skip_tests.txt +.github/build_tools/skip_build.txt +__pycache__/ \ No newline at end of file diff --git a/Common/SkipExamples.cmake b/Common/SkipExamples.cmake new file mode 100644 index 000000000..dde2fa1a4 --- /dev/null +++ b/Common/SkipExamples.cmake @@ -0,0 +1,64 @@ +# MIT License +# +# Copyright (c) 2026 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. + +# Build-skip hook for rocm-examples CI. +# +# Injected via `-DCMAKE_PROJECT_INCLUDE_BEFORE=/Common/SkipExamples.cmake`, +# so CMake runs it at the start of every project() call. It overrides +# add_subdirectory() to drop any example whose repo-root-relative path appears in +# `.github/build_tools/skip_build.txt` (generated from skip_manifest.py). A +# skipped leaf's project()/add_executable()/add_test() never run, so no dangling +# target and no ctest entry are created. +# +# The override is installed exactly once (guarded by a cache variable). Because +# CMake function overrides are inherited by subdirectories, installing it at the +# first project() call intercepts every add_subdirectory() at any depth. + +if(NOT DEFINED ROCM_EXAMPLES_SKIP_BUILD_INITIALIZED) + set(ROCM_EXAMPLES_SKIP_BUILD_INITIALIZED TRUE CACHE INTERNAL "") + + # This file lives in /Common, so the repo root is one directory up. + # It is stable regardless of which folder root cmake -S points at. + get_filename_component(_rocm_examples_root "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) + set(ROCM_EXAMPLES_ROOT "${_rocm_examples_root}" CACHE INTERNAL "") + + set(_skip_file "${ROCM_EXAMPLES_ROOT}/.github/build_tools/skip_build.txt") + set(_skip_list "") + if(EXISTS "${_skip_file}") + file(STRINGS "${_skip_file}" _skip_list) + endif() + set(ROCM_EXAMPLES_SKIP_BUILD "${_skip_list}" CACHE INTERNAL "") + + if(ROCM_EXAMPLES_SKIP_BUILD) + message(STATUS "SkipExamples: build-skip list = ${ROCM_EXAMPLES_SKIP_BUILD}") + endif() + + function(add_subdirectory dir) + get_filename_component(_abs "${dir}" ABSOLUTE) + file(RELATIVE_PATH _rel "${ROCM_EXAMPLES_ROOT}" "${_abs}") + if("${_rel}" IN_LIST ROCM_EXAMPLES_SKIP_BUILD) + message(WARNING "SkipExamples: skipping ${_rel} (build-skip manifest)") + return() + endif() + _add_subdirectory("${dir}" ${ARGN}) + endfunction() +endif() diff --git a/Libraries/hipFFT/Makefile b/Libraries/hipFFT/Makefile index cfdb699dc..abfa52b24 100644 --- a/Libraries/hipFFT/Makefile +++ b/Libraries/hipFFT/Makefile @@ -28,15 +28,25 @@ EXAMPLES := \ plan_z2z \ setworkarea -# ROCm/rocm-systems#7263: static device symbols in rocFFT callbacks abort at runtime -SKIP_FROM_TEST := callback +# Skips are driven by .github/build_tools/skip_manifest.py: CI runs +# generate_skip_tests.py and passes SKIP_FROM_BUILD / SKIP_FROM_TEST as +# repo-relative paths on the make command line (overriding these defaults). +# skip_here matches only entries naming THIS directory's examples, so a shared +# leaf name like `callback` (also under rocProfiler-SDK) is not skipped by +# mistake. A bare local build/test skips nothing. The `callback` example is +# test-skipped in CI (ROCm/rocm-systems#7263: static device symbols in FFT +# callbacks abort at runtime). The `test` target honors SKIP_FROM_BUILD too: an +# example that isn't built can't be tested, so build skips imply test skips. +SKIP_FROM_BUILD ?= +SKIP_FROM_TEST ?= +skip_here = $(foreach e,$(EXAMPLES),$(if $(filter %/$(notdir $(CURDIR))/$(e),$(1)),$(e))) ifneq ($(GPU_RUNTIME), CUDA) EXAMPLES += \ callback endif -all: $(EXAMPLES) +all: $(filter-out $(call skip_here,$(SKIP_FROM_BUILD)),$(EXAMPLES)) clean: TARGET=clean clean: all @@ -45,6 +55,6 @@ $(EXAMPLES): $(MAKE) -C $@ $(TARGET) test: TARGET=test -test: $(filter-out $(SKIP_FROM_TEST),$(EXAMPLES)) +test: $(filter-out $(call skip_here,$(SKIP_FROM_TEST) $(SKIP_FROM_BUILD)),$(EXAMPLES)) .PHONY: all clean test $(EXAMPLES) diff --git a/Libraries/rocDecode/Makefile b/Libraries/rocDecode/Makefile index 4f39bf0e3..3b345e2b3 100644 --- a/Libraries/rocDecode/Makefile +++ b/Libraries/rocDecode/Makefile @@ -32,15 +32,20 @@ EXAMPLES := \ video_decode_rgb \ video_to_sequence -# All rocDecode tests are skipped by default: they require test data -# (videos under $(ROCM_PATH)/share/rocdecode/) that ctest guards behind -# `if(EXISTS …)` checks. Encoding the same conditional logic in Make is -# possible but noisy; for now skip the whole subtree so `make test` from -# root stays clean. To run rocDecode tests manually, cd into the leaf -# Makefile and run `make test`. -SKIP_FROM_TEST := $(EXAMPLES) +# All rocDecode examples need video test data (under $(ROCM_PATH)/share/rocdecode) +# that CI images don't carry, so every example is test-skipped. The skip is now +# driven by .github/build_tools/skip_manifest.py: CI runs generate_skip_tests.py +# and passes SKIP_FROM_TEST (all ten example paths) on the make command line, +# overriding this default. skip_here matches only entries naming THIS directory's +# examples. A bare local `make test` runs them; to skip manually, pass +# SKIP_FROM_TEST or cd into a leaf and control it there. The `test` target honors +# SKIP_FROM_BUILD too: an example that isn't built can't be tested, so build +# skips imply test skips. +SKIP_FROM_BUILD ?= +SKIP_FROM_TEST ?= +skip_here = $(foreach e,$(EXAMPLES),$(if $(filter %/$(notdir $(CURDIR))/$(e),$(1)),$(e))) -all: $(EXAMPLES) +all: $(filter-out $(call skip_here,$(SKIP_FROM_BUILD)),$(EXAMPLES)) clean: TARGET=clean clean: all @@ -49,6 +54,6 @@ $(EXAMPLES): $(MAKE) -C $@ $(TARGET) test: TARGET=test -test: $(filter-out $(SKIP_FROM_TEST),$(EXAMPLES)) +test: $(filter-out $(call skip_here,$(SKIP_FROM_TEST) $(SKIP_FROM_BUILD)),$(EXAMPLES)) .PHONY: all clean test $(EXAMPLES) diff --git a/Libraries/rocFFT/Makefile b/Libraries/rocFFT/Makefile index 289eae8a6..d65932ca4 100644 --- a/Libraries/rocFFT/Makefile +++ b/Libraries/rocFFT/Makefile @@ -30,10 +30,20 @@ EXAMPLES := \ multi_gpu \ real_complex -# ROCm/rocm-systems#7263: static device symbols in rocFFT callbacks abort at runtime -SKIP_FROM_TEST := callback - -all: $(EXAMPLES) +# Skips are driven by .github/build_tools/skip_manifest.py: CI runs +# generate_skip_tests.py and passes SKIP_FROM_BUILD / SKIP_FROM_TEST as +# repo-relative paths on the make command line (overriding these defaults). +# skip_here matches only entries naming THIS directory's examples, so a shared +# leaf name like `callback` (also under rocProfiler-SDK) is not skipped by +# mistake. A bare local build/test skips nothing. The `callback` example is +# test-skipped in CI (ROCm/rocm-systems#7263: static device symbols in rocFFT +# callbacks abort at runtime). The `test` target honors SKIP_FROM_BUILD too: an +# example that isn't built can't be tested, so build skips imply test skips. +SKIP_FROM_BUILD ?= +SKIP_FROM_TEST ?= +skip_here = $(foreach e,$(EXAMPLES),$(if $(filter %/$(notdir $(CURDIR))/$(e),$(1)),$(e))) + +all: $(filter-out $(call skip_here,$(SKIP_FROM_BUILD)),$(EXAMPLES)) clean: TARGET=clean clean: all @@ -42,6 +52,6 @@ $(EXAMPLES): $(MAKE) -C $@ $(TARGET) test: TARGET=test -test: $(filter-out $(SKIP_FROM_TEST),$(EXAMPLES)) +test: $(filter-out $(call skip_here,$(SKIP_FROM_TEST) $(SKIP_FROM_BUILD)),$(EXAMPLES)) .PHONY: all clean test $(EXAMPLES) From 269e9068d6fd6e68b1cc5a76eb77744f88af42ec Mon Sep 17 00:00:00 2001 From: Zichuan Guan Date: Fri, 31 Jul 2026 09:43:29 -0400 Subject: [PATCH 4/4] Add nightly GPU build+test on pinned stable ROCm 7.14 image (#495) ## Motivation Add nightly stable version testing. ## Technical Details Adds a "preinstalled" install method and a stable_release distro (the self-contained ghcr rocm:7.14 image with ROCm baked in at /opt/rocm) so the nightly matrix exercises the pinned stable ROCm on GPU hardware, not just the TheRock nightlies. CK and OpenMP are enabled for this job. Disables CK due to version skew. Add venv and install cmake from pip on the stable docker image. --- .github/build_tools/configure_ci.py | 15 +++++++++-- .../build-rocm-examples-reusable.yml | 26 +++++++++++++++---- .github/workflows/ci_nightly.yml | 1 + Dockerfiles/ubuntu-24.04-rocm.Dockerfile | 7 ++++- 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/.github/build_tools/configure_ci.py b/.github/build_tools/configure_ci.py index e7c21d6ca..284055867 100644 --- a/.github/build_tools/configure_ci.py +++ b/.github/build_tools/configure_ci.py @@ -14,6 +14,10 @@ # Install methods for all distros (ROCm installed at CI runtime from TheRock nightlies). INSTALL_METHODS = ["whl-multi-arch", "tarball-multi-arch"] +# "preinstalled" is a valid input but is NOT part of the default "all" expansion: +# it only applies to images that already ship ROCm (e.g. the pinned stable image). +PREINSTALLED = "preinstalled" + # Distros to build against – keyed by short name. # "install_methods": omit to use the global INSTALL_METHODS list. # Add new entries here to enable more distros (also add to workflow_dispatch options). @@ -23,6 +27,12 @@ "almalinux-8": {"image": "ghcr.io/rocm/rocm-examples-almalinux-8-multiarch:latest", "label": "AlmaLinux 8"}, "ubuntu-24.04": {"image": "ghcr.io/rocm/rocm-examples-ubuntu-24.04-multiarch:latest", "label": "Ubuntu 24.04"}, "ubuntu-26.04": {"image": "ghcr.io/rocm/rocm-examples-ubuntu-26.04-multiarch:latest", "label": "Ubuntu 26.04"}, + # Pinned stable image: ROCm baked in at /opt/rocm (no runtime install). + "stable_release": { + "image": "ghcr.io/rocm/rocm-examples-ubuntu-24.04-rocm:7.14", + "label": "Ubuntu 24.04 (ROCm 7.14)", + "install_methods": [PREINSTALLED], + }, } def _is_all(value): @@ -46,8 +56,9 @@ def main(): if _is_all(install_input): install_methods = INSTALL_METHODS else: - if install_input not in INSTALL_METHODS: - raise ValueError(f"Invalid install method: {install_input}. Allowed: {INSTALL_METHODS}") + allowed_methods = INSTALL_METHODS + [PREINSTALLED] + if install_input not in allowed_methods: + raise ValueError(f"Invalid install method: {install_input}. Allowed: {allowed_methods}") install_methods = [install_input] # Determine distros diff --git a/.github/workflows/build-rocm-examples-reusable.yml b/.github/workflows/build-rocm-examples-reusable.yml index 96dfe09e5..9c70334ec 100644 --- a/.github/workflows/build-rocm-examples-reusable.yml +++ b/.github/workflows/build-rocm-examples-reusable.yml @@ -98,6 +98,22 @@ jobs: echo "ENABLE_OPENMP=ON" >> $GITHUB_ENV echo "HIPCC_COMPILE_FLAGS_APPEND=--offload-arch=${{ matrix.gpu_config.gpu_target }}" >> $GITHUB_ENV + - name: Setup environment variables (preinstalled) + if: ${{ matrix.install_method == 'preinstalled' }} + id: preinstalled + run: | + ROCM_VERSION=$(cat /opt/rocm/core/.info/version) + echo "rocm_version=${ROCM_VERSION}" >> $GITHUB_OUTPUT + echo "## ROCm Version: ${ROCM_VERSION} (preinstalled)" >> $GITHUB_STEP_SUMMARY + + ROCM_PATH=/opt/rocm + echo "ROCM_PATH=${ROCM_PATH}" >> $GITHUB_ENV + echo "HIP_PATH=${ROCM_PATH}" >> $GITHUB_ENV + echo "HIP_PLATFORM=amd" >> $GITHUB_ENV + echo "ENABLE_OPENMP=ON" >> $GITHUB_ENV + echo "ENABLE_CK=OFF" >> $GITHUB_ENV + echo "HIPCC_COMPILE_FLAGS_APPEND=--offload-arch=${{ matrix.gpu_config.gpu_target }}" >> $GITHUB_ENV + - name: Generate skip lists run: | python3 .github/build_tools/generate_skip_tests.py \ @@ -114,7 +130,7 @@ jobs: - name: CMake configure if: ${{ !cancelled() }} run: | - cmake -S . -B build -DCMAKE_HIP_ARCHITECTURES="${{ matrix.gpu_config.gpu_target }}" -DCMAKE_BUILD_RPATH="${ROCM_PATH}/lib" -DROCM_EXAMPLES_ENABLE_OPENMP="${ENABLE_OPENMP}" -DCMAKE_PROJECT_INCLUDE_BEFORE="${GITHUB_WORKSPACE}/Common/SkipExamples.cmake" 2> >(tee cmake_error.log >&2) + cmake -S . -B build -DCMAKE_HIP_ARCHITECTURES="${{ matrix.gpu_config.gpu_target }}" -DCMAKE_BUILD_RPATH="${ROCM_PATH}/lib" -DROCM_EXAMPLES_ENABLE_OPENMP="${ENABLE_OPENMP}" -DROCM_EXAMPLES_ENABLE_CK="${ENABLE_CK}" -DCMAKE_PROJECT_INCLUDE_BEFORE="${GITHUB_WORKSPACE}/Common/SkipExamples.cmake" 2> >(tee cmake_error.log >&2) - name: CMake configure error summary if: ${{ !cancelled() }} @@ -169,14 +185,14 @@ jobs: if: ${{ !cancelled() }} uses: actions/upload-artifact@v4 with: - name: rocm-examples-build-${{ inputs.distro }}-${{ matrix.gpu_config.gpu_target }}-${{ steps.whl-multiarch-version.outputs.rocm_version || steps.install-tarball-multi-arch.outputs.rocm_version }}-${{ matrix.install_method }} + name: rocm-examples-build-${{ inputs.distro }}-${{ matrix.gpu_config.gpu_target }}-${{ steps.whl-multiarch-version.outputs.rocm_version || steps.install-tarball-multi-arch.outputs.rocm_version || steps.preinstalled.outputs.rocm_version }}-${{ matrix.install_method }} path: build/ - name: Upload Makefile build artifacts if: ${{ !cancelled() }} uses: actions/upload-artifact@v4 with: - name: makefile-build-${{ inputs.distro }}-${{ matrix.gpu_config.gpu_target }}-${{ steps.whl-multiarch-version.outputs.rocm_version || steps.install-tarball-multi-arch.outputs.rocm_version }}-${{ matrix.install_method }} + name: makefile-build-${{ inputs.distro }}-${{ matrix.gpu_config.gpu_target }}-${{ steps.whl-multiarch-version.outputs.rocm_version || steps.install-tarball-multi-arch.outputs.rocm_version || steps.preinstalled.outputs.rocm_version }}-${{ matrix.install_method }} path: /tmp/makefile_build/ - name: Run tests @@ -232,7 +248,7 @@ jobs: if: ${{ !cancelled() }} uses: actions/upload-artifact@v4 with: - name: ctest-logs-${{ inputs.distro }}-${{ matrix.gpu_config.gpu_target }}-${{ steps.whl-multiarch-version.outputs.rocm_version || steps.install-tarball-multi-arch.outputs.rocm_version }}-${{ matrix.install_method }} + name: ctest-logs-${{ inputs.distro }}-${{ matrix.gpu_config.gpu_target }}-${{ steps.whl-multiarch-version.outputs.rocm_version || steps.install-tarball-multi-arch.outputs.rocm_version || steps.preinstalled.outputs.rocm_version }}-${{ matrix.install_method }} path: build/Testing/Temporary/ - name: Makefile test @@ -244,7 +260,7 @@ jobs: if: ${{ !cancelled() }} uses: actions/upload-artifact@v4 with: - name: makefile-test-logs-${{ inputs.distro }}-${{ matrix.gpu_config.gpu_target }}-${{ steps.whl-multiarch-version.outputs.rocm_version || steps.install-tarball-multi-arch.outputs.rocm_version }}-${{ matrix.install_method }} + name: makefile-test-logs-${{ inputs.distro }}-${{ matrix.gpu_config.gpu_target }}-${{ steps.whl-multiarch-version.outputs.rocm_version || steps.install-tarball-multi-arch.outputs.rocm_version || steps.preinstalled.outputs.rocm_version }}-${{ matrix.install_method }} path: makefile_test_output.log - name: Clean the workspace diff --git a/.github/workflows/ci_nightly.yml b/.github/workflows/ci_nightly.yml index f6124d68f..c77b864f3 100644 --- a/.github/workflows/ci_nightly.yml +++ b/.github/workflows/ci_nightly.yml @@ -39,6 +39,7 @@ on: - ubuntu-26.04 - sles-15.7 - almalinux-8 + - stable_release permissions: contents: read packages: read diff --git a/Dockerfiles/ubuntu-24.04-rocm.Dockerfile b/Dockerfiles/ubuntu-24.04-rocm.Dockerfile index 5a172ad2d..74a365612 100644 --- a/Dockerfiles/ubuntu-24.04-rocm.Dockerfile +++ b/Dockerfiles/ubuntu-24.04-rocm.Dockerfile @@ -85,7 +85,12 @@ RUN echo "/opt/rocm/lib" >> /etc/ld.so.conf.d/rocm.conf \ ENV ROCM_PATH="/opt/rocm" # Python packages required by ROCm tooling -RUN python3 -m pip install --no-cache-dir --break-system-packages pyyaml +ENV VENV=/opt/rocm-venv +RUN python3 -m venv ${VENV} +ENV PATH="${VENV}/bin:${PATH}" + +RUN pip install --no-cache-dir --upgrade pip && \ + pip install --no-cache-dir pyyaml cmake WORKDIR /workspace CMD ["/bin/bash"]