mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-08 22:28:01 -05:00
chore(hpu): changes based on code review
This commit is contained in:
@@ -62,8 +62,7 @@
|
||||
trace_depth = 32 # In MB
|
||||
|
||||
[firmware]
|
||||
# implementation = "Llt"
|
||||
implementation = "Ilp"
|
||||
implementation = "Llt"
|
||||
integer_w=[2,4,6,8,10,12,14,16,32,64,128]
|
||||
min_batch_size = 11
|
||||
kogge_cfg = "${HPU_BACKEND_DIR}/config_store/${HPU_CONFIG}/kogge_cfg.toml"
|
||||
|
||||
@@ -183,7 +183,7 @@ where
|
||||
&iop.format().expect("Unspecified IOP format").proto,
|
||||
)
|
||||
};
|
||||
// These clones are cheap are they are just Arc
|
||||
// These clones are cheap as they are just Arc
|
||||
let hpu_res = HpuRadixCiphertext::exec(proto, opcode, &srcs, &src.imm);
|
||||
HpuHandle {
|
||||
native: hpu_res
|
||||
@@ -507,7 +507,7 @@ where
|
||||
&asm_iop.format().expect("Unspecified IOP format").proto,
|
||||
)
|
||||
};
|
||||
// These clones are cheap are they are just Arc
|
||||
// These clones are cheap as they are just Arc
|
||||
let hpu_result = HpuRadixCiphertext::exec(proto, opcode, &[hpu_self.clone()], &[])
|
||||
.pop()
|
||||
.expect("IOP_LEAD0 must return 1 value");
|
||||
@@ -570,7 +570,7 @@ where
|
||||
&asm_iop.format().expect("Unspecified IOP format").proto,
|
||||
)
|
||||
};
|
||||
// These clones are cheap are they are just Arc
|
||||
// These clones are cheap as they are just Arc
|
||||
let hpu_result = HpuRadixCiphertext::exec(proto, opcode, &[hpu_self.clone()], &[])
|
||||
.pop()
|
||||
.expect("IOP_LEAD1 must return 1 value");
|
||||
@@ -633,7 +633,7 @@ where
|
||||
&asm_iop.format().expect("Unspecified IOP format").proto,
|
||||
)
|
||||
};
|
||||
// These clones are cheap are they are just Arc
|
||||
// These clones are cheap as they are just Arc
|
||||
let hpu_result = HpuRadixCiphertext::exec(proto, opcode, &[hpu_self.clone()], &[])
|
||||
.pop()
|
||||
.expect("IOP_TRAIL0 must return 1 value");
|
||||
@@ -696,7 +696,7 @@ where
|
||||
&asm_iop.format().expect("Unspecified IOP format").proto,
|
||||
)
|
||||
};
|
||||
// These clones are cheap are they are just Arc
|
||||
// These clones are cheap as they are just Arc
|
||||
let hpu_result = HpuRadixCiphertext::exec(proto, opcode, &[hpu_self.clone()], &[])
|
||||
.pop()
|
||||
.expect("IOP_TRAIL1 must return 1 value");
|
||||
@@ -750,7 +750,7 @@ where
|
||||
&asm_iop.format().expect("Unspecified IOP format").proto,
|
||||
)
|
||||
};
|
||||
// These clones are cheap are they are just Arc
|
||||
// These clones are cheap as they are just Arc
|
||||
let hpu_result = HpuRadixCiphertext::exec(proto, opcode, &[hpu_self.clone()], &[])
|
||||
.pop()
|
||||
.expect("IOP_COUNT0 must return 1 value");
|
||||
@@ -804,7 +804,7 @@ where
|
||||
&asm_iop.format().expect("Unspecified IOP format").proto,
|
||||
)
|
||||
};
|
||||
// These clones are cheap are they are just Arc
|
||||
// These clones are cheap as they are just Arc
|
||||
let hpu_result = HpuRadixCiphertext::exec(proto, opcode, &[hpu_self.clone()], &[])
|
||||
.pop()
|
||||
.expect("IOP_COUNT1 must return 1 value");
|
||||
@@ -869,7 +869,7 @@ where
|
||||
&asm_iop.format().expect("Unspecified IOP format").proto,
|
||||
)
|
||||
};
|
||||
// These clones are cheap are they are just Arc
|
||||
// These clones are cheap as they are just Arc
|
||||
let hpu_result = HpuRadixCiphertext::exec(proto, opcode, &[hpu_self.clone()], &[])
|
||||
.pop()
|
||||
.expect("IOP_ILOG2 must return 1 value");
|
||||
|
||||
@@ -329,8 +329,7 @@ fn test_case_uint32_shift(cks: &ClientKey) {
|
||||
}
|
||||
|
||||
// clear shifts
|
||||
#[cfg(not(feature = "hpu"))]
|
||||
{
|
||||
if cfg!(not(feature = "hpu")) {
|
||||
let c = &a << clear_b;
|
||||
let decrypted: u32 = c.decrypt(cks);
|
||||
assert_eq!(decrypted, clear_a << clear_b);
|
||||
@@ -348,6 +347,8 @@ fn test_case_uint32_shift(cks: &ClientKey) {
|
||||
c <<= clear_b;
|
||||
let decrypted: u32 = c.decrypt(cks);
|
||||
assert_eq!(decrypted, clear_a << clear_b);
|
||||
} else {
|
||||
println!("WARN: HPU currently not support Shift by a scalar");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,8 +459,7 @@ fn test_case_uint32_rotate(cks: &ClientKey) {
|
||||
}
|
||||
|
||||
// clear rotate
|
||||
#[cfg(not(feature = "hpu"))]
|
||||
{
|
||||
if cfg!(not(feature = "hpu")) {
|
||||
let c = (&a).rotate_left(clear_b);
|
||||
let decrypted: u32 = c.decrypt(cks);
|
||||
assert_eq!(decrypted, clear_a.rotate_left(clear_b));
|
||||
@@ -477,6 +477,8 @@ fn test_case_uint32_rotate(cks: &ClientKey) {
|
||||
c.rotate_left_assign(clear_b);
|
||||
let decrypted: u32 = c.decrypt(cks);
|
||||
assert_eq!(decrypted, clear_a.rotate_left(clear_b));
|
||||
} else {
|
||||
println!("WARN: HPU currently not support Shift by a scalar");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user