Skip to content

Commit 72b87d9

Browse files
committed
add doc string
1 parent 6d18f7b commit 72b87d9

3 files changed

Lines changed: 49 additions & 11 deletions

File tree

include/mscclpp/proxy_channel.hpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,24 @@ struct ProxyChannel {
207207
put(dst, offset, src, offset, size);
208208
}
209209

210+
/// @brief Push a @ref TriggerData to the FIFO.
211+
/// @param dst The destination memory region.
212+
/// @param dstOffset The offset into the destination memory region.
213+
/// @param src The source memory region.
214+
/// @param srcOffset The offset into the source memory region.
215+
/// @param width The width of the 2D region.
216+
/// @param height The height of the 2D region.
210217
__forceinline__ __device__ void put2D(MemoryId dst, uint64_t dstOffset, MemoryId src, uint64_t srcOffset,
211218
uint32_t width, uint32_t height) {
212219
fifo_.push(ChannelTrigger(TriggerData, dst, dstOffset, src, srcOffset, width, height, semaphoreId_).value);
213220
}
214221

222+
/// @brief Push a @ref TriggerData to the FIFO.
223+
/// @param dst The destination memory region.
224+
/// @param src The source memory region.
225+
/// @param offset The common offset into the destination and source memory regions.
226+
/// @param width The width of the 2D region.
227+
/// @param height The height of the 2D region.
215228
__forceinline__ __device__ void put2D(MemoryId dst, MemoryId src, uint64_t offset, uint32_t width, uint32_t height) {
216229
put2D(dst, offset, src, offset, width, height);
217230
}
@@ -232,6 +245,13 @@ struct ProxyChannel {
232245
fifo_.push(ChannelTrigger(TriggerData | TriggerFlag, dst, dstOffset, src, srcOffset, size, semaphoreId_).value);
233246
}
234247

