mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 12:15:09 -05:00
fix(mlir): unsigned are considered signless in compiler
+ changed the name of compiled func to main, as it's the default name to be executed later
This commit is contained in:
@@ -58,7 +58,8 @@ class MLIRConverter:
|
||||
dtype = cast(Integer, value.data_type)
|
||||
if dtype.is_signed:
|
||||
return IntegerType.get_signed(dtype.bit_width, context=self.context)
|
||||
return IntegerType.get_unsigned(dtype.bit_width, context=self.context)
|
||||
# unsigned integer are considered signless in the compiler
|
||||
return IntegerType.get_signless(dtype.bit_width, context=self.context)
|
||||
raise TypeError(f"can't convert value of type {type(value)} to MLIR type")
|
||||
|
||||
def convert(self, op_graph: OPGraph) -> str:
|
||||
@@ -80,7 +81,7 @@ class MLIRConverter:
|
||||
]
|
||||
|
||||
@builtin.FuncOp.from_py_func(*func_types)
|
||||
def fhe_circuit(*arg):
|
||||
def main(*arg):
|
||||
ir_to_mlir_node = {}
|
||||
for arg_num, node in op_graph.input_nodes.items():
|
||||
ir_to_mlir_node[node] = arg[arg_num]
|
||||
|
||||
@@ -157,7 +157,7 @@ def test_hdk_clear_integer_to_mlir_type(is_signed):
|
||||
if is_signed:
|
||||
assert int_mlir == IntegerType.get_signed(5)
|
||||
else:
|
||||
assert int_mlir == IntegerType.get_unsigned(5)
|
||||
assert int_mlir == IntegerType.get_signless(5)
|
||||
|
||||
|
||||
def test_failing_hdk_to_mlir_type():
|
||||
|
||||
Reference in New Issue
Block a user