-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Major lia
and Qed
performance regression in 8.10.1
#11063
Comments
This is strange. If I copy/paste the goal in the Lemma foo x x' y :
Z.max (Z.succ x) (Z.max (Z.succ x') y) = Z.max (Z.succ x') (Z.max (Z.succ x) y).
Proof. lia. Time Qed. (* takes close to 0 time *) |
This was done by looking for commits with a ~5x slowdown. The commit itself is about 10x slower on my machine. It is possible that there has been a gradual decline totaling less than 5x slowdown before this commit but I somehow doubt that judging by the commit message and the scope of the commit. |
cc @fajb |
What happens with
|
Same time on my machine (at that exact commit, at least.) |
Profiling indicates that the time is passed in kernel conversion, so most likely some conversion problem went wrong. We should diff the terms generated by the two versions. |
The culprit seems to be lia but: This is fast: This is also fast: In this case, |
The Lines 265 to 268 in 0afbbb0
Diff between doing lia in a Lemma vs obligation: @@ -1,12 +1,8 @@
-orig_proof =
+Z_infinite_obligation_1 =
fun x x' y : Z =>
-(fun
- lemma : (fun t : Z =>
- Z.max (Z.succ x) (Z.max (Z.succ x') y) = Z.max (Z.succ x') (Z.max (Z.succ x) y) <->
- t = Z.max (x' + 1) (Z.max (x + 1) y)) (Z.max (x + 1) (Z.max (x' + 1) y)) =>
- Morphisms.iff_flip_impl_subrelation
- (Z.max (Z.succ x) (Z.max (Z.succ x') y) = Z.max (Z.succ x') (Z.max (Z.succ x) y))
- (Z.max (x + 1) (Z.max (x' + 1) y) = Z.max (x' + 1) (Z.max (x + 1) y)) lemma)
+Morphisms.iff_flip_impl_subrelation
+ (Z.max (Z.succ x) (Z.max (Z.succ x') y) = Z.max (Z.succ x') (Z.max (Z.succ x) y))
+ (Z.max (x + 1) (Z.max (x' + 1) y) = Z.max (x' + 1) (Z.max (x + 1) y))
(eq_ind (Z.max (Z.succ x) (Z.max (Z.succ x') y))
(fun t : Z =>
Z.max (Z.succ x) (Z.max (Z.succ x') y) = Z.max (Z.succ x') (Z.max (Z.succ x) y) <->
@@ -755,8 +751,9 @@
RingMicromega.Flhs := EnvRing.PEX 1;
RingMicromega.Fop := RingMicromega.OpEq;
RingMicromega.Frhs := EnvRing.PEX 2 |} ())))))))) in
- ZMicromega.ZTautoCheckerExt_sound __ff __wit
- (eq_refl <: ZMicromega.ZTautoCheckerExt __ff __wit = true) (VarMap.find 0%Z __varmap) in
+ ZMicromega.ZTautoCheckerExt_sound __ff __wit eq_refl (VarMap.find 0%Z __varmap) in
__arith z6 z4 y z3 z0 x' z2 x z z5 z1 H2 H1 Heqz4 H0 H Heqz0 Heqz2 Heqz)
: forall x x' y : Z,
- Z.max (Z.succ x) (Z.max (Z.succ x') y) = Z.max (Z.succ x') (Z.max (Z.succ x) y)
+ (Z.max ∘ Z.succ) x ((Z.max ∘ Z.succ) x' y) = (Z.max ∘ Z.succ) x' ((Z.max ∘ Z.succ) x y) I don't think the |
I am not quite following. Why was this particular commit responsible for the slowdown? It didn't change whether or not |
I think that commit made the produced term more complicated, which makes the use of the vm more important.
|
I would say that the factor 3.5 on 8.9 is already suspicious. Why should the obligation be more expensive to check? |
@SkySkimmer is there a way to get that VM cast back in without reverting the entire patch? It's not just std++ that is affected by this: the already very slow weak-memory version of lambdaRust got slowed down from 17min to 25min of overall execution time. Here's the per-file instruction count diff. |
Actually that problem seems unrelated to lia after all -- stubbing out most |
So it seems there are two problems here:
I can try to fix the first, @fajb can you comment on the second? |
I am working on it PR #11047 |
- PR coq#9725 fixes completness bugs introduces some inefficiency. The current PR intends to fix the inefficiency while retaining completness. The fix removes a pre-processing step and instead relies on a more elaborate proof format introducing positivity constraints on the fly. fixes coq#11063, fixes coq#11242 - Better interval analysis for product of variables. (fixes coq#11191 , first case) - Generation of positivity constrains for Z.pow (fixes coq#11191 , second case) - More aggressive pruning of (useless) hypotheses
PR coq#9725 fixes completness bugs introduces some inefficiency. The current PR intends to fix the inefficiency while retaining completness. The fix removes a pre-processing step and instead relies on a more elaborate proof format introducing positivity constraints on the fly. Solve bootstrapping issues: RMicromega <-> Rbase <-> lia. Fixes coq#11063 and fixes coq#11242
PR coq#9725 fixes completness bugs introduces some inefficiency. The current PR intends to fix the inefficiency while retaining completness. The fix removes a pre-processing step and instead relies on a more elaborate proof format introducing positivity constraints on the fly. Solve bootstrapping issues: RMicromega <-> Rbase <-> lia. Fixes coq#11063 and fixes coq#11242 and fixes coq#11270
PR coq#9725 fixes completness bugs introduces some inefficiency. The current PR intends to fix the inefficiency while retaining completness. The fix removes a pre-processing step and instead relies on a more elaborate proof format introducing positivity constraints on the fly. Solve bootstrapping issues: RMicromega <-> Rbase <-> lia. Fixes coq#11063 and fixes coq#11242 and fixes coq#11270
PR coq#9725 fixes completness bugs introduces some inefficiency. The current PR intends to fix the inefficiency while retaining completness. The fix removes a pre-processing step and instead relies on a more elaborate proof format introducing positivity constraints on the fly. Solve bootstrapping issues: RMicromega <-> Rbase <-> lia. Fixes coq#11063 and fixes coq#11242 and fixes coq#11270
PR coq#9725 fixes completness bugs introduces some inefficiency. The current PR intends to fix the inefficiency while retaining completness. The fix removes a pre-processing step and instead relies on a more elaborate proof format introducing positivity constraints on the fly. Solve bootstrapping issues: RMicromega <-> Rbase <-> lia. Fixes coq#11063 and fixes coq#11242 and fixes coq#11270
PR coq#9725 fixes completness bugs introduces some inefficiency. The current PR intends to fix the inefficiency while retaining completness. The fix removes a pre-processing step and instead relies on a more elaborate proof format introducing positivity constraints on the fly. Solve bootstrapping issues: RMicromega <-> Rbase <-> lia. Fixes coq#11063 and fixes coq#11242 and fixes coq#11270
PR coq#9725 fixes completness bugs introduces some inefficiency. The current PR intends to fix the inefficiency while retaining completness. The fix removes a pre-processing step and instead relies on a more elaborate proof format introducing positivity constraints on the fly. Solve bootstrapping issues: RMicromega <-> Rbase <-> lia. Fixes coq#11063 and fixes coq#11242 and fixes coq#11270
PR coq#9725 fixes completness bugs introduces some inefficiency. The current PR intends to fix the inefficiency while retaining completness. The fix removes a pre-processing step and instead relies on a more elaborate proof format introducing positivity constraints on the fly. Solve bootstrapping issues: RMicromega <-> Rbase <-> lia. Fixes coq#11063 and fixes coq#11242 and fixes coq#11270 (cherry picked from commit 7d961a9)
Description of the problem
As our CI indicates, there are some major performance regressions (of 305%) in std++ when switching from Coq 8.9.x to 8.10.1. See here.
I managed to extract at least one concrete minimal test case for the regression. The
Time Qed
in the below takes close to 0 time with Coq 8.9.x and more than 1 sec with Coq 8.10.1.The actual (non-minimized) code can be found here: https://gitlab.mpi-sws.org/iris/stdpp/blob/master/theories/infinite.v#L116
Coq Version
The text was updated successfully, but these errors were encountered: