@@ -39,7 +39,8 @@ namespace rocshmem {
3939__host__ IPCContext::IPCContext (Backend *b)
4040 : Context(b, false ) {
4141 IPCBackend *backend{static_cast <IPCBackend *>(b)};
42- ipcImpl = &backend->ipcImpl ;
42+ ipcImpl_.ipc_bases = b->ipcImpl .ipc_bases ;
43+ ipcImpl_.shm_size = b->ipcImpl .shm_size ;
4344
4445 auto *bp{backend->ipc_backend_proxy .get ()};
4546
@@ -59,22 +60,18 @@ __device__ void IPCContext::ctx_destroy(){
5960
6061__device__ void IPCContext::putmem (void *dest, const void *source, size_t nelems,
6162 int pe) {
62- // TODO (Avinash) check if PE is available for IPC using (isIpcAvailable)
63- int local_pe = pe % ipcImpl->shm_size ;
6463 uint64_t L_offset =
65- reinterpret_cast <char *>(dest) - ipcImpl-> ipc_bases [my_pe];
66- ipcImpl-> ipcCopy (ipcImpl-> ipc_bases [local_pe ] + L_offset,
64+ reinterpret_cast <char *>(dest) - ipcImpl_. ipc_bases [my_pe];
65+ ipcImpl_. ipcCopy (ipcImpl_. ipc_bases [pe ] + L_offset,
6766 const_cast <void *>(source), nelems);
6867}
6968
7069__device__ void IPCContext::getmem (void *dest, const void *source, size_t nelems,
7170 int pe) {
72- // TODO (Avinash) check if PE is available for IPC using (isIpcAvailable)
73- int local_pe = pe % ipcImpl->shm_size ;
7471 const char *src_typed = reinterpret_cast <const char *>(source);
7572 uint64_t L_offset =
76- const_cast <char *>(src_typed) - ipcImpl-> ipc_bases [my_pe];
77- ipcImpl-> ipcCopy (dest, ipcImpl-> ipc_bases [local_pe ] + L_offset, nelems);
73+ const_cast <char *>(src_typed) - ipcImpl_. ipc_bases [my_pe];
74+ ipcImpl_. ipcCopy (dest, ipcImpl_. ipc_bases [pe ] + L_offset, nelems);
7875}
7976
8077__device__ void IPCContext::putmem_nbi (void *dest, const void *source,
@@ -103,23 +100,19 @@ __device__ void *IPCContext::shmem_ptr(const void *dest, int pe) {
103100
104101__device__ void IPCContext::putmem_wg (void *dest, const void *source,
105102 size_t nelems, int pe) {
106- // TODO (Avinash) check if PE is available for IPC using (isIpcAvailable)
107- int local_pe = pe % ipcImpl->shm_size ;
108103 uint64_t L_offset =
109- reinterpret_cast <char *>(dest) - ipcImpl-> ipc_bases [my_pe];
110- ipcImpl-> ipcCopy_wg (ipcImpl-> ipc_bases [local_pe ] + L_offset,
104+ reinterpret_cast <char *>(dest) - ipcImpl_. ipc_bases [my_pe];
105+ ipcImpl_. ipcCopy_wg (ipcImpl_. ipc_bases [pe ] + L_offset,
111106 const_cast <void *>(source), nelems);
112107 __syncthreads ();
113108}
114109
115110__device__ void IPCContext::getmem_wg (void *dest, const void *source,
116111 size_t nelems, int pe) {
117- // TODO (Avinash) check if PE is available for IPC using (isIpcAvailable)
118- int local_pe = pe % ipcImpl->shm_size ;
119112 const char *src_typed = reinterpret_cast <const char *>(source);
120113 uint64_t L_offset =
121- const_cast <char *>(src_typed) - ipcImpl-> ipc_bases [my_pe];
122- ipcImpl-> ipcCopy_wg (dest, ipcImpl-> ipc_bases [local_pe ] + L_offset, nelems);
114+ const_cast <char *>(src_typed) - ipcImpl_. ipc_bases [my_pe];
115+ ipcImpl_. ipcCopy_wg (dest, ipcImpl_. ipc_bases [pe ] + L_offset, nelems);
123116 __syncthreads ();
124117}
125118
@@ -135,22 +128,18 @@ __device__ void IPCContext::getmem_nbi_wg(void *dest, const void *source,
135128
136129__device__ void IPCContext::putmem_wave (void *dest, const void *source,
137130 size_t nelems, int pe) {
138- // TODO (Avinash) check if PE is available for IPC using (isIpcAvailable)
139- int local_pe = pe % ipcImpl->shm_size ;
140131 uint64_t L_offset =
141- reinterpret_cast <char *>(dest) - ipcImpl-> ipc_bases [my_pe];
142- ipcImpl-> ipcCopy_wave (ipcImpl-> ipc_bases [local_pe ] + L_offset,
132+ reinterpret_cast <char *>(dest) - ipcImpl_. ipc_bases [my_pe];
133+ ipcImpl_. ipcCopy_wave (ipcImpl_. ipc_bases [pe ] + L_offset,
143134 const_cast <void *>(source), nelems);
144135}
145136
146137__device__ void IPCContext::getmem_wave (void *dest, const void *source,
147138 size_t nelems, int pe) {
148- // TODO (Avinash) check if PE is available for IPC using (isIpcAvailable)
149- int local_pe = pe % ipcImpl->shm_size ;
150139 const char *src_typed = reinterpret_cast <const char *>(source);
151140 uint64_t L_offset =
152- const_cast <char *>(src_typed) - ipcImpl-> ipc_bases [my_pe];
153- ipcImpl-> ipcCopy_wave (dest, ipcImpl-> ipc_bases [local_pe ] + L_offset,
141+ const_cast <char *>(src_typed) - ipcImpl_. ipc_bases [my_pe];
142+ ipcImpl_. ipcCopy_wave (dest, ipcImpl_. ipc_bases [pe ] + L_offset,
154143 nelems);
155144}
156145
0 commit comments