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

Reduce #5

Open
wants to merge 77 commits into
base: master
Choose a base branch
from
Open

Reduce #5

wants to merge 77 commits into from

Conversation

wsmoses
Copy link
Collaborator

@wsmoses wsmoses commented Oct 26, 2023

wmoses@beast:~/git/Enzyme/enzyme/build16/kalman/build (reduce) $ valgrind --track-origins=yes ./example_robot1 
==813853== Memcheck, a memory error detector
==813853== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==813853== Using Valgrind-3.22.0.GIT and LibVEX; rerun with -h for copyright info
==813853== Command: ./example_robot1
==813853== 
fx1=1.600000
 ** On entry to DGEMV  parameter number 11 had an illegal value
Adup[0] = 1.000000, Adup[1] = 1.000000, Adup[2] = 1.000000, Adup[10] = 0.000000==813853== 
==813853== HEAP SUMMARY:
==813853==     in use at exit: 0 bytes in 0 blocks
==813853==   total heap usage: 111 allocs, 111 frees, 157,272 bytes allocated
==813853== 
==813853== All heap blocks were freed -- no leaks are possible
==813853== 
==813853== For lists of detected and suppressed errors, rerun with: -s
==813853== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

@gaurav-arya can you continue to reduce this?

@wsmoses
Copy link
Collaborator Author

wsmoses commented Nov 2, 2023

