Hi, I raised the issue 1293 in Concrete’s GitHub three weeks ago, but haven’t received any response
.
While many other programs I run now work perfectly (Thank you very much for your great framework!), I still have questions about these two simple programs. The Concrete output differs from the plaintext output, and I’m unsure whether this stems from a feature, a bug, or simply an error on my part? (Maybe I missed some documentation explaining these situations?)
Program 1
from concrete import fhe
def foo(x):
x = -97
return x
if __name__ == "__main__":
compiler = fhe.Compiler(foo, {"x": "encrypted"})
inputset = fhe.inputset(fhe.int8)
circuit = compiler.compile(inputset)
circuit.keygen()
encrypted_x = circuit.encrypt(1)
encrypted_result = circuit.run(encrypted_x)
result = circuit.decrypt(encrypted_result)
print(circuit)
print()
print(f"plaintext result: {foo(1)}")
print(f"concrete result: {result}")
Output of program 1:
%0 = -97 # ClearScalar<int8> ∈ [-97, -97]
return %0
plaintext result: -97
concrete result: 415
Program 2:
from concrete import fhe
def foo(x):
return 1, 2, 3
if __name__ == "__main__":
compiler = fhe.Compiler(foo, {"x": "encrypted"})
inputset = fhe.inputset(fhe.int8)
circuit = compiler.compile(inputset)
circuit.keygen()
encrypted_x = circuit.encrypt(1)
encrypted_result = circuit.run(encrypted_x)
result = circuit.decrypt(encrypted_result)
print(circuit)
print()
print(f"plaintext result: {foo(1)}")
print(f"concrete result: {result}")
Output of program 2:
%0 = 1 # ClearScalar<uint1> ∈ [1, 1]
%1 = 2 # ClearScalar<uint2> ∈ [2, 2]
%2 = 3 # ClearScalar<uint2> ∈ [3, 3]
return %0, %1, %2
plaintext result: (1, 2, 3)
concrete result: (1, 0, 0)