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

Use InternalCodeCache #534

Closed
wants to merge 1 commit into from
Closed

Use InternalCodeCache #534

wants to merge 1 commit into from

Conversation

vchuravy
Copy link
Member

@vchuravy vchuravy commented Nov 25, 2023

Adopting to JuliaLang/julia#52233

TODO

  • Add test for cross session caching

@vchuravy
Copy link
Member Author

vchuravy commented Nov 25, 2023

Currently it runs into the fun issue that

(rr) p jl_(owner)
GPUCompiler.CompilerConfig{GPUCompiler.NativeCompilerTarget, Main.CompilerParams}(target=GPUCompiler.NativeCompilerTarget(cpu="znver2", features="-avx512pf,-tsxldtrk,+cx16,+sahf,-tbm,-avx512ifma,+sha,+crc32,-fma4,-vpclmulqdq,+prfchw,+bmi2,-cldemote,+fsgsbase,-avx512bf16,-amx-tile,-uintr,-gfni,+popcnt,-ptwrite,+aes,-avx512bitalg,-movdiri,-widekl,+xsaves,-avx512er,-avxvnni,-avx512fp16,-avx512vnni,-amx-bf16,-avx512vpopcntdq,-pconfig,+clwb,-avx512f,+xsavec,+clzero,-pku,+mmx,-lwp,+rdpid,-xop,+rdseed,-waitpkg,-kl,-movdir64b,+sse4a,-avx512bw,+clflushopt,+xsave,-avx512vbmi2,+64bit,-avx512vl,-serialize,-hreset,-invpcid,-avx512cd,+avx,-vaes,-amx-int8,+cx8,+fma,-rtm,+bmi,-enqcmd,+rdrnd,+mwaitx,+sse4.1,+sse4.2,+avx2,+fxsr,+wbnoinvd,+sse,+lzcnt,+pclmul,+rdpru,+f16c,+ssse3,-sgx,-prefetchwt1,+cmov,-avx512vbmi,-shstk,+movbe,-avx512vp2intersect,+xsaveopt,-avx512dq,+sse2,+adx,+sse3", llvm_always_inline=false, jlruntime=false), params=Main.CompilerParams(entry_safepoint=false, method_table=Core.MethodTable(name=:test_method_table, defs=nothing, leafcache=Memory{Any}(0, 0x7f466f96de80)[], cache=nothing, max_args=0, module=Main, backedges=#<null>, =0, =0, offs=0x00, =0x00)), kernel=false, name=nothing, entry_abi=:specfunc, always_inline=false)
$10 = void

(rr) p jl_(codeinst->owner)
GPUCompiler.CompilerConfig{GPUCompiler.NativeCompilerTarget, Main.CompilerParams}(target=GPUCompiler.NativeCompilerTarget(cpu="znver2", features="-avx512pf,-tsxldtrk,+cx16,+sahf,-tbm,-avx512ifma,+sha,+crc32,-fma4,-vpclmulqdq,+prfchw,+bmi2,-cldemote,+fsgsbase,-avx512bf16,-amx-tile,-uintr,-gfni,+popcnt,-ptwrite,+aes,-avx512bitalg,-movdiri,-widekl,+xsaves,-avx512er,-avxvnni,-avx512fp16,-avx512vnni,-amx-bf16,-avx512vpopcntdq,-pconfig,+clwb,-avx512f,+xsavec,+clzero,-pku,+mmx,-lwp,+rdpid,-xop,+rdseed,-waitpkg,-kl,-movdir64b,+sse4a,-avx512bw,+clflushopt,+xsave,-avx512vbmi2,+64bit,-avx512vl,-serialize,-hreset,-invpcid,-avx512cd,+avx,-vaes,-amx-int8,+cx8,+fma,-rtm,+bmi,-enqcmd,+rdrnd,+mwaitx,+sse4.1,+sse4.2,+avx2,+fxsr,+wbnoinvd,+sse,+lzcnt,+pclmul,+rdpru,+f16c,+ssse3,-sgx,-prefetchwt1,+cmov,-avx512vbmi,-shstk,+movbe,-avx512vp2intersect,+xsaveopt,-avx512dq,+sse2,+adx,+sse3", llvm_always_inline=false, jlruntime=false), params=Main.CompilerParams(entry_safepoint=false, method_table=Core.MethodTable(name=:test_method_table, defs=nothing, leafcache=Memory{Any}(0, 0x7f466f96de80)[], cache=nothing, max_args=0, module=Main, backedges=#<null>, =0, =0, offs=0x00, =0x00)), kernel=false, name=nothing, entry_abi=:specfunc, always_inline=false)

are jl_egal, but are not === and thus we fail the assertion here https://github.com/JuliaLang/julia/pull/52233/files#diff-c1b859ac0f66eb3679d3ed6caf04e93264969da41d7bd8914efe5e4fe9cfcb25R64

return Core.Compiler.InternalCodeCache(job.config)
else
lock(GLOBAL_CI_CACHES_LOCK) do
cache = get!(GLOBAL_CI_CACHES, job.config) do
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maleadt Already now I feel like we are bifurcating the caches to much.

I think this means Enzyme creates a fresh inference cache per top-level request,
due to us using EnzymeCompilerParams to stash information.

https://github.com/EnzymeAD/Enzyme.jl/blob/3f641088fa39cf0cfb00ffd9e4b8c8200564dbfc/src/compiler.jl#L2477

cc: @wsmoses

@vchuravy
Copy link
Member Author

Okay this now works with the latest upstream fixes.

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

Successfully merging this pull request may close these issues.

1 participant