Add default context alltoall API (#350)

[ROCm/rocshmem commit: fddbe7b15d]
Dieser Commit ist enthalten in:
Yiltan verfasst und GitHub committed 2025-12-10 11:43:15 -05:00
1 Ursprung 972893bab2
Commit 258d264ecc
4 Dateien geändert
+69 -9

Keine Dateien entsprechen Ihrer Suche

+26 -9
Datei anzeigen
@@ -534,15 +534,24 @@ __device__ void rocshmem_broadcast_wg(rocshmem_ctx_t ctx,
}
template <typename T>
__device__ void rocshmem_alltoall_wg(rocshmem_ctx_t ctx,
rocshmem_team_t team, T *dest,
const T *source, int nelem) {
GPU_DPRINTF("Function: rocshmem_alltoall_wg (ctx=%zd, team=%zd, dest=%p, source=%p, nelem=%d\n",
ctx.ctx_opaque, team, dest, source, nelem);
__device__ void rocshmem_ctx_alltoall_wg(rocshmem_ctx_t ctx,
rocshmem_team_t team, T *dest,
const T *source, int nelem) {
GPU_DPRINTF("Function: rocshmem_ctx_alltoall_wg (ctx=%zd, team=%zd, dest=%p, source=%p, nelem=%d\n",
ctx.ctx_opaque, team, dest, source, nelem);
get_internal_ctx(ctx)->alltoall<T>(team, dest, source, nelem);
}
template <typename T>
__device__ void rocshmem_alltoall_wg(rocshmem_team_t team, T *dest,
const T *source, int nelem) {
GPU_DPRINTF("Function: rocshmem_alltoall_wg (ctx=%zd, team=%zd, dest=%p, source=%p, nelem=%d\n",
ctx.ctx_opaque, team, dest, source, nelem);
get_internal_ctx(ROCSHMEM_CTX_DEFAULT)->alltoall<T>(team, dest, source, nelem);
}
template <typename T>
__device__ void rocshmem_fcollect_wg(rocshmem_ctx_t ctx,
rocshmem_team_t team, T *dest,
@@ -666,8 +675,8 @@ __global__ ATTR_NO_INLINE void rocshmem_alltoallmem_kernel(rocshmem_team_t team,
// Call device alltoall function with created context and provided team
// Using char type since size is in bytes (1 byte per element)
rocshmem_alltoall_wg<char>(ctx, team, (char *) dest,
(const char *) source, (int) size);
rocshmem_ctx_alltoall_wg<char>(ctx, team, (char *) dest,
(const char *) source, (int) size);
if (ctx_result == 0) {
rocshmem_wg_ctx_destroy(&ctx);
@@ -1219,9 +1228,12 @@ __device__ int rocshmem_team_translate_pe(rocshmem_team_t src_team,
template __device__ void rocshmem_broadcast_wg<T>( \
rocshmem_ctx_t ctx, rocshmem_team_t team, T * dest, const T *source, \
int nelem, int pe_root); \
template __device__ void rocshmem_alltoall_wg<T>( \
template __device__ void rocshmem_ctx_alltoall_wg<T>( \
rocshmem_ctx_t ctx, rocshmem_team_t team, T * dest, const T *source, \
int nelem); \
template __device__ void rocshmem_alltoall_wg<T>( \
rocshmem_team_t team, T * dest, const T *source, \
int nelem); \
template __device__ void rocshmem_fcollect_wg<T>( \
rocshmem_ctx_t ctx, rocshmem_team_t team, T * dest, const T *source, \
int nelem); \
@@ -1536,7 +1548,12 @@ __device__ int rocshmem_team_translate_pe(rocshmem_team_t src_team,
__device__ void rocshmem_ctx_##TNAME##_alltoall_wg( \
rocshmem_ctx_t ctx, rocshmem_team_t team, T *dest, const T *source, \
int nelem) { \
rocshmem_alltoall_wg<T>(ctx, team, dest, source, nelem); \
rocshmem_ctx_alltoall_wg<T>(ctx, team, dest, source, nelem); \
} \
__device__ void rocshmem_##TNAME##_alltoall_wg( \
rocshmem_team_t team, T *dest, const T *source, \
int nelem) { \
rocshmem_alltoall_wg<T>(team, dest, source, nelem); \
} \
__device__ void rocshmem_ctx_##TNAME##_fcollect_wg( \
rocshmem_ctx_t ctx, rocshmem_team_t team, T *dest, const T *source, \