Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
714eb9d
test(rccl): add host microtests for src/mem_manager.cc
aduforest Oct 15, 2026
7503cfa
test(rccl): add host microtests for src/allocator.cc
aduforest Oct 15, 2026
f34ce04
test(rccl): add host microtests for src/mnnvl.cc
aduforest Oct 15, 2026
1937c8c
test(rccl): add host microtests for src/include/alloc.h
aduforest Oct 15, 2026
747d800
test(rccl): order the memory-management microtest registrations
aduforest Oct 15, 2026
048038c
test(rccl): expect the uncached VMM type when the build enables it
aduforest Oct 15, 2026
5e3c90a
test(rccl): use the FABRIC names hipify leaves in the build
aduforest Oct 16, 2026
650b9d3
test(rccl): build the alloc.h microtests against ROCm 7.0 HIP headers
aduforest Oct 16, 2026
02a7531
test(rccl): address review notes on the memory manager and allocator …
aduforest Oct 16, 2026
1a9e913
Merge origin/develop into users/aduforest/aicomrccl-2798-memory-host-…
aduforest Oct 16, 2026
b4c9858
test(rccl): name memory pins KnownBug_, pin the SIGSEGV, own-binary r…
aduforest Oct 16, 2026
c6f58d9
test(rccl): ASan-safe SEGV pin and nothrow operator new in memory mic…
aduforest Oct 16, 2026
562b5fc
Merge remote-tracking branch 'origin/develop' into users/aduforest/ai…
aduforest Oct 19, 2026
1dc0326
test(rccl): share one fakes file across the memory binaries
aduforest Oct 19, 2026
4f8b79f
Merge remote-tracking branch 'origin/develop' into users/aduforest/ai…
aduforest Oct 19, 2026
dbaf67a
Merge remote-tracking branch 'origin/develop' into users/aduforest/ai…
aduforest Oct 20, 2026
dd47cb0
Merge remote-tracking branch 'origin/develop' into users/aduforest/ai…
aduforest Oct 20, 2026
39e3c21
test(rccl): tighten memory microtests per review
aduforest Oct 20, 2026
a44dd14
Merge remote-tracking branch 'origin/develop' into users/aduforest/ai…
aduforest Oct 20, 2026
3f3f168
test(rccl): host-only suites declare num_gpus 0
aduforest Oct 21, 2026
8071440
Merge remote-tracking branch 'origin/develop' into users/aduforest/ai…
aduforest Oct 21, 2026
f501f1a
test(rccl): move memory microtest fakes into the shared fakes per review
aduforest Oct 22, 2026
2c3a897
test(rccl): isolate the skip-free env and harden the shadow-pool pin …
aduforest Oct 22, 2026
3345ba7
Merge remote-tracking branch 'origin/develop' into users/aduforest/ai…
aduforest Oct 22, 2026
a09e18e
Merge remote-tracking branch 'origin/develop' into users/aduforest/ai…
aduforest Oct 22, 2026
240f21a
test(rccl): drop KnownBug pins for bugs closed as won't-do
aduforest Oct 22, 2026
2be9169
Merge remote-tracking branch 'origin/develop' into users/aduforest/ai…
aduforest Oct 23, 2026
114840c
Merge remote-tracking branch 'origin/develop' into users/aduforest/ai…
aduforest Oct 24, 2026
a65578a
test(rccl): reset ncclCuMemHandleType in ResetNcclFakes and drop the …
aduforest Oct 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions projects/rccl/test/host/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ rccl_assert_source_line("${_rccl_src_root}/graph/connect.cc"
"NCCL_PARAM(MaxNchannels, \"MAX_NCHANNELS\", -2)" "fakes/tuning_fakes.cc: ncclParamMaxNchannels()")
rccl_assert_source_line("${_rccl_src_root}/enqueue/enqueue.cc"
"RCCL_PARAM(ForceCe, \"FORCE_CE\", 1)" "fakes/wrap_fakes.cc: rcclParamForceCe()")
# allocator-test.cc copies misc/utils.cc's pointer hash rather than linking utils.cc.
rccl_assert_source_line("${_rccl_src_root}/misc/utils.cc"
"uintptr_t h = reinterpret_cast<uintptr_t>(key);" "allocator-test.cc: ncclHashPointer()")
rccl_assert_source_line("${_rccl_src_root}/misc/utils.cc"
"h ^= h >> 32;" "allocator-test.cc: ncclHashPointer()")
rccl_assert_source_line("${_rccl_src_root}/misc/utils.cc"
"h *= 0x9e3779b97f4a7c13;" "allocator-test.cc: ncclHashPointer()")
rccl_assert_source_line("${_rccl_src_root}/misc/utils.cc"
"return (uint64_t)h >> (64 - hbits);" "allocator-test.cc: ncclHashPointer()")
# src/enqueue/task_prep/*.cc declare these five but define none, and param_redirect.h only rewrites
# NCCL_PARAM where it expands, so the hand-written bodies below are the only definitions on that link line.
rccl_assert_source_line("${_rccl_src_root}/init.cc"
Expand Down Expand Up @@ -421,6 +430,47 @@ function(rccl_define_micro_source_lists)
../common/main_altrsmi.cpp
PARENT_SCOPE)

