chore(mockup): Add clippy target for tfhe_hpu_mockup

Also fix all clippy lint
This commit is contained in:
Baptiste Roux
2025-07-01 22:06:10 +02:00
committed by B. Roux
parent 15cce9f641
commit 6432b98591
2 changed files with 12 additions and 6 deletions

View File

@@ -514,6 +514,12 @@ clippy_hpu_backend: install_rs_check_toolchain
RUSTFLAGS="$(RUSTFLAGS)" cargo "$(CARGO_RS_CHECK_TOOLCHAIN)" clippy --all-targets \
-p tfhe-hpu-backend -- --no-deps -D warnings
.PHONY: clippy_hpu_mockup # Run clippy lints on tfhe-hpu-mockup
clippy_hpu: install_rs_check_toolchain
RUSTFLAGS="$(RUSTFLAGS)" cargo "$(CARGO_RS_CHECK_TOOLCHAIN)" clippy \
--all-targets \
-p tfhe-hpu-backend -- --no-deps -D warnings
.PHONY: check_rust_bindings_did_not_change # Check rust bindings are up to date for tfhe-cuda-backend
check_rust_bindings_did_not_change:
cargo build -p tfhe-cuda-backend && "$(MAKE)" fmt_gpu && \
@@ -1554,7 +1560,7 @@ pcc_gpu: check_rust_bindings_did_not_change clippy_rustdoc_gpu \
clippy_gpu clippy_cuda_backend clippy_bench_gpu check_compile_tests_benches_gpu
.PHONY: pcc_hpu # pcc stands for pre commit checks for HPU compilation
pcc_hpu: clippy_hpu clippy_hpu_backend test_integer_hpu_mockup_ci_fast
pcc_hpu: clippy_hpu clippy_hpu_backend clippy_hpu_mockup test_integer_hpu_mockup_ci_fast
.PHONY: fpcc # pcc stands for pre commit checks, the f stands for fast
fpcc: no_tfhe_typo no_dbg_log check_parameter_export_ok check_fmt check_typos lint_doc \

View File

@@ -257,7 +257,7 @@ impl HpuSim {
let asm_p = format!("{dump_path}/iop/iop_{}.asm", self.iop_nb);
let hex_p = format!("{dump_path}/iop/iop_{}.hex", self.iop_nb);
let mut iop_prog = hpu_asm::Program::default();
iop_prog.push_comment(format!("{}", iop));
iop_prog.push_comment(format!("{iop}"));
iop_prog.push_stmt(iop.clone());
iop_prog.write_asm(&asm_p).unwrap();
iop_prog.write_hex(&hex_p).unwrap();
@@ -389,7 +389,7 @@ impl HpuSim {
tracing::info!("{pe_rpt}");
if let Some(mut rpt_file) = self.options.report_file((&iop).into()) {
writeln!(rpt_file, "Report for IOp: {}", iop).unwrap();
writeln!(rpt_file, "Report for IOp: {iop}").unwrap();
writeln!(rpt_file, "{time_rpt:?}").unwrap();
writeln!(rpt_file, "{dop_rpt}").unwrap();
writeln!(rpt_file, "{pe_rpt}").unwrap();
@@ -400,7 +400,7 @@ impl HpuSim {
if let Some(mut trace_file) = self.options.report_trace((&iop).into()) {
let json_string =
serde_json::to_string(&trace).expect("Could not serialize trace");
writeln!(trace_file, "{}", json_string).unwrap();
writeln!(trace_file, "{json_string}").unwrap();
}
}
hpu_asm::DOp::LD(op_impl) => {
@@ -909,10 +909,10 @@ impl HpuSim {
.enumerate()
.for_each(|(i, slice)| {
// Create file-path
let file_path = format!("{base_path}_{:0>1x}.hex", i);
let file_path = format!("{base_path}_{i:0>1x}.hex");
let mut wr_f = MockupOptions::open_wr_file(&file_path);
writeln!(&mut wr_f, "# LweCiphertext slice #{}", i).unwrap();
writeln!(&mut wr_f, "# LweCiphertext slice #{i}").unwrap();
// Compact Blwe on 32b if possible
if self.params.rtl_params.ntt_params.ct_width <= u32::BITS {
let slice_32b = slice.iter().map(|x| *x as u32).collect::<Vec<u32>>();