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

Add a way to pass textual MLIR into the compiler from the Python frontend #1444

Open
AlexanderViand-Intel opened this issue Feb 20, 2025 · 0 comments
Assignees
Labels
python Pull requests that update Python code

Comments

@AlexanderViand-Intel
Copy link
Collaborator

For debugging, and to support jupyter notebook demos like the ones available via heir_play, the frontend should be able to take in textual MLIR as a string, essentially skipping most of the "Frontend" parts, but still allowing you to use a backend.

E.g., in addition to

@compile()
def foo(x: Secret[I16], y: Secret[I16]):
  return (x + y) * (x - y) + (x * y)


foo.setup() 
enc_x = foo.encrypt_x(7)
enc_y = foo.encrypt_y(8)
result_enc = foo.eval(enc_x, enc_y)
result = foo.decrypt_result(result_enc)

We should also support

ssa ="""
func.func @foo(%x: i16 {secret.secret}, %y: i16 {secret.secret}) -> (i16) {
    %0 = arith.addi %x, %y : i16
    %1 = arith.subi %x, %y : i16
    %2 = arith.muli %0, %1 : i16
    %3 = arith.muli %x, %y : i16
    %4 = arith.addi %2, %3 : i16
    func.return %4 : i16
}"""

foo = compile_ssa(ssa)

foo.setup()
enc_x = foo.encrypt_x(7)
enc_y = foo.encrypt_y(8)
result_enc = foo.eval(enc_x, enc_y)
result = foo.decrypt_result(result_enc)
@AlexanderViand-Intel AlexanderViand-Intel added the python Pull requests that update Python code label Feb 20, 2025
@AlexanderViand-Intel AlexanderViand-Intel self-assigned this Feb 20, 2025
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

1 participant