wmoses@beast:~/git/Enzyme/enzyme/build16/kalman/build ((HEAD detached at origin/reduce)) $ ~/llvms/llvm15/buildD/bin/clang++ -O2 -fplugin=$HOME/git/Enzyme/enzyme/build15/Enzyme/ClangEnzyme-15.so ../examples/big/big_inlined.cpp 
clang-15: /home/wmoses/git/Enzyme/enzyme/Enzyme/DiffeGradientUtils.cpp:617: void DiffeGradientUtils::addToInvertedPtrDiffe(llvm::Instruction*, llvm::Value*, llvm::Type*, unsigned int, unsigned int, llvm::Value*, llvm::Value*, llvm::IRBuilder<>&, llvm::MaybeAlign, llvm::Value*): Assertion `size > addingSize' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /home/wmoses/llvms/llvm15/buildD/bin/clang-15 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj --mrelax-relocations -disable-free -clear-ast-before-backend -main-file-name big_inlined.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -fcoverage-compilation-dir=/home/wmoses/git/Enzyme/enzyme/build16/kalman/build -resource-dir /home/wmoses/llvms/llvm15/buildD/lib/clang/15.0.2 -c-isystem . -c-isystem /home/wmoses/.local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/backward -internal-isystem /home/wmoses/llvms/llvm15/buildD/lib/clang/15.0.2/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -fdeprecated-macro -fdebug-compilation-dir=/home/wmoses/git/Enzyme/enzyme/build16/kalman/build -ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -vectorize-loops -vectorize-slp -load /home/wmoses/git/Enzyme/enzyme/build15/Enzyme/ClangEnzyme-15.so -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/big_inlined-8dc74a.o -x c++ ../examples/big/big_inlined.cpp
1.	<eof> parser at end of file
2.	Optimizer
 #0 0x0000561779f2c93a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/wmoses/llvms/llvm15/llvm/lib/Support/Unix/Signals.inc:569:22
 #1 0x0000561779f2ca01 PrintStackTraceSignalHandler(void*) /home/wmoses/llvms/llvm15/llvm/lib/Support/Unix/Signals.inc:636:1
 #2 0x0000561779f2a590 llvm::sys::RunSignalHandlers() /home/wmoses/llvms/llvm15/llvm/lib/Support/Signals.cpp:103:20
 #3 0x0000561779f2c250 SignalHandler(int) /home/wmoses/llvms/llvm15/llvm/lib/Support/Unix/Signals.inc:407:1
 #4 0x00007f12315b3520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #5 0x00007f1231607a7c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #6 0x00007f1231607a7c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #7 0x00007f1231607a7c pthread_kill ./nptl/pthread_kill.c:89:10
 #8 0x00007f12315b3476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #9 0x00007f12315997f3 abort ./stdlib/abort.c:81:7
#10 0x00007f123159971b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#11 0x00007f12315aae96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#12 0x00007f1230ccb31d DiffeGradientUtils::addToInvertedPtrDiffe(llvm::Instruction*, llvm::Value*, llvm::Type*, unsigned int, unsigned int, llvm::Value*, llvm::Value*, llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&, llvm::MaybeAlign, llvm::Value*) /home/wmoses/git/Enzyme/enzyme/Enzyme/DiffeGradientUtils.cpp:620:37
#13 0x00007f1230c675c4 AdjointGenerator<AugmentedReturn const*>::handle_gemm(BlasInfo, llvm::CallInst&, llvm::Function*, std::vector<bool, std::allocator<bool>> const&, llvm::Type*)::'lambda0'(llvm::Value*, llvm::Value*, llvm::Value*)::operator()(llvm::Value*, llvm::Value*, llvm::Value*) const /home/wmoses/git/Enzyme/enzyme/build15/Enzyme/BlasDerivatives.inc:2582:64
#14 0x00007f1230cb3f30 void GradientUtils::applyChainRule<AdjointGenerator<AugmentedReturn const*>::handle_gemm(BlasInfo, llvm::CallInst&, llvm::Function*, std::vector<bool, std::allocator<bool>> const&, llvm::Type*)::'lambda0'(llvm::Value*, llvm::Value*, llvm::Value*), llvm::Value*, llvm::Value*, llvm::Value*>(llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&, AdjointGenerator<AugmentedReturn const*>::handle_gemm(BlasInfo, llvm::CallInst&, llvm::Function*, std::vector<bool, std::allocator<bool>> const&, llvm::Type*)::'lambda0'(llvm::Value*, llvm::Value*, llvm::Value*), llvm::Value*, llvm::Value*, llvm::Value*) /home/wmoses/git/Enzyme/enzyme/Enzyme/GradientUtils.h:588:3
#15 0x00007f1230ca4b11 void AdjointGenerator<AugmentedReturn const*>::applyChainRule<AdjointGenerator<AugmentedReturn const*>::handle_gemm(BlasInfo, llvm::CallInst&, llvm::Function*, std::vector<bool, std::allocator<bool>> const&, llvm::Type*)::'lambda0'(llvm::Value*, llvm::Value*, llvm::Value*), llvm::Value*, llvm::Value*, llvm::Value*>(llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&, AdjointGenerator<AugmentedReturn const*>::handle_gemm(BlasInfo, llvm::CallInst&, llvm::Function*, std::vector<bool, std::allocator<bool>> const&, llvm::Type*)::'lambda0'(llvm::Value*, llvm::Value*, llvm::Value*), llvm::Value*, llvm::Value*, llvm::Value*) /home/wmoses/git/Enzyme/enzyme/Enzyme/AdjointGenerator.h:1953:46
#16 0x00007f1230c7230d AdjointGenerator<AugmentedReturn const*>::handle_gemm(BlasInfo, llvm::CallInst&, llvm::Function*, std::vector<bool, std::allocator<bool>> const&, llvm::Type*) /home/wmoses/git/Enzyme/enzyme/build15/Enzyme/BlasDerivatives.inc:2512:19
#17 0x00007f1230bea7dd AdjointGenerator<AugmentedReturn const*>::handleBLAS(llvm::CallInst&, llvm::Function*, BlasInfo, std::vector<bool, std::allocator<bool>> const&) /home/wmoses/git/Enzyme/enzyme/build15/Enzyme/BlasDerivatives.inc:28:27
#18 0x00007f1230b1b0ed AdjointGenerator<AugmentedReturn const*>::handleKnownCallDerivatives(llvm::CallInst&, llvm::Function*, llvm::StringRef, std::vector<bool, std::allocator<bool>> const&, llvm::CallInst*) /home/wmoses/git/Enzyme/enzyme/Enzyme/CallDerivatives.cpp:2261:19
#19 0x00007f1230dfd9fe AdjointGenerator<AugmentedReturn const*>::visitCallInst(llvm::CallInst&) /home/wmoses/git/Enzyme/enzyme/Enzyme/AdjointGenerator.h:5967:35
#20 0x00007f1230dfbb6a llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::delegateCallInst(llvm::CallInst&) /home/wmoses/llvms/llvm15/llvm/include/llvm/IR/InstVisitor.h:302:3
#21 0x00007f1230dd6bd9 llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::visitCall(llvm::CallInst&) /home/wmoses/llvms/llvm15/llvm/include/llvm/IR/Instruction.def:209:1
#22 0x00007f1230dc996b llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::visit(llvm::Instruction&) /home/wmoses/llvms/llvm15/llvm/include/llvm/IR/Instruction.def:209:1
#23 0x00007f1230dbc42f llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::visit(llvm::Instruction*) /home/wmoses/llvms/llvm15/llvm/include/llvm/IR/InstVisitor.h:111:49
#24 0x00007f1230da0ff3 EnzymeLogic::CreatePrimalAndGradient(RequestContext, ReverseCacheKey const&&, TypeAnalysis&, AugmentedReturn const*, bool) /home/wmoses/git/Enzyme/enzyme/Enzyme/EnzymeLogic.cpp:4235:7
#25 0x00007f1230e2d084 AdjointGenerator<AugmentedReturn const*>::recursivelyHandleSubfunction(llvm::CallInst&, llvm::Function*, std::vector<bool, std::allocator<bool>> const&, bool, DIFFE_TYPE, bool) /home/wmoses/git/Enzyme/enzyme/Enzyme/AdjointGenerator.h:5460:56
#26 0x00007f1230dfe2a9 AdjointGenerator<AugmentedReturn const*>::visitCallInst(llvm::CallInst&) /home/wmoses/git/Enzyme/enzyme/Enzyme/AdjointGenerator.h:6072:40
#27 0x00007f1230dfbb6a llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::delegateCallInst(llvm::CallInst&) /home/wmoses/llvms/llvm15/llvm/include/llvm/IR/InstVisitor.h:302:3
#28 0x00007f1230dd6bd9 llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::visitCall(llvm::CallInst&) /home/wmoses/llvms/llvm15/llvm/include/llvm/IR/Instruction.def:209:1
#29 0x00007f1230dc996b llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::visit(llvm::Instruction&) /home/wmoses/llvms/llvm15/llvm/include/llvm/IR/Instruction.def:209:1
#30 0x00007f1230dbc42f llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::visit(llvm::Instruction*) /home/wmoses/llvms/llvm15/llvm/include/llvm/IR/InstVisitor.h:111:49
#31 0x00007f1230da0ff3 EnzymeLogic::CreatePrimalAndGradient(RequestContext, ReverseCacheKey const&&, TypeAnalysis&, AugmentedReturn const*, bool) /home/wmoses/git/Enzyme/enzyme/Enzyme/EnzymeLogic.cpp:4235:7
#32 0x00007f1230d2224b (anonymous namespace)::EnzymeBase::HandleAutoDiff(llvm::Instruction*, unsigned int, llvm::Value*, llvm::Type*, llvm::SmallVectorImpl<llvm::Value*>&, std::map<int, llvm::Type*, std::less<int>, std::allocator<std::pair<int const, llvm::Type*>>> const&, std::vector<DIFFE_TYPE, std::allocator<DIFFE_TYPE>> const&, llvm::Function*, DerivativeMode, (anonymous namespace)::EnzymeBase::Options&, bool, llvm::SmallVectorImpl<llvm::CallInst*>&) /home/wmoses/git/Enzyme/enzyme/Enzyme/Enzyme.cpp:1587:46
#33 0x00007f1230d23e57 (anonymous namespace)::EnzymeBase::HandleAutoDiffArguments(llvm::CallInst*, DerivativeMode, bool, llvm::SmallVectorImpl<llvm::CallInst*>&) /home/wmoses/git/Enzyme/enzyme/Enzyme/Enzyme.cpp:1848:26
#34 0x00007f1230d285d0 (anonymous namespace)::EnzymeBase::lowerEnzymeCalls(llvm::Function&, std::set<llvm::Function*, std::less<llvm::Function*>, std::allocator<llvm::Function*>>&) /home/wmoses/git/Enzyme/enzyme/Enzyme/Enzyme.cpp:2514:48
#35 0x00007f1230d29d13 (anonymous namespace)::EnzymeBase::run(llvm::Module&) /home/wmoses/git/Enzyme/enzyme/Enzyme/Enzyme.cpp:2741:15
#36 0x00007f1230d31d0e EnzymeNewPM::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/wmoses/git/Enzyme/enzyme/Enzyme/Enzyme.cpp:3021:56
#37 0x00007f1230d79ac7 llvm::detail::PassModel<llvm::Module, EnzymeNewPM, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/wmoses/llvms/llvm15/llvm/include/llvm/IR/PassManagerInternal.h:89:3
#38 0x00005617794092a3 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/wmoses/llvms/llvm15/llvm/include/llvm/IR/PassManager.h:522:16
#39 0x000056177a491329 (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&) /home/wmoses/llvms/llvm15/clang/lib/CodeGen/BackendUtil.cpp:977:12
#40 0x000056177a4918d1 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) /home/wmoses/llvms/llvm15/clang/lib/CodeGen/BackendUtil.cpp:1035:21
#41 0x000056177a492979 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) /home/wmoses/llvms/llvm15/clang/lib/CodeGen/BackendUtil.cpp:1193:25
#42 0x000056177b98a623 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /home/wmoses/llvms/llvm15/clang/lib/CodeGen/CodeGenAction.cpp:381:24
#43 0x000056177b00351f clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) /home/wmoses/llvms/llvm15/clang/lib/Frontend/MultiplexConsumer.cpp:297:25
#44 0x000056177dbf9605 clang::ParseAST(clang::Sema&, bool, bool) /home/wmoses/llvms/llvm15/clang/lib/Parse/ParseAST.cpp:205:14
#45 0x000056177afbf759 clang::ASTFrontendAction::ExecuteAction() /home/wmoses/llvms/llvm15/clang/lib/Frontend/FrontendAction.cpp:1144:11
#46 0x000056177b986a4c clang::CodeGenAction::ExecuteAction() /home/wmoses/llvms/llvm15/clang/lib/CodeGen/CodeGenAction.cpp:1145:5
#47 0x000056177afbf008 clang::FrontendAction::Execute() /home/wmoses/llvms/llvm15/clang/lib/Frontend/FrontendAction.cpp:1041:38
#48 0x000056177aeedea7 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/wmoses/llvms/llvm15/clang/lib/Frontend/CompilerInstance.cpp:1035:42
#49 0x000056177b16d6c5 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/wmoses/llvms/llvm15/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:266:38
#50 0x0000561777f1d556 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/wmoses/llvms/llvm15/clang/tools/driver/cc1_main.cpp:250:40
#51 0x0000561777f0f8e3 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) /home/wmoses/llvms/llvm15/clang/tools/driver/driver.cpp:317:20
#52 0x0000561777f10023 clang_main(int, char**) /home/wmoses/llvms/llvm15/clang/tools/driver/driver.cpp:388:26
#53 0x0000561777f3d0c5 main /home/wmoses/llvms/llvm15/buildD/tools/clang/tools/driver/clang-driver.cpp:11:63
#54 0x00007f123159ad90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#55 0x00007f123159ae40 call_init ./csu/../csu/libc-start.c:128:20
#56 0x00007f123159ae40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#57 0x0000561777f0dff5 _start (/home/wmoses/llvms/llvm15/buildD/bin/clang-15+0x10f6ff5)
clang-15: error: unable to execute command: Aborted (core dumped)
clang-15: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 15.0.2 ([email protected]:llvm/llvm-project 10a54971b0d34f3b68b3213bcf82079dc2d00ae9)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/wmoses/llvms/llvm15/buildD/bin
clang-15: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-15: note: diagnostic msg: /tmp/big_inlined-7e87d1.cpp
clang-15: note: diagnostic msg: /tmp/big_inlined-7e87d1.sh
clang-15: note: diagnostic msg: 

@wsmoses
Copy link
Collaborator Author

wsmoses commented Nov 2, 2023

Adup[0] = 137558947.970487, Adup[1] = 0.000000, Adup[2] = 0.000000, Adup[10] = 0.000000wmoses@beast:~/git/Enzyme/enzyme/build16/kalman/build ((HEAD detached at origin/reduce)) $ valgrind --track-origins=yes ./a.out 
==2856445== Memcheck, a memory error detector
==2856445== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==2856445== Using Valgrind-3.22.0.GIT and LibVEX; rerun with -h for copyright info
==2856445== Command: ./a.out
==2856445== 
f(A) = 51584628.754482
Adup_fd[0] = 1858746938.630447, Adup_fd[1] = 1858746938.630447, Adup_fd[2] = 1858746938.630447, Adup_fd[10] = 1858746938.630447
 ** On entry to DLASCL parameter number  9 had an illegal value
 ** On entry to DLASCL parameter number  1 had an illegal value
 ** On entry to DLASCL parameter number  9 had an illegal value
 ** On entry to DLASCL parameter number  9 had an illegal value
 ** On entry to DLASCL parameter number  1 had an illegal value
 ** On entry to DLASCL parameter number  9 had an illegal value
 ** On entry to DLASCL parameter number  1 had an illegal value
 ** On entry to DLASCL parameter number  9 had an illegal value
 ** On entry to DLASCL parameter number  1 had an illegal value
 ** On entry to DLASCL parameter number  9 had an illegal value
 ** On entry to DLASCL parameter number  1 had an illegal value
 ** On entry to DLASCL parameter number  9 had an illegal value
 ** On entry to DLASCL parameter number  1 had an illegal value
 ** On entry to DLASCL parameter number  9 had an illegal value
 ** On entry to DLASCL parameter number  9 had an illegal value
 ** On entry to DLASCL parameter number  1 had an illegal value
 ** On entry to DLASCL parameter number  9 had an illegal value
 ** On entry to DLASCL parameter number  1 had an illegal value
 ** On entry to DLASCL parameter number  9 had an illegal value
 ** On entry to DLASCL parameter number  1 had an illegal value
 ** On entry to DLASCL parameter number  9 had an illegal value
 ** On entry to DLASCL parameter number  1 had an illegal value
Adup[0] = 137558947.970487, Adup[1] = 0.000000, Adup[2] = 0.000000, Adup[10] = 0.000000==2856445== 
==2856445== HEAP SUMMARY:
==2856445==     in use at exit: 9,600 bytes in 12 blocks
==2856445==   total heap usage: 182 allocs, 170 frees, 196,832 bytes allocated
==2856445== 
==2856445== LEAK SUMMARY:
==2856445==    definitely lost: 9,600 bytes in 12 blocks
==2856445==    indirectly lost: 0 bytes in 0 blocks
==2856445==      possibly lost: 0 bytes in 0 blocks
==2856445==    still reachable: 0 bytes in 0 blocks
==2856445==         suppressed: 0 bytes in 0 blocks
==2856445== Rerun with --leak-check=full to see details of leaked memory
==2856445== 
==2856445== For lists of detected and suppressed errors, rerun with: -s
==2856445== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
wmoses@beast:~/git/Enzyme/enzyme/build16/kalman/build ((HEAD detached at ori

@gaurav-arya
Copy link
Collaborator

Does the dlascl warning need a minimize?

@wsmoses
Copy link
Collaborator Author

wsmoses commented Nov 2, 2023

Yeah that would be helpful. You should check out the latest main for various fixes. It appears this dlascl comes from an active B

@gaurav-arya
Copy link
Collaborator

e85afed is a minimized example (3-4 lines of eigen) with just:

 ** On entry to DGEMM  parameter number 13 had an illegal value

Uncommenting the commented line we get:

 ** On entry to DLASCL parameter number  9 had an illegal value
 ** On entry to DLASCL parameter number  9 had an illegal value

cc @ZuseZ4 @wsmoses

There were other parameter number errors I saw during minimization (specifically lascl 1, gemm 2 10 11) -- hopefully they are related to whatever fixes the above, else will minimize those too.

@wsmoses
Copy link
Collaborator Author

wsmoses commented Nov 3, 2023

@gaurav-arya I think this should fix it: EnzymeAD/Enzyme#1522 [found an issue where we were passing an i8 instead of i32 -> stack corruption -> all hell breaks loose] Fixing this seemed to fix for me

@wsmoses
Copy link
Collaborator Author

wsmoses commented Nov 3, 2023

going backwards in minimized git history, this now seems to work

wmoses@beast:~/git/Enzyme/enzyme/build16/kalman/build ((HEAD detached at 4f0a22c)) $ ./example_robot1 
f(A) = 51584628.754482
Adup_fd[0] = 1858746938.630447, Adup_fd[1] = 1858746938.630447, Adup_fd[2] = 1858746938.630447, Adup_fd[10] = 1858746938.630447
Adup[0] = 137558947.970487, Adup[1] = 0.000000, Adup[2] = 0.000000, Adup[10] = 0.000000wmoses@beast:~/git/Enzyme/enzyme/build16/kalman/build ((HEAD detached at 4f0a22c)) $

@wsmoses
Copy link
Collaborator Author

wsmoses commented Nov 3, 2023

and now:

wmoses@beast:~/git/Enzyme/enzyme/build16/kalman/build ((HEAD detached at 86d7fd4)) $ ./example_robot1 
fx1=1.600000
Adup[0] = 1.000000, Adup[1] = 1.000000, Adup[2] = 1.000000, Adup[10] = 0.000000wmoses@beast:~/git/Enzyme/enzyme/build16/kalman/build ((HEAD detached at 86d7fd4)) $ 

@wsmoses
Copy link
Collaborator Author

wsmoses commented Nov 3, 2023

The correctness 2 commit/branch no longer has param errors (though not sure if correct)?

wmoses@beast:~/git/Enzyme/enzyme/build16/kalman/build ((HEAD detached at 61848d3)) $ ./example_robot1 
f(A) = 175.987168, f(A + delta) = 176.044467, f'(A)[0] fd = 57.299305
f(A) = 175.987168, f(A + delta2) = 175.987226, f'(A)[0] fd = 57.985182
f(A) = 175.987168, f(A + delta) = 175.986967, f'(A)[1] fd = -0.201019
f(A) = 175.987168, f(A + delta) = 175.986967, f'(A)[2] fd = -0.201019
f(A) = 175.987168, f(A + delta) = 175.986866, f'(A)[10] fd = -0.302252
Adup[0] = 748.312670, Adup[1] = 0.000000, Adup[2] = 0.000000, Adup[10] = 0.000000wmoses@beast:~/git/Enzyme/enzyme/build16/kalman/build ((HEAD detached at 61848d3)) $ 

@wsmoses
Copy link
Collaborator Author

wsmoses commented Nov 3, 2023

Correctness issue 1 commit current status:

wmoses@beast:~/git/Enzyme/enzyme/build16/kalman/build ((HEAD detached at 0dc936d)) $ ./example_robot1 
f(A) = 48.001035, f(A + delta) = 48.267872, f'(A)[0] fd = 266.837353
f(A) = 48.001035, f(A + delta2) = 48.001301, f'(A)[0] fd = 266.285760
f(A) = 48.001035, f(A + delta) = 48.212941, f'(A)[1] fd = 211.906350
f(A) = 48.001035, f(A + delta) = 48.212941, f'(A)[2] fd = 211.906350
f(A) = 48.001035, f(A + delta) = 48.001035, f'(A)[10] fd = 0.000000
Adup[0] = 316.808103, Adup[1] = 252.806723, Adup[2] = 252.806723, Adup[10] = 0.000000wmoses@beast:~/git/Enzyme/enzyme/build16/kalman/build ((HEAD detached at 0dc936d)) $ 

@wsmoses
Copy link
Collaborator Author

wsmoses commented Nov 3, 2023

@gaurav-arya I think now all of the segfault param issues are gone, though seemingly still correctness problems. If you're able to take a stab at minimizing the correctness issues I can try to fix those next. (note you'll need the latest main with: EnzymeAD/Enzyme#1522 )

@gaurav-arya
Copy link
Collaborator

gaurav-arya commented Nov 4, 2023

Minimized a correctness issue: 854ae64

Output on latest main:

f(A) = 0.515978
Adup_fd[0] = 1.315763, Adup_fd[1] = 1.291408, Adup_fd[2] = 1.291408, Adup_fd[3] = 1.291408
Adup[0] = 0.625922, Adup[1] = 0.625524, Adup[2] = 0.625524, Adup[3] = 0.625524

@wsmoses
Copy link
Collaborator Author

wsmoses commented Nov 6, 2023

@gaurav-arya this should now be fixed on main by EnzymeAD/Enzyme#1526.

See if you find any other correctness issues

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

Successfully merging this pull request may close these issues.

3 participants