Lightning-AI / Lightning-AI/lightning-thunder

Tensor.item should be disallowed in the CUDA Graphs region

Open
#727 1 comment 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

cudagraphs
Dominant language
Python
Stars
1.5k
Forks
121
PR merge metrics
No merged PRs in 30d

Description

Note: If you have a model or program that is not supported yet but should be, please use the program coverage template.

🐛 Bug

import thunder
import torch

def func(x):
    return x.sum().item()

a = torch.randn(3, 3, device="cuda")

jfunc = thunder.jit(func)
jfunc(a) # works!

jfunc = thunder.jit(func, use_cudagraphs=True)
jfunc(a) # fails!
File thunder.CUDAGraph0_fn_3:10, in CUDAGraph0_fn(***failed resolving arguments***)
      9 del x
---> 10 f1 = Tensor.item(t0)  # f1: "float ?"
     11 del t0

RuntimeError: CUDA error: operation not permitted when stream is capturing

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.