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

How do I access the ThunderModule if I'm compiling a function? #121

Open
carmocca opened this issue Apr 2, 2024 · 1 comment
Open

How do I access the ThunderModule if I'm compiling a function? #121

carmocca opened this issue Apr 2, 2024 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@carmocca
Copy link
Contributor

carmocca commented Apr 2, 2024

🚀 Feature

Motivation

Sometimes the code requires that a ThunderModule is passed, however, if the user is compiling a function that takes the module as an argument, the user doesn't have a way to get a reference to it.

For example, #96 implements a workaround for this issue with the no_sync context manager.

Pitch

Provide an API to get this reference. Maybe it's something like thunder.compile_data(jitted_function).module.

Additional context

The design might need to consider the presence of multiple ThunderModules.

@carmocca carmocca added enhancement New feature or request help wanted Extra attention is needed labels Apr 2, 2024
@kshitij12345
Copy link
Collaborator

I think another thing to consider would be if thunder.jit fuses an operation outside the module forward with operations in the forward.

def foo(module, x):
    return module(x) + 1  # it is likely that a FusionExecutor will fuse `+1` with the last functions in `module.forward`.

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

No branches or pull requests

2 participants