Skip to content

Commit

Permalink
gpu: add cvar MPIR_CVAR_GPU_HAS_WAIT_KERNEL
Browse files Browse the repository at this point in the history
Add cvar MPIR_CVAR_GPU_HAS_WAIT_KERNEL to supply yaksa_init with info
hint "yaksa_has_wait_kernel". With the hint, yaksa should avoid code
that may potentially dead lock with a wait kernel.
  • Loading branch information
hzhou committed Jul 21, 2022
1 parent fbd805b commit df052f5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/include/mpir_gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@
and we do not query the buffer type internally because we assume
no GPU buffer is use.
- name : MPIR_CVAR_GPU_HAS_WAIT_KERNEL
category : GPU
type : int
default : 0
class : none
verbosity : MPI_T_VERBOSITY_USER_BASIC
scope : MPI_T_SCOPE_ALL_EQ
description : >-
If set to 1, avoid allocate allocating GPU registered host buffers
for temporary buffers. When stream workq and GPU wait kernels are
in use, access APIs for GPU registered memory may cause deadlock.
=== END_MPI_T_CVAR_INFO_BLOCK ===
*/

Expand Down
8 changes: 7 additions & 1 deletion src/mpi/datatype/typerep/src/typerep_yaksa_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,13 @@ void MPIR_Typerep_init(void)
yaksa_info_keyval_append(MPII_yaksa_info_nogpu, "yaksa_gpu_driver", "nogpu", 6);

if (MPIR_CVAR_ENABLE_GPU) {
yaksa_init(NULL);
yaksa_info_t info = NULL;
if (MPIR_CVAR_GPU_HAS_WAIT_KERNEL) {
yaksa_info_create(&info);
yaksa_info_keyval_append(info, "yaksa_has_wait_kernel", "1", 2);
}

yaksa_init(info);
} else {
/* prevent yaksa to query gpu devices, which can be very expensive */
yaksa_init(MPII_yaksa_info_nogpu);
Expand Down

0 comments on commit df052f5

Please sign in to comment.