/************************************************************************* * Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved. * * See LICENSE.txt for license information ************************************************************************/ #pragma once #include #include "comm.h" #include "dda_init_detail.h" namespace RcclUnitTesting { // Minimal ncclComm stand-in for DDA IPC eligibility unit tests. struct DdaIpcMockComm { ncclComm comm{}; char bootstrapPlaceholder{0}; DdaIpcMockComm() { reset(); } void reset() { std::memset(&comm, 0, sizeof(comm)); comm.bootstrap = &bootstrapPlaceholder; comm.nNodes = 1; comm.nRanks = nccl_dda_detail::kDdaNranks; comm.ddaScratchBytes = DDA_IPC_BUFFER_SIZE; setIpcResourcesPresent(true); } void setIpcResourcesPresent(bool present) { if (present) { comm.ddaIpcMemHandler = reinterpret_cast(0x1); comm.ddaScratch = reinterpret_cast(0x2); comm.ddaPeerPtrsDev = reinterpret_cast(0x3); comm.ddaIpcBarrierState = reinterpret_cast(0x4); } else { comm.ddaIpcMemHandler = nullptr; comm.ddaScratch = nullptr; comm.ddaPeerPtrsDev = nullptr; comm.ddaIpcBarrierState = nullptr; } } ncclComm* get() { return &comm; } }; } // namespace RcclUnitTesting