heir icon indicating copy to clipboard operation
heir copied to clipboard

Bug: secret-forget-secrets does not work after yosys optimizer

Open asraa opened this issue 1 year ago • 2 comments
trafficstars

@j2kun - I thought it would be nice to check the Yosys optimizer pass for correctness by chaining yosys-optimizer with secret-forget-secrets and then lowering to LLVM to execute (this would have caught the bug)

The issue here seems to be that the secret.cast that transforms the multi-bit secrets to the tensor of single-bits has no conversion pattern. We already have code that extracts bits from plaintext multi-bits so we can use that here for an input conversion.

asraa avatar Jan 30 '24 14:01 asraa

I lost the train of thought on this bug. Is there a simple reproducer for the error?

j2kun avatar Feb 23 '24 04:02 j2kun

Sure! Maybe the add_one example is the easiest. It hits this bug on anything with a multi-bit integer value.

bazel run -c dbg @heir//tools:heir-opt --  --yosys-optimizer --canonicalize --cse --secret-forget-secrets $(pwd)/tests/yosys_optimizer/arith_ops.mlir

asraa avatar Feb 23 '24 13:02 asraa