Archived
libr4d: a refused IPC export is not fatal
r4d_ar_ipc_alloc exports every collective buffer with hipIpcGetMemHandle. Beside another process holding the same cards it answers invalid argument while the allocation is fine, and HIPOK stopped the engine. libr4d's ranks are threads of one process and share the pointer itself, so the handle is never read: a refused export leaves it empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6fb31c0577
commit
fb7a30cd84
1 file changed
+11
-3
@@ -300,10 +300,18 @@ long r4d_ar_ipc_alloc(long size, int finegrained, char* out_handle, int* out_len
|
||||
// The zeroes must land before the pointer reaches a peer, or its first push or flag store could
|
||||
// race the queued memset.
|
||||
HIPOK(hipStreamSynchronize(nullptr));
|
||||
// The handle is for an out-of-process peer. libr4d's ranks are threads of one process and share
|
||||
// the pointer itself (r4d_ar_entry.hip), so a refused export is not fatal: beside another engine
|
||||
// on the same cards hipIpcGetMemHandle answers invalid argument while the allocation is fine.
|
||||
hipIpcMemHandle_t h;
|
||||
HIPOK(hipIpcGetMemHandle(&h, p));
|
||||
std::memcpy(out_handle, &h, sizeof(h));
|
||||
*out_len = (int)sizeof(h);
|
||||
if (hipIpcGetMemHandle(&h, p) == hipSuccess) {
|
||||
std::memcpy(out_handle, &h, sizeof(h));
|
||||
*out_len = (int)sizeof(h);
|
||||
} else {
|
||||
(void)hipGetLastError();
|
||||
std::memset(out_handle, 0, R4D_AR_HANDLE_BYTES);
|
||||
*out_len = 0;
|
||||
}
|
||||
return (long)p;
|
||||
}
|
||||
// r4d_p2p_copy2d as a kernel with a bounded workgroup count.
|
||||
|
||||
Reference in new issue
Block a user