mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-09 22:57:59 -05:00
fix(hpu): fix overflow flag of OVF_MUL & OVF_MULS, also update simulation HPU config
This commit is contained in:
committed by
Pierre Gardrat
parent
ab25919187
commit
ca4159f123
@@ -25,18 +25,26 @@
|
|||||||
lut_mem = 256
|
lut_mem = 256
|
||||||
lut_pc = {Hbm={pc=34}}
|
lut_pc = {Hbm={pc=34}}
|
||||||
|
|
||||||
fw_size= 16777215 # i.e. 16 MiB
|
fw_size= 16777216 # i.e. 16 MiB
|
||||||
fw_pc = {Ddr= {offset= 0x3900_0000}} # NB: Allocation must take place in the Discrete DDR
|
fw_pc = {Ddr= {offset= 0x3900_0000}} # NB: Allocation must take place in the Discrete DDR
|
||||||
|
|
||||||
bsk_pc = [
|
bsk_pc = [
|
||||||
{Hbm={pc=8}},
|
{Hbm={pc=8}},
|
||||||
|
{Hbm={pc=10}},
|
||||||
{Hbm={pc=12}},
|
{Hbm={pc=12}},
|
||||||
|
{Hbm={pc=14}},
|
||||||
{Hbm={pc=24}},
|
{Hbm={pc=24}},
|
||||||
|
{Hbm={pc=26}},
|
||||||
{Hbm={pc=28}},
|
{Hbm={pc=28}},
|
||||||
|
{Hbm={pc=30}},
|
||||||
{Hbm={pc=40}},
|
{Hbm={pc=40}},
|
||||||
|
{Hbm={pc=42}},
|
||||||
{Hbm={pc=44}},
|
{Hbm={pc=44}},
|
||||||
|
{Hbm={pc=46}},
|
||||||
{Hbm={pc=56}},
|
{Hbm={pc=56}},
|
||||||
{Hbm={pc=60}}
|
{Hbm={pc=58}},
|
||||||
|
{Hbm={pc=60}},
|
||||||
|
{Hbm={pc=62}}
|
||||||
]
|
]
|
||||||
|
|
||||||
ksk_pc = [
|
ksk_pc = [
|
||||||
@@ -64,7 +72,7 @@
|
|||||||
[firmware]
|
[firmware]
|
||||||
implementation = "Llt"
|
implementation = "Llt"
|
||||||
integer_w=[2,4,6,8,10,12,14,16,32,64,128]
|
integer_w=[2,4,6,8,10,12,14,16,32,64,128]
|
||||||
min_batch_size = 11
|
min_batch_size = 12
|
||||||
kogge_cfg = "${HPU_BACKEND_DIR}/config_store/${HPU_CONFIG}/kogge_cfg.toml"
|
kogge_cfg = "${HPU_BACKEND_DIR}/config_store/${HPU_CONFIG}/kogge_cfg.toml"
|
||||||
custom_iop.'IOP[0]' = "${HPU_BACKEND_DIR}/config_store/${HPU_CONFIG}/custom_iop/cust_0.asm"
|
custom_iop.'IOP[0]' = "${HPU_BACKEND_DIR}/config_store/${HPU_CONFIG}/custom_iop/cust_0.asm"
|
||||||
custom_iop.'IOP[1]' = "${HPU_BACKEND_DIR}/config_store/${HPU_CONFIG}/custom_iop/cust_1.asm"
|
custom_iop.'IOP[1]' = "${HPU_BACKEND_DIR}/config_store/${HPU_CONFIG}/custom_iop/cust_1.asm"
|
||||||
@@ -80,8 +88,8 @@
|
|||||||
custom_iop.'IOP[21]' = "${HPU_BACKEND_DIR}/config_store/${HPU_CONFIG}/custom_iop/cust_21.asm"
|
custom_iop.'IOP[21]' = "${HPU_BACKEND_DIR}/config_store/${HPU_CONFIG}/custom_iop/cust_21.asm"
|
||||||
|
|
||||||
[firmware.op_cfg.default]
|
[firmware.op_cfg.default]
|
||||||
fill_batch_fifo = true
|
fill_batch_fifo = false
|
||||||
min_batch_size = false
|
min_batch_size = true
|
||||||
use_tiers = false
|
use_tiers = false
|
||||||
flush_behaviour = "Patient"
|
flush_behaviour = "Patient"
|
||||||
flush = true
|
flush = true
|
||||||
|
|||||||
@@ -498,6 +498,7 @@ pub fn iop_mulx(
|
|||||||
// Wrapped required lookup table in MetaVar
|
// Wrapped required lookup table in MetaVar
|
||||||
let pbs_msg = new_pbs!(prog, "MsgOnly");
|
let pbs_msg = new_pbs!(prog, "MsgOnly");
|
||||||
let pbs_carry = new_pbs!(prog, "CarryInMsg");
|
let pbs_carry = new_pbs!(prog, "CarryInMsg");
|
||||||
|
let pbs_carry_is_some = new_pbs!(prog, "CarryIsSome");
|
||||||
let pbs_mul_lsb = new_pbs!(prog, "MultCarryMsgLsb");
|
let pbs_mul_lsb = new_pbs!(prog, "MultCarryMsgLsb");
|
||||||
let pbs_mul_msb = new_pbs!(prog, "MultCarryMsgMsb");
|
let pbs_mul_msb = new_pbs!(prog, "MultCarryMsgMsb");
|
||||||
let pbs_mult_is_some = new_pbs!(prog, "MultCarryMsgIsSome");
|
let pbs_mult_is_some = new_pbs!(prog, "MultCarryMsgIsSome");
|
||||||
@@ -691,7 +692,7 @@ pub fn iop_mulx(
|
|||||||
pp_vars.push_back((w + 1, msb));
|
pp_vars.push_back((w + 1, msb));
|
||||||
} else if flag.is_some() {
|
} else if flag.is_some() {
|
||||||
// Last carry must be extracted for overflow computation
|
// Last carry must be extracted for overflow computation
|
||||||
let ovf_lsb_nz = var.pbs(&pbs_mult_msb_is_some, false);
|
let ovf_lsb_nz = var.pbs(&pbs_carry_is_some, false);
|
||||||
ovf_non_zero_vars.push(ovf_lsb_nz);
|
ovf_non_zero_vars.push(ovf_lsb_nz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user