Refactor Barrier_all and Sync_all APIs to use default context (#159)

* Refactor `Barrier_all` and `Sync_all` to use default context

- Removed context-specific implementations of barrier_all and sync_all
- Added barrier_all and sync_all to the default context implementation
- Updated functional tests to use the default context for barrier_all and sync_all

* Update `Barrier_all` and `Sync_all` API usage in documentation

* Update `CHANGELOG`

---------

Co-authored-by: Yiltan <ytemucin@amd.com>
Этот коммит содержится в:
Avinash Kethineedi
2025-06-17 11:16:18 -05:00
коммит произвёл GitHub
родитель 551603829c
Коммит bf48bcabf2
10 изменённых файлов: 115 добавлений и 130 удалений
+4 -7
Просмотреть файл
@@ -265,10 +265,9 @@ void IPCBackend::init_wrk_sync_buffer() {
auto max_num_teams{team_tracker.get_max_num_teams()};
/**
* size of barrier sync for all the contexts
* size of barrier sync
*/
Wrk_Sync_buffer_size_ += sizeof(*barrier_sync) * ROCSHMEM_BARRIER_SYNC_SIZE *
(maximum_num_contexts_ + 1);
Wrk_Sync_buffer_size_ += sizeof(*barrier_sync) * ROCSHMEM_BARRIER_SYNC_SIZE;
/**
* Size of sync arrays for the teams
@@ -367,9 +366,7 @@ void IPCBackend::rocshmem_collective_init() {
* Allocate heap space for barrier_sync
*/
size_t one_sync_size_bytes {sizeof(*barrier_sync)};
size_t total_sync_elems {
ROCSHMEM_BARRIER_SYNC_SIZE * (maximum_num_contexts_ + 1)};
size_t sync_size_bytes {one_sync_size_bytes * total_sync_elems};
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;
@@ -377,7 +374,7 @@ void IPCBackend::rocshmem_collective_init() {
/*
* Initialize the barrier synchronization array with default values.
*/
for (int i = 0; i < total_sync_elems; i++) {
for (int i = 0; i < num_pes; i++) {
barrier_sync[i] = ROCSHMEM_SYNC_VALUE;
}
+1 -3
Просмотреть файл
@@ -44,9 +44,7 @@ __host__ IPCContext::IPCContext(Backend *b, unsigned int ctx_id)
ipcImpl_.ipc_bases = b->ipcImpl.ipc_bases;
ipcImpl_.shm_size = b->ipcImpl.shm_size;
size_t barrier_sync_offset = ctx_id * ROCSHMEM_BARRIER_SYNC_SIZE;
barrier_sync = backend->barrier_sync + barrier_sync_offset;
barrier_sync = backend->barrier_sync;
fence_pool = backend->fence_pool;
Wrk_Sync_buffer_bases_ = backend->get_wrk_sync_bases();
ctx_id_ = ctx_id;