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

Building HECO #45

Closed
or-cr opened this issue Jun 14, 2022 · 6 comments
Closed

Building HECO #45

or-cr opened this issue Jun 14, 2022 · 6 comments

Comments

@or-cr
Copy link
Contributor

or-cr commented Jun 14, 2022

Hello,

I've noticed that branch main isn't really HECO, so I've tried to build dev.
After building SEAL and MLIR as required, the command cmake --build . --target check-fhe as written in the README doesn't work (no such target).
Which target should I build? Is dev even the correct branch to work with?

Thanks,
Or

@AlexanderViand
Copy link
Collaborator

Hi Or,

Thanks for trying out HECO! As you've correctly spotted, main is very much out of date and we're currently busy getting the open-source version of HECO cleaned up and brought up to speed on dev.

Thanks for pointing out the out-of-date build instructions! You currently want to build a target called fhe-tool, wich is a command line interface. If you've got experience with MLIR, you can think of fhe-tool as being our mlir-opt. After building it, you can run it with fhe-tool --help to get a list of available options, which includes indivdual optimization passes or entire pre-defined pipelines.

Our frontends are currently being reworked, so the versions available on \dev might not work with the current version of the compiler. However, expressing simple programs directly in the high-level MLIR SSA IR should be relatively straightforward. For examples, have a look at the *_1_ssa.mlir files in /test/IR/AST.

If you want to output to something other than MLIR/LLVM, you can use the --bgv2emitc pass and pass the resulting file to emitc-translate --mlir-to-cpp which will produce a *.cpp file. Copy&paste or include wrapper.cpp.inc in that file and compile & link against SEAL (probably easiest to use a basic CMake setup, see the example in \test\IR\BGV) to run it.

One of the open todo's right now is to make the command line interface simpler to work with, removing the need to interact with this internal "plumbing". Please excuse the rough edges for the moment :)

@or-cr
Copy link
Contributor Author

or-cr commented Jun 15, 2022

Thanks, it works! I've opened a PR with the new command.
Now, when I'm running for example fhe-tool --from-ssa-pass boxblur_1_ssa.mlir on the files in test/IR/ABC, I get the error "tensor2fhe requires all tensor.extract indices used with tensors of fhe.secret to be constant!" in the Tensor2BatchedSecretPass pass.
Am I doing something wrong? Would you rather I close this issue and discuss this in a different issue?
By the way, do you know what is the last stable commit so I can play around a bit?

@AlexanderViand
Copy link
Collaborator

Thanks for the PR, which I just merged :)

You should not be getting that error message from the examples, that's definitively a bug somewhere (either in the example or one of the passes before tensor2fhe). Actually, give me a day to have a look at this, I'm sure I can get things cleaned up enough to run examples & play around, even with some other changes/etc still pending :)

@or-cr
Copy link
Contributor Author

or-cr commented Jun 15, 2022

Cool, thanks

@or-cr or-cr closed this as completed Jun 15, 2022
@AlexanderViand
Copy link
Collaborator

To follow up on this: This was indeed a bug, the loop-unroll was commented out while rebasing HECO to a new MLIR version, this is fixed as of 89707f9.

You should be able to run fhe-tool --from-ssa-pass boxblur_1_ssa.mlir without issue now. I'm also slowly updating the documentation for how to actually get an executable out of HECO. However, some recent refactorings mean that the original emitC pipeline no longer works, so I'm currently updating that.

@or-cr
Copy link
Contributor Author

or-cr commented Jun 16, 2022

Cool, it works :)
Thanks!

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

No branches or pull requests

2 participants