bugfix: do not dereference ctx during create_ctx if we did run out (#83)

This commit is contained in:
Aurelien Bouteiller
2025-04-16 10:37:44 -04:00
committed by GitHub
parent f6ef19f5a9
commit 9befbe8293
2 changed files with 11 additions and 3 deletions
+6 -2
View File
@@ -289,7 +289,9 @@ __device__ int rocshmem_wg_ctx_create(long option, rocshmem_ctx_t *ctx) {
if (get_flat_block_id() == 0) {
ctx->team_opaque = reinterpret_cast<TeamInfo *>(ROCSHMEM_CTX_DEFAULT.team_opaque);
result = device_backend_proxy->create_ctx(option, ctx);
reinterpret_cast<Context *>(ctx->ctx_opaque)->setFence(option);
if(result) {
reinterpret_cast<Context *>(ctx->ctx_opaque)->setFence(option);
}
}
__syncthreads();
return result == true ? 0 : -1;
@@ -308,7 +310,9 @@ __device__ int rocshmem_wg_team_create_ctx(rocshmem_team_t team, long options,
TeamInfo *info_wrt_world = team_obj->tinfo_wrt_world;
ctx->team_opaque = info_wrt_world;
result = device_backend_proxy->create_ctx(options, ctx);
reinterpret_cast<Context *>(ctx->ctx_opaque)->setFence(options);
if(result) {
reinterpret_cast<Context *>(ctx->ctx_opaque)->setFence(options);
}
}
__syncthreads();