Lightning-AI / Lightning-AI/lightning-thunder
Add nvFuser support for thunder.torch.randn
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 121
- PR merge metrics
- No merged PRs in 30d
Description
## 🐛 Bug
```py
import thunder
import torch
@thunder.jit
def normal(shape, device):
return torch.randn(tuple(shape), device=device)
shape = [1, 4, 40, 84, 84]
t1 = normal(shape, device="cuda:0")
print(thunder.last_traces(normal)[-1]) # should have nvFusion0 there!
```
```py
def computation():
t6 = torch.randn((1, 4, 40, 84, 84), device=torch.device("cuda:0"), dtype=torch.float32) # t6: "cuda:0 f32[1, 4, 40, 84, 84]"
# t6 = ltorch.randn((1, 4, 40, 84, 84), generator=None, dtype=torch.float32, device=torch.device("cuda:0"), layout=torch.strided, requires_grad=False, pin_memory=False, out=None) # t6: "cuda:0 f32[1, 4, 40, 84, 84]"
# t6 = prims.randn((1, 4, 40, 84, 84), device=devices.Device("cuda:0"), dtype=dtypes.float32) # t6: "cuda:0 f32[1, 4, 40, 84, 84]"
return t6
```
cc @tfogal
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided thunder.jit example with the stated shape and CUDA device, then inspect the resulting trace from thunder.last_traces(normal)[-1]. Follow how torch.randn is lowered through the shown ltorch and prims forms and compare the trace with the expected nvFusion0 output. Done means the trace includes nvFuser for this reproducible case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100