Skip to content

Commit

Permalink
inference
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Jan 14, 2025
1 parent b6927b5 commit 2ca184f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crates/libm-test/benches/icount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ macro_rules! icount_benches {
CheckBasis::None,
GeneratorKind::QuickSpaced
);
ctx.override_ntests(BENCH_ITER_ITEMS);
ctx.override_iterations(BENCH_ITER_ITEMS);
let ret = spaced::get_test_cases::<Op>(&ctx).0.collect::<Vec<_>>();
println!("operation {}, {} steps", Op::NAME, ret.len());
ret
Expand Down
22 changes: 11 additions & 11 deletions crates/libm-test/src/run_cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct CheckCtx {
pub basis: CheckBasis,
pub gen_kind: GeneratorKind,
/// If specified, this value will override the value returned by [`iteration_count`].
pub override_ntests: Option<u64>,
pub override_iterations: Option<u64>,
}

impl CheckCtx {
Expand All @@ -55,7 +55,7 @@ impl CheckCtx {
base_name_str: fn_ident.base_name().as_str(),
basis,
gen_kind,
override_ntests: None,
override_iterations: None,
};
ret.ulp = crate::default_ulp(&ret);
ret
Expand All @@ -65,8 +65,8 @@ impl CheckCtx {
self.fn_ident.math_op().rust_sig.args.len()
}

pub fn override_ntests(&mut self, count: u64) {
self.override_ntests = Some(count)
pub fn override_iterations(&mut self, count: u64) {
self.override_iterations = Some(count)
}
}

Expand Down Expand Up @@ -224,20 +224,20 @@ pub fn iteration_count(ctx: &CheckCtx, argnum: usize) -> u64 {
total_iterations = 800;
}

let mut overridden = false;
if let Some(count) = ctx.override_iterations {
total_iterations = count;
overridden = true;
}

// Adjust for the number of inputs
let mut ntests = match t_env.input_count {
let ntests = match t_env.input_count {
1 => total_iterations,
2 => (total_iterations as f64).sqrt().ceil() as u64,
3 => (total_iterations as f64).cbrt().ceil() as u64,
_ => panic!("test has more than three arguments"),
};

let mut overridden = false;
if let Some(count) = ctx.override_ntests {
ntests = count;
overridden = true;
}

let total = ntests.pow(t_env.input_count.try_into().unwrap());

let seed_msg = match ctx.gen_kind {
Expand Down

0 comments on commit 2ca184f

Please sign in to comment.