chore: fix october typos

This commit is contained in:
Arthur Meyre
2025-10-01 11:40:43 +02:00
parent 73de886c07
commit 9fdaa983e3
30 changed files with 135 additions and 134 deletions

View File

@@ -13,6 +13,7 @@ extend-ignore-identifiers-re = [
# Example in trivium
"C9217BA0D762ACA1",
"0x[0-9a-fA-F]+",
"xrt_coreutil",
]
[files]

View File

@@ -36,7 +36,7 @@ __device__ Torus *get_ith_block(Torus *ksk, int i, int level,
*
*/
// Each thread in x are used to calculate one output.
// threads in y are used to paralelize the lwe_dimension_in loop.
// threads in y are used to parallelize the lwe_dimension_in loop.
// shared memory is used to store intermediate results of the reduction.
// Note: To reduce register pressure we have slightly changed the algorithm,
// the idea consists in calculating the negate value of the output. So, instead

View File

@@ -26,7 +26,7 @@
lut_pc = {Hbm={pc=34}}
fw_size= 16777215 # i.e. 16 MiB
fw_pc = {Ddr= {offset= 0x3900_0000}} # NB: Allocation must take place in the Discret DDR
fw_pc = {Ddr= {offset= 0x3900_0000}} # NB: Allocation must take place in the Discrete DDR
bsk_pc = [
{Hbm={pc=8}},

View File

@@ -31,7 +31,7 @@
lut_pc = {Hbm={pc=34}}
fw_size= 16777216 # i.e. 16 MiB
fw_pc = {Ddr= {offset= 0x3900_0000}} # NB: Allocation must take place in the Discret DDR
fw_pc = {Ddr= {offset= 0x3900_0000}} # NB: Allocation must take place in the Discrete DDR
bsk_pc = [
{Hbm={pc=8}},

View File

@@ -81,7 +81,7 @@ pub enum ImmId {
}
impl ImmId {
/// Create new immediat template
/// Create new immediate template
pub fn new_var(tid: u8, bid: u8) -> Self {
Self::Var { tid, bid }
}
@@ -132,7 +132,7 @@ pub struct PeArithInsn {
}
/// PeaMsg instructions
/// Arithmetic operation that use one destination register, one source register and an immediat
/// Arithmetic operation that use one destination register, one source register and an immediate
/// value
#[derive(Clone, Copy, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct PeArithMsgInsn {

View File

@@ -69,7 +69,7 @@ impl From<&PeArithHex> for PeArithInsn {
}
/// PeaMsg instructions
/// Arithmetic operation that use one destination register, one source register and an immediat
/// Arithmetic operation that use one destination register, one source register and an immediate
/// value
#[bitfield(u32)]
pub struct PeArithMsgHex {

View File

@@ -4,7 +4,7 @@
use super::*;
use field::{
FwMode, IOpHeader, IOpcode, ImmBundle, Immediat, Operand, OperandBlock, OperandBundle,
FwMode, IOpHeader, IOpcode, ImmBundle, Immediate, Operand, OperandBlock, OperandBundle,
};
use lazy_static::lazy_static;
@@ -393,7 +393,7 @@ impl std::str::FromStr for ImmBundle {
.map_err(|err| ParsingError::InvalidArg(err.to_string()))?
};
Ok(Immediat::from_cst(imm))
Ok(Immediate::from_cst(imm))
})
.collect::<Result<Vec<_>, ParsingError>>()?;
@@ -475,7 +475,7 @@ impl std::fmt::Display for IOp {
// Source operands list
write!(f, " <{}>", self.src)?;
// Immediat operands list [Optional]
// Immediate operands list [Optional]
if self.header.has_imm {
write!(f, " <{}>", self.imm)?;
}

View File

@@ -75,7 +75,7 @@ impl Operand {
}
}
/// Create a dedicated type for a collection of Immediat
/// Create a dedicated type for a collection of Immediate
/// This is to enable trait implementation on it (c.f arg)
#[derive(Debug, Clone)]
pub struct OperandBundle(Vec<Operand>);
@@ -142,32 +142,32 @@ impl OperandBundle {
// Immediate operands
// ------------------------------------------------------------------------------------------------
/// Immediat Size
/// => Number of valid digit in following immediat
/// Immediate Size
/// => Number of valid digit in following immediate
/// To obtain the number of valid bits, user should multiply by the msg_width
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ImmBlock(pub u16);
/// Immediat header
/// Immediate header
/// Use to implement top-level parser manually
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ImmediatHeader {
pub struct ImmediateHeader {
pub(super) lsb_msg: u16,
pub(super) block: ImmBlock,
pub(super) is_last: bool,
pub(super) kind: OperandKind,
}
/// Full Immediat representation (i.e. header + data)
/// Full Immediate representation (i.e. header + data)
#[derive(Debug, Clone, PartialEq)]
pub struct Immediat {
pub struct Immediate {
pub(super) kind: OperandKind,
pub(super) is_last: bool,
pub(super) block: ImmBlock,
pub(super) msg: Vec<u16>,
}
impl Immediat {
impl Immediate {
/// Access imm msg for template patching
/// Extract the correct block (i.e. MSG_WIDTH chunk)
pub fn msg_block(&self, bid: u8) -> u16 {
@@ -217,7 +217,7 @@ impl Immediat {
}
}
impl Immediat {
impl Immediate {
#[tracing::instrument(level = "trace", ret)]
pub fn from_words(stream: &[IOpWordRepr]) -> Result<(Self, usize), HexParsingError> {
// Keep track of the current peak index
@@ -226,7 +226,7 @@ impl Immediat {
// 1. Parse header
let header = if let Some(header_word) = stream.get(peak_words) {
peak_words += 1;
ImmediatHeader::from(&fmt::ImmediatHeaderHex::from_bits(*header_word))
ImmediateHeader::from(&fmt::ImmediateHeaderHex::from_bits(*header_word))
} else {
return Err(HexParsingError::EmptyStream);
};
@@ -276,13 +276,13 @@ impl Immediat {
pub fn to_words(&self) -> Vec<IOpWordRepr> {
let mut words = Vec::new();
let header = ImmediatHeader {
let header = ImmediateHeader {
lsb_msg: *self.msg.first().unwrap_or(&0),
block: self.block,
is_last: self.is_last,
kind: self.kind,
};
words.push(fmt::ImmediatHeaderHex::from(&header).into_bits());
words.push(fmt::ImmediateHeaderHex::from(&header).into_bits());
if self.msg.len() > 1 {
for imm in self.msg[1..]
@@ -302,10 +302,10 @@ impl Immediat {
}
}
/// Create a dedicated type for a collection of Immediat
/// Create a dedicated type for a collection of Immediate
/// This is to enable trait implementation on it (c.f arg)
#[derive(Debug, Clone)]
pub struct ImmBundle(Vec<Immediat>);
pub struct ImmBundle(Vec<Immediate>);
impl ImmBundle {
#[tracing::instrument(level = "trace", ret)]
@@ -315,7 +315,7 @@ impl ImmBundle {
let mut imm_list = Vec::new();
loop {
let (imm, peaked) = Immediat::from_words(&stream[peak_words..])?;
let (imm, peaked) = Immediate::from_words(&stream[peak_words..])?;
peak_words += peaked;
let is_last = imm.is_last;
@@ -335,9 +335,9 @@ impl ImmBundle {
}
}
impl From<Vec<Immediat>> for ImmBundle {
impl From<Vec<Immediate>> for ImmBundle {
#[tracing::instrument(level = "trace", ret)]
fn from(inner: Vec<Immediat>) -> Self {
fn from(inner: Vec<Immediate>) -> Self {
let mut inner = inner;
// Enforce correct is_last handling
inner.iter_mut().for_each(|op| op.is_last = false);
@@ -349,7 +349,7 @@ impl From<Vec<Immediat>> for ImmBundle {
}
impl std::ops::Deref for ImmBundle {
type Target = Vec<Immediat>;
type Target = Vec<Immediate>;
fn deref(&self) -> &Self::Target {
&self.0
@@ -392,7 +392,7 @@ use std::collections::VecDeque;
/// Implement construction
/// Used to construct IOp from Backend HpuVar
impl IOp {
pub fn new(opcode: IOpcode, dst: Vec<Operand>, src: Vec<Operand>, imm: Vec<Immediat>) -> Self {
pub fn new(opcode: IOpcode, dst: Vec<Operand>, src: Vec<Operand>, imm: Vec<Immediate>) -> Self {
let dst_align = dst.iter().map(|x| x.block).max().unwrap();
let src_align = src.iter().map(|x| x.block).max().unwrap();
let has_imm = !imm.is_empty();
@@ -504,7 +504,7 @@ impl IOp {
src
};
// 4. Parse Immediat [Optional]
// 4. Parse Immediate [Optional]
let (imm, peaked) = if header.has_imm {
ImmBundle::from_words(&stream.as_slices().0[peak_words..])?
} else {
@@ -533,7 +533,7 @@ impl IOp {
words.extend(self.dst.to_words());
// 3. Sources
words.extend(self.src.to_words());
// 4. Immediat
// 4. Immediate
words.extend(self.imm.to_words());
words
}

View File

@@ -60,7 +60,7 @@ impl From<&Operand> for OperandHex {
}
#[bitfield(u32)]
pub struct ImmediatHeaderHex {
pub struct ImmediateHeaderHex {
#[bits(16)]
lsb_msg: u16,
#[bits(12)]
@@ -73,8 +73,8 @@ pub struct ImmediatHeaderHex {
kind: u8,
}
impl From<&ImmediatHeaderHex> for field::ImmediatHeader {
fn from(value: &ImmediatHeaderHex) -> Self {
impl From<&ImmediateHeaderHex> for field::ImmediateHeader {
fn from(value: &ImmediateHeaderHex) -> Self {
let kind = if value.kind() == OperandKind::Src as u8 {
OperandKind::Src
} else if value.kind() == OperandKind::Dst as u8 {
@@ -94,8 +94,8 @@ impl From<&ImmediatHeaderHex> for field::ImmediatHeader {
}
}
impl From<&field::ImmediatHeader> for ImmediatHeaderHex {
fn from(value: &field::ImmediatHeader) -> Self {
impl From<&field::ImmediateHeader> for ImmediateHeaderHex {
fn from(value: &field::ImmediateHeader) -> Self {
Self::new()
.with_lsb_msg(value.lsb_msg)
.with_block(value.block.0)

View File

@@ -2,7 +2,7 @@
//! IOp definition
mod field;
pub use field::{HexParsingError, IOp, IOpcode, Immediat, Operand, OperandKind};
pub use field::{HexParsingError, IOp, IOpcode, Immediate, Operand, OperandKind};
mod fmt;
pub use fmt::{IOpRepr, IOpWordRepr};
mod iop_macro;

View File

@@ -20,7 +20,7 @@ SUB R2 R1 R3
MUL R2 R1 R3
MAC R2 R1 R3 4
; Test ArithMsg operation with various immediat template format
; Test ArithMsg operation with various immediate template format
ADDS R2 R1 10
SUBS R2 R1 TI[4].0
SSUB R2 R1 TI[2].4

View File

@@ -2,7 +2,7 @@
; with the != available arguments modes
; Simple Mode:
; 1 destination, 2 sources, no immediat
; 1 destination, 2 sources, no immediate
; With raw opcode -> 0x35
IOP[0x35] <I8 I8> <I8@0x08> <I8@0x0 I8@0x4>
; With raw opcode -> 40 and dynamic Fw generation
@@ -11,7 +11,7 @@ IOP[0x35] <dyn I8 I8> <I8@0x08> <I8@0x0 I8@0x4>
; With opcode alias -> MUL
MUL <I8 I8> <I8@0x08> <I8@0x0 I4@0x4>
; Simple Mode with immediat
; Simple Mode with immediate
; Source operands are defined through vector mode
MULS <I8 I8> <I8@0x8> <I8[2]@0x0> <0xaf>
@@ -26,6 +26,6 @@ IOP[0x60] <dyn I8 I8> <I8@0x10 I8@0x14> <I8@0x0 I8@0x4>
; Previous operation could be defined with vector format.
IOP[0x40] <dyn I8 I8> <I8[2]@0x10> <I8[2]@0x0>
; With multiple immediat
; With multiple immediate
; Example this operation could compute D <- A*4 + B*8
IOP[0x0] <I16 I16> <I16@16> <I16@0x0 I8@0x8> <0xdeadc0de>

View File

@@ -84,7 +84,7 @@ impl HpuV80Pdi {
}
#[allow(unused)]
/// Deconstruct HpuV80Pdi into a folder with discret files
/// Deconstruct HpuV80Pdi into a folder with discrete files
pub fn to_folder(&self, folder_path: &str) -> Result<(), Box<dyn Error>> {
let metadata_path = Path::new(folder_path).join("metadata.toml");
self.metadata.to_toml(

View File

@@ -100,11 +100,11 @@ pub fn iop_adds(prog: &mut Program) {
let mut dst = prog.iop_template_var(OperandKind::Dst, 0);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("ADDS Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("ADDS Operand::Dst Operand::Src Operand::Immediate".to_string());
// Deferred implementation to generic addx function
iop_addx(prog, &mut dst, None, &src_a, &src_b);
}
@@ -134,18 +134,18 @@ pub fn iop_overflow_adds(prog: &mut Program) {
let mut flag = prog.iop_template_var(OperandKind::Dst, 1);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("ADDS Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("ADDS Operand::Dst Operand::Src Operand::Immediate".to_string());
// Deferred implementation to generic addx function
iop_addx(prog, &mut dst, Some(&mut flag[0]), &src_a, &src_b);
}
/// Generic Add operation
/// One destination and two sources operation
/// Source could be Operand or Immediat
/// Source could be Operand or Immediate
#[instrument(level = "trace", skip(prog))]
pub fn iop_addx(
prog: &mut Program,
@@ -191,7 +191,7 @@ pub fn iop_sub(prog: &mut Program) {
let mut dst = prog.iop_template_var(OperandKind::Dst, 0);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Src, 1);
// Add Comment header
@@ -207,11 +207,11 @@ pub fn iop_subs(prog: &mut Program) {
let mut dst = prog.iop_template_var(OperandKind::Dst, 0);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("SUBS Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("SUBS Operand::Dst Operand::Src Operand::Immediate".to_string());
// Deferred implementation to generic subx function
iop_subx(prog, &mut dst, None, &src_a, &src_b);
}
@@ -224,7 +224,7 @@ pub fn iop_overflow_sub(prog: &mut Program) {
let mut flag = prog.iop_template_var(OperandKind::Dst, 1);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Src, 1);
// Add Comment header
@@ -241,18 +241,18 @@ pub fn iop_overflow_subs(prog: &mut Program) {
let mut flag = prog.iop_template_var(OperandKind::Dst, 1);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("SUBS Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("SUBS Operand::Dst Operand::Src Operand::Immediate".to_string());
// Deferred implementation to generic subx function
iop_subx(prog, &mut dst, Some(&mut flag[0]), &src_a, &src_b);
}
/// Generic sub operation
/// One destination and two sources operation
/// Source could be Operand or Immediat
/// Source could be Operand or Immediate
#[instrument(level = "trace", skip(prog))]
pub fn iop_subx(
prog: &mut Program,
@@ -324,18 +324,18 @@ pub fn iop_ssub(prog: &mut Program) {
let mut dst = prog.iop_template_var(OperandKind::Dst, 0);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("SSUB Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("SSUB Operand::Dst Operand::Src Operand::Immediate".to_string());
// Deferred implementation to generic subx function
iop_ssubx(prog, &mut dst, None, &src_a, &src_b);
}
/// Generic SSUB operation
/// One destination and two sources operation
/// Source could be Operand or Immediat
/// Source could be Operand or Immediate
#[instrument(level = "trace", skip(prog))]
pub fn iop_ssubx(
prog: &mut Program,
@@ -406,11 +406,11 @@ pub fn iop_overflow_ssub(prog: &mut Program) {
let mut flag = prog.iop_template_var(OperandKind::Dst, 1);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("SUBS Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("SUBS Operand::Dst Operand::Src Operand::Immediate".to_string());
// Deferred implementation to generic ssubx function
iop_ssubx(prog, &mut dst, Some(&mut flag[0]), &src_a, &src_b);
}
@@ -422,7 +422,7 @@ pub fn iop_mul(prog: &mut Program) {
let mut dst = prog.iop_template_var(OperandKind::Dst, 0);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Src, 1);
// Add Comment header
@@ -437,11 +437,11 @@ pub fn iop_muls(prog: &mut Program) {
let mut dst = prog.iop_template_var(OperandKind::Dst, 0);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("MULS Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("MULS Operand::Dst Operand::Src Operand::Immediate".to_string());
// Deferred implementation to generic mulx function
iop_mulx(prog, &mut dst, None, &src_a, &src_b);
}
@@ -454,7 +454,7 @@ pub fn iop_overflow_mul(prog: &mut Program) {
let mut flag = prog.iop_template_var(OperandKind::Dst, 1);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Src, 1);
// Add Comment header
@@ -471,18 +471,18 @@ pub fn iop_overflow_muls(prog: &mut Program) {
let mut flag = prog.iop_template_var(OperandKind::Dst, 1);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("MULS Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("MULS Operand::Dst Operand::Src Operand::Immediate".to_string());
// Deferred implementation to generic mulx function
iop_mulx(prog, &mut dst, Some(&mut flag[0]), &src_a, &src_b);
}
/// Generic mul operation
/// One destination and two sources operation
/// Source could be Operand or Immediat
/// Source could be Operand or Immediate
#[instrument(level = "trace", skip(prog))]
pub fn iop_mulx(
prog: &mut Program,
@@ -994,11 +994,11 @@ pub fn iop_shift_scalar_right(prog: &mut Program) {
let mut dst = prog.iop_template_var(OperandKind::Dst, 0);
// Src -> Operand
let src = prog.iop_template_var(OperandKind::Src, 0);
// Amount-> Immediat
// Amount-> Immediate
let amount = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("SHIFTS_R Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("SHIFTS_R Operand::Dst Operand::Src Operand::Immediate".to_string());
// Deferred implementation to generic rotx function
iop_scalar_shiftrotx(prog, ShiftKind::ShiftRight, &mut dst, &src, &amount);
}
@@ -1010,11 +1010,11 @@ pub fn iop_shift_scalar_left(prog: &mut Program) {
let mut dst = prog.iop_template_var(OperandKind::Dst, 0);
// Src -> Operand
let src = prog.iop_template_var(OperandKind::Src, 0);
// Amount-> Immediat
// Amount-> Immediate
let amount = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("SHIFTS_L Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("SHIFTS_L Operand::Dst Operand::Src Operand::Immediate".to_string());
// Deferred implementation to generic rotx function
iop_scalar_shiftrotx(prog, ShiftKind::ShiftLeft, &mut dst, &src, &amount);
}
@@ -1026,11 +1026,11 @@ pub fn iop_rotate_scalar_right(prog: &mut Program) {
let mut dst = prog.iop_template_var(OperandKind::Dst, 0);
// Src -> Operand
let src = prog.iop_template_var(OperandKind::Src, 0);
// Amount-> Immediat
// Amount-> Immediate
let amount = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("ROTS_R Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("ROTS_R Operand::Dst Operand::Src Operand::Immediate".to_string());
// Deferred implementation to generic rotx function
iop_scalar_shiftrotx(prog, ShiftKind::RotRight, &mut dst, &src, &amount);
}
@@ -1041,11 +1041,11 @@ pub fn iop_rotate_scalar_left(prog: &mut Program) {
let mut dst = prog.iop_template_var(OperandKind::Dst, 0);
// Src -> Operand
let src = prog.iop_template_var(OperandKind::Src, 0);
// Amount-> Immediat
// Amount-> Immediate
let amount = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("ROTS_L Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("ROTS_L Operand::Dst Operand::Src Operand::Immediate".to_string());
// Deferred implementation to generic rotx function
iop_scalar_shiftrotx(prog, ShiftKind::RotRight, &mut dst, &src, &amount);
}
@@ -1118,7 +1118,7 @@ pub fn iop_cmp(prog: &mut Program, cmp_op: Pbs) {
/// Generic Cmp operation
/// One destination block and two sources operands
/// Source could be Operand or Immediat
/// Source could be Operand or Immediate
#[instrument(level = "trace", skip(prog))]
pub fn iop_cmpx(
prog: &mut Program,

View File

@@ -21,7 +21,7 @@ pub fn iop_div(prog: &mut Program) {
let mut dst_remain = prog.iop_template_var(OperandKind::Dst, 1);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Src, 1);
// Add Comment header
@@ -37,11 +37,11 @@ pub fn iop_divs(prog: &mut Program) {
let mut dst_remain = prog.iop_template_var(OperandKind::Dst, 1);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("DIVS Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("DIVS Operand::Dst Operand::Src Operand::Immediate".to_string());
// Deferred implementation to generic divx function
// TODO: do computation on immediate directly for more efficiency.
// Workaround: transform immediate into ct.
@@ -52,7 +52,7 @@ pub fn iop_divs(prog: &mut Program) {
/// Generic div operation
/// One destination and two sources operation
/// Source could be Operand or Immediat
/// Source could be Operand or Immediate
pub fn iop_divx(
prog: &mut Program,
dst_quotient: &mut [metavar::MetaVarCell],
@@ -80,7 +80,7 @@ pub fn iop_mod(prog: &mut Program) {
let mut dst_remain = prog.iop_template_var(OperandKind::Dst, 0);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Src, 1);
// Add Comment header
@@ -95,11 +95,11 @@ pub fn iop_mods(prog: &mut Program) {
let mut dst_remain = prog.iop_template_var(OperandKind::Dst, 0);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("MODS Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("MODS Operand::Dst Operand::Src Operand::Immediate".to_string());
// Deferred implementation to generic modx function
// TODO: do computation on immediate directly for more efficiency.
// Workaround: transform immediate into ct.
@@ -110,7 +110,7 @@ pub fn iop_mods(prog: &mut Program) {
/// Generic mod operation
/// One destination and two sources operation
/// Source could be Operand or Immediat
/// Source could be Operand or Immediate
pub fn iop_modx(
prog: &mut Program,
dst_remain: &mut [metavar::MetaVarCell],

View File

@@ -98,7 +98,7 @@ pub fn iop_add(prog: &mut Program) {
let dst = prog.iop_template_var(OperandKind::Dst, 0);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Src, 1);
// Add Comment header
@@ -123,11 +123,11 @@ pub fn iop_adds(prog: &mut Program) {
let dst = prog.iop_template_var(OperandKind::Dst, 0);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("ADDS Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("ADDS Operand::Dst Operand::Src Operand::Immediate".to_string());
iop_addx(prog, dst, src_a, src_b);
}
@@ -138,7 +138,7 @@ pub fn iop_sub(prog: &mut Program) {
let dst = prog.iop_template_var(OperandKind::Dst, 0);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Src, 1);
// Add Comment header
@@ -152,11 +152,11 @@ pub fn iop_subs(prog: &mut Program) {
let dst = prog.iop_template_var(OperandKind::Dst, 0);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("SUBS Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("SUBS Operand::Dst Operand::Src Operand::Immediate".to_string());
iop_subx(prog, dst, src_a, src_b);
}
@@ -166,11 +166,11 @@ pub fn iop_ssub(prog: &mut Program) {
let dst = prog.iop_template_var(OperandKind::Dst, 0);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Imm, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Src, 0);
// Add Comment header
prog.push_comment("SSUB Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("SSUB Operand::Dst Operand::Src Operand::Immediate".to_string());
iop_subx(prog, dst, src_a, src_b);
}
@@ -199,7 +199,7 @@ pub fn iop_mul(prog: &mut Program) {
let dst = prog.iop_template_var(OperandKind::Dst, 0);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Src, 1);
// Add Comment header
@@ -215,11 +215,11 @@ pub fn iop_muls(prog: &mut Program) {
let dst = prog.iop_template_var(OperandKind::Dst, 0);
// SrcA -> Operand
let src_a = prog.iop_template_var(OperandKind::Src, 0);
// SrcB -> Immediat
// SrcB -> Immediate
let src_b = prog.iop_template_var(OperandKind::Imm, 0);
// Add Comment header
prog.push_comment("MULS Operand::Dst Operand::Src Operand::Immediat".to_string());
prog.push_comment("MULS Operand::Dst Operand::Src Operand::Immediate".to_string());
iop_mulx(prog, dst, src_a, src_b).add_to_prog(prog);
}
@@ -534,7 +534,7 @@ pub fn iop_mulx(
/// Generic mul operation
/// One destination and two sources operation
/// Source could be Operand or Immediat
/// Source could be Operand or Immediate
#[instrument(level = "trace", skip(prog))]
pub fn iop_mulx_ser(
prog: &mut Program,
@@ -654,7 +654,7 @@ pub fn iop_mulx_ser(
/// Generic Cmp operation
/// One destination block and two sources operands
/// Source could be Operand or Immediat
/// Source could be Operand or Immediate
#[instrument(level = "trace", skip(prog))]
pub fn iop_cmpx(
prog: &mut Program,
@@ -673,7 +673,7 @@ pub fn iop_cmpx(
/// Generic Cmp operation
/// One destination block and two sources operands
/// Source could be Operand or Immediat
/// Source could be Operand or Immediate
#[instrument(level = "trace", skip(prog))]
pub fn iop_cmpx_rtl(
prog: &mut Program,

View File

@@ -3,7 +3,7 @@
//!
//! Provide two concrete implementation of those traits
//! * DigitOperations (DOp)
//! * IntegerOperarions (IOp)
//! * IntegerOperations (IOp)
pub mod fw_impl;
pub mod isc_sim;

View File

@@ -382,9 +382,9 @@ impl Program {
}
/// Create templated arguments
/// kind is used to specify if it's bind to src/dst or immediat template
/// kind is used to specify if it's bind to src/dst or immediate template
/// pos_id is used to bind the template to an IOp operand position
// TODO pass the associated operand or immediat to obtain the inner blk properties instead of
// TODO pass the associated operand or immediate to obtain the inner blk properties instead of
// using the global one
pub fn iop_template_var(&mut self, kind: asm::OperandKind, pos_id: u8) -> Vec<MetaVarCell> {
let nb_blk = self.params().blk_w() as u8;

View File

@@ -2,11 +2,11 @@
/// Help with IOp management over HPU
/// Track IOp status and handle backward update of associated HpuVariable
use super::*;
use crate::asm::iop::{Immediat, Operand, OperandKind};
use crate::asm::iop::{Immediate, Operand, OperandKind};
use crate::asm::{IOp, IOpcode};
use variable::HpuVarWrapped;
/// Underlying type used for Immediat value;
/// Underlying type used for Immediate value;
pub type HpuImm = u128;
/// Structure that hold an IOp with there associated operands
@@ -15,7 +15,7 @@ pub struct HpuCmd {
pub(crate) op: IOp,
pub(crate) dst: Vec<HpuVarWrapped>,
pub(crate) src: Vec<HpuVarWrapped>,
// NB: No need to track Immediat lifetime. It's simply constant completely held by the IOp
// NB: No need to track Immediate lifetime. It's simply constant completely held by the IOp
// definition
}
@@ -75,7 +75,7 @@ impl HpuCmd {
.collect::<Vec<_>>();
let imm_op = imm
.iter()
.map(|var| Immediat::from_cst(*var))
.map(|var| Immediate::from_cst(*var))
.collect::<Vec<_>>();
let op = IOp::new(opcode, dst_op, src_op, imm_op);

View File

@@ -113,7 +113,7 @@ impl UCore {
patch_imm(iop, imm);
dop_patch
}
// TODO Patch immediat
// TODO Patch immediate
_ => dop_patch,
}
})
@@ -126,7 +126,7 @@ impl UCore {
}
}
/// Utility function to patch immediat argument
/// Utility function to patch immediate argument
fn patch_imm(iop: &hpu_asm::IOp, imm: &mut hpu_asm::ImmId) {
*imm = match imm {
hpu_asm::ImmId::Cst(val) => hpu_asm::ImmId::Cst(*val),

View File

@@ -127,7 +127,7 @@ $ cargo run --release
You can learn more about homomorphic types and associated compilation features in the [configuration documentation.](../configuration/rust-configuration.md)
## Perforance tips
## Performance tips
Performance can be further improved by setting `lto="fat"` in `Cargo.toml`
```toml
[profile.release]

View File

@@ -56,7 +56,7 @@ pub struct Args {
#[arg(long, value_parser = maybe_hex::<u128>)]
pub src: Vec<u128>,
/// Force immediat input values
/// Force immediate input values
#[arg(long, value_parser = maybe_hex::<u128>)]
pub imm: Vec<u128>,

View File

@@ -92,8 +92,8 @@ pub enum Candidate {
}
pub enum CandidateResult {
SatisfiyingBound(Candidate),
BestNotSatisfiyingBound(Candidate),
SatisfyingBound(Candidate),
BestNotSatisfyingBound(Candidate),
}
pub fn choose_candidate_to_improve_modulus_switch_noise_for_binary_key<Scalar, C1, C2>(
@@ -155,7 +155,7 @@ where
let mut best_measure = base_measure;
if base_measure <= bound.0 {
return CandidateResult::SatisfiyingBound(best_candidate);
return CandidateResult::SatisfyingBound(best_candidate);
}
for (index, encryption_of_zero) in encryptions_of_zero.iter().enumerate() {
@@ -187,11 +187,11 @@ where
}
if measure <= bound.0 {
return CandidateResult::SatisfiyingBound(best_candidate);
return CandidateResult::SatisfyingBound(best_candidate);
}
}
CandidateResult::BestNotSatisfiyingBound(best_candidate)
CandidateResult::BestNotSatisfyingBound(best_candidate)
}
/// This function can be called before doing a modulus switch.
@@ -222,13 +222,13 @@ pub fn improve_lwe_ciphertext_modulus_switch_noise_for_binary_key<Scalar, C1, C2
#[cfg(test)]
assert!(
matches!(candidate, CandidateResult::SatisfiyingBound(_)),
matches!(candidate, CandidateResult::SatisfyingBound(_)),
"MS noise reduction bound not reached for any candidate"
);
let candidate = match candidate {
CandidateResult::SatisfiyingBound(candidate) => candidate,
CandidateResult::BestNotSatisfiyingBound(candidate) => candidate,
CandidateResult::SatisfyingBound(candidate) => candidate,
CandidateResult::BestNotSatisfyingBound(candidate) => candidate,
};
match candidate {

View File

@@ -292,8 +292,8 @@ fn improve_modulus_switch_noise_test_average_number_checks(params: MsNoiseReduct
input_variance,
log_modulus,
) {
CandidateResult::SatisfiyingBound(candidate) => candidate,
CandidateResult::BestNotSatisfiyingBound(_) => {
CandidateResult::SatisfyingBound(candidate) => candidate,
CandidateResult::BestNotSatisfyingBound(_) => {
panic!("No candidate was good enough")
}
};

View File

@@ -534,8 +534,8 @@ impl<Scalar: UnsignedInteger + CastInto<usize> + CastFrom<usize>> ParameterSetCo
&& lwe_ct_parameters.ct_modulus.is_power_of_two()
&& match lwe_ct_parameters.ms_decompression_method {
MsDecompressionType::ClassicPbs => false,
MsDecompressionType::MultiBitPbs(expected_gouping_factor) => {
expected_gouping_factor.0 == grouping_factor.0
MsDecompressionType::MultiBitPbs(expected_grouping_factor) => {
expected_grouping_factor.0 == grouping_factor.0
}
}
&& *uncompressed_ciphertext_modulus == lwe_ct_parameters.ct_modulus

View File

@@ -94,7 +94,7 @@ impl<Id: FheUintId> FheUint<Id> {
}
/// Generates an encrypted `num_block` blocks unsigned integer
/// taken uniformly in `[0, 2^random_bits_count[` using the given seed.
/// The encryted value is oblivious to the server.
/// The encrypted value is oblivious to the server.
/// It can be useful to make server random generation deterministic.
///
/// ```rust
@@ -188,7 +188,7 @@ impl<Id: FheUintId> FheUint<Id> {
impl<Id: FheIntId> FheInt<Id> {
/// Generates an encrypted signed integer
/// taken uniformly in its full range using the given seed.
/// The encryted value is oblivious to the server.
/// The encrypted value is oblivious to the server.
/// It can be useful to make server random generation deterministic.
///
/// ```rust
@@ -275,7 +275,7 @@ impl<Id: FheIntId> FheInt<Id> {
}
/// Generates an encrypted `num_block` blocks signed integer
/// taken uniformly in `[0, 2^random_bits_count[` using the given seed.
/// The encryted value is oblivious to the server.
/// The encrypted value is oblivious to the server.
/// It can be useful to make server random generation deterministic.
///
/// ```rust

View File

@@ -17,7 +17,7 @@ use crate::integer::gpu::{get_grouped_oprf_size_on_gpu, grouped_oprf_async, Cuda
impl CudaServerKey {
/// Generates an encrypted `num_block` blocks unsigned integer
/// taken uniformly in its full range using the given seed.
/// The encryted value is oblivious to the server.
/// The encrypted value is oblivious to the server.
/// It can be useful to make server random generation deterministic.
///
/// ```rust
@@ -56,7 +56,7 @@ impl CudaServerKey {
/// Generates an encrypted `num_block` blocks unsigned integer
/// taken uniformly in `[0, 2^random_bits_count[` using the given seed.
/// The encryted value is oblivious to the server.
/// The encrypted value is oblivious to the server.
/// It can be useful to make server random generation deterministic.
///
/// ```rust
@@ -115,7 +115,7 @@ impl CudaServerKey {
/// Generates an encrypted `num_block` blocks signed integer
/// taken uniformly in its full range using the given seed.
/// The encryted value is oblivious to the server.
/// The encrypted value is oblivious to the server.
/// It can be useful to make server random generation deterministic.
///
/// ```rust
@@ -155,7 +155,7 @@ impl CudaServerKey {
/// Generates an encrypted `num_block` blocks signed integer
/// taken uniformly in `[0, 2^random_bits_count[` using the given seed.
/// The encryted value is oblivious to the server.
/// The encrypted value is oblivious to the server.
/// It can be useful to make server random generation deterministic.
///
/// ```rust

View File

@@ -8,7 +8,7 @@ pub use tfhe_csprng::seeders::{Seed, Seeder};
impl ServerKey {
/// Generates an encrypted `num_block` blocks unsigned integer
/// taken uniformly in its full range using the given seed.
/// The encryted value is oblivious to the server.
/// The encrypted value is oblivious to the server.
/// It can be useful to make server random generation deterministic.
///
/// ```rust
@@ -78,7 +78,7 @@ impl ServerKey {
/// Generates an encrypted `num_block` blocks unsigned integer
/// taken uniformly in `[0, 2^random_bits_count[` using the given seed.
/// The encryted value is oblivious to the server.
/// The encrypted value is oblivious to the server.
/// It can be useful to make server random generation deterministic.
///
/// ```rust
@@ -159,7 +159,7 @@ impl ServerKey {
impl ServerKey {
/// Generates an encrypted `num_block` blocks signed integer
/// taken uniformly in its full range using the given seed.
/// The encryted value is oblivious to the server.
/// The encrypted value is oblivious to the server.
/// It can be useful to make server random generation deterministic.
///
/// ```rust
@@ -206,7 +206,7 @@ impl ServerKey {
/// Generates an encrypted `num_block` blocks signed integer
/// taken uniformly in `[0, 2^random_bits_count[` using the given seed.
/// The encryted value is oblivious to the server.
/// The encrypted value is oblivious to the server.
/// It can be useful to make server random generation deterministic.
///
/// ```rust

View File

@@ -108,7 +108,7 @@ pub trait AtomicPattern {
/// `full_bits_count` is the size of the lwe message, ie the shortint message + carry + padding
/// bit.
/// The output in in the form 0000rrr000noise (random_bits_count=3, full_bits_count=7)
/// The encryted value is oblivious to the server
/// The encrypted value is oblivious to the server
fn generate_oblivious_pseudo_random(
&self,
seed: Seed,

View File

@@ -178,7 +178,7 @@ pub(crate) fn raw_seeded_msed_to_lwe<Scalar: UnsignedInteger + CastFrom<usize>>(
/// `full_bits_count` is the size of the lwe message, ie the shortint message + carry + padding
/// bit.
/// The output in in the form 0000rrr000noise (rbc=3, fbc=7)
/// The encryted value is oblivious to the server.
/// The encrypted value is oblivious to the server.
///
/// It is the reponsiblity of the calling AP to transform this into a shortint ciphertext. The
/// returned LWE is in the post PBS state, so a Keyswitch might be needed if the order is PBS-KS.
@@ -261,7 +261,7 @@ where
impl<AP: AtomicPattern> GenericServerKey<AP> {
/// Uniformly generates a random encrypted value in `[0, 2^random_bits_count[`
/// `2^random_bits_count` must be smaller than the message modulus
/// The encryted value is oblivious to the server
/// The encrypted value is oblivious to the server
pub fn generate_oblivious_pseudo_random(
&self,
seed: Seed,
@@ -281,7 +281,7 @@ impl<AP: AtomicPattern> GenericServerKey<AP> {
}
/// Uniformly generates a random value in `[0, 2^random_bits_count[`
/// The encryted value is oblivious to the server
/// The encrypted value is oblivious to the server
pub(crate) fn generate_oblivious_pseudo_random_message_and_carry(
&self,
seed: Seed,