You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to go from a c program to tfhe-bool-rust.
Issue
An unexpected error occurs in heir-translate, which I believe is due to the non-entrypoint function not being booleanized or removed. This is a guess from the error that gets outputted. Below I give instructions on how to reproduce this.
The remove dead values call was me trying to see if it would remove the dead function.
The entry function is called _Z5isqrti because polygeist outputs the mangled cpp name. We could fix this by adding extern "C" to the isqrt method. Noting this as the mangling might be different if you are using a different compiler.
Heir-opt output
The output has been copied into this gist since it is quite a lot of code.
After all of those passes, we get the linked mlir file which is supposed to be in the tfhe-bool-rust dialect.
The non-entry point method however has not been converted to tfhe-rust-bool dialect or removed. This might not be an issue, if we assume all function calls should be inlined -- I have not looked into the codebase to be able to deduce the correct behaviour.
The output is also large and has been copied into this gist
The errors that occur in the first few lines are referring to the non-entrypoint function that has not been booleanized. Looking closer, polygeist has already inlined this function in the entrypoint, so this function should not be needed at all.
The text was updated successfully, but these errors were encountered:
Aim
I am trying to go from a c program to tfhe-bool-rust.
Issue
An unexpected error occurs in heir-translate, which I believe is due to the non-entrypoint function not being booleanized or removed. This is a guess from the error that gets outputted. Below I give instructions on how to reproduce this.
The C Program
This was copied from Jeremy's polygeist PR and modified to have the
foo
function call.Note: The one in Jeremy's PR required me to unroll the loops for it eventually be translated to tfhe-rust-bool.
Polygeist
I convert it from C to standard MLIR using polygeist with the following call:
Polygeist output
The attributes seem to cause heir-translate to fail, so I remove them.
The cleaned up Polygeist output
The above is what I feed into heir-opt.
Heir-opt
I run the following bash script that repeatedly calls heir-opt:
_Z5isqrti
because polygeist outputs the mangled cpp name. We could fix this by addingextern "C"
to the isqrt method. Noting this as the mangling might be different if you are using a different compiler.Heir-opt output
The output has been copied into this gist since it is quite a lot of code.
After all of those passes, we get the linked mlir file which is supposed to be in the tfhe-bool-rust dialect.
The non-entry point method however has not been converted to tfhe-rust-bool dialect or removed. This might not be an issue, if we assume all function calls should be inlined -- I have not looked into the codebase to be able to deduce the correct behaviour.
Heir-translate
I then call heir-translate with:
The output is also large and has been copied into this gist
The errors that occur in the first few lines are referring to the non-entrypoint function that has not been booleanized. Looking closer, polygeist has already inlined this function in the entrypoint, so this function should not be needed at all.
The text was updated successfully, but these errors were encountered: