Use new naming scheme
This commit is contained in:
+40
-40
@@ -33,10 +33,10 @@ namespace rocshmem {
|
||||
} \
|
||||
}
|
||||
|
||||
extern roc_shmem_ctx_t ROC_SHMEM_HOST_CTX_DEFAULT;
|
||||
extern rocshmem_ctx_t ROCSHMEM_HOST_CTX_DEFAULT;
|
||||
|
||||
roc_shmem_team_t get_external_team(GPUIBTeam *team) {
|
||||
return reinterpret_cast<roc_shmem_team_t>(team);
|
||||
rocshmem_team_t get_external_team(GPUIBTeam *team) {
|
||||
return reinterpret_cast<rocshmem_team_t>(team);
|
||||
}
|
||||
|
||||
int get_ls_non_zero_bit(char *bitmask, int mask_length) {
|
||||
@@ -57,7 +57,7 @@ IPCBackend::IPCBackend(MPI_Comm comm)
|
||||
: Backend() {
|
||||
type = BackendType::IPC_BACKEND;
|
||||
|
||||
if (auto maximum_num_contexts_str = getenv("ROC_SHMEM_MAX_NUM_CONTEXTS")) {
|
||||
if (auto maximum_num_contexts_str = getenv("ROCSHMEM_MAX_NUM_CONTEXTS")) {
|
||||
std::stringstream sstream(maximum_num_contexts_str);
|
||||
sstream >> maximum_num_contexts_;
|
||||
}
|
||||
@@ -82,7 +82,7 @@ IPCBackend::IPCBackend(MPI_Comm comm)
|
||||
|
||||
default_host_ctx = std::make_unique<IPCHostContext>(this, 0);
|
||||
|
||||
ROC_SHMEM_HOST_CTX_DEFAULT.ctx_opaque = default_host_ctx.get();
|
||||
ROCSHMEM_HOST_CTX_DEFAULT.ctx_opaque = default_host_ctx.get();
|
||||
|
||||
init_g_ret(&heap, thread_comm, MAX_NUM_BLOCKS, &bp->g_ret);
|
||||
|
||||
@@ -92,7 +92,7 @@ IPCBackend::IPCBackend(MPI_Comm comm)
|
||||
|
||||
init_wrk_sync_buffer();
|
||||
|
||||
roc_shmem_collective_init();
|
||||
rocshmem_collective_init();
|
||||
|
||||
setup_fence_buffer();
|
||||
|
||||
@@ -143,7 +143,7 @@ void IPCBackend::setup_ctxs() {
|
||||
}
|
||||
}
|
||||
|
||||
__device__ bool IPCBackend::create_ctx(int64_t options, roc_shmem_ctx_t *ctx) {
|
||||
__device__ bool IPCBackend::create_ctx(int64_t options, rocshmem_ctx_t *ctx) {
|
||||
IPCContext *ctx_{nullptr};
|
||||
|
||||
auto pop_result = ctx_free_list.get()->pop_front();
|
||||
@@ -158,7 +158,7 @@ __device__ bool IPCBackend::create_ctx(int64_t options, roc_shmem_ctx_t *ctx) {
|
||||
return true;
|
||||
}
|
||||
|
||||
__device__ void IPCBackend::destroy_ctx(roc_shmem_ctx_t *ctx) {
|
||||
__device__ void IPCBackend::destroy_ctx(rocshmem_ctx_t *ctx) {
|
||||
ctx_free_list.get()->push_back(static_cast<IPCContext *>(ctx->ctx_opaque));
|
||||
}
|
||||
|
||||
@@ -182,9 +182,9 @@ void IPCBackend::setup_team_world() {
|
||||
team_tracker.set_team_world(team_world);
|
||||
|
||||
/**
|
||||
* Copy the address to ROC_SHMEM_TEAM_WORLD.
|
||||
* Copy the address to ROCSHMEM_TEAM_WORLD.
|
||||
*/
|
||||
ROC_SHMEM_TEAM_WORLD = reinterpret_cast<roc_shmem_team_t>(team_world);
|
||||
ROCSHMEM_TEAM_WORLD = reinterpret_cast<rocshmem_team_t>(team_world);
|
||||
}
|
||||
|
||||
void IPCBackend::init_mpi_once(MPI_Comm comm) {
|
||||
@@ -205,7 +205,7 @@ void IPCBackend::init_mpi_once(MPI_Comm comm) {
|
||||
NET_CHECK(MPI_Comm_rank(thread_comm, &my_pe));
|
||||
}
|
||||
|
||||
void IPCBackend::team_destroy(roc_shmem_team_t team) {
|
||||
void IPCBackend::team_destroy(rocshmem_team_t team) {
|
||||
IPCTeam *team_obj = get_internal_ipc_team(team);
|
||||
|
||||
/* Mark the pool as available */
|
||||
@@ -221,7 +221,7 @@ void IPCBackend::create_new_team([[maybe_unused]] Team *parent_team,
|
||||
TeamInfo *team_info_wrt_parent,
|
||||
TeamInfo *team_info_wrt_world, int num_pes,
|
||||
int my_pe_in_new_team, MPI_Comm team_comm,
|
||||
roc_shmem_team_t *new_team) {
|
||||
rocshmem_team_t *new_team) {
|
||||
/**
|
||||
* Read the bit mask and find out a common index into
|
||||
* the pool of available work arrays.
|
||||
@@ -303,24 +303,24 @@ void IPCBackend::init_wrk_sync_buffer() {
|
||||
/**
|
||||
* size of barrier sync
|
||||
*/
|
||||
Wrk_Sync_buffer_size_ += sizeof(*barrier_sync) * ROC_SHMEM_BARRIER_SYNC_SIZE;
|
||||
Wrk_Sync_buffer_size_ += sizeof(*barrier_sync) * ROCSHMEM_BARRIER_SYNC_SIZE;
|
||||
|
||||
/**
|
||||
* Size of sync arrays for the teams
|
||||
*/
|
||||
Wrk_Sync_buffer_size_ += sizeof(long) * max_num_teams *
|
||||
(ROC_SHMEM_BARRIER_SYNC_SIZE +
|
||||
ROC_SHMEM_REDUCE_SYNC_SIZE +
|
||||
ROC_SHMEM_BCAST_SYNC_SIZE +
|
||||
ROC_SHMEM_ALLTOALL_SYNC_SIZE);
|
||||
(ROCSHMEM_BARRIER_SYNC_SIZE +
|
||||
ROCSHMEM_REDUCE_SYNC_SIZE +
|
||||
ROCSHMEM_BCAST_SYNC_SIZE +
|
||||
ROCSHMEM_ALLTOALL_SYNC_SIZE);
|
||||
|
||||
/**
|
||||
* Size of work arrays for the teams
|
||||
* Accommodate largest possible data type for pWrk
|
||||
*/
|
||||
Wrk_Sync_buffer_size_ += sizeof(double) * max_num_teams *
|
||||
(ROC_SHMEM_REDUCE_MIN_WRKDATA_SIZE +
|
||||
ROC_SHMEM_ATA_MAX_WRKDATA_SIZE);
|
||||
(ROCSHMEM_REDUCE_MIN_WRKDATA_SIZE +
|
||||
ROCSHMEM_ATA_MAX_WRKDATA_SIZE);
|
||||
|
||||
/**
|
||||
* Size of fence array
|
||||
@@ -397,12 +397,12 @@ void IPCBackend::setup_fence_buffer() {
|
||||
temp_Wrk_Sync_buff_ptr_ += sizeof(int) * num_pes;
|
||||
}
|
||||
|
||||
void IPCBackend::roc_shmem_collective_init() {
|
||||
void IPCBackend::rocshmem_collective_init() {
|
||||
/*
|
||||
* Allocate heap space for barrier_sync
|
||||
*/
|
||||
size_t one_sync_size_bytes{sizeof(*barrier_sync)};
|
||||
size_t sync_size_bytes{one_sync_size_bytes * ROC_SHMEM_BARRIER_SYNC_SIZE};
|
||||
size_t sync_size_bytes{one_sync_size_bytes * ROCSHMEM_BARRIER_SYNC_SIZE};
|
||||
barrier_sync = reinterpret_cast<int64_t*>(temp_Wrk_Sync_buff_ptr_);
|
||||
temp_Wrk_Sync_buff_ptr_ += sync_size_bytes;
|
||||
|
||||
@@ -410,7 +410,7 @@ void IPCBackend::roc_shmem_collective_init() {
|
||||
* Initialize the barrier synchronization array with default values.
|
||||
*/
|
||||
for (int i = 0; i < num_pes; i++) {
|
||||
barrier_sync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
barrier_sync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -427,29 +427,29 @@ void IPCBackend::teams_init() {
|
||||
auto max_num_teams{team_tracker.get_max_num_teams()};
|
||||
|
||||
barrier_pSync_pool = reinterpret_cast<long *>(temp_Wrk_Sync_buff_ptr_);
|
||||
temp_Wrk_Sync_buff_ptr_ += sizeof(long) * ROC_SHMEM_BARRIER_SYNC_SIZE
|
||||
temp_Wrk_Sync_buff_ptr_ += sizeof(long) * ROCSHMEM_BARRIER_SYNC_SIZE
|
||||
* max_num_teams;
|
||||
|
||||
reduce_pSync_pool = reinterpret_cast<long *>(temp_Wrk_Sync_buff_ptr_);
|
||||
temp_Wrk_Sync_buff_ptr_ += sizeof(long) * ROC_SHMEM_REDUCE_SYNC_SIZE
|
||||
temp_Wrk_Sync_buff_ptr_ += sizeof(long) * ROCSHMEM_REDUCE_SYNC_SIZE
|
||||
* max_num_teams;
|
||||
|
||||
bcast_pSync_pool = reinterpret_cast<long *>(temp_Wrk_Sync_buff_ptr_);
|
||||
temp_Wrk_Sync_buff_ptr_ += sizeof(long) * ROC_SHMEM_BCAST_SYNC_SIZE
|
||||
temp_Wrk_Sync_buff_ptr_ += sizeof(long) * ROCSHMEM_BCAST_SYNC_SIZE
|
||||
* max_num_teams;
|
||||
|
||||
alltoall_pSync_pool = reinterpret_cast<long *>(temp_Wrk_Sync_buff_ptr_);
|
||||
temp_Wrk_Sync_buff_ptr_ += sizeof(long) * ROC_SHMEM_BCAST_SYNC_SIZE
|
||||
temp_Wrk_Sync_buff_ptr_ += sizeof(long) * ROCSHMEM_BCAST_SYNC_SIZE
|
||||
* max_num_teams;
|
||||
|
||||
/* Accommodating for largest possible data type for pWrk */
|
||||
pWrk_pool = reinterpret_cast<void *>(temp_Wrk_Sync_buff_ptr_);
|
||||
temp_Wrk_Sync_buff_ptr_ += sizeof(double) * ROC_SHMEM_REDUCE_MIN_WRKDATA_SIZE
|
||||
temp_Wrk_Sync_buff_ptr_ += sizeof(double) * ROCSHMEM_REDUCE_MIN_WRKDATA_SIZE
|
||||
* max_num_teams;
|
||||
|
||||
|
||||
pAta_pool = reinterpret_cast<void *>(temp_Wrk_Sync_buff_ptr_);
|
||||
temp_Wrk_Sync_buff_ptr_ += sizeof(double) * ROC_SHMEM_ATA_MAX_WRKDATA_SIZE
|
||||
temp_Wrk_Sync_buff_ptr_ += sizeof(double) * ROCSHMEM_ATA_MAX_WRKDATA_SIZE
|
||||
* max_num_teams;
|
||||
|
||||
/**
|
||||
@@ -458,25 +458,25 @@ void IPCBackend::teams_init() {
|
||||
long *barrier_pSync, *reduce_pSync, *bcast_pSync, *alltoall_pSync;
|
||||
for (int team_i = 0; team_i < max_num_teams; team_i++) {
|
||||
barrier_pSync = reinterpret_cast<long *>(
|
||||
&barrier_pSync_pool[team_i * ROC_SHMEM_BARRIER_SYNC_SIZE]);
|
||||
&barrier_pSync_pool[team_i * ROCSHMEM_BARRIER_SYNC_SIZE]);
|
||||
reduce_pSync = reinterpret_cast<long *>(
|
||||
&reduce_pSync_pool[team_i * ROC_SHMEM_REDUCE_SYNC_SIZE]);
|
||||
&reduce_pSync_pool[team_i * ROCSHMEM_REDUCE_SYNC_SIZE]);
|
||||
bcast_pSync = reinterpret_cast<long *>(
|
||||
&bcast_pSync_pool[team_i * ROC_SHMEM_BCAST_SYNC_SIZE]);
|
||||
&bcast_pSync_pool[team_i * ROCSHMEM_BCAST_SYNC_SIZE]);
|
||||
alltoall_pSync = reinterpret_cast<long *>(
|
||||
&alltoall_pSync_pool[team_i * ROC_SHMEM_ALLTOALL_SYNC_SIZE]);
|
||||
&alltoall_pSync_pool[team_i * ROCSHMEM_ALLTOALL_SYNC_SIZE]);
|
||||
|
||||
for (int i = 0; i < ROC_SHMEM_BARRIER_SYNC_SIZE; i++) {
|
||||
barrier_pSync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
for (int i = 0; i < ROCSHMEM_BARRIER_SYNC_SIZE; i++) {
|
||||
barrier_pSync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
}
|
||||
for (int i = 0; i < ROC_SHMEM_REDUCE_SYNC_SIZE; i++) {
|
||||
reduce_pSync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
for (int i = 0; i < ROCSHMEM_REDUCE_SYNC_SIZE; i++) {
|
||||
reduce_pSync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
}
|
||||
for (int i = 0; i < ROC_SHMEM_BCAST_SYNC_SIZE; i++) {
|
||||
bcast_pSync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
for (int i = 0; i < ROCSHMEM_BCAST_SYNC_SIZE; i++) {
|
||||
bcast_pSync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
}
|
||||
for (int i = 0; i < ROC_SHMEM_ALLTOALL_SYNC_SIZE; i++) {
|
||||
alltoall_pSync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
for (int i = 0; i < ROCSHMEM_ALLTOALL_SYNC_SIZE; i++) {
|
||||
alltoall_pSync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,13 +48,13 @@ class IPCBackend : public Backend {
|
||||
*/
|
||||
virtual ~IPCBackend();
|
||||
|
||||
__device__ bool create_ctx(int64_t options, roc_shmem_ctx_t *ctx);
|
||||
__device__ bool create_ctx(int64_t options, rocshmem_ctx_t *ctx);
|
||||
|
||||
/**
|
||||
* @brief Destroy a `roc_shmem_ctx_t` context and returns it back to the
|
||||
* @brief Destroy a `rocshmem_ctx_t` context and returns it back to the
|
||||
* context free list.
|
||||
*/
|
||||
__device__ void destroy_ctx(roc_shmem_ctx_t *ctx);
|
||||
__device__ void destroy_ctx(rocshmem_ctx_t *ctx);
|
||||
|
||||
/**
|
||||
* @copydoc Backend::ctx_create
|
||||
@@ -103,12 +103,12 @@ class IPCBackend : public Backend {
|
||||
void create_new_team(Team *parent_team, TeamInfo *team_info_wrt_parent,
|
||||
TeamInfo *team_info_wrt_world, int num_pes,
|
||||
int my_pe_in_new_team, MPI_Comm team_comm,
|
||||
roc_shmem_team_t *new_team) override;
|
||||
rocshmem_team_t *new_team) override;
|
||||
|
||||
/**
|
||||
* @copydoc Backend::team_destroy(roc_shmem_team_t)
|
||||
* @copydoc Backend::team_destroy(rocshmem_team_t)
|
||||
*/
|
||||
void team_destroy(roc_shmem_team_t team) override;
|
||||
void team_destroy(rocshmem_team_t team) override;
|
||||
|
||||
/**
|
||||
* @brief Accessor for work/sync bases
|
||||
@@ -213,7 +213,7 @@ class IPCBackend : public Backend {
|
||||
* When this method completes, the barrier_sync member will be available
|
||||
* for use.
|
||||
*/
|
||||
void roc_shmem_collective_init();
|
||||
void rocshmem_collective_init();
|
||||
|
||||
/**
|
||||
* @brief Allocate buffer for fence/quiet operation
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <cstdlib>
|
||||
|
||||
#include "config.h" // NOLINT(build/include_subdir)
|
||||
#include "roc_shmem/roc_shmem.hpp"
|
||||
#include "rocshmem/rocshmem.hpp"
|
||||
#include "backend_ipc.hpp"
|
||||
|
||||
namespace rocshmem {
|
||||
|
||||
@@ -63,7 +63,7 @@ class IPCContext : public Context {
|
||||
|
||||
__device__ void sync_all();
|
||||
|
||||
__device__ void sync(roc_shmem_team_t team);
|
||||
__device__ void sync(rocshmem_team_t team);
|
||||
|
||||
template <typename T>
|
||||
__device__ void p(T *dest, T value, int pe);
|
||||
@@ -121,18 +121,18 @@ class IPCContext : public Context {
|
||||
__device__ T amo_fetch_cas(void *dst, T value, T cond, int pe);
|
||||
|
||||
// Collectives
|
||||
template <typename T, ROC_SHMEM_OP Op>
|
||||
__device__ int reduce(roc_shmem_team_t team, T *dest, const T *source, int nreduce);
|
||||
template <typename T, ROCSHMEM_OP Op>
|
||||
__device__ int reduce(rocshmem_team_t team, T *dest, const T *source, int nreduce);
|
||||
|
||||
template <typename T>
|
||||
__device__ void broadcast(roc_shmem_team_t team, T *dest, const T *source,
|
||||
__device__ void broadcast(rocshmem_team_t team, T *dest, const T *source,
|
||||
int nelems, int pe_root);
|
||||
|
||||
template <typename T>
|
||||
__device__ void alltoall(roc_shmem_team_t team, T *dest, const T *source,
|
||||
__device__ void alltoall(rocshmem_team_t team, T *dest, const T *source,
|
||||
int nelems);
|
||||
template <typename T>
|
||||
__device__ void fcollect(roc_shmem_team_t team, T *dest, const T *source,
|
||||
__device__ void fcollect(rocshmem_team_t team, T *dest, const T *source,
|
||||
int nelems);
|
||||
|
||||
|
||||
@@ -211,11 +211,11 @@ class IPCContext : public Context {
|
||||
int pe_root); // NOLINT(runtime/int)
|
||||
|
||||
template <typename T>
|
||||
__device__ void fcollect_linear(roc_shmem_team_t team, T *dest,
|
||||
__device__ void fcollect_linear(rocshmem_team_t team, T *dest,
|
||||
const T *source, int nelems);
|
||||
|
||||
template <typename T>
|
||||
__device__ void alltoall_linear(roc_shmem_team_t team, T *dest,
|
||||
__device__ void alltoall_linear(rocshmem_team_t team, T *dest,
|
||||
const T *source, int nelems);
|
||||
|
||||
__device__ void internal_sync(int pe, int PE_start, int stride, int PE_size,
|
||||
@@ -227,10 +227,10 @@ class IPCContext : public Context {
|
||||
__device__ void internal_atomic_barrier(int pe, int PE_start, int stride,
|
||||
int n_pes, int64_t *pSync);
|
||||
|
||||
template <typename T, ROC_SHMEM_OP Op>
|
||||
template <typename T, ROCSHMEM_OP Op>
|
||||
__device__ void internal_direct_allreduce(T *dst, const T *src,
|
||||
int nelems, IPCTeam *team_obj);
|
||||
template <typename T, ROC_SHMEM_OP Op>
|
||||
template <typename T, ROCSHMEM_OP Op>
|
||||
__device__ void internal_ring_allreduce(T *dst, const T *src,
|
||||
int nelems, IPCTeam *team_obj,
|
||||
int n_seg, int seg_size, int chunk_size);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* IN THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "roc_shmem/roc_shmem.hpp"
|
||||
#include "rocshmem/rocshmem.hpp"
|
||||
#include "../context_incl.hpp"
|
||||
#include "context_ipc_tmpl_device.hpp"
|
||||
#include "../util.hpp"
|
||||
@@ -39,8 +39,8 @@ __device__ void IPCContext::internal_direct_barrier(int pe, int PE_start,
|
||||
__threadfence_system();
|
||||
#endif /* __gfx90a__ */
|
||||
for (size_t i = 1; i < n_pes; i++) {
|
||||
wait_until(&pSync[i], ROC_SHMEM_CMP_EQ, flag_val);
|
||||
pSync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
wait_until(&pSync[i], ROCSHMEM_CMP_EQ, flag_val);
|
||||
pSync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
}
|
||||
threadfence_system();
|
||||
|
||||
@@ -58,8 +58,8 @@ __device__ void IPCContext::internal_direct_barrier(int pe, int PE_start,
|
||||
#if defined(__gfx90a__)
|
||||
__threadfence_system();
|
||||
#endif /* __gfx90a__ */
|
||||
wait_until(&pSync[0], ROC_SHMEM_CMP_EQ, flag_val);
|
||||
pSync[0] = ROC_SHMEM_SYNC_VALUE;
|
||||
wait_until(&pSync[0], ROCSHMEM_CMP_EQ, flag_val);
|
||||
pSync[0] = ROCSHMEM_SYNC_VALUE;
|
||||
threadfence_system();
|
||||
}
|
||||
}
|
||||
@@ -69,8 +69,8 @@ __device__ void IPCContext::internal_atomic_barrier(int pe, int PE_start,
|
||||
int64_t *pSync) {
|
||||
int64_t flag_val = 1;
|
||||
if (pe == PE_start) {
|
||||
wait_until(&pSync[0], ROC_SHMEM_CMP_EQ, (int64_t)(n_pes - 1));
|
||||
pSync[0] = ROC_SHMEM_SYNC_VALUE;
|
||||
wait_until(&pSync[0], ROCSHMEM_CMP_EQ, (int64_t)(n_pes - 1));
|
||||
pSync[0] = ROCSHMEM_SYNC_VALUE;
|
||||
threadfence_system();
|
||||
|
||||
for (size_t i = 1, j = PE_start + stride; i < n_pes; ++i, j += stride) {
|
||||
@@ -78,8 +78,8 @@ __device__ void IPCContext::internal_atomic_barrier(int pe, int PE_start,
|
||||
}
|
||||
} else {
|
||||
amo_add<int64_t>(&pSync[0], flag_val, PE_start);
|
||||
wait_until(&pSync[0], ROC_SHMEM_CMP_EQ, flag_val);
|
||||
pSync[0] = ROC_SHMEM_SYNC_VALUE;
|
||||
wait_until(&pSync[0], ROCSHMEM_CMP_EQ, flag_val);
|
||||
pSync[0] = ROCSHMEM_SYNC_VALUE;
|
||||
threadfence_system();
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ __device__ void IPCContext::internal_sync(int pe, int PE_start, int stride,
|
||||
__syncthreads();
|
||||
}
|
||||
|
||||
__device__ void IPCContext::sync(roc_shmem_team_t team) {
|
||||
__device__ void IPCContext::sync(rocshmem_team_t team) {
|
||||
IPCTeam *team_obj = reinterpret_cast<IPCTeam *>(team);
|
||||
|
||||
int pe = team_obj->my_pe_in_world;
|
||||
|
||||
@@ -86,16 +86,16 @@ class IPCHostContext : public Context {
|
||||
long *p_sync);
|
||||
|
||||
template <typename T>
|
||||
__host__ void broadcast(roc_shmem_team_t team, T *dest, const T *source,
|
||||
__host__ void broadcast(rocshmem_team_t team, T *dest, const T *source,
|
||||
int nelems, int pe_root);
|
||||
|
||||
template <typename T, ROC_SHMEM_OP Op>
|
||||
template <typename T, ROCSHMEM_OP Op>
|
||||
__host__ void to_all(T *dest, const T *source, int nreduce, int pe_start,
|
||||
int log_pe_stride, int pe_size, T *p_wrk,
|
||||
long *p_sync);
|
||||
|
||||
template <typename T, ROC_SHMEM_OP Op>
|
||||
__host__ int reduce(roc_shmem_team_t team, T *dest, const T *source, int nreduce);
|
||||
template <typename T, ROCSHMEM_OP Op>
|
||||
__host__ int reduce(rocshmem_team_t team, T *dest, const T *source, int nreduce);
|
||||
|
||||
template <typename T>
|
||||
__host__ void wait_until(T *ivars, int cmp, T val);
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
#define LIBRARY_SRC_IPC_CONTEXT_TMPL_DEVICE_HPP_
|
||||
|
||||
#include "config.h" // NOLINT(build/include_subdir)
|
||||
#include "roc_shmem/roc_shmem.hpp"
|
||||
#include "rocshmem/rocshmem.hpp"
|
||||
#include "context_ipc_device.hpp"
|
||||
#include "../util.hpp"
|
||||
#include "ipc_team.hpp"
|
||||
#include "../roc_shmem_calc.hpp"
|
||||
#include "../rocshmem_calc.hpp"
|
||||
|
||||
namespace rocshmem {
|
||||
|
||||
@@ -153,7 +153,7 @@ __device__ T IPCContext::amo_fetch_cas(void *dest, T value, T cond, int pe) {
|
||||
}
|
||||
|
||||
// Collectives
|
||||
template <typename T, ROC_SHMEM_OP Op>
|
||||
template <typename T, ROCSHMEM_OP Op>
|
||||
__device__ void compute_reduce(T *src, T *dst, int size, int wg_id,
|
||||
int wg_size) {
|
||||
for (size_t i = wg_id; i < size; i += wg_size) {
|
||||
@@ -162,7 +162,7 @@ __device__ void compute_reduce(T *src, T *dst, int size, int wg_id,
|
||||
__syncthreads();
|
||||
}
|
||||
|
||||
template <typename T, ROC_SHMEM_OP Op>
|
||||
template <typename T, ROCSHMEM_OP Op>
|
||||
__device__ void IPCContext::internal_direct_allreduce(
|
||||
T *dst, const T *src, int nelems, IPCTeam *team_obj) { // NOLINT(runtime/int)
|
||||
|
||||
@@ -203,7 +203,7 @@ __device__ void IPCContext::internal_direct_allreduce(
|
||||
if (i != pe) {
|
||||
// Wait for leader thread to see that the buffer is ready.
|
||||
if (is_thread_zero_in_block()) {
|
||||
wait_until(&pSync[i], ROC_SHMEM_CMP_EQ, flag_val);
|
||||
wait_until(&pSync[i], ROCSHMEM_CMP_EQ, flag_val);
|
||||
}
|
||||
__syncthreads();
|
||||
|
||||
@@ -216,7 +216,7 @@ __device__ void IPCContext::internal_direct_allreduce(
|
||||
__syncthreads();
|
||||
|
||||
for (int i = wg_id; i < num_pes; i += wg_size) {
|
||||
pSync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
pSync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
}
|
||||
threadfence_system();
|
||||
__syncthreads();
|
||||
@@ -278,7 +278,7 @@ __device__ void IPCContext::internal_direct_allreduce(
|
||||
* [02+12+22+32] [02+12+22+32] [02+12+22+32] [02+12+22+32]
|
||||
* [03+13+23+33] [03+13+23+33] [03+13+23+33] [03+13+23+33]
|
||||
*/
|
||||
template <typename T, ROC_SHMEM_OP Op>
|
||||
template <typename T, ROCSHMEM_OP Op>
|
||||
__device__ void IPCContext::internal_ring_allreduce(
|
||||
T *dst, const T *src, int nelems, IPCTeam *team_obj, // NOLINT(runtime/int)
|
||||
int n_seg, int seg_size, int chunk_size) {
|
||||
@@ -323,7 +323,7 @@ __device__ void IPCContext::internal_ring_allreduce(
|
||||
#if defined(__gfx90a__)
|
||||
__threadfence_system();
|
||||
#endif /* __gfx90a__ */
|
||||
wait_until(&pSync[iter], ROC_SHMEM_CMP_EQ, wait_val);
|
||||
wait_until(&pSync[iter], ROCSHMEM_CMP_EQ, wait_val);
|
||||
}
|
||||
__syncthreads();
|
||||
compute_reduce<T, Op>(&pWrk[off_recv], &dst[off_seg + off_recv],
|
||||
@@ -344,7 +344,7 @@ __device__ void IPCContext::internal_ring_allreduce(
|
||||
#if defined(__gfx90a__)
|
||||
__threadfence_system();
|
||||
#endif /* __gfx90a__ */
|
||||
wait_until(&pSync[iter], ROC_SHMEM_CMP_EQ, wait_val);
|
||||
wait_until(&pSync[iter], ROCSHMEM_CMP_EQ, wait_val);
|
||||
}
|
||||
__syncthreads();
|
||||
}
|
||||
@@ -352,13 +352,13 @@ __device__ void IPCContext::internal_ring_allreduce(
|
||||
__syncthreads();
|
||||
|
||||
for (size_t i = wg_id; i < 2 * num_pes - 2; i += wg_size) {
|
||||
pSync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
pSync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
}
|
||||
__syncthreads();
|
||||
}
|
||||
|
||||
template <typename T, ROC_SHMEM_OP Op>
|
||||
__device__ int IPCContext::reduce(roc_shmem_team_t team, T *dest,
|
||||
template <typename T, ROCSHMEM_OP Op>
|
||||
__device__ int IPCContext::reduce(rocshmem_team_t team, T *dest,
|
||||
const T *source, int nreduce) {
|
||||
IPCTeam *team_obj = reinterpret_cast<IPCTeam *>(team);
|
||||
|
||||
@@ -367,14 +367,14 @@ __device__ int IPCContext::reduce(roc_shmem_team_t team, T *dest,
|
||||
size_t direct_pWrk = PE_size * nreduce;
|
||||
size_t direct_pSync = PE_size;
|
||||
size_t ring_pSync = 2 * PE_size;
|
||||
size_t provided_pWrk = max(nreduce / 2 + 1, ROC_SHMEM_REDUCE_MIN_WRKDATA_SIZE);
|
||||
size_t provided_pSync = ROC_SHMEM_REDUCE_SYNC_SIZE;
|
||||
size_t provided_pWrk = max(nreduce / 2 + 1, ROCSHMEM_REDUCE_MIN_WRKDATA_SIZE);
|
||||
size_t provided_pSync = ROCSHMEM_REDUCE_SYNC_SIZE;
|
||||
|
||||
if (provided_pWrk >= direct_pWrk && provided_pSync >= direct_pSync) {
|
||||
internal_direct_allreduce<T, Op>(dest, source, nreduce, team_obj);
|
||||
} else {
|
||||
if (ring_pSync <= ROC_SHMEM_REDUCE_SYNC_SIZE) {
|
||||
size_t ring_pWrk = ROC_SHMEM_REDUCE_MIN_WRKDATA_SIZE;
|
||||
if (ring_pSync <= ROCSHMEM_REDUCE_SYNC_SIZE) {
|
||||
size_t ring_pWrk = ROCSHMEM_REDUCE_MIN_WRKDATA_SIZE;
|
||||
// integer division truncating value
|
||||
int chunk_size = ring_pWrk / PE_size;
|
||||
int seg_size = chunk_size * PE_size;
|
||||
@@ -410,10 +410,10 @@ __device__ int IPCContext::reduce(roc_shmem_team_t team, T *dest,
|
||||
}
|
||||
} else {
|
||||
GPU_DPRINTF("Unsupported reduction size for IPC conduit.\n");
|
||||
return ROC_SHMEM_ERROR;
|
||||
return ROCSHMEM_ERROR;
|
||||
}
|
||||
}
|
||||
return ROC_SHMEM_SUCCESS;
|
||||
return ROCSHMEM_SUCCESS;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -439,7 +439,7 @@ __device__ void IPCContext::internal_get_broadcast(
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__device__ void IPCContext::broadcast(roc_shmem_team_t team, T *dst,
|
||||
__device__ void IPCContext::broadcast(rocshmem_team_t team, T *dst,
|
||||
const T *src, int nelems, int pe_root) {
|
||||
IPCTeam *team_obj = reinterpret_cast<IPCTeam *>(team);
|
||||
|
||||
@@ -471,13 +471,13 @@ __device__ void IPCContext::internal_broadcast(T *dst, const T *src, int nelems,
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__device__ void IPCContext::alltoall(roc_shmem_team_t team, T *dst,
|
||||
__device__ void IPCContext::alltoall(rocshmem_team_t team, T *dst,
|
||||
const T *src, int nelems) {
|
||||
alltoall_linear(team, dst, src, nelems);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__device__ void IPCContext::alltoall_linear(roc_shmem_team_t team, T *dst,
|
||||
__device__ void IPCContext::alltoall_linear(rocshmem_team_t team, T *dst,
|
||||
const T *src, int nelems) {
|
||||
IPCTeam *team_obj = reinterpret_cast<IPCTeam *>(team);
|
||||
|
||||
@@ -500,13 +500,13 @@ __device__ void IPCContext::alltoall_linear(roc_shmem_team_t team, T *dst,
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__device__ void IPCContext::fcollect(roc_shmem_team_t team, T *dst,
|
||||
__device__ void IPCContext::fcollect(rocshmem_team_t team, T *dst,
|
||||
const T *src, int nelems) {
|
||||
fcollect_linear(team, dst, src, nelems);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__device__ void IPCContext::fcollect_linear(roc_shmem_team_t team, T *dst,
|
||||
__device__ void IPCContext::fcollect_linear(rocshmem_team_t team, T *dst,
|
||||
const T *src, int nelems) {
|
||||
IPCTeam *team_obj = reinterpret_cast<IPCTeam *>(team);
|
||||
|
||||
|
||||
@@ -93,13 +93,13 @@ __host__ void IPCHostContext::broadcast(
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__host__ void IPCHostContext::broadcast(roc_shmem_team_t team, T *dest,
|
||||
__host__ void IPCHostContext::broadcast(rocshmem_team_t team, T *dest,
|
||||
const T *source, int nelems,
|
||||
int pe_root) {
|
||||
host_interface->broadcast<T>(team, dest, source, nelems, pe_root);
|
||||
}
|
||||
|
||||
template <typename T, ROC_SHMEM_OP Op>
|
||||
template <typename T, ROCSHMEM_OP Op>
|
||||
__host__ void IPCHostContext::to_all(T *dest, const T *source, int nreduce,
|
||||
int pe_start, int log_pe_stride,
|
||||
int pe_size, T *p_wrk,
|
||||
@@ -108,8 +108,8 @@ __host__ void IPCHostContext::to_all(T *dest, const T *source, int nreduce,
|
||||
pe_size, p_wrk, p_sync);
|
||||
}
|
||||
|
||||
template <typename T, ROC_SHMEM_OP Op>
|
||||
__host__ int IPCHostContext::reduce(roc_shmem_team_t team, T *dest,
|
||||
template <typename T, ROCSHMEM_OP Op>
|
||||
__host__ int IPCHostContext::reduce(rocshmem_team_t team, T *dest,
|
||||
const T *source, int nreduce) {
|
||||
return host_interface->reduce<T, Op>(team, dest, source, nreduce);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class IPCDefaultContextProxy {
|
||||
auto ctx{proxy_.get()};
|
||||
new (ctx) IPCContext(reinterpret_cast<Backend*>(backend));
|
||||
ctx->tinfo = tinfo;
|
||||
roc_shmem_ctx_t local{ctx, tinfo};
|
||||
rocshmem_ctx_t local{ctx, tinfo};
|
||||
set_internal_ctx(&local);
|
||||
}
|
||||
|
||||
@@ -89,4 +89,4 @@ using IPCDefaultContextProxyT = IPCDefaultContextProxy<HIPAllocator>;
|
||||
|
||||
} // namespace rocshmem
|
||||
|
||||
#endif // LIBRARY_SRC_IPC_CONTEXT_PROXY_HPP_
|
||||
#endif // LIBRARY_SRC_IPC_CONTEXT_PROXY_HPP_
|
||||
|
||||
@@ -38,17 +38,17 @@ IPCTeam::IPCTeam(Backend *backend, TeamInfo *team_info_parent,
|
||||
pool_index_ = pool_index;
|
||||
|
||||
barrier_pSync =
|
||||
&(b->barrier_pSync_pool[pool_index * ROC_SHMEM_BARRIER_SYNC_SIZE]);
|
||||
&(b->barrier_pSync_pool[pool_index * ROCSHMEM_BARRIER_SYNC_SIZE]);
|
||||
reduce_pSync =
|
||||
&(b->reduce_pSync_pool[pool_index * ROC_SHMEM_REDUCE_SYNC_SIZE]);
|
||||
bcast_pSync = &(b->bcast_pSync_pool[pool_index * ROC_SHMEM_BCAST_SYNC_SIZE]);
|
||||
&(b->reduce_pSync_pool[pool_index * ROCSHMEM_REDUCE_SYNC_SIZE]);
|
||||
bcast_pSync = &(b->bcast_pSync_pool[pool_index * ROCSHMEM_BCAST_SYNC_SIZE]);
|
||||
alltoall_pSync =
|
||||
&(b->alltoall_pSync_pool[pool_index * ROC_SHMEM_ALLTOALL_SYNC_SIZE]);
|
||||
&(b->alltoall_pSync_pool[pool_index * ROCSHMEM_ALLTOALL_SYNC_SIZE]);
|
||||
|
||||
pWrk = reinterpret_cast<char *>(b->pWrk_pool) +
|
||||
ROC_SHMEM_REDUCE_MIN_WRKDATA_SIZE * sizeof(double) * pool_index;
|
||||
ROCSHMEM_REDUCE_MIN_WRKDATA_SIZE * sizeof(double) * pool_index;
|
||||
pAta = reinterpret_cast<char *>(b->pAta_pool) +
|
||||
ROC_SHMEM_ATA_MAX_WRKDATA_SIZE * sizeof(double) * pool_index;
|
||||
ROCSHMEM_ATA_MAX_WRKDATA_SIZE * sizeof(double) * pool_index;
|
||||
}
|
||||
|
||||
IPCTeam::~IPCTeam() {}
|
||||
|
||||
Reference in New Issue
Block a user