BackendEmitter: Generate default debug function
- Dominant language
- MLIR
- Stars
- 906
- Forks
- 171
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 32
Description
It is favorable to emit the default debug function that just print the decryption value for the user, instead of the user adding its own, even just copy from the template.
Cf. https://github.com/google/heir/pull/1306#discussion_r1929124056 and #1266
After #1430 is in, we can now emit the following code for Openfhe, which is no longer user-input dependent.
```cpp
void __heir_debug(CryptoContextT cc, PrivateKeyT sk, CiphertextT ct,
const std::map& debugAttrMap) {
auto isBlockArgument = debugAttrMap.at("asm.is_block_arg");
if (isBlockArgument == "1") {
std::cout << "Input" << std::endl;
} else {
std::cout << debugAttrMap.at("asm.op_name") << std::endl;
}
PlaintextT ptxt;
cc->Decrypt(sk, ct, &ptxt);
ptxt->SetLength(std::stod(debugAttrMap.at("message.size")));
std::cout << " " << ptxt << std::endl;
}
```
Contributor guide
Assessment
This issue has not been assessed yet.