Compatible with cu132#686
Conversation
| DECL_LAZY_CUDA_DRIVER_FUNCTION(cuDeviceGet); | ||
| DECL_LAZY_CUDA_DRIVER_FUNCTION(cuDeviceGetAttribute); | ||
| DECL_LAZY_CUDA_DRIVER_FUNCTION(cuStreamBatchMemOp); | ||
| DECL_LAZY_CUDA_DRIVER_FUNCTION(cuStreamBatchMemOp_v2); |
There was a problem hiding this comment.
🟡 warning: The versionless cuStreamBatchMemOp is replaced by a hardcoded cuStreamBatchMemOp_v2. Because the lazy wrapper resolves the API both at compile time (against the cuda.h header) and at runtime (dlsym on the installed driver), this unconditionally drops compatibility with older CUDA toolkits/drivers (< 12) that export only the versionless/_v1 ABI. The previously used versionless alias existed precisely for that broader compatibility. Either add a runtime/compile-time availability/version guard (falling back to the versionless/legacy entrypoint), or explicitly document/require a CUDA 12+ baseline and bump the build accordingly.
🤖 v4
| DECL_LAZY_CUDA_DRIVER_FUNCTION(cuDeviceGet); | ||
| DECL_LAZY_CUDA_DRIVER_FUNCTION(cuDeviceGetAttribute); | ||
| DECL_LAZY_CUDA_DRIVER_FUNCTION(cuStreamBatchMemOp); | ||
| DECL_LAZY_CUDA_DRIVER_FUNCTION(cuStreamBatchMemOp_v2); |
There was a problem hiding this comment.
🔵 suggestion: 将 DECL_LAZY_CUDA_DRIVER_FUNCTION(cuStreamBatchMemOp) 改为 cuStreamBatchMemOp_v2 本身是正确的:该宏使用 decltype(&name) 推导函数类型并用 #name 作为 dlsym 查找的符号名,改为 _v2 后会正确加载版本化符号。需要注意兼容性:cuStreamBatchMemOp_v2 是在较新的 CUDA 版本中引入的,若项目仍需支持较旧的 CUDA toolkit 编译环境,decltype(&cuStreamBatchMemOp_v2) 会因头文件中缺少该声明而导致编译期报错。建议在文档或 CI 中明确受支持的最低 CUDA 版本,或对旧版本做条件编译回退。
🤖 v3
🤖 ds-review-bot Code Reviewv6The change consistently loads and calls the CUDA v2 batch memory operation API, which is available for the documented CUDA 12.3+ requirement. No regressions or actionable defects were found. v4Verdict: MERGE with a caveat. The MR makes the lazily-loaded CUDA driver entrypoint cuStreamBatchMemOp cu132-compatible by switching from the legacy, unversioned cuStreamBatchMemOp (which under cu132 is the deprecated alias of the _v1 ABI) to the explicit, non-deprecated cuStreamBatchMemOp_v2. This is done in the two affected files: the lazy-loading declaration in csrc/utils/lazy_driver.hpp and the three call sites in csrc/kernels/backend/cuda_driver.cu. The DECL_LAZY_CUDA_DRIVER_FUNCTION macro resolves the API at both compile time (decltype/alias against cuda.h) and runtime (dlsym), so the deprecated/removed unversioned symbol fails one or both of those under cu132, while _v2 is the stable entrypoint the project already relies on elsewhere (cuMemGetAddressRange_v2). The call arguments and CUstreamBatchMemOpParams usage are unaffected. The change is consistent and minimal. Caveat/concern summarized: hardcoding cuStreamBatchMemOp_v2 unconditionally drops source/runtime compatibility with older CUDA toolkits or drivers (< 12) that export only the versionless/_v1 ABI; this is only safe if the project already requires a CUDA 12+ baseline (which the existing cuMemGetAddressRange_v2 implies). Otherwise the unversioned alias was previously chosen for broader compatibility and should be replaced by a runtime/compile-time availability/version guard instead of a hardcoded v2. v3本次变更旨在兼容 CUDA 13.2 (cu132),因为驱动 API Files reviewed: 2 |
cuStreamBatchMemOp_v1 has been deprecated