Zulip Chat Archive
Stream: mathlib4
Topic: cache misses aesop
Yaël Dillies (Jun 14 2024 at 07:23):
Am I the only one having to rebuild all of aesop every time I restart the server?
Rida Hamadani (Jun 14 2024 at 11:10):
I had to rebuild everything when I worked on gitpod today, which has never happened to me before.
Ruben Van de Velde (Jun 14 2024 at 11:27):
Yeah, batteries as well
Peter Nelson (Jun 14 2024 at 11:28):
Me too - I have to rebuild everything (not just aesop) even after a fresh clone and lake exe cache get
.
Ruben Van de Velde (Jun 14 2024 at 11:43):
I'm thinking we should revert #13808 @Kim Morrison
Ruben Van de Velde (Jun 14 2024 at 11:59):
Though the output looks like
✔ [956/4954] Built Aesop.Main:c.o
✔ [957/4954] Built Aesop.Main:dynlib
✔ [959/4954] Built Aesop:c.o
✔ [960/4954] Built Aesop:dynlib
I wonder...
Ruben Van de Velde (Jun 14 2024 at 12:02):
False accusation, it starts with #13789
Ruben Van de Velde (Jun 14 2024 at 12:03):
-testDriver = "test"
-precompileModules = false # We would like to turn this on, but it breaks the Mathlib cache.
+testDriver = "AesopTest"
+precompileModules = true
Ruben Van de Velde (Jun 14 2024 at 12:04):
@Jannis Limperg
Matthew Ballard (Jun 14 2024 at 12:05):
It breaks the benchmarking also
Jannis Limperg (Jun 14 2024 at 12:11):
I'll revert. @Mac Malone it seems precompilation breaks the Mathlib cache after all.
Jannis Limperg (Jun 14 2024 at 12:17):
Jannis Limperg (Jun 14 2024 at 12:17):
Sorry for the disruption.
Sebastian Ullrich (Jun 14 2024 at 12:57):
It seems the "check the cache" test did not catch this as it only tries to restore Mathlib .oleans https://github.com/leanprover-community/mathlib4/actions/runs/9511124129/job/26216720180#step:16:6
Sebastian Ullrich (Jun 14 2024 at 12:58):
And here I was wondering why live.lean-lang.org spent all morning repeatedly recompiling Mathlib
Peter Nelson (Jun 14 2024 at 13:01):
How long until this is fixed from the perspective of a regular mathlib user? I'm teaching lean in front of a class in a couple of hours.
Ruben Van de Velde (Jun 14 2024 at 13:02):
Can you use a mathlib from yesterday?
Peter Nelson (Jun 14 2024 at 13:21):
That gives me the 'wrong infoview' bug to contend with, which is also not ideal.
Yaël Dillies (Jun 14 2024 at 13:43):
Peter Nelson said:
How long until this is fixed from the perspective of a regular mathlib user? I'm teaching lean in front of a class in a couple of hours.
I think it will be fixed when @Kim Morrison does the update, which is once a day
Ruben Van de Velde (Jun 14 2024 at 14:21):
@Peter Nelson this should work now
Peter Nelson (Jun 14 2024 at 14:25):
Thanks!
Mac Malone (Jun 14 2024 at 18:43):
Jannis Limperg said:
I'll revert. Mac Malone it seems precompilation breaks the Mathlib cache after all.
This is because mathlib does not yet set platformIndependent := true
in its lakefile.
Mac Malone (Jun 14 2024 at 18:43):
(Lake defaults to asssuming packages are platform-dependent.)
Kim Morrison (Jun 14 2024 at 23:51):
Yaël Dillies said:
Peter Nelson said:
How long until this is fixed from the perspective of a regular mathlib user? I'm teaching lean in front of a class in a couple of hours.
I think it will be fixed when Kim Morrison does the update, which is once a day
Which update? Dependency updates are now (at least, should be, new CI is invariably broken) automatic.
Yaël Dillies (Jun 15 2024 at 08:57):
Oh sorry I thought you had closed the PR, but I now remember that this the PR about shake. I can't see the automatic update though. https://github.com/leanprover-community/mathlib4/commit/7fa489a5cbf3c4f08d36e1e0b5dee4d761fdbd9b doesn't seem very automatic.
Kim Morrison (Jun 15 2024 at 09:28):
It's in .github/workflows/update_dependencies.yml
. I haven't had a chance to look if it is working. If you would like to debug, help appreciated. :-)
Yaël Dillies (Jun 15 2024 at 09:35):
I actually don't know where the logs go to, nor where I should be expecting to run ("every hour" okay, but there isn't always something to update)
Jannis Limperg (Jun 16 2024 at 16:07):
Mac Malone said:
Jannis Limperg said:
I'll revert. Mac Malone it seems precompilation breaks the Mathlib cache after all.
This is because mathlib does not yet set
platformIndependent := true
in its lakefile.
Should this be done and should we then try again? Precompiled Aesop is ~30% faster on the test suite, though likely somewhat less on Mathlib.
Sebastian Ullrich (Jun 16 2024 at 16:21):
Let's test it on separate branches first?
Jannis Limperg (Jun 17 2024 at 12:57):
#13891 sets platformIndependent := true
in Mathlib and enables Aesop precompilation. In my manual tests, the cache works, both when I check out the PR branch in a new clone of Mathlib and when I create a new project that depends on Mathlib.
However, the speed center's benchmarking script appears to break.
Jannis Limperg (Jun 17 2024 at 13:03):
Actually, the cache also doesn't work. Repro:
$ git clone https://github.com/leanprover-community/mathlib4
$ cd mathlib4
$ git switch jannis/aesop-precompilation
$ lake exe cache get
-- succeeds
$ lake build
-- compiles Aesop (expected) and all files depending on Aesop (unexpected)
@Mac Malone could you take a look?
Mac Malone (Jun 17 2024 at 13:30):
@Jannis Limperg I suspect the problem is that Aesop itself does not use platformIndependent = true
.
Jannis Limperg (Jun 17 2024 at 13:33):
Ah, okay. Btw what's the meaning of this flag exactly?
Jannis Limperg (Jun 17 2024 at 13:35):
Nvm, found the docs. Thanks for the help!
Mac Malone (Jun 17 2024 at 13:43):
@Jannis Limperg If you still encounter a problem once Aesop is also platform-independent, feel free to ping me again!
Sebastian Ullrich (Jun 17 2024 at 13:59):
@Jannis Limperg When you have a fixed version of the branch, I'm happy to look at the benchmarking failure. It seems to be the proxy of leanc
is broken, as it has never been necessary before
Jannis Limperg (Jun 17 2024 at 15:13):
@Mac Malone The issue unfortunately seems to persist when I set platformIndependent = true
in Aesop's lakefile.toml
. :( The repro above is still relevant.
Mac Malone (Jun 17 2024 at 16:49):
@Jannis Limperg :cry: I will debug and see if I can fix the issue.
Mac Malone (Jun 17 2024 at 22:36):
@Jannis Limperg Found the bug. Fix is at lean4#4478. Added a test to prevent this problem in the future. If you want, I can bump aesop / the mathlib PR to this toolchain to verify everything works as expected before this goes live.
Yaël Dillies (Jun 18 2024 at 08:38):
The problem is back on rc2 :sweat:
Kim Morrison (Jun 18 2024 at 08:42):
@Yaël Dillies, could you clarify? It seems unlikely this has regressed.
Yaël Dillies (Jun 18 2024 at 08:47):
Okay, I thought it was fixed by the bump to rc2 but apparently it was fixed a bit later? My branch seems to have been on that intermediate version
Jannis Limperg (Jun 18 2024 at 09:27):
Yes, it was fixed in dc44afb4353b441dfdbca70458574c5b4be98b32
.
Jannis Limperg (Jun 18 2024 at 09:28):
Mac Malone said:
Jannis Limperg Found the bug. Fix is at lean4#4478. Added a test to prevent this problem in the future. If you want, I can bump aesop / the mathlib PR to this toolchain to verify everything works as expected before this goes live.
Beautiful, ty! I'll test with the PR toolchain.
Jannis Limperg (Jun 18 2024 at 11:52):
Seems to work now: lake exe cache
succeeds and lake build
only builds the platform-specific Aesop code. :tada:
Sebastian Ullrich (Jun 18 2024 at 11:56):
Do we have a Mathlib !bench
yet? lake exe cache get && lake build
overhead would also be interesting
Jannis Limperg (Jun 18 2024 at 12:01):
!bench
is running: http://speed.lean-fro.org/mathlib4/task-detail/725191f8-ef40-4b90-ab00-2763d647e258
Jannis Limperg (Jun 18 2024 at 12:10):
On my system and with my internet connection, lake exe cache get
takes ~40s with a clean checkout and clean ~/.cache/mathlib
. lake build
then takes another 50s. So the overhead is not great.
Jannis Limperg (Jun 18 2024 at 12:37):
!bench
failed, same error as before: leanc
reports unknown command /usr/bin/time
.
Jannis Limperg (Jun 19 2024 at 12:40):
Sebastian fixed the benchmark script, so we now have a performance comparison between no precompilation and precompilation. Copying my comment from #13891:
- Aesop -40%
- build wall-clock +7%
- interpretation +10%
open Mathlib
task-clock +1000%, wall-clock +225%, instructions +109%
So a loss overall. But where do these crazy numbers for open Mathlib
come from? And why does interpretation get slower?
Last updated: May 02 2025 at 03:31 UTC