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
zatwierdzone przez GitHub
rodzic f6ef19f5a9
commit 9befbe8293
2 zmienionych plików z 11 dodań i 3 usunięć
@@ -51,9 +51,12 @@ __global__ void TeamCtxInfraTest(ShmemContextType ctx_type,
*/
rocshmem_wg_team_create_ctx(team[0], ctx_type, &ctx1);
assert (nullptr != ctx1.ctx_opaque);
rocshmem_wg_team_create_ctx(team[0], ctx_type, &ctx2);
assert (nullptr != ctx2.ctx_opaque);
rocshmem_wg_ctx_destroy(&ctx1);
rocshmem_wg_team_create_ctx(team[0], ctx_type, &ctx3);
assert (nullptr != ctx3.ctx_opaque);
__syncthreads();
@@ -73,6 +76,7 @@ __global__ void TeamCtxInfraTest(ShmemContextType ctx_type,
*/
for (int team_i = 0; team_i < NUM_TEAMS; team_i++) {
rocshmem_wg_team_create_ctx(team[team_i], ctx_type, &ctx[team_i]);
assert (nullptr != ctx.ctx_opaque);
}
if (ctx[0].team_opaque == ctx[NUM_TEAMS - 1].team_opaque) {
@@ -133,7 +137,7 @@ void TeamCtxInfraTester::launchKernel(dim3 gridSize, dim3 blockSize, int loop,
sizeof(rocshmem_team_t) * NUM_TEAMS, hipMemcpyHostToDevice));
hipLaunchKernelGGL(TeamCtxInfraTest, gridSize, blockSize, shared_bytes,
stream, _shmem_context, teams_on_device);
stream, _shmem_context, teams_on_device);
CHECK_HIP(hipFree(teams_on_device));
}