Lightning-AI/lightning-thunder

Handle returning NamedTuples from the JIT

Open

#147 opened on Apr 9, 2024

 (0 comments) (0 reactions) (0 assignees)Python (114 forks)github user discovery
enhancementhelp wantedjit

Repository metrics

Stars
 (1,460 stars)
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