Skip to content

mpl/gpu: fix conversions/comparisons between runtime/driver API enums - #7923

Open
nmnobre wants to merge 4 commits into
pmodels:mainfrom
nmnobre:warnings
Open

mpl/gpu: fix conversions/comparisons between runtime/driver API enums#7923
nmnobre wants to merge 4 commits into
pmodels:mainfrom
nmnobre:warnings

Conversation

@nmnobre

@nmnobre nmnobre commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Pull Request Description

Fixes conversions and comparisons between different CUDA runtime and driver API enum types:

  CC       src/gpu/mpl_gpu_cuda.lo
../../../mpich/src/mpl/src/gpu/mpl_gpu_cuda.c: In function 'MPL_gpu_ipc_handle_create':
../../../mpich/src/mpl/src/gpu/mpl_gpu_cuda.c:146:9: warning: implicit conversion from 'CUresult' {aka 'enum cudaError_enum'} to 'cudaError_t' {aka 'enum cudaError'} [-Wenum-conversion]
  146 |     ret = cuPointerGetAttribute(&ipc_handle->id, CU_POINTER_ATTRIBUTE_BUFFER_ID, (CUdeviceptr) ptr);
      |         ^
In file included from ../../../mpich/src/mpl/src/gpu/mpl_gpu_cuda.c:9:
../../../mpich/src/mpl/src/gpu/mpl_gpu_cuda.c: In function 'MPL_gpu_get_buffer_id':
../../../mpich/src/mpl/src/gpu/mpl_gpu_cuda.c:200:16: warning: comparison between 'CUresult' {aka 'enum cudaError_enum'} and 'enum cudaError' [-Wenum-compare]
  200 |     assert(ret == cudaSuccess);
      |                ^~
../../../mpich/src/mpl/src/gpu/mpl_gpu_cuda.c: In function 'MPL_gpu_ipc_handle_is_valid':
../../../mpich/src/mpl/src/gpu/mpl_gpu_cuda.c:211:16: warning: comparison between 'CUresult' {aka 'enum cudaError_enum'} and 'enum cudaError' [-Wenum-compare]
  211 |     assert(ret == cudaSuccess);
      |                ^~

Also removes HI_ERR_CHECK(), currently only used to check the return value of hipMemGetAddressRange(), which is of type hipError_t, so should compare with hipSuccess instead:

In file included from ../../../mpich/src/mpl/include/mpl.h:9:
../../../mpich/src/mpl/src/gpu/mpl_gpu_hip.c: In function 'MPL_gpu_get_buffer_bounds':
../../../mpich/src/mpl/src/gpu/mpl_gpu_hip.c:12:46: warning: comparison between 'hipError_t' and 'enum <anonymous>' [-Wenum-compare]
   12 | #define HI_ERR_CHECK(ret) if (unlikely((ret) != HIP_SUCCESS)) goto fn_fail
      |                                              ^~
../../../mpich/src/mpl/include/mpl_base.h:81:42: note: in definition of macro 'unlikely'
   81 | #define unlikely(x_) __builtin_expect(!!(x_),0)
      |                                          ^~
../../../mpich/src/mpl/src/gpu/mpl_gpu_hip.c:448:5: note: in expansion of macro 'HI_ERR_CHECK'
  448 |     HI_ERR_CHECK(hiret);
      |     ^~~~~~~~~~~~

Plus an unused variable:

../../../mpich/src/mpl/src/gpu/mpl_gpu_hip.c: In function 'MPL_gpu_init':
../../../mpich/src/mpl/src/gpu/mpl_gpu_hip.c:358:17: warning: unused variable 'global_dev_id' [-Wunused-variable]
  358 |             int global_dev_id;
      |                 ^~~~~~~~~~~~~

@nmnobre nmnobre changed the title Warnings Fix conversions and comparisons between CUDA runtime and driver API enum types: Aug 5, 2026
@nmnobre nmnobre changed the title Fix conversions and comparisons between CUDA runtime and driver API enum types: Fix conversions/comparisons between CUDA runtime/driver API enums Aug 5, 2026
@nmnobre nmnobre changed the title Fix conversions/comparisons between CUDA runtime/driver API enums mpl/gpu/cuda: fix conversions/comparisons between CUDA runtime/driver API enums Aug 5, 2026
@nmnobre nmnobre changed the title mpl/gpu/cuda: fix conversions/comparisons between CUDA runtime/driver API enums mpl/gpu: fix conversions/comparisons between runtime/driver API enums Aug 5, 2026

@hzhou hzhou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hzhou

hzhou commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

test:mpich/ch4/gpu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants