Skip to content

Commit e9fb01a

Browse files
authored
Merge pull request #27 from ROCm/ipc_bringup
Ipc bringup
2 parents 375d145 + fc45d7a commit e9fb01a

38 files changed

+3783
-35
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ string(REGEX REPLACE "([0-9]+)\.([0-9]+)\.([0-9]+)(.*)" "\\1.\\2.\\3" ROCSHMEM_V
5454
###############################################################################
5555
option(DEBUG "Enable debug trace" OFF)
5656
option(PROFILE "Enable statistics and timing support" OFF)
57-
option(USE_GPU_IB "Enable GPU_IB conduit. If off, RO_NET will be used" ON)
57+
option(USE_GPU_IB "Enable GPU_IB conduit." ON)
58+
option(USE_RO "Enable RO conduit." ON)
5859
option(USE_DC "Enable IB dynamically connected transport (DC)" OFF)
5960
option(USE_IPC "Enable IPC support (using HIP)" OFF)
6061
option(USE_THREADS "Enable workgroup threads to share network queues" OFF)

cmake/config.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#cmakedefine DEBUG
22
#cmakedefine PROFILE
33
#cmakedefine USE_GPU_IB
4+
#cmakedefine USE_RO
45
#cmakedefine USE_DC
56
#cmakedefine USE_IPC
67
#cmakedefine USE_THREADS

scripts/build_configs/ipc_single

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
# Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
3+
4+
if [ -z $1 ]
5+
then
6+
install_path=~/rocshmem
7+
else
8+
install_path=$1
9+
fi
10+
11+
src_path=$(dirname "$(realpath $0)")/../../
12+
13+
cmake \
14+
-DCMAKE_BUILD_TYPE=Release \
15+
-DCMAKE_INSTALL_PREFIX=$install_path \
16+
-DCMAKE_VERBOSE_MAKEFILE=OFF \
17+
-DDEBUG=OFF \
18+
-DPROFILE=OFF \
19+
-DUSE_GPU_IB=OFF \
20+
-DUSE_RO=OFF \
21+
-DUSE_DC=OFF \
22+
-DUSE_IPC=ON \
23+
-DUSE_COHERENT_HEAP=ON \
24+
-DUSE_THREADS=OFF \
25+
-DUSE_WF_COAL=OFF \
26+
-DUSE_SINGLE_NODE=ON \
27+
-DUSE_HOST_SIDE_HDP_FLUSH=OFF\
28+
$src_path
29+
cmake --build . --parallel 8
30+
cmake --install .

scripts/build_configs/ro_net

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cmake \
1818
-DPROFILE=OFF \
1919
-DUSE_GPU_IB=OFF \
2020
-DUSE_DC=OFF \
21-
-DUSE_IPC=OFF \
21+
-DUSE_IPC=ON \
2222
-DUSE_THREADS=ON \
2323
-DUSE_WF_COAL=OFF \
2424
-DUSE_COHERENT_HEAP=ON \

src/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ target_sources(
3030
backend_bc.cpp
3131
context_host.cpp
3232
context_device.cpp
33-
ipc_policy.cpp
3433
mpi_init_singleton.cpp
3534
roc_shmem_gpu.cpp
3635
roc_shmem.cpp
3736
team.cpp
3837
team_tracker.cpp
3938
util.cpp
4039
wf_coal_policy.cpp
40+
ipc_policy.cpp
4141
)
4242

4343
target_compile_options(
@@ -60,8 +60,10 @@ target_compile_options(
6060
###############################################################################
6161
IF (USE_GPU_IB)
6262
add_subdirectory(gpu_ib)
63-
ELSE()
63+
ELSEIF(USE_RO)
6464
add_subdirectory(reverse_offload)
65+
ELSE()
66+
add_subdirectory(ipc)
6567
ENDIF()
6668
add_subdirectory(containers)
6769
add_subdirectory(host)

src/backend_bc.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
#include "backend_type.hpp"
2626
#include "context_incl.hpp"
2727

28-
#ifndef USE_GPU_IB
28+
#ifdef USE_GPU_IB
29+
#include "gpu_ib/backend_ib.hpp"
30+
#elif defined(USE_RO)
2931
#include "reverse_offload/backend_ro.hpp"
3032
#else
31-
#include "gpu_ib/backend_ib.hpp"
33+
#include "ipc/backend_ipc.hpp"
3234
#endif
3335

3436
namespace rocshmem {
@@ -201,18 +203,22 @@ void Backend::reset_stats() {
201203
}
202204

203205
__device__ bool Backend::create_ctx(int64_t option, roc_shmem_ctx_t* ctx) {
204-
#ifndef USE_GPU_IB
206+
#ifdef USE_GPU_IB
207+
return static_cast<GPUIBBackend*>(this)->create_ctx(option, ctx);
208+
#elif defined(USE_RO)
205209
return static_cast<ROBackend*>(this)->create_ctx(option, ctx);
206210
#else
207-
return static_cast<GPUIBBackend*>(this)->create_ctx(option, ctx);
211+
return static_cast<IPCBackend*>(this)->create_ctx(option, ctx);
208212
#endif
209213
}
210214

211215
__device__ void Backend::destroy_ctx(roc_shmem_ctx_t* ctx) {
212-
#ifndef USE_GPU_IB
216+
#ifdef USE_GPU_IB
217+
static_cast<GPUIBBackend*>(this)->destroy_ctx(ctx);
218+
#elif defined(USE_RO)
213219
static_cast<ROBackend*>(this)->destroy_ctx(ctx);
214220
#else
215-
static_cast<GPUIBBackend*>(this)->destroy_ctx(ctx);
221+
static_cast<IPCBackend*>(this)->destroy_ctx(ctx);
216222
#endif
217223
}
218224

src/backend_type.hpp

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace rocshmem {
4444
* @note Derived classes which use Backend as a base class must add
4545
* themselves to this enum class to support static polymorphism.
4646
*/
47-
enum class BackendType { RO_BACKEND, GPU_IB_BACKEND };
47+
enum class BackendType { RO_BACKEND, GPU_IB_BACKEND, IPC_BACKEND };
4848

4949
/**
5050
* @brief Helper macro for some dispatch calls
@@ -57,9 +57,12 @@ enum class BackendType { RO_BACKEND, GPU_IB_BACKEND };
5757
#ifdef USE_GPU_IB
5858
#define DISPATCH(Func) \
5959
static_cast<GPUIBContext *>(this)->Func;
60-
#else
60+
#elif defined(USE_RO)
6161
#define DISPATCH(Func) \
6262
static_cast<ROContext *>(this)->Func;
63+
#else
64+
#define DISPATCH(Func) \
65+
static_cast<IPCContext *>(this)->Func;
6366
#endif
6467

6568
/**
@@ -69,10 +72,15 @@ enum class BackendType { RO_BACKEND, GPU_IB_BACKEND };
6972
#define DISPATCH_RET(Func) \
7073
auto ret_val = static_cast<GPUIBContext *>(this)->Func; \
7174
return ret_val;
72-
#else
75+
#elif defined(USE_RO)
7376
#define DISPATCH_RET(Func) \
7477
auto ret_val = static_cast<ROContext *>(this)->Func; \
7578
return ret_val;
79+
#else
80+
#define DISPATCH_RET(Func) \
81+
auto ret_val{0}; \
82+
ret_val = static_cast<IPCContext *>(this)->Func; \
83+
return ret_val;
7684
#endif
7785
/**
7886
* @brief Device static dispatch method call with a return type of pointer.
@@ -82,11 +90,16 @@ enum class BackendType { RO_BACKEND, GPU_IB_BACKEND };
8290
void *ret_val{nullptr}; \
8391
ret_val = static_cast<GPUIBContext *>(this)->Func; \
8492
return ret_val;
85-
#else
93+
#elif defined(USE_RO)
8694
#define DISPATCH_RET_PTR(Func) \
8795
void *ret_val{nullptr}; \
8896
ret_val = static_cast<ROContext *>(this)->Func; \
8997
return ret_val;
98+
#else
99+
#define DISPATCH_RET_PTR(Func) \
100+
void *ret_val{nullptr}; \
101+
ret_val = static_cast<IPCContext *>(this)->Func; \
102+
return ret_val;
90103
#endif
91104

92105
/**
@@ -98,8 +111,10 @@ enum class BackendType { RO_BACKEND, GPU_IB_BACKEND };
98111
*/
99112
#ifdef USE_GPU_IB
100113
#define HOST_DISPATCH(Func) static_cast<GPUIBHostContext *>(this)->Func;
101-
#else
114+
#elif defined(USE_RO)
102115
#define HOST_DISPATCH(Func) static_cast<ROHostContext *>(this)->Func;
116+
#else
117+
#define HOST_DISPATCH(Func) static_cast<IPCHostContext *>(this)->Func;
103118
#endif
104119
/**
105120
* @brief Host static dispatch method call with return value.
@@ -113,10 +128,15 @@ enum class BackendType { RO_BACKEND, GPU_IB_BACKEND };
113128
#define HOST_DISPATCH_RET(Func) \
114129
auto ret_val = static_cast<GPUIBHostContext *>(this)->Func; \
115130
return ret_val;
116-
#else
131+
#elif defined(USE_RO)
117132
#define HOST_DISPATCH_RET(Func) \
118133
auto ret_val = static_cast<ROHostContext *>(this)->Func; \
119134
return ret_val;
135+
#else
136+
#define HOST_DISPATCH_RET(Func) \
137+
auto ret_val{0}; \
138+
ret_val = static_cast<IPCHostContext *>(this)->Func; \
139+
return ret_val;
120140
#endif
121141

122142
} // namespace rocshmem

src/context_incl.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@
2929
#ifdef USE_GPU_IB
3030
#include "gpu_ib/context_ib_device.hpp"
3131
#include "gpu_ib/context_ib_host.hpp"
32-
#else
32+
#elif defined (USE_RO)
3333
#include "reverse_offload/context_ro_device.hpp"
3434
#include "reverse_offload/context_ro_host.hpp"
35+
#else
36+
#include "ipc/context_ipc_device.hpp"
37+
#include "ipc/context_ipc_host.hpp"
3538
#endif
3639

3740
#endif // LIBRARY_SRC_CONTEXT_INCL_HPP_

src/context_tmpl_device.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
#include "backend_type.hpp"
2828
#ifdef USE_GPU_IB
2929
#include "gpu_ib/context_ib_device.hpp"
30-
#else
30+
#elif defined(USE_RO)
3131
#include "reverse_offload/context_ro_device.hpp"
32+
#else
33+
#include "ipc/context_ipc_device.hpp"
3234
#endif
3335

3436
namespace rocshmem {

src/context_tmpl_host.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
#include "backend_type.hpp"
2828
#ifdef USE_GPU_IB
2929
#include "gpu_ib/context_ib_host.hpp"
30-
#else
30+
#elif defined(USE_RO)
3131
#include "reverse_offload/context_ro_host.hpp"
32+
#else
33+
#include "ipc/context_ipc_host.hpp"
3234
#endif
3335
namespace rocshmem {
3436

0 commit comments

Comments
 (0)