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

Support multiple functions in Python frontend #1312

Open
AlexanderViand-Intel opened this issue Jan 25, 2025 · 1 comment
Open

Support multiple functions in Python frontend #1312

AlexanderViand-Intel opened this issue Jan 25, 2025 · 1 comment
Labels
python Pull requests that update Python code

Comments

@AlexanderViand-Intel
Copy link
Collaborator

Currently, the frontend primarily relies on a decorator that captures a single function.

@heir.compile()
def foo():
    # ....

There seem to be (at least) two ways to achieve multiple function support:

  • have multiple decorated functions and use global state to collect all the functions
  • use a ContextManager:
    with heir.compile(): 
       def foo():
          # ....
        
        def bar():
           # ....

I'm currently leaning towards the latter version, but since there's plenty of C++-side work that needs to be done first to fully support this, we have some time to decide.

@AlexanderViand-Intel AlexanderViand-Intel added the python Pull requests that update Python code label Jan 25, 2025
@j2kun
Copy link
Collaborator

j2kun commented Jan 26, 2025

This implies the functions are calling each other, and I feel like we need to solve this in the compiler first before doing the frontend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests that update Python code
Projects
None yet
Development

No branches or pull requests

2 participants