Lightning-AI / Lightning-AI/lightning-thunder

`python_print` should support `*args`

Open
#314 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

## 🐛 Bug

```python
Traceback (most recent call last):
File "/home/carmocca/git/lightning-thunder/kk.py", line 8, in
y = cfn()
File "/home/carmocca/git/lightning-thunder/thunder/common.py", line 645, in _fn
trc_or_result = trace(compile_data=cd)(cd.processed_function, *args, **kwargs)
File "/home/carmocca/git/lightning-thunder/thunder/common.py", line 480, in _trace
result = fn(*proxyargs, **proxykwargs)
File "", line 2, in fn
File "/home/carmocca/git/lightning-thunder/thunder/core/symbol.py", line 269, in __call__
result = self.meta(*args, **kwargs)
File "/home/carmocca/git/lightning-thunder/thunder/core/langctx.py", line 92, in _fn
result = fn(*args, **kwargs)
TypeError: _print_meta() takes 1 positional argument but 2 were given
```

### To Reproduce

```python
import thunder
from thunder.core.prims import python_print

def fn():
python_print("Hello", "world")

cfn = thunder.jit(fn)
y = cfn()
```

### Expected behavior

Works like `print`

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

Start at the python_print entry point imported from thunder.core.prims.py, then inspect the _print_meta call shown in the traceback. Reproduce the example with two arguments and verify that the compiled function accepts multiple positional arguments and behaves like print.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.