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

ensure proper handling of sparams for widened compile signatures #47667

Merged
merged 4 commits into from
Dec 12, 2022

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Nov 22, 2022

Fix #47476

@vtjnash vtjnash added needs nanosoldier run This PR should have benchmarks run on it needs pkgeval Tests for all registered packages should be run with this change backport 1.9 Change should be backported to release-1.9 labels Nov 22, 2022
@vtjnash vtjnash requested a review from JeffBezanson November 22, 2022 18:18
@vtjnash vtjnash added the don't squash Don't squash merge label Nov 22, 2022
@vtjnash
Copy link
Member Author

vtjnash commented Nov 28, 2022

@nanosoldier runtests()

@vtjnash
Copy link
Member Author

vtjnash commented Nov 28, 2022

@nanosoldier runbenchmarks(!"scalar", vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

@vtjnash
Copy link
Member Author

vtjnash commented Nov 29, 2022

Interesting that ["misc", "julia", ("macroexpand", "evalpoly")] was slightly hurt and insertionsort sortperm was slightly helped by this. But fortunately no issues seem to have been detected

@nanosoldier
Copy link
Collaborator

Your package evaluation job has completed - possible new issues were detected. A full report can be found here.

@vtjnash
Copy link
Member Author

vtjnash commented Nov 30, 2022

That did surprisingly badly. I will need to dig into those

@vtjnash
Copy link
Member Author

vtjnash commented Nov 30, 2022

Found one of the main causes. Still need to look more into FastGaussQuadrature which is failing to precompile with a typeintersect issue:

ERROR: LoadError: MethodError: Union{}(::NTuple{20, Float64}) is ambiguous.                                                     
                                                                                                                                
Candidates:                                                                                                                     
  (::Type{FA})(x::Tuple) where FA<:StaticArraysCore.FieldArray                                                                  
    @ StaticArrays ~/.julia/packages/StaticArrays/B0HhH/src/FieldArray.jl:2                                                     
  (::Type{T})(x::Tuple) where T<:Tuple                                                                                          
    @ Base tuple.jl:362                                                                                                         
  (::Type{SA})(x::Tuple) where SA<:Union{StaticArrays.SHermitianCompact, StaticArraysCore.MArray, StaticArraysCore.SArray, StaticArraysCore.SizedArray}
    @ StaticArrays ~/.julia/packages/StaticArrays/B0HhH/src/convert.jl:161                                                      
  Union{}(a...)                                                                                                                                                                                                                                                  
    @ Core boot.jl:263                                                                                                          
  (::Type{T})(itr) where T<:Tuple                                                                                               
    @ Base tuple.jl:367                                                                                                                                                                                                                                          
  (::Type{SA})(x...) where SA<:StaticArraysCore.StaticArray                                                                     
    @ StaticArrays ~/.julia/packages/StaticArrays/B0HhH/src/convert.jl:160                                                      
                                                                
Possible fix, define                                                                                                            
  Union{}(::Tuple)

Stacktrace:
 [1] (StaticArraysCore.SVector{20})(x::NTuple{20, Float64})
   @ StaticArrays ~/.julia/packages/StaticArrays/B0HhH/src/convert.jl:163
 [2] top-level scope
   @ ~/.julia/packages/FastGaussQuadrature/BRLTf/src/constants.jl:1

and Hygienic KernelGradients which is failing after tests with an LLVM error:
EDIT: this one is an Enzyme bug

julia: /workspace/srcdir/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h:157: llvm::orc::SymbolStringPool::~SymbolStringPool(): Assertion `Pool.empty() && "Dangling references at pool destruction time"' failed.                         
                                                                                                                                                                                                                                                                 
[1829272] signal (6.-6): Aborted                                                                                                                                                                                                                                 
in expression starting at none:0                                                                                                                                                                                                                                 
gsignal at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)                                                                                                                                                                                                        
abort at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)                                                                                                                                                                                                          
unknown function (ip: 0x7ff2edd5c728)                                                                                                                                                                                                                            
__assert_fail at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)                                                                                                                                                                                                  
_ZNSt19_Sp_counted_deleterIPN4llvm3orc16SymbolStringPoolENSt12__shared_ptrIS2_LN9__gnu_cxx12_Lock_policyE2EE8_DeleterISaIS2_EEES9_LS6_2EE10_M_disposeEv at /data/vtjnash/julia/usr/bin/../lib/libLLVM-14jl.so (unknown line)                                     
_ZN4llvm3orc26SelfExecutorProcessControlD0Ev at /data/vtjnash/julia/usr/bin/../lib/libLLVM-14jl.so (unknown line)                                                                                                                                                
_ZNKSt14default_deleteIN4llvm3orc16ExecutionSessionEEclEPS2_.isra.664.part.665 at /data/vtjnash/julia/usr/bin/../lib/libLLVM-14jl.so (unknown line)                                                                                                              
_ZN4llvm3orc5LLJITD2Ev at /data/vtjnash/julia/usr/bin/../lib/libLLVM-14jl.so (unknown line)                                                                                                                                                                      
LLVMOrcDisposeLLJIT at /data/vtjnash/julia/usr/bin/../lib/libLLVM-14jl.so (unknown line)                                                                                                                                                                         
LLVMOrcDisposeLLJIT at /home/vtjnash/.julia/packages/LLVM/WjSQG/lib/13/libLLVM_h.jl:5994 [inlined]                                                                                                                                                               
dispose at /home/vtjnash/.julia/packages/LLVM/WjSQG/src/executionengine/lljit.jl:43 [inlined]                                                                                                                                                                    
dispose at /home/vtjnash/.julia/packages/Enzyme/7ekWs/src/compiler/orcv2.jl:18                                                                                                                                                                                   
#2 at /home/vtjnash/.julia/packages/Enzyme/7ekWs/src/compiler/orcv2.jl:109                                                                                                                                                                                       
unknown function (ip: 0x7ff2b98875df)                                                                                                                                                                                                                            
_jl_invoke at /data/vtjnash/julia/src/gf.c:2627 [inlined]                                                                                                                                                                                                        
ijl_apply_generic at /data/vtjnash/julia/src/gf.c:2828                                                                                                                                                                                                           
_atexit at ./initdefs.jl:383                                                                                                                                                                                                                                     
jfptr__atexit_28468 at /data/vtjnash/julia/usr/lib/julia/sys.so (unknown line)                                                                                                                                                                                   
_jl_invoke at /data/vtjnash/julia/src/gf.c:2627 [inlined]                                                                                                                                                                                                        
ijl_apply_generic at /data/vtjnash/julia/src/gf.c:2828                                                                                                                                                                                                           
jl_apply at /data/vtjnash/julia/src/julia.h:1875 [inlined]                                                                                                                                                                                                       
ijl_atexit_hook at /data/vtjnash/julia/src/init.c:280                                                                                                                                                                                                            
jl_repl_entrypoint at /data/vtjnash/julia/src/jlapi.c:718                                                                                                                                                                                                        
main at /data/vtjnash/julia/cli/loader_exe.c:58                                                                                                                                                                                                                  
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)                                                                                                                                                                                              
_start at /data/vtjnash/julia/usr/bin/julia (unknown line)                                                                                                                                                                                                       
Allocations: 38229437 (Pool: 38200545; Big: 28892); GC: 47                                                                                                                                                                                                       

This behaved a bit differently than Base.rewrap_unionall, which meant it
might make types like `Any where T` from `supertype(struct A{T} <: Any)`.
This can confuse subtyping, which does not expect other types to appear
to be wider than Any.
In some instances, the preferred compilation signature will require
sparams to be provided at runtime. When we build the cache around these,
we need to make sure the method instance we are calling has those values
computed for the current signature, and not use the widened signature.
But we can still compile for the widened signature, we just need to make
sure we create a cache entry for every narrower call signature.

Fix #47476
Follow-up issue found while working on #47476
…rarg methods

And fix a related accuracy issue in jl_isa_compileable_sig

Follow-up issue found while working on #47476
@vtjnash vtjnash removed needs nanosoldier run This PR should have benchmarks run on it needs pkgeval Tests for all registered packages should be run with this change labels Dec 7, 2022
@vtjnash vtjnash merged commit 770f5a3 into master Dec 12, 2022
@vtjnash vtjnash deleted the jn/47476 branch December 12, 2022 14:54
@KristofferC KristofferC mentioned this pull request Dec 14, 2022
26 tasks
@KristofferC KristofferC removed the backport 1.9 Change should be backported to release-1.9 label Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
don't squash Don't squash merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in computing type parameter(?) on 1.9
3 participants