Skip to content

Compatible with cu132#686

Open
MARD1NO wants to merge 1 commit into
deepseek-ai:mainfrom
MARD1NO:compatible_with_cu132
Open

Compatible with cu132#686
MARD1NO wants to merge 1 commit into
deepseek-ai:mainfrom
MARD1NO:compatible_with_cu132

Conversation

@MARD1NO

@MARD1NO MARD1NO commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

cuStreamBatchMemOp_v1 has been deprecated

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);

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.

🟡 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);

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.

🔵 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

Copy link
Copy Markdown
Collaborator

🤖 ds-review-bot Code Review

v6

The 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.

v4

Verdict: 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 cuStreamBatchMemOp(历史上通过 dlsym 解析到 _v1 版本符号)在 cu132 中已被弃用。改动共涉及 2 个文件:1) csrc/utils/lazy_driver.hpp 中将惰性加载声明从 cuStreamBatchMemOp 改为 cuStreamBatchMemOp_v2,使 dlsym 查找到版本化的 cuStreamBatchMemOp_v2 符号;2) csrc/kernels/backend/cuda_driver.cu 中的 3 处调用点(batched_write、batched_wait、batched_write_and_wait,第 35/42/51 行)由 lazy_cuStreamBatchMemOp 统一更新为 lazy_cuStreamBatchMemOp_v2,与 header 声明保持一致,改动完整无遗漏,参数顺序与 _v2 签名匹配,功能语义未变。整体实现正确,能够解决 cu132 上的符号加载失败问题。

Files reviewed: 2
Issues found: 🟡 1 warning | 🔵 1 suggestion
Inline comments posted: 2

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