Skip to content
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

Enzyme v0.11.11+ much slower to load #1243

Closed
staticfloat opened this issue Jan 19, 2024 · 2 comments
Closed

Enzyme v0.11.11+ much slower to load #1243

staticfloat opened this issue Jan 19, 2024 · 2 comments

Comments

@staticfloat
Copy link

It appears that Enzyme v0.11.11 introduced a pretty serious load time regression in Enzyme.Compiler.__init__():

(tmp.QXqGKVm6jS) pkg> add [email protected]
   Resolving package versions...             
    Updating `/private/var/folders/b1/lrtym5_j0zl_8r96ydwfrgy40000gp/T/tmp.QXqGKVm6jS/Project.toml`
⌃ [7da242da] + Enzyme v0.11.10
julia> @time_imports using Enzyme
      1.6 ms  EnzymeCore
      1.5 ms  CEnum
      9.5 ms  Preferences
      0.5 ms  LazyArtifacts
      0.5 ms  JLLWrappers
               ┌ 3.2 ms LLVMExtra_jll.__init__() 70.46% compilation time
     19.1 ms  LLVMExtra_jll 88.50% compilation time
               ┌ 0.1 ms LLVM.__init__() 
     25.2 ms  LLVM
               ┌ 0.7 ms Enzyme_jll.__init__() 
      1.7 ms  Enzyme_jll
      0.4 ms  ExprTools
               ┌ 0.1 ms TimerOutputs.__init__() 
     11.2 ms  TimerOutputs
      0.4 ms  Scratch
               ┌ 1.7 ms GPUCompiler.__init__() 
     70.0 ms  GPUCompiler 0.04% compilation time
      0.4 ms  Reexport
      0.4 ms  StructIO
               ┌ 0.0 ms ObjectFile.__init__() 
      6.0 ms  ObjectFile
               ┌ 1.1 ms Enzyme.API.__init__() 
               ├ 0.2 ms Enzyme.Compiler.JIT.__init__() 
               ├ 0.0 ms Enzyme.Compiler.FFI.BLASSupport.__init__() 
               ├ 1.8 ms Enzyme.Compiler.FFI.__init__() 
               ├ 0.1 ms Enzyme.Compiler.__init__() 
    110.6 ms  Enzyme 0.03% compilation time

Versus:

(tmp.QXqGKVm6jS) pkg> add [email protected]
   Resolving package versions...             
    Updating `/private/var/folders/b1/lrtym5_j0zl_8r96ydwfrgy40000gp/T/tmp.QXqGKVm6jS/Project.toml`
⌃ [7da242da] + Enzyme v0.11.11
julia> @time_imports using Enzyme
      1.6 ms  EnzymeCore
      1.5 ms  CEnum
     40.9 ms  Preferences
      0.4 ms  LazyArtifacts
      0.5 ms  JLLWrappers
               ┌ 2.6 ms LLVMExtra_jll.__init__() 68.41% compilation time
     15.2 ms  LLVMExtra_jll 89.35% compilation time
               ┌ 0.1 ms LLVM.__init__() 
     21.0 ms  LLVM
               ┌ 0.8 ms Enzyme_jll.__init__() 
      1.6 ms  Enzyme_jll
      0.4 ms  ExprTools
               ┌ 0.0 ms TimerOutputs.__init__() 
     10.8 ms  TimerOutputs
      0.4 ms  Scratch
               ┌ 1.8 ms GPUCompiler.__init__() 
     65.0 ms  GPUCompiler 0.05% compilation time
      0.4 ms  Reexport
      0.3 ms  StructIO
               ┌ 0.0 ms ObjectFile.__init__() 
      5.4 ms  ObjectFile
               ┌ 6.4 ms Enzyme.API.__init__() 
               ├ 0.2 ms Enzyme.Compiler.JIT.__init__() 
               ├ 0.0 ms Enzyme.Compiler.FFI.BLASSupport.__init__() 
               ├ 1.9 ms Enzyme.Compiler.FFI.__init__() 
               ├ 3086.9 ms Enzyme.Compiler.__init__() 99.99% compilation time
   3202.9 ms  Enzyme 96.37% compilation time
@staticfloat
Copy link
Author

This also apparently can be worsened if you've loaded many other packages, adding just SciMLSensitivity to the environment and then timing that load shows the time spent growing to absurd numbers:

...
10.8 ms  ObjectFile
               ┌ 5.9 ms Enzyme.API.__init__() 
               ├ 0.2 ms Enzyme.Compiler.JIT.__init__() 
               ├ 0.0 ms Enzyme.Compiler.FFI.BLASSupport.__init__() 
               ├ 2.1 ms Enzyme.Compiler.FFI.__init__() 
               ├ 10521.1 ms Enzyme.Compiler.__init__() 100.00% compilation time
  10673.4 ms  Enzyme 98.57% compilation time
...

This is just with a fresh environment on Julia v1.10:

(tmp.QXqGKVm6jS) pkg> st
Status `/private/var/folders/b1/lrtym5_j0zl_8r96ydwfrgy40000gp/T/tmp.QXqGKVm6jS/Project.toml`
⌃ [7da242da] Enzyme v0.11.11
  [1ed8b502] SciMLSensitivity v7.52.0
Info Packages marked with ⌃ have new versions available and may be upgradable.

Using Enzyme v0.11.10 eliminates this time, and lowers the overall load time of SciMLSensitivity from 16.7s -> 6.1s.

@wsmoses
Copy link
Member

wsmoses commented Jan 19, 2024

I think duplicate of #776, so let's move this info/conversation to that issue.

But regardless my tldr understanding is that the Julia compiler itself needs improvements here

@wsmoses wsmoses closed this as not planned Won't fix, can't repro, duplicate, stale Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants