Lightning-AI / Lightning-AI/lightning-thunder

make traces own proxies and bsyms

Open
#1,606 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Currently, we do not guard against inconsistencies in traces resulting from proxies not being linked to them except through the names attribute.

This proposes to change it:
- make the "names" set into a dict name->proxy,
- make `Proxy.owning_trace` / `BoundSymbol.owning_trace` a weak ref to the owning trace,
- have a mechanism to copy proxies and bsyms to a trace,
- enforce (at least in debug mode but maybe in general?) that a proxy/bsym is used in a trace only if it is in names and the owning trace is using it.

Note that many of the hard to debug "key error" issues in 2024 came from inconsistencies that would be disallowed.

cc @mruberry @lantiga @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

No files or tests are named. Start by locating the Trace, Proxy, and BoundSymbol definitions and the current names handling, then trace how proxies and bound symbols are associated with traces; done means ownership, copying, and consistency checks are designed and covered for the stated invariants.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.