-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
upstreamThe issue is with an upstream dependency, e.g. LLVMThe issue is with an upstream dependency, e.g. LLVM
Description
In PkgEval results, the GaussianProcess test is segfaulting due to an invalid memory hoist.
https://s3.amazonaws.com/julialang-reports/nanosoldier/pkgeval/by_date/2025-03/18/GaussianProcesses.primary.log
In particular, the code optimized from
julia> code_llvm(GaussianProcesses.set_params!, (GaussianProcesses.ProdMean{Tuple{GaussianProcesses.MeanConst, GaussianProcesses.MeanLin}}, Array{Float64, 1}), raw=true, optimize=true)
In particular, this is a tuple of two elements, both themselves a tuple of two elements, but where the first has a Float64 and second has a Vector{Float64} as the first element. The optimized code tries to load the size field from the Vector{Float64} before checking the type of the container object (which happens to be the first field with the first type, though julia inference didn't know that), and then tries masking with select instead of keeping the branch:
L16: ; preds = %top
; @ /home/vtjnash/.julia/packages/GaussianProcesses/dOato/src/common.jl:112 within `set_params!`
; ┌ @ tuple.jl:74 within `iterate` @ tuple.jl:74
; │┌ @ tuple.jl:33 within `getindex`
%"obj::ProdMean[1]" = load atomic ptr, ptr %"obj::ProdMean" unordered, align 8, !dbg !99, !tbaa !29, !alias.scope !66, !noalias !67, !nonnull !9, !dereferenceable !68, !align !69
%4 = getelementptr inbounds i8, ptr %"new::SubArray", i64 8
%"new::Tuple8.sroa.0.sroa.2.0..sroa_idx" = getelementptr inbounds i8, ptr %"new::SubArray", i64 16
%5 = getelementptr inbounds i8, ptr %"new::SubArray", i64 24
%6 = getelementptr inbounds i8, ptr %"new::SubArray", i64 32
; └└
; @ /home/vtjnash/.julia/packages/GaussianProcesses/dOato/src/common.jl:113 within `set_params!`
%"obj::ProdMean[1].tag_addr" = getelementptr inbounds i8, ptr %"obj::ProdMean[1]", i64 -8, !dbg !106
%"obj::ProdMean[1].tag" = load atomic i64, ptr %"obj::ProdMean[1].tag_addr" unordered, align 8, !dbg !106, !tbaa !107, !range !109
%7 = and i64 %"obj::ProdMean[1].tag", -16, !dbg !106
%8 = inttoptr i64 %7 to ptr, !dbg !106
%exactly_isa.not = icmp eq ptr %8, @"+GaussianProcesses.MeanConst#7430.jit", !dbg !106
%"value_phi.\CE\B246" = load atomic ptr, ptr %"obj::ProdMean[1]" unordered, align 8, !dbg !106, !nonnull !9, !align !69
%"value_phi.\CE\B246.size_ptr" = getelementptr inbounds i8, ptr %"value_phi.\CE\B246", i64 16, !dbg !106
%"value_phi.\CE\B246.size.0.copyload" = load i64, ptr %"value_phi.\CE\B246.size_ptr", align 8, !dbg !106
%value_phi3 = select i1 %exactly_isa.not, i64 1, i64 %"value_phi.\CE\B246.size.0.copyload", !dbg !106
Metadata
Metadata
Assignees
Labels
upstreamThe issue is with an upstream dependency, e.g. LLVMThe issue is with an upstream dependency, e.g. LLVM