Skip to content

fix(build): add CUDA 13.2 support#368

Draft
CharryWu wants to merge 2 commits intoRust-GPU:mainfrom
CharryWu:fix/cuda-13.2-cumem-location-bindgen
Draft

fix(build): add CUDA 13.2 support#368
CharryWu wants to merge 2 commits intoRust-GPU:mainfrom
CharryWu:fix/cuda-13.2-cumem-location-bindgen

Conversation

@CharryWu
Copy link
Copy Markdown
Contributor

@CharryWu CharryWu commented Mar 26, 2026

Summary

  • In CUDA 13.2, the id field of CUmemLocation_st was placed inside an anonymous union. Bindgen exposes this as __bindgen_anon_1: CUmemLocation_st__bindgen_ty_1 instead of a direct id field on the struct.
  • The existing code (from commit 2623e21, "Fix CUDA 13 API issues") set id directly, which compiled on CUDA 13.0 but fails on 13.2.
  • Adds a cuMemLocation_anon_id cfg in build.rs (gated on driver_version >= 13020) and uses field-level #[cfg] at all 5 CUmemLocation construction sites so both CUDA 13.0 and 13.2 compile correctly.

Test plan

  • cargo build -p cust passes on CUDA 13.2 (Windows, RTX 3060, driver 595.79)
  • Verify cargo build -p cust still passes on CUDA 13.0 (Windows, Linux CI)

Attribution

This bugfix was implemented with the help of Claude Sonnet 4.6 and Cursor IDE

@CharryWu
Copy link
Copy Markdown
Contributor Author

@LegNeato Please hold off on this PR for now — Jimver/cuda-toolkit does not yet support CUDA 13.2.0 (Error: Version not available: 13.2.0), so the Windows CI matrix entry can't run, see CI output on my fork. I'll revisit once the action adds 13.2 support.

@CharryWu CharryWu marked this pull request as draft March 26, 2026 21:00
@CharryWu CharryWu changed the title fix(cust): use bindgen anonymous union for CUmemLocation_st.id on CUDA 13.2 fix(cust): support CUDA 13.2 Mar 26, 2026
@CharryWu CharryWu changed the title fix(cust): support CUDA 13.2 fix(build): add CUDA 13.2 support Mar 26, 2026
@LegNeato
Copy link
Copy Markdown
Contributor

LegNeato commented Mar 27, 2026

We have docker images for cuda 13 in https://github.com/Rust-GPU/rust-cuda/tree/e91b9cefc78258000f92d0978f327c907c515831/container for CI. They currently check 13.0...should we add 13.2? The matrix is starting to get big 🤔

@CharryWu CharryWu force-pushed the fix/cuda-13.2-cumem-location-bindgen branch from ed6fad8 to db5be61 Compare April 5, 2026 21:37
@CharryWu
Copy link
Copy Markdown
Contributor Author

CharryWu commented Apr 6, 2026

We have docker images for cuda 13 in e91b9ce/container for CI. They currently check 13.0...should we add 13.2? The matrix is starting to get big 🤔

Thx for checking. I think you definitely should: this repo aims to be the de facto full port CUDA kit/ecosystem of the Rust world 🦀, so any new official CUDA updates that introduce breaking changes shall be tested (new changes & regression). The Windows build dependency recently adds support of CUDA 13.2. I tested with their latest 0.2.35 release on Windows and it's passing.

For now, there're 2 pieces of 13.2 update: 1) this branch CharryWu:fix/cuda-13.2-cumem-location-bindgen which only fixes the breaking change in header (id field moved into anon union), and 2) update to the build matrix on CharryWu:ci/cuda-13.2-build-matrix. I have 2 questions before making this PR ready for review -

  1. Should I submit the build matrix update as separate PR against main of this repo, or should this PR contain all 13.2 updates (header fix + build matrix)?
  2. Is the release of ghcr.io/rust-gpu/rust-cuda-ubuntu24-cuda132:latest ghcr.io/rust-gpu/rust-cuda-rockylinux9-cuda132:latest automatic as soon as the Dockerfile gets merged into main, or is it gated by your Org account and needs manual approval?

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