← Back to Pull requests

refactor: rewrite cmake depedency fetching #11869

Open
unknown opened this pull request with 473 lines diff across 5 files
View on GitHub
unknown unknown commented on Sep 09, 2026 14:06 UTC
Author

JIRA ID : EXSWSTRHPC-328

Motivation

The current set of CMake contain a lot of duplicated, stale, and bit-rotten code across the different primitive projects. This is one of many PRs to unify and modernize these files.

This PR tackles the dependency fetching.

Technical Details

Moved fetching of the following dependencies:
ROCmCMakeBuildTools: moved to shared/cmake/dependencies/rocm-cmake.cmake.
rocprim: moved to shared/cmake/dependencies/monorepo.cmake.
rocrand: moved to shared/cmake/dependencies/monorepo.cmake.
googletest: moved to shared/cmake/dependencies/googletest.cmake.
Fixed shadowing of ROCm CMake warnings.
Issue: Previously ROCm CMake toolchain warnings were disabled by wrapping rocm_check_toolchain_var.
However, re-importing ROCmCMakeBuildTools would overwrite this wrapper.
Fix: Manage the wrapping in rocm-cmake.cmake and guard against re-inclusion via include_guard(GLOBAL).
Fixed leaking of BUILD_ options to depedencies. Unify fix across project.
Issue: Some projects would leak important build options to the dependency.
This is an inherit issue of using FetchContent.
Issue: Some projects have fixes for some of the common cases, but certain options would still leak.
Fix: Add utilities to temporarily override variables in utils.cmake.
Both monorepo.cmake and googletest.cmake will ensure correct build settings of dependencies.
This also unifies the implementation across projects.
Fixed rocRAND creating a ROCm CMake package definition when it is not a top layer project.
Issue: When including rocRAND through the monorepo, rocRAND would still invoke rocm_create_package.
This causes ROCm CMake to be confused on what the actual target is and throw a bunch of warnings.
Fix: Use a similar mechanism as rocPRIM to disable the creation of a ROCm package if it is not a top level project.
Improved monorepo fetching behavior strictness.
Issue: the original fetching had a lot of fallbacks and it's unclear to the developer what it actually consumes.
This hinders reproducibility across different development and build environments.
Fix: By default it looks for system-provided packages.
If it is not found, throw an error and show possible fixes by e.g. swapping to the monorepo, or installing the package.
Removed all instances of DownloadProject.cmake. Using FetchContent is now the preferred way when fetching from the monorepo.
Issue: DownloadProject is bulky and no-longer the best way to handle dependencies.
Dependencies fetches through DownloadProject.cmake are also build
during configure, which causes very long configuration times for projects that depend on rocRAND.
Issue: Swapping to FetchContent causes variables to leak to the sub-projects.
Fix: Ensure variables are masked when utilizing FetchContent.
Removed mixed usage of REQUIRED-keyword when looking for GoogleTest.
Issue: Between Windows and Linux, find_package(GTest) had mixed usage of REQUIRED.
This diverging behavior can be confusing and has therefore been removed.
Fix: We removed the REQUIRED-keyword.
Investigated and clarified use of BUILD_SHARED_LIBS.
Generally this needs to be the same as the final compilation target.

This PR does not address hermetic build violations by the 3rd party dependencies. The PR is already quite large and falls outside the scope of. A follow-up PR addressing this can be expected.

Test Plan

CI pass.

Test Result

CI pass (hopefully).

Submission Checklist

  • Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
  • Diff: 473 lines (+354 / -119) across 5 files Reviewer: Naraenda Review duration: 119258m
    All Vouch review confidence checks passed
    Residual risk 0.29 = Change Risk (0.53) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.53 · 473 lines diff across 5 files
    0.53
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.369
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #11869"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52.7% (MEDIUM) · Higher = larger blast radius
    52.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 29.1% · Safe to merge
    29.1%