chore(clap): Replace use of deprecated attributes

Replace deprecated #[clap(...)] attributes to #[arg]/#[command] and remove redundant use of value_parser
This commit is contained in:
Himess
2025-09-07 16:00:58 +03:00
committed by Nicolas Sarlin
parent 5d70ae4232
commit 6fde90ad9c
8 changed files with 67 additions and 75 deletions

View File

@@ -14,24 +14,22 @@ use tfhe_hpu_mockup::{HpuSim, MockupOptions, MockupParameters};
/// Define CLI arguments
use clap::Parser;
#[derive(clap::Parser, Debug, Clone)]
#[clap(long_about = "Hpu Simulation mockup.")]
#[command(long_about = "Hpu Simulation mockup.")]
pub struct Args {
// Configuration ----------------------------------------------------
/// Fpga fake configuration
/// Toml file similar to the one used with the real hpu-backend
/// Enable to retrieved ipc_name, register_file and board definition
#[clap(
#[arg(
long,
value_parser,
default_value = "${HPU_BACKEND_DIR}/config_store/${HPU_CONFIG}/hpu_config.toml"
)]
pub config: ShellString,
/// Hpu rtl parameters
/// Enable to retrieved the associated tfhe-rs parameters and other Rtl parameters
#[clap(
#[arg(
long,
value_parser,
default_value = "${HPU_MOCKUP_DIR}/params/gaussian_64b_fast.toml"
)]
pub params: ShellString,
@@ -41,30 +39,30 @@ pub struct Args {
// configuration file
// Used to override some parameters at runtime
/// Override Number of Register
#[clap(long, value_parser)]
#[arg(long)]
register: Option<usize>,
/// Override HPU lookahead buffer depth
/// Number of instruction that are considered in advance
#[clap(long, value_parser)]
#[arg(long)]
isc_depth: Option<usize>,
// Simulation configuration -----------------------------------------
/// Frequency in MHz
/// Only use for report display
#[clap(long, value_parser, default_value_t = 300)]
#[arg(long, default_value_t = 300)]
freq_mhz: usize,
/// Simulation quantum in micro_seconds.
/// Maximum simulation time drift between mockup and backend
#[clap(long, value_parser, default_value_t = 1_000_000)]
#[arg(long, default_value_t = 1_000_000)]
quantum_us: usize,
/// Consider all received ciphertext as trivial ciphertext
/// Execute Pbs in a trivial manner and display value in tracing::debug
/// Useful for IOp algorithm debug
/// WARN: Only work if user application send trivial ciphertext
#[clap(long, value_parser)]
#[arg(long)]
trivial: bool,
// Dump configuration ----------------------------------------------------
@@ -72,27 +70,27 @@ pub struct Args {
/// Specify simulus dump folder.
/// NB: The Rtl stimulus (i.e. Input/Output, Keys, Lut) should be generated by the client.
/// Only used to dump IOp/DOp and the inner register values (c.f. dump-reg)
#[clap(long, value_parser)]
#[arg(long)]
dump_out: Option<String>,
/// Activate the dump of intermediate register value. Only work if dump-out is also specified
#[clap(long, value_parser)]
#[arg(long)]
dump_reg: bool,
// Reports configuration -------------------------------------------------
// Use to activate some performances reports
/// Specify reports dump folder. When not specified, no reports were generated
#[clap(long, value_parser)]
#[arg(long)]
report_out: Option<String>,
/// Activate the execution trace export for later analysis
#[clap(long, value_parser)]
#[arg(long)]
report_trace: bool,
// Log configuration -------------------------------------------------
/// Write trace message in the file (instead of on stdio)
/// NB: Use RUST_LOG env variable to set the verbosity
#[clap(long, value_parser)]
#[arg(long)]
log_out: Option<String>,
}