Implement default RO context (#64)
* Allocate default context buffers and initialize queue for management
- Allocated the status flag, g return, and atomic return buffers for
the default context.
- Initialized `AtomicWFQueueProxy` instances to manage these buffers
efficiently for concurrent access.
* Update `BlockHandle` with default context buffers
* Add default context flag and update buffer retrieval functions
- Added a flag to distinguish the default context from other contexts.
- Modified return buffer functionns and `get_status_flag` function to accommodate
the default context
* Add default context primitive tests
- get, put, get_nbi, put_nbi, g, and p APIs.
[ROCm/rocshmem commit: 867519e1d0]
This commit is contained in:
committed by
GitHub
parent
7aecbdec4d
commit
7a4d1ac064
@@ -64,6 +64,10 @@ ROBackend::ROBackend(MPI_Comm comm)
|
||||
|
||||
max_wg_size_ = device_props.maxThreadsPerBlock;
|
||||
|
||||
wf_size_ = device_props.warpSize;
|
||||
|
||||
setup_default_ctx_buffers();
|
||||
|
||||
size_t num_buff_elems = maximum_num_contexts_ * max_wg_size_;
|
||||
|
||||
g_ret_buffer_ = RetBufferProxyT(num_buff_elems);
|
||||
@@ -113,7 +117,9 @@ ROBackend::ROBackend(MPI_Comm comm)
|
||||
default_block_handle_proxy_ = DefaultBlockHandleProxyT(
|
||||
g_ret_buffer_.get(),
|
||||
atomic_ret_buffer_.get(), &queue_,
|
||||
status_.get());
|
||||
status_.get(), default_ctx_status_.get(),
|
||||
default_ctx_g_ret_buffer_.get(),
|
||||
default_ctx_atomic_ret_buffer_.get());
|
||||
|
||||
TeamInfo *tinfo = team_tracker.get_team_world()->tinfo_wrt_world;
|
||||
|
||||
@@ -137,6 +143,37 @@ void ROBackend::setup_ctxs() {
|
||||
}
|
||||
}
|
||||
|
||||
void ROBackend::setup_default_ctx_buffers() {
|
||||
if (auto maximum_wf_buffers_str = getenv("ROCSHMEM_MAX_WF_BUFFERS")) {
|
||||
std::stringstream sstream(maximum_wf_buffers_str);
|
||||
sstream >> max_wavefront_buffers_;
|
||||
}
|
||||
|
||||
size_t num_buff_elems = max_wavefront_buffers_ * wf_size_;
|
||||
|
||||
g_ret_buffer_default_ctx_ = RetBufferProxyT(num_buff_elems);
|
||||
|
||||
atomic_ret_buffer_default_ctx_ = RetBufferProxyT(num_buff_elems);
|
||||
|
||||
status_default_ctx_ = StatusProxyT(num_buff_elems);
|
||||
|
||||
default_ctx_status_.get()->allocate_queue(max_wavefront_buffers_);
|
||||
default_ctx_g_ret_buffer_.get()->allocate_queue(max_wavefront_buffers_);
|
||||
default_ctx_atomic_ret_buffer_.get()->allocate_queue(max_wavefront_buffers_);
|
||||
|
||||
|
||||
char* status = status_default_ctx_.get();
|
||||
uint64_t* g_ret_buf = g_ret_buffer_default_ctx_.get();
|
||||
uint64_t* atomic_ret_buf = atomic_ret_buffer_default_ctx_.get();
|
||||
|
||||
for (int i{0}; i < max_wavefront_buffers_; i++) {
|
||||
int offset {i * wf_size_};
|
||||
default_ctx_status_.get()->push(status + offset);
|
||||
default_ctx_g_ret_buffer_.get()->push(g_ret_buf + offset);
|
||||
default_ctx_atomic_ret_buffer_.get()->push(atomic_ret_buf + offset);
|
||||
}
|
||||
}
|
||||
|
||||
ROBackend::~ROBackend() {
|
||||
ro_net_free_runtime();
|
||||
CHECK_HIP(hipFree(ctx_array));
|
||||
|
||||
Reference in New Issue
Block a user