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

Segfault with NNlib.batched_mul #1983

Closed
avik-pal opened this issue Oct 17, 2024 · 2 comments
Closed

Segfault with NNlib.batched_mul #1983

avik-pal opened this issue Oct 17, 2024 · 2 comments

Comments

@avik-pal
Copy link
Contributor

avik-pal commented Oct 17, 2024

using NNlib, Enzyme

x = rand(Float32, 2, 2, 3)
y = rand(Float32, 2, 2, 3)

fn(x, y) = sum(NNlib.batched_mul(x, y))

begin
    dx = zero(x)
    dy = zero(y)
    Enzyme.autodiff(Reverse, fn, Duplicated(x, dx), Duplicated(y, dy))
end
[472169] signal (11.1): Segmentation fault
in expression starting at REPL[5]:1
_ZNK4llvm11LLVMContext23shouldDiscardValueNamesEv at /home/avikpal/.julia/juliaup/julia-1.10.5+0.x64.linux.gnu/bin/../lib/julia/libLLVM-15jl.so (unknown line)
Allocations: 41498498 (Pool: 41412511; Big: 85987); GC: 56
[1]    472169 segmentation fault (core dumped)  julia +1.10 --project=envs/enz --threads=12
@wsmoses
Copy link
Member

wsmoses commented Oct 18, 2024

wmoses@beast:~/git/Enzyme.jl ((HEAD detached at origin/main)) $ ./julia10/julia --project nseg.jl

Cannot create a null constant of that type!
UNREACHABLE executed at /home/wmoses/git/Enzyme.jl/julia10/deps/srccache/llvm-julia-15.0.7-10/llvm/lib/IR/Constants.cpp:374!

