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

hypot error on Julia 1.7 #974

Closed
jgreener64 opened this issue Aug 1, 2023 · 5 comments
Closed

hypot error on Julia 1.7 #974

jgreener64 opened this issue Aug 1, 2023 · 5 comments

Comments

@jgreener64
Copy link
Contributor

This works on Julia 1.9 and Enzyme main (b35703b):

using Enzyme
f(x) = hypot(x, 2x)
autodiff(Reverse, f, Active, Active(2.0))[1][1] # 2.23606797749979
autodiff(Forward, f, Duplicated(2.0, 1.0))[1]   # 2.23606797749979

But on Julia 1.7.3 it seems to error. I couldn't reproduce locally but at https://github.com/EnzymeAD/Enzyme.jl/actions/runs/5727131372/job/15518920903?pr=969 the error appears to be:

signal (11): Segmentation fault
in expression starting at /home/runner/work/Enzyme.jl/Enzyme.jl/test/runtests.jl:258
vector at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/stl_vector.h:460 [inlined]
pair at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/stl_pair.h:292 [inlined]
construct<std::pair<const std::vector<int, std::allocator<int> >, ConcreteType>, const std::pair<const std::vector<int, std::allocator<int> >, ConcreteType>&> at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/ext/new_allocator.h:136 [inlined]
construct<std::pair<const std::vector<int, std::allocator<int> >, ConcreteType>, const std::pair<const std::vector<int, std::allocator<int> >, ConcreteType>&> at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/alloc_traits.h:475 [inlined]
_M_construct_node<const std::pair<const std::vector<int, std::allocator<int> >, ConcreteType>&> at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/stl_tree.h:637 [inlined]
_M_create_node<const std::pair<const std::vector<int, std::allocator<int> >, ConcreteType>&> at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/stl_tree.h:654 [inlined]
operator()<const std::pair<const std::vector<int, std::allocator<int> >, ConcreteType>&> at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/stl_tree.h:567 [inlined]
_M_clone_node<std::_Rb_tree<const std::vector<int, std::allocator<int> >, std::pair<const std::vector<int, std::allocator<int> >, ConcreteType>, std::_Select1st<std::pair<const std::vector<int, std::allocator<int> >, ConcreteType> >, std::less<const std::vector<int, std::allocator<int> > >, std::allocator<std::pair<const std::vector<int, std::allocator<int> >, ConcreteType> > >::_Alloc_node> at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/stl_tree.h:677 [inlined]
_M_copy<std::_Rb_tree<const std::vector<int, std::allocator<int> >, std::pair<const std::vector<int, std::allocator<int> >, ConcreteType>, std::_Select1st<std::pair<const std::vector<int, std::allocator<int> >, ConcreteType> >, std::less<const std::vector<int, std::allocator<int> > >, std::allocator<std::pair<const std::vector<int, std::allocator<int> >, ConcreteType> > >::_Alloc_node> at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/stl_tree.h:1834
_M_copy<std::_Rb_tree<const std::vector<int, std::allocator<int> >, std::pair<const std::vector<int, std::allocator<int> >, ConcreteType>, std::_Select1st<std::pair<const std::vector<int, std::allocator<int> >, ConcreteType> >, std::less<const std::vector<int, std::allocator<int> > >, std::allocator<std::pair<const std::vector<int, std::allocator<int> >, ConcreteType> > >::_Alloc_node> at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/stl_tree.h:891 [inlined]
_M_copy at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/stl_tree.h:902 [inlined]
_Rb_tree at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/stl_tree.h:940 [inlined]
map at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/stl_map.h:205 [inlined]
TypeTree at /workspace/srcdir/Enzyme/enzyme/Enzyme/TypeAnalysis/TypeTree.h:72 [inlined]
EnzymeMergeTypeTree at /workspace/srcdir/Enzyme/enzyme/Enzyme/CApi.cpp:710
EnzymeMergeTypeTree at /home/runner/work/Enzyme.jl/Enzyme.jl/src/api.jl:68 [inlined]
inout_rule at /home/runner/work/Enzyme.jl/Enzyme.jl/src/compiler.jl:7181
unknown function (ip: 0x7f969858aed4)
operator() at /workspace/srcdir/Enzyme/enzyme/Enzyme/CApi.cpp:273 [inlined]
_M_invoke at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/std_function.h:282
operator() at /opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/8.1.0/bits/std_function.h:687 [inlined]
visitCallInst at /workspace/srcdir/Enzyme/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp:3776
visitValue at /workspace/srcdir/Enzyme/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp:1167
run at /workspace/srcdir/Enzyme/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp:1096
analyzeFunction at /workspace/srcdir/Enzyme/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp:5370
CreateFromClone at /workspace/srcdir/Enzyme/enzyme/Enzyme/DiffeGradientUtils.cpp:149
CreatePrimalAndGradient at /workspace/srcdir/Enzyme/enzyme/Enzyme/EnzymeLogic.cpp:3933
recursivelyHandleSubfunction at /workspace/srcdir/Enzyme/enzyme/Enzyme/AdjointGenerator.h:7751
visitCallInst at /workspace/srcdir/Enzyme/enzyme/Enzyme/AdjointGenerator.h:10297
main at /buildworker/worker/package_linux64/build/cli/loader_exe.c:42
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
_start at /opt/hostedtoolcache/julia/1.7.3/x64/bin/julia (unknown line)
Allocations: 337983577 (Pool: 337774263; Big: 209314); GC: 268
ERROR: LoadError: Package Enzyme errored during testing (received signal: 11)
Stacktrace:
 [1] pkgerror(msg::String)
   @ Pkg.Types /opt/hostedtoolcache/julia/1.7.3/x64/share/julia/stdlib/v1.7/Pkg/src/Types.jl:68
 [2] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, julia_args::Cmd, test_args::Cmd, test_fn::Nothing, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool)
   @ Pkg.Operations /opt/hostedtoolcache/julia/1.7.3/x64/share/julia/stdlib/v1.7/Pkg/src/Operations.jl:1672
 [3] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, test_fn::Nothing, julia_args::Vector{String}, test_args::Cmd, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool, kwargs::Base.Pairs{Symbol, IOContext{Base.PipeEndpoint}, Tuple{Symbol}, NamedTuple{(:io,), Tuple{IOContext{Base.PipeEndpoint}}}})
   @ Pkg.API /opt/hostedtoolcache/julia/1.7.3/x64/share/julia/stdlib/v1.7/Pkg/src/API.jl:421
 [4] test(pkgs::Vector{Pkg.Types.PackageSpec}; io::IOContext{Base.PipeEndpoint}, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:coverage, :julia_args, :force_latest_compatible_version), Tuple{Bool, Vector{String}, Bool}}})
   @ Pkg.API /opt/hostedtoolcache/julia/1.7.3/x64/share/julia/stdlib/v1.7/Pkg/src/API.jl:149
 [5] test(; name::Nothing, uuid::Nothing, version::Nothing, url::Nothing, rev::Nothing, path::Nothing, mode::Pkg.Types.PackageMode, subdir::Nothing, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:coverage, :julia_args, :force_latest_compatible_version), Tuple{Bool, Vector{String}, Bool}}})
   @ Pkg.API /opt/hostedtoolcache/julia/1.7.3/x64/share/julia/stdlib/v1.7/Pkg/src/API.jl:164
 [6] top-level scope
   @ ~/work/_actions/julia-actions/julia-runtest/v1/test_harness.jl:15
 [7] include(fname::String)
   @ Base.MainInclude ./client.jl:451
 [8] top-level scope
   @ none:1
in expression starting at /home/runner/work/_actions/julia-actions/julia-runtest/v1/test_harness.jl:7
Error: Process completed with exit code 1.
@wsmoses
Copy link
Member

wsmoses commented Aug 7, 2023

I also cannot reproduce this locally? Can you make a branch/PR that only contains the failing test [with CI failing]

@jgreener64
Copy link
Contributor Author

See #990 for test failure.

@wsmoses
Copy link
Member

wsmoses commented Aug 8, 2023

Sorry to ask for more, but can you nuke the CI test branch to literally only contain the failing test (and not any previous tests)?

@jgreener64
Copy link
Contributor Author

Sure, done.

@wsmoses
Copy link
Member

wsmoses commented Aug 8, 2023

Now fixed

@wsmoses wsmoses closed this as completed Aug 8, 2023
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