Skip to content

Resolve third-party dependencies from the build environment - #12331

Draft
BrianHarrisonAMD wants to merge 7 commits into
developfrom
users/bharriso/samples-gtest-find-package
Draft

BrianHarrisonAMD wants to merge 7 commits into
developfrom
users/bharriso/samples-gtest-find-package

Conversation

@BrianHarrisonAMD

@BrianHarrisonAMD BrianHarrisonAMD commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

hipDNN and the dnn-providers fell back to FetchContent whenever a find_package missed. TheRock owns third-party acquisition and prescribes find_package: https://github.com/ROCm/TheRock/blob/main/docs/development/dependencies.md

Fetching is now opt-in through ALLOW_FETCH_DEPS, default OFF. A miss fails configuration naming the package and the remedy.

Risk Assessment

Risk level 3. Build system only. Changes dependency resolution for hipDNN, all three providers and the samples, and alters a default: a standalone configure against an incomplete prefix now fails where it downloaded. The superbuild sets ALLOW_FETCH_DEPS=ON, so the documented developer flow is unchanged.

Related

Technical Changes

projects/hipdnn/cmake/Dependencies.cmake, dnn-providers/cmake/Dependencies.cmake, root CMakeLists.txt

  • ALLOW_FETCH_DEPS replaces HIPDNN_NO_DOWNLOAD, which was inverted: enabling it forced FETCHCONTENT_FULLY_DISCONNECTED off. Shared with dnn-providers, which had no such option.
  • FETCHCONTENT_FULLY_DISCONNECTED stays as a backstop, set as a normal variable so it does not reach sibling subprojects that run their own FetchContent.
  • HIPDNN_NO_DOWNLOAD works for one more release. Only a truthy value counts: the previous release declared it with option(), so every existing build tree caches it as OFF.

projects/hipdnn/samples/CMakeLists.txt, .../example_engine_plugin/tests/CMakeLists.txt

  • Tests try find_package(GTest CONFIG) first; the independent v1.14.0 pin becomes a cache variable fed from HIPDNN_GTEST_VERSION.
  • samples forwards the resolved location through the ExternalProject_Add cache arguments. Stubs under CMAKE_FIND_PACKAGE_REDIRECTS_DIR are excluded — they name in-tree targets the plugin's separate build lacks.
  • With no forwardable package, the already-populated GoogleTest source tree is passed as FETCHCONTENT_SOURCE_DIR_GOOGLETEST. Both entries are cleared with -U, as nlohmann_json_DIR already is.

dnn-providers/hip-kernel-provider/descriptor-packaging/cmake/HkpPackaging.cmake

  • The rocke wheel venv inherits msgpack/zstandard from Python3_EXECUTABLE through a seeded .pth instead of installing them from an index. --system-site-packages inherits from sys.base_prefix, not the invoking interpreter, and the superbuild's interpreter is a venv.
  • The venv still owns the rocke wheels; its site-packages precedes the seeded paths.
  • hkp_require_kpack_runtime() runs against Python3_EXECUTABLE at configure time; it previously ran only against the venv python, which does not exist until the build.

Device / Architecture Coverage

No device-specific code. Passing PR CI is sufficient.

Testing Checklist

  • Superbuild — hipdnn;hipdnn-integration-tests;miopen-provider;hipblaslt-provider;hip-kernel-provider;hipdnn-samples, ingestor and rocKE on — Status: Passed, zero fetches during the build, all providers report Found system GTest
  • Unit suites — 12126 tests across hipDNN, the three providers and the plugin — Devices: gfx90a — Status: Passed
  • No-network build — unshare -rn cmake --build ... -- -k 0 over hipdnn, samples and hip-kernel-provider including ingestor packing — Status: Passed, 0 failing edges
  • Option matrix — warm tree with the old cache entry, fresh tree, ALLOW_FETCH_DEPS=ON/OFF, HIPDNN_NO_DOWNLOAD=ON/OFF — Status: Passed
  • Fail-closed — standalone configure without spdlog — Status: Passed, error names spdlog and ALLOW_FETCH_DEPS
  • PR CI — Status: Pending

Flags / Guardrails

ALLOW_FETCH_DEPS, default OFF. The superbuild sets it ON without FORCE, so an explicit OFF wins. Per-dependency opt-ins such as HIPKERNELPROVIDER_KPACK_ALLOW_FETCH are unaffected.

Known Limitations

  • In the superbuild the plugin cannot resolve GoogleTest as a package: the root declares it with OVERRIDE_FIND_PACKAGE, pinning GTest_DIR to the redirect stub. The source-tree hand-off covers that path.
  • Forwarding ALLOW_FETCH_DEPS into the plugin sub-build is not included; it requires Add therock-googletest to hipDNN_samples build deps TheRock#8345 first.
  • Three GoogleTest pins remain: HIPDNN_GTEST_VERSION 1.16.0, a literal in dnn-providers/cmake/Dependencies.cmake 1.16.0, and the superbuild root 1.17.0. This removes the plugin's fourth.
  • rocke-pyenv still installs from PyPI during the build. rocKE-owned, tracked separately.

@therock-pr-bot

therock-pr-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass
Forbidden Files ✅ Pass
🧪 Unit Test ✅ Pass
🔎 pre-commit ✅ Pass
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled
🤖 therock-pr-bot ✅ Pass

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

TheRock owns third-party dependency acquisition and prescribes
find_package as the way a sub-project depends on one. hipDNN and the
dnn-providers instead fell back to FetchContent whenever a lookup missed,
and the example engine plugin's tests fetched GoogleTest unconditionally.

ALLOW_FETCH_DEPS replaces HIPDNN_NO_DOWNLOAD and defaults OFF. The old
option was inverted -- enabling it forced FETCHCONTENT_FULLY_DISCONNECTED
off -- so the only switch for suppressing downloads did nothing. The new
option is shared with dnn-providers, which had none, and a miss now fails
configuration naming the package and the remedy. The superbuild sets it
ON: it mirrors a developer environment and already supplies dependencies
by fetching them. HIPDNN_NO_DOWNLOAD works for one more release; only a
truthy value counts, because the previous release declared it with
option() and every existing build tree caches it as OFF.

The plugin tests try find_package(GTest CONFIG) before fetching, and
samples forwards what it resolved through the ExternalProject_Add cache
arguments, which is otherwise an isolation boundary no package resolution
crosses. Stubs under CMAKE_FIND_PACKAGE_REDIRECTS_DIR are not forwarded;
they name in-tree targets the plugin's separate build does not have. When
no package is forwardable but FetchContent has already populated
GoogleTest, its source tree is handed over instead, so the plugin adopts
it rather than downloading a second copy. The plugin's independent
v1.14.0 pin becomes a cache variable fed from HIPDNN_GTEST_VERSION.

The rocke wheel venv inherits rocm_kpack's runtime dependencies from
Python3_EXECUTABLE through a seeded .pth rather than installing msgpack
and zstandard from an index. --system-site-packages cannot express this:
venv inherits from sys.base_prefix, not from the invoking interpreter,
and the superbuild's interpreter is itself a venv.

Verified: the superbuild builds hipdnn, the integration tests, all three
providers and the samples with no fetch during the build, 12126 unit
tests pass, and hipdnn, samples and hip-kernel-provider build inside a
network namespace with no interfaces and no failing edges.

Refs #12302. Requires ROCm/TheRock#8345 for the TheRock path.
@BrianHarrisonAMD
BrianHarrisonAMD force-pushed the users/bharriso/samples-gtest-find-package branch from b103c3c to 07dc5f8 Compare September 19, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant