Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make trace introspection available as methods or attribute accesses on functions returned by Thunder #1418

Open
IvanYashchuk opened this issue Nov 8, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@IvanYashchuk
Copy link
Collaborator

🚀 Feature

Make trace introspection available as methods or attribute accesses on functions returned by thunder.jit.

Looking at the last traces of a thunder callable currently requires importing Thunder explicitly. They are currently hidden behind ._lc_cs attribute:

fn_._lc_cs = cs

@IvanYashchuk IvanYashchuk added the enhancement New feature or request label Nov 8, 2024
@t-vi
Copy link
Collaborator

t-vi commented Nov 8, 2024

We should not add alternative ways to do things much, it is good when there is only one way to achieve things.
What's bad with using thunder.last_traces?

@IvanYashchuk
Copy link
Collaborator Author

There's nothing bad with thunder.last_traces, the alternative is better:

@thunder.jit
def f():
    pass

# Call once ...
f()
# ... and access the traces with
f.last_traces

It doesn't matter in scripts but it's more friendly to REPL development and exploration. Users can hit TAB and see what can be done with this object that thunder.jit returns.
With thunder.last_traces as a free function there's an additional effort involved of knowing and understanding which objects are allowed to be passed to thunder.last_traces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants