Lightning-AI / Lightning-AI/lightning-thunder

Support non_blocking in Tensor.to

Open
#197 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

import torch
import torch.nn as nn
import thunder
from thunder.core.transforms import grad, autocast
from thunder.examine import examine

def foo(x):
    return x.to(device='cpu', non_blocking=True)

x = torch.randn(3, device='cpu')

jfoo = thunder.jit(foo)

jfoo(x)

Error:

TypeError: to() got an unexpected keyword argument 'non_blocking'

This will also allow Tensor.cuda to model this argument as it calls to.

cc @apaz-cli

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.

Research direction

Start by running the Python reproduction in the issue and trace how Thunder handles the Tensor.to arguments. Done means to accepts non_blocking=True without the shown TypeError, and Tensor.cuda can model the same argument through to.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.