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

Python Frontend: Use Numba Type Inference #1253

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

AlexanderViand-Intel
Copy link
Collaborator

@AlexanderViand-Intel AlexanderViand-Intel commented Jan 9, 2025

Very much WIP,

This does a few things:

  • Enable Numba type inference and uses the inferred types to decide the MLIR type that gets emitted
  • Add an @mlir decorator that is a slightly modified version of numba's @intrinsic, with the main difference being that one can provide a pure python implementation and run it under python. This allows us to define, e.g., linalg.matmul and assign it np.matmul as its python implementation.
  • Changes a few defaults/adds a few options to the pipeline here and there. Not really related to type inference, might pull out into another PR
  • Adds dummy classes for MLR types (e.g., Secret[...]), in preparation for grabbing signature types from type annotations (rathter than from a string passed into the decorator, as is Numba's approach for ahead-of-time compilation)
  • TODO: lots of cleanup, but most importantly we need to define MLIR-style integers and Tensor types (see also Decide on (Cleartext) Integer Semantics for HEIR's Python Frontend #1252)

PS: fun fact - in numba/numpy world, i4 is not a 4-bit integer (as in MLIR), but shorthand for the 4-byte type int32.

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.

1 participant