Lightning-AI/lightning-thunder

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

Open

#121 opened on Apr 2, 2024

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Python (114 forks)github user discovery
enhancementhelp wanted

Repository metrics

Stars
 (1,460 stars)
PR merge metrics
 (PR metrics pending)

Description

🚀 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.

Contributor guide