refactor: rewrite cmake depedency fetching #11869
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
Naraenda
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 toshared/cmake/dependencies/rocm-cmake.cmake.rocprim: moved toshared/cmake/dependencies/monorepo.cmake.rocrand: moved toshared/cmake/dependencies/monorepo.cmake.googletest: moved toshared/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
ROCmCMakeBuildToolswould overwrite this wrapper.Fix: Manage the wrapping in
rocm-cmake.cmakeand guard against re-inclusion viainclude_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.cmakeandgoogletest.cmakewill 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. UsingFetchContentis 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.cmakeare also build during configure, which causes very long configuration times for projects that depend on rocRAND.Issue: Swapping to
FetchContentcauses 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 ofREQUIRED.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