Lightning-AI / Lightning-AI/lightning-thunder

Document TraceCtx.scopes or refactor the code removing scopes

Open
#935 0 comments 0 reactions 1 assignee View on GitHub

@crcrpar is already working on this.

Since Aug 6, 2024.

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

Description

## 🚀 Feature

TraceCtx.scopes is a list of scopes that are currently active in the trace context. Scopes are added to the list when they are entered and removed when they are exited. The list is ordered from the most recently entered scope to the least recently entered scope.
A current scope is the current list of bound symbols.

It's confusing when appending to a trace when to use scope vs bound_symbols. The request is to clarify that in the docstring of TraceCtx and provide an example of how to use scopes.

For example, why do we need to use `scopes` in the following code:

https://github.com/Lightning-AI/lightning-thunder/blob/36f46dde9b280784d8ff2a3a24e3a975fc67ffe1/thunder/executors/passes.py#L54

Why can't we just use `bound_symbols` or temporary TraceCtx objects?

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.