# rccl-UnitTestsMicroMemManager -- src/mem_manager.cc. Own binary: mem_manager.cc defines ncclMemTrack and
# ncclMemTrackImportFromPeer (also in nccl_fakes.cc) and ncclCommMemSuspend (also in collective_stubs.cc).
set(TEST_MICRO_MEM_MANAGER_SOURCE_FILES
mem-manager-test.cc
fakes/mem_manager_micro_fakes.cc
fakes/bootstrap_stubs.cc
fakes/hip_fakes.cc
../common/main_altrsmi.cpp
PARENT_SCOPE)

# rccl-UnitTestsMicroAllocator -- src/allocator.cc. Own binary: every other binary that needs
# ncclShadowPoolToHost links allocator_fakes.cc instead.
set(TEST_MICRO_ALLOCATOR_SOURCE_FILES
allocator-test.cc
fakes/hip_fakes.cc
fakes/nccl_fakes.cc
fakes/rocmwrap_fakes.cc
../common/main_altrsmi.cpp
PARENT_SCOPE)

# rccl-UnitTestsMicroMnnvl -- src/mnnvl.cc. Own binary: nccl_stubs.cc, which most targets link, defines
# ncclMnnvlCheck, and mnnvl.cc defines it too.
set(TEST_MICRO_MNNVL_SOURCE_FILES
mnnvl-test.cc
fakes/hip_fakes.cc
fakes/nccl_fakes.cc
fakes/utils_fakes.cc
../common/main_altrsmi.cpp
PARENT_SCOPE)

# rccl-UnitTestsMicroAlloc -- src/include/alloc.h. Own binary: alloc.h's inline side-stream map and
# shutdown and skip-free state would be shared with every other unit in rccl-UnitTestsMicro.
set(TEST_MICRO_ALLOC_SOURCE_FILES
alloc-test.cc
fakes/hip_fakes.cc
fakes/nccl_fakes.cc
fakes/os_fakes.cc
fakes/utils_fakes.cc
../common/main_altrsmi.cpp
PARENT_SCOPE)

