RCCL Multinode DMA Buffer crash fix (#1682)
This commit handles DMABUF initialization and call appropriate handling function. This fixes crash in OS with no peermem support and relying on only DMABUF.
* Initial test commit
* Handling Dmabuf_fd opening and closing
* Cleanup
* Use DMABuff or Peermem as needed
* Using user input for ibDmaBufSupportInitOnce
* Revert all changes to rocmwrap.cc
* Revert all changes to rocmwrap.cc
* Changing to func definition braces
* Reverting line removal in utils.h
* useDmaBuf to calculate flushEnabled
[ROCm/rccl commit: 5f6805b4f4]
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#include "core.h"
|
||||
|
||||
#include "nvmlwrap.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// Get current Compute Capability
|
||||
@@ -289,3 +289,22 @@ void ncclMemoryStackDestruct(struct ncclMemoryStack* me) {
|
||||
h = h1;
|
||||
}
|
||||
}
|
||||
|
||||
size_t get_sc_page_size() {
|
||||
static size_t cached_page_size = 0;
|
||||
size_t ps = __atomic_load_n(&cached_page_size,__ATOMIC_RELAXED);
|
||||
if (ps == 0) {
|
||||
ps = (size_t)sysconf(_SC_PAGESIZE);
|
||||
__atomic_store_n(&cached_page_size, ps,__ATOMIC_RELAXED);
|
||||
}
|
||||
return ps;
|
||||
}
|
||||
|
||||
void get_aligned_ptr_and_size(const void *ptr, const size_t bufsize, void **aligned_ptr, size_t *aligned_size) {
|
||||
if (!aligned_ptr || !aligned_size) return;
|
||||
const size_t page_size = get_sc_page_size();
|
||||
uintptr_t aligned_ptr_local = (uintptr_t)ptr & ~(page_size - 1);
|
||||
size_t local_offset = (size_t)((uintptr_t)ptr - aligned_ptr_local);
|
||||
*aligned_size = (bufsize + local_offset + page_size - 1) & ~(page_size - 1);
|
||||
*aligned_ptr = (void *)aligned_ptr_local;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user