Lightning-AI / Lightning-AI/lightning-thunder

[symbolic values] Trace bakes in the initial value of input used for trace construction

Open
#2,789 2 comments 0 reactions 1 assignee View on GitHub

@kshitij12345 is already working on this.

Since Dec 11, 2025.

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

Description

Repro:

import thunder
import torch
import math

def fn(x, y):
    return x + y

tfn = thunder.jit(fn, cache="symbolic values")

tfn(1, 2)

print(thunder.last_traces(tfn)[-1])
# def computation(x, y):
#   # x: "int 1"
#   # y: "int 2"

#   # /opt/pytorch/lightning-thunder/test.py:6:       return x + y
#   i3 = operator.add(x, y)  # i3: "int 3"
#     # i3 = prims.add(x, y)  # i3: "int 3"
#   return (i3,)

tfn(1, 3)

print(thunder.last_traces(tfn)[-1])
# def computation(x, y):
#   # x: "int 1"
#   # y: "int 2"

#   # /opt/pytorch/lightning-thunder/test.py:6:       return x + y
#   i3 = operator.add(x, y)  # i3: "int 3"
#     # i3 = prims.add(x, y)  # i3: "int 3"
#   return (i3,)

Trace bakes in the initial values for # x: "int 1", # y: "int 2" which is confusing. It would be better to just print x: int.

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.