Lightning-AI / Lightning-AI/lightning-thunder

Handle returning NamedTuples from the JIT

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

Nobody has claimed this yet.

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

Description

NamedTuples have (some) support in the interpreter, but to return them from the JIT, we would need some more things:

- ensure value tracking covers creation (populating the `attribute_wrappers`) - this is in interpreter,
- when seeing NamedTuples being returned, add epilogue code to create the NamedTuple from its contents (which are available),

This is nontrivial as it requires return values to be routed through the epilogue, but I don't think that is grave.

This is probably an intermediate to advanced issue for people fond of the JIT / frontend bits.

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

Read the interpreter's NamedTuple handling and how value tracking populates attribute_wrappers, then trace how JIT return values move through the epilogue. Done means NamedTuples can be constructed from their available contents when returned from the JIT, with return values routed through the epilogue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.