Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redefinition of CUstream with different type #510

Closed
Jacobfaib opened this issue Oct 23, 2024 · 1 comment · Fixed by #511
Closed

Redefinition of CUstream with different type #510

Jacobfaib opened this issue Oct 23, 2024 · 1 comment · Fixed by #511

Comments

@Jacobfaib
Copy link
Contributor

/Users/jfaibussowit/soft/nv/legate.core.internal/arch-cu-driver/cmake_build/_deps/kvikio-src/cpp/include/kvikio/shim/cuda_h_wrapper.hpp:36:7: error: type alias redefinition with different types ('void *' vs 'struct CUstream_st *')
   36 | using CUstream    = void*;
      |       ^
/Users/jfaibussowit/soft/nv/legate.core.internal/src/cpp/legate/cuda/cuda.h:35:7: note: previous definition is here
   35 | using CUstream = struct CUstream_st*;
      |       ^

This occurs when:

  1. Kvikio is built without CUDA.
  2. Kvikio headers are included in a library that also shims various CUDA driver types.

IMO, Kvikio should use the right typedefs for these to match the CUDA driver API. In our case, our forward decls do need to be ABI compatible with CUDA driver, since we dlsym() the driver at runtime, but do not want to introduce a build-time dependency on the driver API.

Specifically:

#if defined(_WIN64) || defined(__LP64__)
// Don't use uint64_t, we want to match the driver headers exactly
using CUdeviceptr = unsigned long long;
#else
using CUdeviceptr = unsigned int;
#endif
static_assert(sizeof(CUdeviceptr) == sizeof(void*));

using CUresult   = int;
using CUdevice   = int;
using CUcontext  = struct CUctx_st*;
using CUstream   = struct CUstream_st*;
using CUevent    = struct CUevent_st*;
using CUfunction = struct CUfunc_st*;
using CUlibrary  = struct CUlib_st*;
using CUkernel   = struct CUkern_st*;
@madsbk
Copy link
Member

madsbk commented Oct 23, 2024

Sounds good to me, can you submit a PR?

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 a pull request may close this issue.

2 participants