Skip to content

Commit 716dd22

Browse files
committed
disable float non-determinism for now to be able to complete the sync
1 parent 5e4c582 commit 716dd22

File tree

4 files changed

+47
-36
lines changed

4 files changed

+47
-36
lines changed

src/build_helper/src/git.rs

-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ pub fn get_closest_merge_commit(
154154
"rev-list",
155155
&format!("--author={}", config.git_merge_commit_email),
156156
"-n1",
157-
"--first-parent",
158157
&merge_base,
159158
]);
160159

src/tools/miri/src/intrinsics/mod.rs

+12-10
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,12 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
251251
let res = res.to_soft();
252252
// Apply a relative error of 16ULP to introduce some non-determinism
253253
// simulating imprecise implementations and optimizations.
254-
let res = apply_random_float_error_ulp(
255-
this,
256-
res,
257-
4, // log2(16)
258-
);
254+
// FIXME: temporarily disabled as it breaks std tests.
255+
// let res = apply_random_float_error_ulp(
256+
// this,
257+
// res,
258+
// 4, // log2(16)
259+
// );
259260
let res = this.adjust_nan(res, &[f]);
260261
this.write_scalar(res, dest)?;
261262
}
@@ -286,11 +287,12 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
286287
let res = res.to_soft();
287288
// Apply a relative error of 16ULP to introduce some non-determinism
288289
// simulating imprecise implementations and optimizations.
289-
let res = apply_random_float_error_ulp(
290-
this,
291-
res,
292-
4, // log2(16)
293-
);
290+
// FIXME: temporarily disabled as it breaks std tests.
291+
// let res = apply_random_float_error_ulp(
292+
// this,
293+
// res,
294+
// 4, // log2(16)
295+
// );
294296
let res = this.adjust_nan(res, &[f]);
295297
this.write_scalar(res, dest)?;
296298
}

src/tools/miri/src/shims/foreign_items.rs

+32-24
Original file line numberDiff line numberDiff line change
@@ -765,13 +765,15 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
765765
"erfcf" => f_host.erfc(),
766766
_ => bug!(),
767767
};
768+
let res = res.to_soft();
768769
// Apply a relative error of 16ULP to introduce some non-determinism
769770
// simulating imprecise implementations and optimizations.
770-
let res = math::apply_random_float_error_ulp(
771-
this,
772-
res.to_soft(),
773-
4, // log2(16)
774-
);
771+
// FIXME: temporarily disabled as it breaks std tests.
772+
// let res = math::apply_random_float_error_ulp(
773+
// this,
774+
// res,
775+
// 4, // log2(16)
776+
// );
775777
let res = this.adjust_nan(res, &[f]);
776778
this.write_scalar(res, dest)?;
777779
}
@@ -796,11 +798,12 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
796798
};
797799
// Apply a relative error of 16ULP to introduce some non-determinism
798800
// simulating imprecise implementations and optimizations.
799-
let res = math::apply_random_float_error_ulp(
800-
this,
801-
res,
802-
4, // log2(16)
803-
);
801+
// FIXME: temporarily disabled as it breaks std tests.
802+
// let res = math::apply_random_float_error_ulp(
803+
// this,
804+
// res,
805+
// 4, // log2(16)
806+
// );
804807
let res = this.adjust_nan(res, &[f1, f2]);
805808
this.write_scalar(res, dest)?;
806809
}
@@ -839,13 +842,15 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
839842
"erfc" => f_host.erfc(),
840843
_ => bug!(),
841844
};
845+
let res = res.to_soft();
842846
// Apply a relative error of 16ULP to introduce some non-determinism
843847
// simulating imprecise implementations and optimizations.
844-
let res = math::apply_random_float_error_ulp(
845-
this,
846-
res.to_soft(),
847-
4, // log2(16)
848-
);
848+
// FIXME: temporarily disabled as it breaks std tests.
849+
// let res = math::apply_random_float_error_ulp(
850+
// this,
851+
// res.to_soft(),
852+
// 4, // log2(16)
853+
// );
849854
let res = this.adjust_nan(res, &[f]);
850855
this.write_scalar(res, dest)?;
851856
}
@@ -870,11 +875,12 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
870875
};
871876
// Apply a relative error of 16ULP to introduce some non-determinism
872877
// simulating imprecise implementations and optimizations.
873-
let res = math::apply_random_float_error_ulp(
874-
this,
875-
res,
876-
4, // log2(16)
877-
);
878+
// FIXME: temporarily disabled as it breaks std tests.
879+
// let res = math::apply_random_float_error_ulp(
880+
// this,
881+
// res,
882+
// 4, // log2(16)
883+
// );
878884
let res = this.adjust_nan(res, &[f1, f2]);
879885
this.write_scalar(res, dest)?;
880886
}
@@ -900,10 +906,11 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
900906
// Using host floats (but it's fine, these operations do not have guaranteed precision).
901907
let (res, sign) = x.to_host().ln_gamma();
902908
this.write_int(sign, &signp)?;
909+
let res = res.to_soft();
903910
// Apply a relative error of 16ULP to introduce some non-determinism
904911
// simulating imprecise implementations and optimizations.
905-
let res =
906-
math::apply_random_float_error_ulp(this, res.to_soft(), 4 /* log2(16) */);
912+
// FIXME: temporarily disabled as it breaks std tests.
913+
// let res = math::apply_random_float_error_ulp(this, res, 4 /* log2(16) */);
907914
let res = this.adjust_nan(res, &[x]);
908915
this.write_scalar(res, dest)?;
909916
}
@@ -915,10 +922,11 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
915922
// Using host floats (but it's fine, these operations do not have guaranteed precision).
916923
let (res, sign) = x.to_host().ln_gamma();
917924
this.write_int(sign, &signp)?;
925+
let res = res.to_soft();
918926
// Apply a relative error of 16ULP to introduce some non-determinism
919927
// simulating imprecise implementations and optimizations.
920-
let res =
921-
math::apply_random_float_error_ulp(this, res.to_soft(), 4 /* log2(16) */);
928+
// FIXME: temporarily disabled as it breaks std tests.
929+
// let res = math::apply_random_float_error_ulp(this, res, 4 /* log2(16) */);
922930
let res = this.adjust_nan(res, &[x]);
923931
this.write_scalar(res, dest)?;
924932
}

src/tools/miri/tests/pass/float.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,7 @@ fn test_non_determinism() {
12811281
/// Ensure that the operation is non-deterministic
12821282
#[track_caller]
12831283
fn ensure_nondet<T: PartialEq + std::fmt::Debug>(f: impl Fn() -> T) {
1284+
12841285
let rounds = 16;
12851286
let first = f();
12861287
for _ in 1..rounds {
@@ -1290,7 +1291,8 @@ fn test_non_determinism() {
12901291
}
12911292
}
12921293
// We saw the same thing N times.
1293-
panic!("expected non-determinism, got {rounds} times the same result: {first:?}");
1294+
// FIXME: temporarily disabled as it breaks std tests.
1295+
//panic!("expected non-determinism, got {rounds} times the same result: {first:?}");
12941296
}
12951297

12961298
macro_rules! test_operations_f {

0 commit comments

Comments
 (0)