[835571] signal (6.-6): Aborted
in expression starting at /home/wmoses/git/Enzyme.jl/nseg.jl:8
pthread_kill at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
gsignal at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
abort at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
llvm_unreachable_internal at /home/wmoses/git/Enzyme.jl/julia10/deps/srccache/llvm-julia-15.0.7-10/llvm/lib/Support/ErrorHandling.cpp:212
getNullValue at /home/wmoses/git/Enzyme.jl/julia10/deps/srccache/llvm-julia-15.0.7-10/llvm/lib/IR/Constants.cpp:374
transformConstExprCastCall at /home/wmoses/git/Enzyme.jl/julia10/deps/srccache/llvm-julia-15.0.7-10/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:3388
visitCallBase at /home/wmoses/git/Enzyme.jl/julia10/deps/srccache/llvm-julia-15.0.7-10/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:2960
visitCallInst at /home/wmoses/git/Enzyme.jl/julia10/deps/srccache/llvm-julia-15.0.7-10/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1154
run at /home/wmoses/git/Enzyme.jl/julia10/deps/srccache/llvm-julia-15.0.7-10/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:4287
combineInstructionsOverFunction at /home/wmoses/git/Enzyme.jl/julia10/deps/srccache/llvm-julia-15.0.7-10/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:4575
runOnFunction at /home/wmoses/git/Enzyme.jl/julia10/deps/srccache/llvm-julia-15.0.7-10/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:4655 [inlined]
runOnFunction at /home/wmoses/git/Enzyme.jl/julia10/deps/srccache/llvm-julia-15.0.7-10/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:4633
runOnFunction at /home/wmoses/git/Enzyme.jl/julia10/deps/srccache/llvm-julia-15.0.7-10/llvm/lib/IR/LegacyPassManager.cpp:1430
runOnModule at /home/wmoses/git/Enzyme.jl/julia10/deps/srccache/llvm-julia-15.0.7-10/llvm/lib/IR/LegacyPassManager.cpp:1476
runOnModule at /home/wmoses/git/Enzyme.jl/julia10/deps/srccache/llvm-julia-15.0.7-10/llvm/lib/IR/LegacyPassManager.cpp:1545 [inlined]
run at /home/wmoses/git/Enzyme.jl/julia10/deps/srccache/llvm-julia-15.0.7-10/llvm/lib/IR/LegacyPassManager.cpp:535
LLVMRunPassManager at /home/wmoses/git/Enzyme.jl/julia10/deps/srccache/llvm-julia-15.0.7-10/llvm/lib/IR/Core.cpp:4172
LLVMRunPassManager at /home/wmoses/.julia/packages/LLVM/joxPv/lib/15/libLLVM.jl:6353 [inlined]
run! at /home/wmoses/.julia/packages/LLVM/joxPv/src/passmanager.jl:39 [inlined]
#18925 at /home/wmoses/git/Enzyme.jl/src/compiler/optimize.jl:2533
#ModulePassManager#49 at /home/wmoses/.julia/packages/LLVM/joxPv/src/passmanager.jl:33
ModulePassManager at /home/wmoses/.julia/packages/LLVM/joxPv/src/passmanager.jl:30 [inlined]
optimize! at /home/wmoses/git/Enzyme.jl/src/compiler/optimize.jl:2479
#codegen#19013 at /home/wmoses/git/Enzyme.jl/src/compiler.jl:6807
codegen at /home/wmoses/git/Enzyme.jl/src/compiler.jl:5931 [inlined]
_thunk at /home/wmoses/git/Enzyme.jl/src/compiler.jl:8206
_thunk at /home/wmoses/git/Enzyme.jl/src/compiler.jl:8206 [inlined]
cached_compilation at /home/wmoses/git/Enzyme.jl/src/compiler.jl:8247 [inlined]
thunkbase at /home/wmoses/git/Enzyme.jl/src/compiler.jl:8379
unknown function (ip: 0x76e3321ee2ed)
_jl_invoke at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:2895
ijl_apply_generic at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:3077
#s2070#19068 at /home/wmoses/git/Enzyme.jl/src/compiler.jl:8516 [inlined]
#s2070#19068 at ./none:0
jl_fptr_args at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:2537
_jl_invoke at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:2895
ijl_apply_generic at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:3077
GeneratedFunctionStub at ./boot.jl:602
jl_fptr_args at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:2537
_jl_invoke at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:2876
ijl_apply_generic at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:3077
jl_call_staged at /home/wmoses/git/Enzyme.jl/julia10/src/method.c:540
ijl_code_for_staged at /home/wmoses/git/Enzyme.jl/julia10/src/method.c:593
get_staged at ./compiler/utilities.jl:123
retrieve_code_info at ./compiler/utilities.jl:135 [inlined]
InferenceState at ./compiler/inferencestate.jl:430
typeinf_edge at ./compiler/typeinfer.jl:920
abstract_call_method at ./compiler/abstractinterpretation.jl:629
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:95
abstract_call_known at ./compiler/abstractinterpretation.jl:2087
abstract_call at ./compiler/abstractinterpretation.jl:2169
abstract_call at ./compiler/abstractinterpretation.jl:2162
abstract_call at ./compiler/abstractinterpretation.jl:2354
abstract_eval_call at ./compiler/abstractinterpretation.jl:2370
abstract_eval_statement_expr at ./compiler/abstractinterpretation.jl:2380
abstract_eval_statement at ./compiler/abstractinterpretation.jl:2624
abstract_eval_basic_statement at ./compiler/abstractinterpretation.jl:2889
typeinf_local at ./compiler/abstractinterpretation.jl:3098
typeinf_nocycle at ./compiler/abstractinterpretation.jl:3186
_typeinf at ./compiler/typeinfer.jl:247
typeinf at ./compiler/typeinfer.jl:216
typeinf_edge at ./compiler/typeinfer.jl:930
abstract_call_method at ./compiler/abstractinterpretation.jl:629
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:95
abstract_call_known at ./compiler/abstractinterpretation.jl:2087
abstract_call at ./compiler/abstractinterpretation.jl:2169
abstract_apply at ./compiler/abstractinterpretation.jl:1612
abstract_call_known at ./compiler/abstractinterpretation.jl:2004
abstract_call at ./compiler/abstractinterpretation.jl:2169
abstract_call at ./compiler/abstractinterpretation.jl:2162
abstract_call at ./compiler/abstractinterpretation.jl:2354
abstract_eval_call at ./compiler/abstractinterpretation.jl:2370
abstract_eval_statement_expr at ./compiler/abstractinterpretation.jl:2380
abstract_eval_statement at ./compiler/abstractinterpretation.jl:2624
abstract_eval_basic_statement at ./compiler/abstractinterpretation.jl:2913
typeinf_local at ./compiler/abstractinterpretation.jl:3098
typeinf_nocycle at ./compiler/abstractinterpretation.jl:3186
_typeinf at ./compiler/typeinfer.jl:247
typeinf at ./compiler/typeinfer.jl:216
typeinf_edge at ./compiler/typeinfer.jl:930
abstract_call_method at ./compiler/abstractinterpretation.jl:629
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:95
abstract_call_known at ./compiler/abstractinterpretation.jl:2087
abstract_call at ./compiler/abstractinterpretation.jl:2169
abstract_apply at ./compiler/abstractinterpretation.jl:1612
abstract_call_known at ./compiler/abstractinterpretation.jl:2004
abstract_call at ./compiler/abstractinterpretation.jl:2169
abstract_call at ./compiler/abstractinterpretation.jl:2162
abstract_call at ./compiler/abstractinterpretation.jl:2354
abstract_eval_call at ./compiler/abstractinterpretation.jl:2370
abstract_eval_statement_expr at ./compiler/abstractinterpretation.jl:2380
abstract_eval_statement at ./compiler/abstractinterpretation.jl:2624
abstract_eval_basic_statement at ./compiler/abstractinterpretation.jl:2913
typeinf_local at ./compiler/abstractinterpretation.jl:3098
typeinf_nocycle at ./compiler/abstractinterpretation.jl:3186
_typeinf at ./compiler/typeinfer.jl:247
typeinf at ./compiler/typeinfer.jl:216
typeinf_ext at ./compiler/typeinfer.jl:1051
typeinf_ext_toplevel at ./compiler/typeinfer.jl:1082
typeinf_ext_toplevel at ./compiler/typeinfer.jl:1078
jfptr_typeinf_ext_toplevel_35947 at /home/wmoses/git/Enzyme.jl/julia10/usr/lib/julia/sys-debug.so (unknown line)
_jl_invoke at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:2876
ijl_apply_generic at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:3077
jl_apply at /home/wmoses/git/Enzyme.jl/julia10/src/julia.h:1982
jl_type_infer at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:394
jl_generate_fptr_impl at /home/wmoses/git/Enzyme.jl/julia10/src/jitlayers.cpp:504
jl_compile_method_internal at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:2481
_jl_invoke at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:2887
ijl_apply_generic at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:3077
jl_apply at /home/wmoses/git/Enzyme.jl/julia10/src/julia.h:1982
do_call at /home/wmoses/git/Enzyme.jl/julia10/src/interpreter.c:126
eval_value at /home/wmoses/git/Enzyme.jl/julia10/src/interpreter.c:223
eval_stmt_value at /home/wmoses/git/Enzyme.jl/julia10/src/interpreter.c:174
eval_body at /home/wmoses/git/Enzyme.jl/julia10/src/interpreter.c:617
jl_interpret_toplevel_thunk at /home/wmoses/git/Enzyme.jl/julia10/src/interpreter.c:775
jl_toplevel_eval_flex at /home/wmoses/git/Enzyme.jl/julia10/src/toplevel.c:934
jl_toplevel_eval_flex at /home/wmoses/git/Enzyme.jl/julia10/src/toplevel.c:877
ijl_toplevel_eval at /home/wmoses/git/Enzyme.jl/julia10/src/toplevel.c:943
ijl_toplevel_eval_in at /home/wmoses/git/Enzyme.jl/julia10/src/toplevel.c:985
eval at ./boot.jl:385 [inlined]
include_string at ./loading.jl:2076
jl_fptr_args at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:2537
_jl_invoke at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:2876
ijl_apply_generic at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:3077
_include at ./loading.jl:2136
include at ./Base.jl:495
jfptr_include_46713 at /home/wmoses/git/Enzyme.jl/julia10/usr/lib/julia/sys-debug.so (unknown line)
_jl_invoke at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:2876
ijl_apply_generic at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:3077
exec_options at ./client.jl:318
_start at ./client.jl:552
jfptr__start_82996 at /home/wmoses/git/Enzyme.jl/julia10/usr/lib/julia/sys-debug.so (unknown line)
_jl_invoke at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:2876
ijl_apply_generic at /home/wmoses/git/Enzyme.jl/julia10/src/gf.c:3077
jl_apply at /home/wmoses/git/Enzyme.jl/julia10/src/julia.h:1982
true_main at /home/wmoses/git/Enzyme.jl/julia10/src/jlapi.c:582
jl_repl_entrypoint at /home/wmoses/git/Enzyme.jl/julia10/src/jlapi.c:731
jl_load_repl at /home/wmoses/git/Enzyme.jl/julia10/cli/loader_lib.c:568
main at /home/wmoses/git/Enzyme.jl/julia10/cli/loader_exe.c:58
unknown function (ip: 0x76e34082a1c9)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
_start at ./julia10/julia (unknown line)
Allocations: 42748432 (Pool: 42659411; Big: 89021); GC: 43
Aborted (core dumped)

@wsmoses
Copy link
Member

wsmoses commented Oct 19, 2024

Fixed by jll bump

@wsmoses wsmoses closed this as completed Oct 19, 2024
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