248+
/// Push a @ref TriggerData and a @ref TriggerFlag at the same time to the FIFO.
249+
/// @param dst The destination memory region.
250+
/// @param dstOffset The offset into the destination memory region.
251+
/// @param src The source memory region.
252+
/// @param srcOffset The offset into the source memory region.
253+
/// @param width The width of the 2D region.
254+
/// @param height The height of the 2D region.
235255
__forceinline__ __device__ void put2DWithSignal(MemoryId dst, uint64_t dstOffset, MemoryId src, uint64_t srcOffset,
236256
uint32_t width, uint32_t height) {
237257
fifo_.push(
@@ -247,6 +267,12 @@ struct ProxyChannel {
247267
putWithSignal(dst, offset, src, offset, size);
248268
}
249269

270+
/// Push a @ref TriggerData and a @ref TriggerFlag at the same time to the FIFO.
271+
/// @param dst The destination memory region.
272+
/// @param src The source memory region.
273+
/// @param offset The common offset into the destination and source memory regions.
274+
/// @param width The width of the 2D region.
275+
/// @param height The height of the 2D region.
250276
__forceinline__ __device__ void put2DWithSignal(MemoryId dst, MemoryId src, uint64_t offset, uint32_t width,
251277
uint32_t height) {
252278
put2DWithSignal(dst, offset, src, offset, width, height);
@@ -328,6 +354,11 @@ struct SimpleProxyChannel {
328354
proxyChan_.put(dst_, dstOffset, src_, srcOffset, size);
329355
}
330356

357+
/// Push a @ref TriggerData to the FIFO.
358+
/// @param dstOffset The offset into the destination memory region.
359+
/// @param srcOffset The offset into the source memory region.
360+
/// @param width The width of the 2D region.
361+
/// @param height The height of the 2D region.
331362
__forceinline__ __device__ void put2D(uint64_t dstOffset, uint64_t srcOffset, uint32_t width, uint32_t height) {
332363
proxyChan_.put2D(dst_, dstOffset, src_, srcOffset, width, height);
333364
}
@@ -348,6 +379,11 @@ struct SimpleProxyChannel {
348379
proxyChan_.putWithSignal(dst_, dstOffset, src_, srcOffset, size);
349380
}
350381

382+
/// Push a @ref TriggerData and a @ref TriggerFlag at the same time to the FIFO.
383+
/// @param dstOffset The offset into the destination memory region.
384+
/// @param srcOffset The offset into the source memory region.
385+
/// @param width The width of the 2D region.
386+
/// @param height The height of the 2D region.
351387
__forceinline__ __device__ void put2DWithSignal(uint64_t dstOffset, uint64_t srcOffset, uint32_t width,
352388
uint32_t height) {
353389
proxyChan_.put2DWithSignal(dst_, dstOffset, src_, srcOffset, width, height);
@@ -358,6 +394,10 @@ struct SimpleProxyChannel {
358394
/// @param size The size of the transfer.
359395
__forceinline__ __device__ void putWithSignal(uint64_t offset, uint64_t size) { putWithSignal(offset, offset, size); }
360396

397+
/// Push a @ref TriggerData, a @ref TriggerFlag, and a @ref TriggerSync at the same time to the FIFO.
398+
/// @param offset The common offset into the destination and source memory regions.
399+
/// @param width The width of the 2D region.
400+
/// @param height The height of the 2D region.
361401
__forceinline__ __device__ void put2DWithSignal(uint64_t offset, uint32_t width, uint32_t height) {
362402
put2DWithSignal(offset, offset, width, height);
363403
}

src/connection.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,10 @@ void CudaIpcConnection::write2D(RegisteredMemory dst, uint64_t dstOffset, Regist
6666
char* dstPtr = (char*)dst.data();
6767
char* srcPtr = (char*)src.data();
6868

69-
INFO(MSCCLPP_P2P,
70-
"CudaIpcConnection write: from %p to %p, width %lu height %lu dstPitch %lu srcPitch %lu dstOffset %lu srcOffset "
71-
"%lu",
72-
srcPtr + srcOffset, dstPtr + dstOffset, width, height, dst.pitch(), src.pitch(), dstOffset, srcOffset);
7369
MSCCLPP_CUDATHROW(cudaMemcpy2DAsync(dstPtr + dstOffset, dst.pitch(), srcPtr + srcOffset, src.pitch(), width, height,
7470
cudaMemcpyDeviceToDevice, stream_));
71+
INFO(MSCCLPP_P2P, "CudaIpcConnection write: from %p to %p, width %lu height %lu dstPitch %lu srcPitch %lu",
72+
srcPtr + srcOffset, dstPtr + dstOffset, width, height, dst.pitch(), src.pitch());
7573
}
7674

7775
void CudaIpcConnection::updateAndSync(RegisteredMemory dst, uint64_t dstOffset, uint64_t* src, uint64_t newValue) {

test/mp_unit/proxy_channel_tests.cu

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ void ProxyChannelOneToOneTest::setupMeshConnections(
6969

7070
__constant__ DeviceHandle<mscclpp::SimpleProxyChannel> gChannelOneToOneTestConstProxyChans;
7171

72-
__device__ size_t getTileElementOffset(int elementId, int width, int rowIndex, int colIndex, int nElemInPitch) {
72+
__device__ size_t getTileElementOffset(int elementId, int width, int rowIndex, int colIndex, int nElemPerPitch) {
7373
int rowIndexInTile = elementId / width;
7474
int colIndexInTile = elementId % width;
75-
return (rowIndex + rowIndexInTile) * nElemInPitch + (colIndex + colIndexInTile);
75+
return (rowIndex + rowIndexInTile) * nElemPerPitch + (colIndex + colIndexInTile);
7676
}
7777

7878
__global__ void kernelProxyTilePingPong(int* buff, int rank, int pitch, int rowIndex, int colIndex, int width,
@@ -83,14 +83,14 @@ __global__ void kernelProxyTilePingPong(int* buff, int rank, int pitch, int rowI
8383
int flusher = 0;
8484
size_t offset = rowIndex * pitch + colIndex * sizeof(int);
8585
size_t nElem = width * hight;
86-
size_t nElemPerInPitch = pitch / sizeof(int);
86+
size_t nElemPerPitch = pitch / sizeof(int);
8787
for (int i = 0; i < nTries; i++) {
8888
if (rank == 0) {
8989
if (i > 0) {
9090
if (threadIdx.x == 0) proxyChan.wait();
9191
__syncthreads();
9292
for (int j = threadIdx.x; j < nElem; j += blockDim.x) {
93-
size_t tileOffset = getTileElementOffset(j, width, rowIndex, colIndex, nElemPerInPitch);
93+
size_t tileOffset = getTileElementOffset(j, width, rowIndex, colIndex, nElemPerPitch);
9494
if (sendBuff[tileOffset] != offset + i - 1 + j) {
9595
// printf("rank 0 ERROR: sendBuff[%d] = %d, expected %d\n", j, sendBuff[j], rank1Offset + i - 1 + j);
9696
*ret = 1;
@@ -99,7 +99,7 @@ __global__ void kernelProxyTilePingPong(int* buff, int rank, int pitch, int rowI
9999
}
100100
}
101101
for (int j = threadIdx.x; j < nElem; j += blockDim.x) {
102-
size_t tileOffset = getTileElementOffset(j, width, rowIndex, colIndex, nElemPerInPitch);
102+
size_t tileOffset = getTileElementOffset(j, width, rowIndex, colIndex, nElemPerPitch);
103103
sendBuff[tileOffset] = i + j;
104104
}
105105
__syncthreads();
@@ -110,7 +110,7 @@ __global__ void kernelProxyTilePingPong(int* buff, int rank, int pitch, int rowI
110110
if (threadIdx.x == 0) proxyChan.wait();
111111
__syncthreads();
112112
for (int j = threadIdx.x; j < nElem; j += blockDim.x) {
113-
size_t tileOffset = getTileElementOffset(j, width, rowIndex, colIndex, nElemPerInPitch);
113+
size_t tileOffset = getTileElementOffset(j, width, rowIndex, colIndex, nElemPerPitch);
114114
if (sendBuff[tileOffset] != i + j) {
115115
// printf("rank 1 ERROR: sendBuff[%d] = %d, expected %d\n", j, sendBuff[j], i + j);
116116
*ret = 1;
@@ -119,7 +119,7 @@ __global__ void kernelProxyTilePingPong(int* buff, int rank, int pitch, int rowI
119119
}
120120
if (i < nTries - 1) {
121121
for (int j = threadIdx.x; j < nElem; j += blockDim.x) {
122-
size_t tileOffset = getTileElementOffset(j, width, rowIndex, colIndex, nElemPerInPitch);
122+
size_t tileOffset = getTileElementOffset(j, width, rowIndex, colIndex, nElemPerPitch);
123123
sendBuff[tileOffset] = offset + i + j;
124124
}
125125
__syncthreads();

0 commit comments

Comments
 (0)