test(rccl): consolidate host-only microtest framework into test/host - #9817
Open
pvallem wants to merge 9 commits into
Open
test(rccl): consolidate host-only microtest framework into test/host#9817pvallem wants to merge 9 commits into
pvallem wants to merge 9 commits into
Conversation
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
Move the host-only microtest framework from test/microtest into test/host, where the merged rccl-HostUnitTests suite (PR #9320) already lives. Both are no-GPU, hipcc --offload-host-only suites, so they now share one home and one build entry point. The microtest framework being relocated (p2p-test.cc, fakes/, the in-build and standalone CMake, README, coverage.sh) was originally authored by Matt Hughes on users/mahughes/unit-test-ideas. This commit relocates that work into test/host and merges the two build models. - test/host/CMakeLists.txt is now dual-mode: under BUILD_TESTS (./install.sh -t, via add_subdirectory(host)) it builds only the in-RCCL-build rccl-UnitTestsMicro target and returns; invoked standalone (cmake -B build) it builds rccl-HostUnitTests + rccl-UnitTestsMicro from a hipified snapshot. The microtest/standalone build is folded in (no separate standalone/ dir). - test/CMakeLists.txt gains MICRO_TEST_LINK_LIBS (COMPILE_ONLY hip, no HIP runtime at link) and add_subdirectory(host). - Coverage: in-build -Xarch_device flags use the "SHELL:" prefix so CMake does not de-dup the repeated -Xarch_device and drop host __llvm_covmap. - fakes headers converted from #pragma once to RCCL_TEST_HOST_*_H_ guards (house style); keeping the fakes/ subdir also pre-empts the future init_stubs.cpp vs fakes/init_stubs.cc name collision from #9783. JIRA ID: AICOMRCCL-1661 Co-Authored-By: Matt Hughes <matt.hughes@amd.com>
pvallem
force-pushed
the
users/pvallem/consolidate-host-tests
branch
from
August 7, 2026 03:09
d127254 to
f89d541
Compare
added 4 commits
August 7, 2026 04:39
… coverage.sh Follow-up to the microtest consolidation, addressing review feedback: - Register rccl-UnitTestsMicro with CTest via RCCL's shared category mechanism (apply_test_category_labels + new test/test_categories_micro.yaml), matching how rccl-UnitTests/Fixtures register — the in-build target was installed but never add_test()-registered, so ctest never ran it. Standalone build keeps the #9320 direct-invocation model (documented), no bare add_test. - Replace $<COMPILE_ONLY:hip::host/device> (needs CMake 3.27) with $<TARGET_PROPERTY:hip::*,INTERFACE_INCLUDE_DIRECTORIES/COMPILE_OPTIONS/ COMPILE_DEFINITIONS>, valid at the declared minimum (3.16); still no HIP runtime on the link line. - coverage.sh: parse --html/FUNC before invoking the binary and forward only post-`--` args to gtest (previously --html leaked into the test command); fix the source scope from the non-existent p2p.cc to the compiled unit p2p_tmp.cc (llvm-cov was silently falling back to whole-binary totals); correct the coverage-option docs (MICRO_COVERAGE / in-build unconditional, drop the nonexistent ENABLE_MICROTEST_COVERAGE). - MICROTEST_README.md: replace the "Adding a new test" placeholder with a real section; drop trailing whitespace. JIRA ID: AICOMRCCL-1661
…ctly The coverage.sh convenience wrapper is not used by the build, CI, or CTest and only worked where llvm-cov is present (not on OCI). Remove it and document the equivalent ROCm llvm-cov / llvm-profdata invocations in MICROTEST_README.md, including the OCI (generate profraw) -> host (render) flow and the correct p2p_tmp.cc scoping. Update the p2p-test.cc comment that referenced it. JIRA ID: AICOMRCCL-1661
The microtest framework is an example/pattern for writing host-only tests; avoid citing specific coverage percentages. JIRA ID: AICOMRCCL-1661
- Correct the run example filter to the real test name P2pMicrotest.IpcRegisterBuffer_NullRegRecordIsNoOp (the old IpcRegisterBuffer.NullRegRecordIsNoOp matched zero tests). - Scope the cuMem*/hipMem* dependency advice to the two test models: runtime-linked RCCL targets get hip::host via RCCL_COMMON_LINK_LIBS, whereas rccl-UnitTestsMicro deliberately excludes the HIP runtime and needs a fake/seam instead. Add a warning about link deps not carrying over when moving a test into this hermetic target. JIRA ID: AICOMRCCL-1661
mch
requested changes
Aug 7, 2026
mch
left a comment
Contributor
There was a problem hiding this comment.
I think it would be good to delete a lot of slop comments otherwise we'll get buried in them over time. One area of duplication related to signature drift detection that should be addressed.
… trim comments
Addresses mch's review on the microtest fakes:
- Extract the signature-drift watchdog (FnSigOf/HookMatchesProd templates +
ASSERT_HOOK_MATCHES_PROD macro) into fakes/signature-drift.h; nccl_fakes.cc
and p2p_fakes.cc now include it and keep only their per-file assertions
(removes the duplicated templates/macro).
- Fold micro_link_stubs.cc into hip_fakes.cc (Section 2) and drop the separate
file; neither host binary links the HIP runtime, so the stubs live in one
place. Standalone target no longer lists micro_link_stubs.cc.
- Trim verbose comments across hip_fakes.{cc,h}, nccl_fakes.{cc,h},
p2p_fakes.{cc,h} and the README.
Binaries intentionally kept separate for now (combining rccl-UnitTestsMicro
into rccl-HostUnitTests is a larger change to evaluate separately).
Verified: standalone test/host build on WSL (ROCm 7.2.4) — rccl-HostUnitTests
275/275, rccl-UnitTestsMicro 30/30, ldd clean (links without micro_link_stubs.cc).
JIRA ID: AICOMRCCL-1661
mch
approved these changes
Aug 7, 2026
Co-authored-by: Matt Hughes <matt.hughes@amd.com>
Co-authored-by: Matt Hughes <matt.hughes@amd.com>
Co-authored-by: Matt Hughes <matt.hughes@amd.com>
This was referenced Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Consolidate the host-only microtest framework from
projects/rccl/test/microtest/intoprojects/rccl/test/host/, co-locating it with therccl-HostUnitTestssuite added in #9320.Both are no-GPU,
hipcc --offload-host-onlysuites that link neitherlibrccl.sonor the HIPruntime.
This framework is an example / pattern for writing fast host-only microtests: the test TU
#includes the production.ccunder test directly (via a*_CC_PATHmacro) and satisfies everyexternal HIP /
nccl*symbol fromfakes/, sostatichelpers and individual failure branchesbecome reachable with no GPU and no library link.
p2p-test.cc(exercisingipcRegisterBuffer) is the worked example;MICROTEST_README.mddocuments how to add more.The framework was originally authored by Matt Hughes (matt.hughes@amd.com) on
origin/users/mahughes/unit-test-ideas, and he is credited as co-author. This PR relocates it ontodevelopand merges the twoCMakeLists.txtinto one.What moved (
test/microtest/→test/host/)p2p-test.cc,fakes/{hip,nccl,p2p}_fakes.{cc,h}standalone/micro_link_stubs.cc→test/host/micro_link_stubs.cc(thestandalone/subdir isfolded in, not kept separate — same host-only build model)
README.md→test/host/MICROTEST_README.md(withstandalone/README.mdfolded in)test/common/and are only referenced, not moved(
main_altrsmi.cpp,ProcessIsolatedTestRunner.cpp).Merged build model
test/host/CMakeLists.txtis dual-mode:./install.sh -t, viaadd_subdirectory(host)underBUILD_TESTS): buildsrccl-UnitTestsMicroand registers it with CTest through RCCL's shared category mechanism(
apply_test_category_labels+ newtest/test_categories_micro.yaml), the same path used byrccl-UnitTests/rccl-UnitTestsFixtures.cmake -B build -DRCCL_BUILD_DIR=<hipified snapshot>): buildsrccl-HostUnitTests+rccl-UnitTestsMicrofrom a hipified snapshot; run the binaries directly.HIP's compile requirements are applied without linking the HIP runtime via
$<TARGET_PROPERTY:hip::*,INTERFACE_INCLUDE_DIRECTORIES/COMPILE_OPTIONS/COMPILE_DEFINITIONS>(valid at the declared CMake minimum, 3.16), so any un-shimmed HIP call surfaces as a link error.
Header guards
fakes headers converted from
#pragma onceto explicit#ifndefguards (house style):RCCL_TEST_HOST_HIP_FAKES_H_,RCCL_TEST_HOST_NCCL_FAKES_H_,RCCL_TEST_HOST_P2P_FAKES_H_.Coverage
rccl-UnitTestsMicrobuilds instrumented (llvm source-based coverage). There is no bespokewrapper script;
MICROTEST_README.mddocuments rendering a report with ROCmllvm-covscoped tothe compiled unit (
p2p_tmp.cc), including the OCI (generate profraw) → host (render) flow.The host-only unit-test CI workflow is added separately in #9742.
Coordination with other PRs
unit-test-ideas) will rebase onto thesetest/hostpaths; keeping the
fakes/subdir pre-empts thetest/host/init_stubs.cpp(feature(rccl): AICOMRCCL-1669 rccl-HostUnitTests — CPU-only test binary #9320) vsfakes/init_stubs.cc(test(rccl): host-only unit tests for src/init.cc (AICOMRCCL-1685) #9783) name collision by path.test/hoststandalone on every PR touchingprojects/rccl/**; once it lands, that workflow also compilesrccl-UnitTestsMicro.Test Result
rccl-HostUnitTests275/275 andrccl-UnitTestsMicro30/30 pass;lddshows no rccl / HIP / HSA../install.sh --debug -tbuilds clean;ctest -Nlists the
rccl-UnitTestsMicro_*category suites andctest -R Micropasses; direct run 30/30,lddclean.JIRA ID: AICOMRCCL-1661