Perftest: fix compiling with CUDA 13#376
Conversation
| printf("creating CUDA Ctx\n"); | ||
|
|
||
| /* Create context */ | ||
| #if CUDA_VER >= 13000 |
There was a problem hiding this comment.
(a) Here is another CUDA_VER that should be CUDA_VERSION (haven't searched if there are furhter ones), and (b) should your new CUDA 13 CI testing have caught this?
(I'm not an actual user -- this is just a drive-by comment; I found this PR here while researching solutions for similar CUDA 13 cuCtxCreate breakage in https://github.com/SourceryTools/nvptx-tools.)
There was a problem hiding this comment.
Oops, thanks for the review! I think the CI didn't catch it because configure.ac defines CUDA_VER (extracted from CUDA_VERSION in cuda.h), so both macros end up with the same value during the CI build. But I agree that's not ideal — if the CUDA toolkit on the system is upgraded without re-running ./configure, CUDA_VER would be stale and the wrong preprocessor branch would be taken.
As for the compatibility question, I think we could use cuCtxCreate_v2 directly instead of relying on the unversioned cuCtxCreate symbol, which would let us keep compatibility between CUDA 12 and CUDA 13 without needing the #if altogether.
|
Thanks for the PR @Yue-ByteDance. |
cuGetProcAddress resolves versioned driver entry points from the requested CUDA version, not from the headers used to compile perftest. Request the CUDA 3.2 cuCtxCreate ABI explicitly and keep the function pointer plus call site on the three-argument cuCtxCreate_v2 signature, even when CUDA 13 headers expose a newer default cuCtxCreate prototype. The stale configure-generated CUDA_VER macro is removed because source now uses CUDA_VERSION from cuda.h for compile-time checks. The existing CUDA_VER_* constants remain local names for explicit driver-entry ABI request versions. Signed-off-by: Zelong Yue <yuezelong@bytedance.com>
Add an Ubuntu 24.04 GitHub Actions job that installs CUDA 13.1 and builds perftest against the CUDA headers. This keeps the CUDA loader compatibility path covered by CI after the driver API signature changes in CUDA 13. Signed-off-by: Zelong Yue <yuezelong@bytedance.com>
a291222 to
dafceed
Compare
cuda.honly definesCUDA_VERSIONbut notCUDA_VER, change it to the correct macro.