Skip to content

Perftest: fix compiling with CUDA 13#376

Open
Yue-ByteDance wants to merge 2 commits into
linux-rdma:masterfrom
Yue-ByteDance:yzl/fix-cuda-13
Open

Perftest: fix compiling with CUDA 13#376
Yue-ByteDance wants to merge 2 commits into
linux-rdma:masterfrom
Yue-ByteDance:yzl/fix-cuda-13

Conversation

@Yue-ByteDance
Copy link
Copy Markdown
Contributor

  • cuda.h only defines CUDA_VERSION but not CUDA_VER, change it to the correct macro.
  • Add CI for checking compiling with CUDA 13

Comment thread src/cuda_memory.c Outdated
printf("creating CUDA Ctx\n");

/* Create context */
#if CUDA_VER >= 13000
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

(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.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@sshaulnv
Copy link
Copy Markdown
Contributor

Thanks for the PR @Yue-ByteDance.
how is it different than this reverted PR? 42f5ec5

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

3 participants