Lightning-AI / Lightning-AI/lightning-thunder

[Feature request] Optional debugging option to get trace with information on tensor strides along with tensor shapes

Open
#614 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

## 🚀 Feature Request

Currently we have computation traces with the generated tensor shapes as part of comments next to the computation like
```
t908 = torch.nn.functional.linear(t907, t19, t17) # t908: "cuda:0 bf16[1, 2048, 4096]"
# t908 = ltorch.linear(t907, t19, t17) # t908: "cuda:0 bf16[1, 2048, 4096]"
# t908 = prims.linear(t907, t19, t17) # t908: "cuda:0 bf16[1, 2048, 4096]"
```

However, there are some situations where stride information becomes necessary for debugging like #583 where a stride difference was creating an illegal memory access in one of the executors.
While my understanding is that Thunder consciously has made a decision to not include stride information in order to let backends manage strides on their own and not limit constructed traces to stride requirements. This feature request does not require changing that.

Given a set of fixed input tensors, can there be a way of generating computation traces with the tensor shapes and strides? There can be a mandatory requirement that such a trace can only be generated after one full iteration has executed so that strides can be recorded or such a trace can only be generated until a failed execution?

cc @carmocca @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 locating the computation-trace generation path described in the issue and inspect how fixed input tensors record shape metadata after execution. Done means a debugging option can produce traces containing both tensor shapes and strides without changing the existing stride-management behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
compilers, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.