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

[Relax] Expose BlockBuilder's Analyzer instance in Python #17548

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

oskar-inceptron
Copy link

It is currently not possible to access a BlockBuilder's Analyzer instance from Python code, which would be useful e.g. when converting from front-end representations to Relax.

This PR addresses that by adding a get_analyzer method to the Python BlockBuilder class. Behind the scenes, it uses the same FFI and code paths as when creating a standalone Python Analyzer, the only difference being where the underlying C++ instance originates from. To avoid object lifetime issues in Python code (which would be surprising given that it is a memory managed language), a C++ BlockBuilder's Analyzer field is now a shared pointer.

@Hzfengsy
Copy link
Member

Hzfengsy commented Dec 6, 2024

cc @tqchen

@tqchen
Copy link
Member

tqchen commented Dec 10, 2024

thanks @oskar-inceptron If we want to go towards this directly, a better approach is to make Analyzer an Object, so we can use ObjectPtr for this

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

Successfully merging this pull request may close these issues.

3 participants