You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code optimizes away on 1.7, but contains a dynamic call on 1.8:
# a simple immutable array type backed by stack memory## similar to StaticArrays, but immutable to prevent optimization bugs (JuliaLang/julia#41800)struct LocalArray{L,T}
data::NTuple{L,T}LocalArray{L,T}(::UndefInitializer) where {L,T} =new{L,T}()
LocalArray{L,T}(x::NTuple{L,T}) where {L,T} =new{L,T}(x)
end@inlinefunctionsetindex(v::LocalArray{L,T} , val::T, i::Int) where {L,T}
new_data = Base.setindex(v.data, val, i)
LocalArray{L,T}(new_data)
endfunctionkernel()
v =LocalArray{16,Int}(undef)
setindex(v, 0, 1)
returnendcode_llvm(kernel, Tuple{})
definevoid@julia_kernel_112() #0 {
top:
retvoid
}
vs
; @ /home/tim/Julia/pkg/CUDA/wip.jl:20 within `kernel`definevoid@julia_kernel_190() #0 {
top:
%0 = alloca {}*, align8%gcframe2 = alloca [3 x {}*], align16%gcframe2.sub = getelementptrinbounds [3 x {}*], [3 x {}*]* %gcframe2, i640, i640%1 = bitcast [3 x {}*]* %gcframe2toi8*callvoid@llvm.memset.p0i8.i32(i8* noundef nonnullalign16dereferenceable(24) %1, i80, i3224, i1false)
%2 = alloca { i64, i64, [16 x i64] }, align8%thread_ptr = calli8*asm"movq %fs:0, $0", "=r"() #2%ppgcstack_i8 = getelementptri8, i8*%thread_ptr, i64 -8%ppgcstack = bitcasti8*%ppgcstack_i8to {}****
%pgcstack = load {}***, {}**** %ppgcstack, align8; @ /home/tim/Julia/pkg/CUDA/wip.jl:22 within `kernel`; ┌ @ /home/tim/Julia/pkg/CUDA/wip.jl:13 within `setindex` @ tuple.jl:55; │┌ @ tuple.jl:58 within `_setindex`%3 = bitcast [3 x {}*]* %gcframe2toi64*storei644, i64*%3, align16%4 = getelementptrinbounds [3 x {}*], [3 x {}*]* %gcframe2, i640, i641%5 = bitcast {}** %4to {}***
%6 = load {}**, {}*** %pgcstack, align8store {}** %6, {}*** %5, align8%7 = bitcast {}*** %pgcstackto {}***
store {}** %gcframe2.sub, {}*** %7, align8%8 = getelementptrinbounds { i64, i64, [16 x i64] }, { i64, i64, [16 x i64] }* %2, i640, i322, i642%9 = bitcasti64*%8to <4 x i64>*
store <4 x i64> <i64139704043836304, i64139704201753424, i647808250546924, i6413692355740775>, <4 x i64>* %9, align8%10 = getelementptrinbounds { i64, i64, [16 x i64] }, { i64, i64, [16 x i64] }* %2, i640, i322, i646%11 = bitcasti64*%10to <4 x i64>*
store <4 x i64> <i640, i64 -1047008294339651328, i6417, i64 -1047008294339651328>, <4 x i64>* %11, align8%12 = getelementptrinbounds { i64, i64, [16 x i64] }, { i64, i64, [16 x i64] }* %2, i640, i322, i6410%13 = bitcasti64*%12to <4 x i64>*
store <4 x i64> <i64139704043895616, i64140732546470088, i644, i64140732546470080>, <4 x i64>* %13, align8%14 = getelementptrinbounds { i64, i64, [16 x i64] }, { i64, i64, [16 x i64] }* %2, i640, i322, i6414%15 = bitcasti64*%14to <2 x i64>*
store <2 x i64> <i64139704161878032, i640>, <2 x i64>* %15, align8; ││ @ tuple.jl:60 within `_setindex`%16 = bitcast { i64, i64, [16 x i64] }* %2to <4 x i64>*
store <4 x i64> <i640, i641, i645937600496, i64139704201753104>, <4 x i64>* %16, align8; ││┌ @ ntuple.jl:19 within `ntuple`%17 = callnonnull {}* @j__ntuple_192({ i64, i64, [16 x i64] }* nocapturereadonly%2, i64signext16) #0; │└└; │ @ /home/tim/Julia/pkg/CUDA/wip.jl:14 within `setindex`%18 = bitcast {}* %17toi64*%19 = getelementptrinboundsi64, i64*%18, i64 -1%20 = loadatomici64, i64*%19unordered, align8%21 = andi64%20, -16%22 = inttoptri64%21to {}*
%.not = icmpeq {}* %22, inttoptr (i64139704201753184to {}*)
bri1%.not, label%L13, label%L10
L10: ; preds = %top%23 = getelementptrinbounds [3 x {}*], [3 x {}*]* %gcframe2, i640, i642store {}* %17, {}** %23, align16store {}* %17, {}** %0, align8%24 = callnonnull {}* @ijl_apply_generic({}* inttoptr (i64139704201753104to {}*), {}** nonnull%0, i321)
brlabel%L13
L13: ; preds = %L10, %top%25 = load {}*, {}** %4, align8%26 = bitcast {}*** %pgcstackto {}**
store {}* %25, {}** %26, align8; └; @ /home/tim/Julia/pkg/CUDA/wip.jl:23 within `kernel`retvoid
}
The following code optimizes away on 1.7, but contains a dynamic call on 1.8:
vs
Bisected to #40635. Originally encountered in GPU code, JuliaGPU/GemmKernels.jl#99.
PR incoming.
The text was updated successfully, but these errors were encountered: