Add host APIs for querying device ctx and remote heap pointer (#200)
* Add host APIs for querying device ctx and remote heap pointer * Host API to query device pointer for ROCSHMEM_DEFAULT_CONTEXT, this is needed to support dynamic module initialization via device kernel library bitcode. * Host API to query remote symmetric heap pointer that can be used in custom device kernel for RMA operations. * Added rocshmem_ptr implementation within the Host Context class * Enables pointer retrieval functionality for symmetric data objects * Copy IPC pointers to host memory in RO host context --------- Co-authored-by: avinashkethineedi <avinash.kethineedi@amd.com>
This commit is contained in:
1 vanhempi
42e28835ad
commit
87f99e7ec6
12 files changed
+144
-12
No files matched your search
@@ -42,9 +42,20 @@ __host__ IPCHostContext::IPCHostContext(Backend *backend,
|
||||
host_interface = b->host_interface;
|
||||
|
||||
context_window_info = host_interface->acquire_window_context();
|
||||
|
||||
char** ipc_bases = new char*[b->ipcImpl.shm_size];
|
||||
|
||||
CHECK_HIP(hipMemcpy(ipc_bases,
|
||||
b->ipcImpl.ipc_bases,
|
||||
b->ipcImpl.shm_size * sizeof(char *),
|
||||
hipMemcpyDeviceToHost));
|
||||
|
||||
ipcImpl_.ipc_bases = ipc_bases;
|
||||
}
|
||||
|
||||
__host__ IPCHostContext::~IPCHostContext() {
|
||||
delete[] ipcImpl_.ipc_bases;
|
||||
|
||||
host_interface->release_window_context(context_window_info);
|
||||
}
|
||||
|
||||
@@ -76,6 +87,15 @@ __host__ void IPCHostContext::quiet() {
|
||||
host_interface->quiet(context_window_info);
|
||||
}
|
||||
|
||||
__host__ void *IPCHostContext::shmem_ptr(const void *dest, int pe) {
|
||||
void *ret = nullptr;
|
||||
void *dst = const_cast<void *>(dest);
|
||||
uint64_t L_offset =
|
||||
reinterpret_cast<char *>(dst) - ipcImpl_.ipc_bases[my_pe];
|
||||
ret = ipcImpl_.ipc_bases[pe] + L_offset;
|
||||
return ret;
|
||||
}
|
||||
|
||||
__host__ void IPCHostContext::sync_all() {
|
||||
host_interface->sync_all(context_window_info);
|
||||
}
|
||||
|
||||
@@ -78,6 +78,8 @@ class IPCHostContext : public Context {
|
||||
|
||||
__host__ void quiet();
|
||||
|
||||
__host__ void *shmem_ptr(const void *dest, int pe);
|
||||
|
||||
__host__ void barrier_all();
|
||||
|
||||
__host__ void sync_all();
|
||||
|
||||
Reference in new issue
Block a user