Lightning-AI / Lightning-AI/lightning-thunder
Apply `set_execution_file` to specific traces such as forward/backward execution traces
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 121
- PR merge metrics
- No merged PRs in 30d
Description
With https://github.com/Lightning-AI/lightning-thunder/blob/621dce773148e46f4a01a86cbafcb4032eabfcb9/thunder/core/trace.py#L671, we can modify traces before execution, but it seems that every `TraceCtx.python_callable()` call gets affected by the function according to https://github.com/Lightning-AI/lightning-thunder/blob/621dce773148e46f4a01a86cbafcb4032eabfcb9/thunder/core/trace.py#L495-L508.
From my point of view, the number of traces we'd want to modify would be 1 or 2: forward execution trace and/or backward execution trace.
Thus I think it'd be helpful to have an option to only make [`set_execution_callback_file`](https://github.com/Lightning-AI/lightning-thunder/blob/621dce773148e46f4a01a86cbafcb4032eabfcb9/thunder/__init__.py#L225) effective to the two traces mentioned above.
cc @borda @mruberry
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 in thunder/core/trace.py around set_execution_file and TraceCtx.python_callable(), then inspect thunder/__init__.py around set_execution_callback_file. Trace how forward and backward execution traces are created and selected; done means the callback affects only the intended trace or traces without changing other TraceCtx.python_callable() calls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100