# rccl-UnitTestsMicroSymKernels -- REAL src/sym_kernels.cc + generated host TU,
# plus the REAL symmetric cost model (src/tuning/sym_model.cc, src/tuning/sym_model/*.cc).
set(TEST_MICRO_SYM_KERNELS_SOURCE_FILES
Expand Down Expand Up @@ -1440,6 +1490,45 @@ rccl_add_micro_binary(rccl-UnitTestsMicroConnect
CONNECT_CC_PATH="${RCCL_HOST_HIPIFY_DIR}/src/graph/connect.cc"
CATEGORIES_YAML "${CMAKE_CURRENT_SOURCE_DIR}/../test_categories_micro_connect.yaml")

# ---------------------------------------------------------------------------
# rccl-UnitTestsMicroMemManager
# ---------------------------------------------------------------------------
rccl_add_micro_binary(rccl-UnitTestsMicroMemManager
SOURCES ${TEST_MICRO_MEM_MANAGER_SOURCE_FILES}
EXTRA_DEFS
${_MICRO_MODE_DEFS}
MEM_MANAGER_CC_PATH="${RCCL_HOST_HIPIFY_DIR}/src/mem_manager.cc"
CATEGORIES_YAML "${CMAKE_CURRENT_SOURCE_DIR}/../test_categories_micro_mem_manager.yaml")

# ---------------------------------------------------------------------------
# rccl-UnitTestsMicroAllocator
# ---------------------------------------------------------------------------
rccl_add_micro_binary(rccl-UnitTestsMicroAllocator
SOURCES ${TEST_MICRO_ALLOCATOR_SOURCE_FILES}
EXTRA_DEFS
${_MICRO_MODE_DEFS}
ALLOCATOR_CC_PATH="${RCCL_HOST_HIPIFY_DIR}/src/allocator.cc"
CATEGORIES_YAML "${CMAKE_CURRENT_SOURCE_DIR}/../test_categories_micro_allocator.yaml")

# ---------------------------------------------------------------------------
# rccl-UnitTestsMicroMnnvl
# ---------------------------------------------------------------------------
rccl_add_micro_binary(rccl-UnitTestsMicroMnnvl
SOURCES ${TEST_MICRO_MNNVL_SOURCE_FILES}
EXTRA_DEFS
${_MICRO_MODE_DEFS}
MNNVL_CC_PATH="${RCCL_HOST_HIPIFY_DIR}/src/mnnvl.cc"
CATEGORIES_YAML "${CMAKE_CURRENT_SOURCE_DIR}/../test_categories_micro_mnnvl.yaml")

# ---------------------------------------------------------------------------
# rccl-UnitTestsMicroAlloc
# ---------------------------------------------------------------------------
rccl_add_micro_binary(rccl-UnitTestsMicroAlloc
SOURCES ${TEST_MICRO_ALLOC_SOURCE_FILES}
EXTRA_DEFS
${_MICRO_MODE_DEFS}
CATEGORIES_YAML "${CMAKE_CURRENT_SOURCE_DIR}/../test_categories_micro_alloc.yaml")

# ---------------------------------------------------------------------------
# rccl-UnitTestsMicroEnqueue (+ shipping -devlinker arm standalone)
# ---------------------------------------------------------------------------
Expand Down
21 changes: 21 additions & 0 deletions projects/rccl/test/host/MICROTEST_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,22 @@ export colliding non-`static` symbols; otherwise a unit needs its own binary:
without pulling in that file's dependency floor. See
`test_categories_micro_scheduler.yaml`.

- **`rccl-UnitTestsMicroMemManager`** — `mem_manager.cc` (via `MEM_MANAGER_CC_PATH`, from
`mem-manager-test.cc`); suite `MemManager*`. Its own binary: `nccl_fakes.cc` defines
`ncclMemTrack` and `ncclMemTrackImportFromPeer`, and `collective_stubs.cc` defines
`ncclCommMemSuspend`; `mem_manager.cc` defines all three. Its other externals are in
`fakes/mem_manager_micro_fakes.cc`. See `test_categories_micro_mem_manager.yaml`.
- **`rccl-UnitTestsMicroAllocator`** — `allocator.cc` (via `ALLOCATOR_CC_PATH`, from
`allocator-test.cc`); suite `Allocator*`. Its own binary because every other binary that
needs `ncclShadowPoolToHost` links `fakes/allocator_fakes.cc` instead. See
`test_categories_micro_allocator.yaml`.
- **`rccl-UnitTestsMicroMnnvl`** — `mnnvl.cc` (via `MNNVL_CC_PATH`, from `mnnvl-test.cc`);
suite `Mnnvl*`. Its own binary: `nccl_stubs.cc`, which most targets link, defines
`ncclMnnvlCheck`, and `mnnvl.cc` defines it too. See `test_categories_micro_mnnvl.yaml`.
- **`rccl-UnitTestsMicroAlloc`** — header-only `include/alloc.h` (from `alloc-test.cc`); suite
`Alloc*`. Its own binary: `alloc.h`'s inline side-stream map and shutdown and skip-free state
would be shared with every other unit in `rccl-UnitTestsMicro`. See
`test_categories_micro_alloc.yaml`.
- **`rccl-UnitTestsMicroTaskPrep`** — `src/enqueue/task_prep/task_prep.cc` (via
`TASK_PREP_CC_PATH`, suite `TaskPrepMicrotest.*`),
`src/enqueue/task_prep/task_classify.cc` (via `TASK_CLASSIFY_CC_PATH`, suite
Expand Down Expand Up @@ -605,6 +621,7 @@ symbol.
| `src/init.cc` comm lifecycle + CTA/channel params | `fakes/comm_fakes.cc` |
| `src/init_nvtx.cc` | `fakes/init_nvtx_fakes.cc` |
| `src/mem_manager.cc` | `fakes/mem_manager_fakes.cc`; `ncclMemTrack*` / `ncclMemUntrack*` in `fakes/nccl_fakes.cc` |
| externals `src/mem_manager.cc` reaches (`rccl-UnitTestsMicroMemManager`, which compiles it) | `fakes/mem_manager_micro_fakes.cc` |
| `src/misc/amdsmi_wrap.cc` | `fakes/amdsmi_fakes.cc` |
| `src/misc/api_trace.cc` (`NCCL_API` dispatch) | `fakes/api_trace_fakes.cc` |
| `src/misc/ibvwrap.cc` (PD / MR registration wrappers) | `fakes/ibvwrap_fakes.cc` |
Expand Down Expand Up @@ -1024,6 +1041,10 @@ cmake --build build -j"$(nproc)"
./build/rccl-UnitTestsMicroConnect # src/graph/connect.cc Preset/Postset tests
./build/rccl-UnitTestsMicroDiagnostics # src/diagnostics.cc + src/diagnostics/ tests
./build/rccl-UnitTestsMicroGraph # src/graph/{xml,topo,paths,search,rome_models}.cc tests
./build/rccl-UnitTestsMicroMemManager # src/mem_manager.cc tests
./build/rccl-UnitTestsMicroAllocator # src/allocator.cc tests
./build/rccl-UnitTestsMicroMnnvl # src/mnnvl.cc tests
./build/rccl-UnitTestsMicroAlloc # src/include/alloc.h tests
./build/rccl-UnitTestsMicroTopo # src/graph/*.cc tests
./build/rccl-UnitTestsMicroGinHost # src/gin/gin_host.cc GIN_PROXY_NTHREADS
./build/rccl-UnitTestsMicroGinHostFinalize # src/gin/gin_host.cc host finalize
Expand Down
45 changes: 45 additions & 0 deletions projects/rccl/test/host/WatchedDelete.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*************************************************************************
* Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
*
* See LICENSE.txt for license information
************************************************************************/

// Replaces every operator new/delete form with malloc/free, the matched pair ASan expects, and counts deletes
// of one watched pointer. Include it from one TU per binary, below any #undef of malloc/free.

#ifndef RCCL_TEST_HOST_WATCHEDDELETE_H_
#define RCCL_TEST_HOST_WATCHEDDELETE_H_

#include <cstddef>
#include <cstdlib>
#include <new>

static const void* g_deleteWatchPtr = nullptr;
static int g_deleteWatchHits = 0;
// Leaves the watched block allocated, so a second delete of it is counted rather than a double free.
static bool g_deleteWatchKeeps = false;

static void MicroOperatorDelete(void* p) noexcept {
if (p != nullptr && p == g_deleteWatchPtr) {
++g_deleteWatchHits;
if (g_deleteWatchKeeps) return;
}
std::free(p);
}
// Replaced as a matched pair and in every form: `delete p` emits the SIZED overload, so void* alone counts nothing.
void* operator new(std::size_t n) {
void* p = std::malloc(n != 0 ? n : 1);
if (p == nullptr) throw std::bad_alloc();
return p;
}
void* operator new[](std::size_t n) { return ::operator new(n); }
void* operator new(std::size_t n, const std::nothrow_t&) noexcept { return std::malloc(n != 0 ? n : 1); }
void* operator new[](std::size_t n, const std::nothrow_t&) noexcept { return std::malloc(n != 0 ? n : 1); }
void operator delete(void* p) noexcept { MicroOperatorDelete(p); }
void operator delete[](void* p) noexcept { MicroOperatorDelete(p); }
void operator delete(void* p, std::size_t) noexcept { MicroOperatorDelete(p); }
void operator delete[](void* p, std::size_t) noexcept { MicroOperatorDelete(p); }
void operator delete(void* p, const std::nothrow_t&) noexcept { MicroOperatorDelete(p); }
void operator delete[](void* p, const std::nothrow_t&) noexcept { MicroOperatorDelete(p); }

#endif // RCCL_TEST_HOST_WATCHEDDELETE_H_
Loading
Loading