File tree Expand file tree Collapse file tree 4 files changed +12
-8
lines changed
bench-cargo-miri/big-allocs/src Expand file tree Collapse file tree 4 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,10 @@ fn main() {
77 // We can't use too big of an allocation or this code will encounter an allocation failure in
88 // CI. Since the allocation can't be huge, we need to do a few iterations so that the effect
99 // we're trying to measure is clearly visible above the interpreter's startup time.
10- for _ in 0 ..10 {
10+ // FIXME (https://github.com/rust-lang/miri/issues/4253): On 32bit targets, we can run out of
11+ // usable addresses if we don't reuse, leading to random test failures.
12+ let count = if cfg ! ( target_pointer_width = "32" ) { 8 } else { 12 } ;
13+ for _ in 0 ..count {
1114 drop ( Vec :: < u8 > :: with_capacity ( 512 * 1024 * 1024 ) ) ;
1215 }
1316}
Original file line number Diff line number Diff line change 1- d5b4c2e4f19b6d7037371cdaecc3cc2c701c68df
1+ 25a615bf829b9f6d6f22da537e3851043f92e5f2
Original file line number Diff line number Diff line change @@ -411,9 +411,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
411411 } ;
412412 let res = this. binary_op ( op, & a, & b) ?;
413413 // `binary_op` already called `generate_nan` if needed.
414- // Apply a relative error of 16ULP to simulate non-deterministic precision loss
414+ // Apply a relative error of 4ULP to simulate non-deterministic precision loss
415415 // due to optimizations.
416- let res = apply_random_float_error_to_imm ( this, res, 4 /* log2(16 ) */ ) ?;
416+ let res = apply_random_float_error_to_imm ( this, res, 2 /* log2(4 ) */ ) ?;
417417 this. write_immediate ( * res, dest) ?;
418418 }
419419
@@ -464,9 +464,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
464464 if !float_finite ( & res) ? {
465465 throw_ub_format ! ( "`{intrinsic_name}` intrinsic produced non-finite value as result" ) ;
466466 }
467- // Apply a relative error of 16ULP to simulate non-deterministic precision loss
467+ // Apply a relative error of 4ULP to simulate non-deterministic precision loss
468468 // due to optimizations.
469- let res = apply_random_float_error_to_imm ( this, res, 4 /* log2(16 ) */ ) ?;
469+ let res = apply_random_float_error_to_imm ( this, res, 2 /* log2(4 ) */ ) ?;
470470 this. write_immediate ( * res, dest) ?;
471471 }
472472
Original file line number Diff line number Diff line change @@ -38,8 +38,9 @@ macro_rules! assert_approx_eq {
3838 } } ;
3939
4040 ( $a: expr, $b: expr) => {
41- // accept up to 64ULP (16ULP for host floats and 16ULP for miri artificial error and 32 for any rounding errors)
42- assert_approx_eq!( $a, $b, 64 ) ;
41+ // accept up to 12ULP (4ULP for host floats and 4ULP for miri artificial error and 4 for any additional effects
42+ // due to having multiple error sources.
43+ assert_approx_eq!( $a, $b, 12 ) ;
4344 } ;
4445}
4546
You can’t perform that action at this time.
0 commit comments