Skip to content

cuda.core: bump tensor bridge PyTorch upper-bound to 2.12#2099

Open
aryanputta wants to merge 1 commit into
NVIDIA:mainfrom
aryanputta:fix/pytorch-2-12-version-cap
Open

cuda.core: bump tensor bridge PyTorch upper-bound to 2.12#2099
aryanputta wants to merge 1 commit into
NVIDIA:mainfrom
aryanputta:fix/pytorch-2-12-version-cap

Conversation

@aryanputta
Copy link
Copy Markdown
Contributor

Closes #2089.

Problem

PyTorch 2.12 was released on ~May 14 2026. The version guard in _torch_version_check() (cuda_core/cuda/core/_memoryview.pyx) capped the AOTI tensor bridge at (2, 11), so _is_torch_tensor() returned False for any torch tensor under 2.12.

As a result, torch tensors fell through to the generic CAI/DLPack paths and raised:

BufferError: only CUDA Array Interface v3 or above is supported

Fix

Extend the upper bound from (2, 11) to (2, 12). The THPVariable struct layout (PyObject_HEAD followed by at::Tensor cdata) and the AtenTensorHandle == at::Tensor* identity are stable across PyTorch 2.x minor releases, as they have been across 2.3–2.11.

-    _torch_version_ok = (2, 3) <= (major, minor) <= (2, 11)
+    _torch_version_ok = (2, 3) <= (major, minor) <= (2, 12)

Testing

This change cannot be exercised without a PyTorch 2.12 build in CI. The existing tensor bridge tests (cuda_core/tests/) cover the code path; they will validate correctness once a 2.12 runner is available. The nightly CI matrix already references a latest PyTorch entry (see nightly.yml) which should pick up 2.12.

PyTorch 2.12 was released on ~May 14 2026.  The version guard in
_torch_version_check() capped the AOTI tensor bridge at (2, 11), causing
_is_torch_tensor() to return False for torch tensors under 2.12.  As a
result, torch tensors fell through to the generic CAI/DLPack paths and
raised:

  BufferError: only CUDA Array Interface v3 or above is supported

The THPVariable struct layout and AtenTensorHandle aliasing are stable
across PyTorch 2.x minor releases.  Extend the upper bound to (2, 12).

Closes NVIDIA#2089
@copy-pr-bot
Copy link
Copy Markdown
Contributor

copy-pr-bot Bot commented May 16, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.core Everything related to the cuda.core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bump tensor bridge version cap for PyTorch 2.12

1 participant