-
Notifications
You must be signed in to change notification settings - Fork 145
enzyme-tblgen fix for aarch64 CFP #1331
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
Conversation
wsmoses
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a test otherwise LGTM
|
This one fails locally for me now: |
|
@ZuseZ4 what is dif->getType() and ptr->getType() on your local build with that test? |
|
This is consistent and errors: (gdb) bt
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737347913600) at ./nptl/pthread_kill.c:44
#1 __pthread_kill_internal (signo=6, threadid=140737347913600) at ./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=140737347913600, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3 0x00007ffff7a57476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4 0x00007ffff7a3d7f3 in __GI_abort () at ./stdlib/abort.c:79
#5 0x00007ffff7a3d71b in __assert_fail_base (fmt=0x7ffff7bf2150 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x6c62902 "Ty == cast<PointerType>(Ptr->getType())->getElementType()",
file=0x6c610b7 "/home/wmoses/llvms/llvm12/llvm/lib/IR/Instructions.cpp", line=1409, function=<optimized out>) at ./assert/assert.c:92
#6 0x00007ffff7a4ee96 in __GI___assert_fail (assertion=0x6c62902 "Ty == cast<PointerType>(Ptr->getType())->getElementType()", file=0x6c610b7 "/home/wmoses/llvms/llvm12/llvm/lib/IR/Instructions.cpp", line=1409,
function=0x6c6293c "llvm::LoadInst::LoadInst(llvm::Type *, llvm::Value *, const llvm::Twine &, bool, llvm::Align, llvm::AtomicOrdering, SyncScope::ID, llvm::Instruction *)") at ./assert/assert.c:101
#7 0x00000000035b4e26 in llvm::LoadInst::LoadInst (this=0x8ac4c50, Ty=0x8a80440, Ptr=0x8ac4710, Name=..., isVolatile=false, Align=..., Order=llvm::AtomicOrdering::NotAtomic, SSID=1 '\001', InsertBef=0x0)
at /home/wmoses/llvms/llvm12/llvm/lib/IR/Instructions.cpp:1409
#8 0x00000000035b4c02 in llvm::LoadInst::LoadInst (this=0x8ac4c50, Ty=0x8a80440, Ptr=0x8ac4710, Name=..., isVolatile=false, Align=..., InsertBef=0x0) at /home/wmoses/llvms/llvm12/llvm/lib/IR/Instructions.cpp:1397
#9 0x00007ffff71bdedd in llvm::IRBuilderBase::CreateAlignedLoad (this=0x7fffffff8200, Ty=0x8a80440, Ptr=0x8ac4710, Align=..., isVolatile=false, Name=...) at /home/wmoses/llvms/llvm12/llvm/include/llvm/IR/IRBuilder.h:1776
#10 0x00007ffff71bdde9 in llvm::IRBuilderBase::CreateAlignedLoad (this=0x7fffffff8200, Ty=0x8a80440, Ptr=0x8ac4710, Align=..., Name=...) at /home/wmoses/llvms/llvm12/llvm/include/llvm/IR/IRBuilder.h:1760
#11 0x00007ffff71bdd14 in llvm::IRBuilderBase::CreateLoad (this=0x7fffffff8200, Ty=0x8a80440, Ptr=0x8ac4710, Name=...) at /home/wmoses/llvms/llvm12/llvm/include/llvm/IR/IRBuilder.h:1713
#12 0x00007ffff7215f80 in DiffeGradientUtils::addToDiffe (this=0x8a9b210, val=0x8a8e9c0, dif=0x8ac4680, BuilderM=..., addingType=0x8a80080, idxs=..., mask=0x0) at /home/wmoses/git/Enzyme/enzyme/Enzyme/DiffeGradientUtils.cpp:330
#13 0x00007ffff74ae3dc in AdjointGenerator<AugmentedReturn const*>::addToDiffe (this=0x7fffffff8de0, val=0x8a8e9c0, dif=0x8ac4680, Builder=..., T=0x8a80080, mask=0x0) at /home/wmoses/git/Enzyme/enzyme/Enzyme/AdjointGenerator.h:2020
#14 0x00007ffff741c0f9 in AdjointGenerator<AugmentedReturn const*>::visitCallInst (this=0x7fffffff8de0, call=...) at /home/wmoses/git/Enzyme/enzyme/build12/Enzyme/CallDerivatives.inc:8018
#15 0x00007ffff73cfef4 in llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::delegateCallInst (this=0x7fffffff8de0, I=...) at /home/wmoses/llvms/llvm12/llvm/include/llvm/IR/InstVisitor.h:299
#16 0x00007ffff73207af in llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::visitCall (this=0x7fffffff8de0, I=...) at /home/wmoses/llvms/llvm12/llvm/include/llvm/IR/Instruction.def:209
#17 0x00007ffff73110a9 in llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::visit (this=0x7fffffff8de0, I=...) at /home/wmoses/llvms/llvm12/llvm/include/llvm/IR/Instruction.def:209
#18 0x00007ffff730211f in llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::visit (this=0x7fffffff8de0, I=0x8a95880) at /home/wmoses/llvms/llvm12/llvm/include/llvm/IR/InstVisitor.h:112
#19 0x00007ffff72dc91b in EnzymeLogic::CreatePrimalAndGradient (this=0x8a86498, key=..., TA=..., augmenteddata=0x0, omp=false) at /home/wmoses/git/Enzyme/enzyme/Enzyme/EnzymeLogic.cpp:4185
#20 0x00007ffff7267ad1 in (anonymous namespace)::EnzymeBase::HandleAutoDiff (this=0x8a86498, CI=0x8a7ed10, CallingConv=0, ret=0x8a7ed10, retElemType=0x0, args=..., byVal=std::map with 0 elements, constants=std::vector of length 1, capacity 1 = {...},
fn=0x8a13218, mode=DerivativeMode::ReverseModeCombined, options=..., sizeOnly=false) at /home/wmoses/git/Enzyme/enzyme/Enzyme/Enzyme.cpp:1440
#21 0x00007ffff7269c30 in (anonymous namespace)::EnzymeBase::HandleAutoDiffArguments (this=0x8a86498, CI=0x8a7ed10, mode=DerivativeMode::ReverseModeCombined, sizeOnly=false) at /home/wmoses/git/Enzyme/enzyme/Enzyme/Enzyme.cpp:1764
#22 0x00007ffff726e118 in (anonymous namespace)::EnzymeBase::lowerEnzymeCalls (this=0x8a86498, F=..., done=std::set with 2 elements = {...}) at /home/wmoses/git/Enzyme/enzyme/Enzyme/Enzyme.cpp:2431
#23 0x00007ffff726ed73 in (anonymous namespace)::EnzymeBase::run (this=0x8a86498, M=...) at /home/wmoses/git/Enzyme/enzyme/Enzyme/Enzyme.cpp:2597
#24 0x00007ffff727574c in EnzymeNewPM::run (this=0x8a86498, M=..., MAM=...) at /home/wmoses/git/Enzyme/enzyme/Enzyme/Enzyme.cpp:2880
#25 0x00007ffff72b8e71 in llvm::detail::PassModel<llvm::Module, EnzymeNewPM, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (this=0x8a86490, IR=..., AM=...)
at /home/wmoses/llvms/llvm12/llvm/include/llvm/IR/PassManagerInternal.h:85
#26 0x000000000365b9ec in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (this=0x7fffffffb498, IR=..., AM=...)
at /home/wmoses/llvms/llvm12/llvm/include/llvm/IR/PassManager.h:517
#27 0x0000000000d9a82c in llvm::runPassPipeline (Arg0=..., M=..., TM=0x0, TLII=0x7fffffffd648, Out=0x8a7f250, ThinLTOLinkOut=0x0, OptRemarkFile=0x0, PassPipeline=..., Passes=..., OK=llvm::opt_tool::OK_OutputAssembly,
VK=llvm::opt_tool::VK_VerifyInAndOut, ShouldPreserveAssemblyUseListOrder=false, ShouldPreserveBitcodeUseListOrder=true, EmitSummaryIndex=false, EmitModuleHash=false, EnableDebugify=false, Coroutines=false)
at /home/wmoses/llvms/llvm12/llvm/tools/opt/NewPMDriver.cpp:449
#28 0x0000000000dcf32a in main (argc=8, argv=0x7fffffffdf48) at /home/wmoses/llvms/llvm12/llvm/tools/opt/opt.cpp:787
(gdb) f 12
#12 0x00007ffff7215f80 in DiffeGradientUtils::addToDiffe (this=0x8a9b210, val=0x8a8e9c0, dif=0x8ac4680, BuilderM=..., addingType=0x8a80080, idxs=..., mask=0x0) at /home/wmoses/git/Enzyme/enzyme/Enzyme/DiffeGradientUtils.cpp:330
330 Value *old = BuilderM.CreateLoad(dif->getType(), ptr);
(gdb) l ptr->dump()
Function "ptr->dump()" not defined.
(gdb) p ptr->dump()
%"in'de" = alloca [2 x double], align 8
$1 = void
(gdb) p dif->dump()
%37 = insertvalue { double, double } %36, double %33, 1
$2 = void
(gdb) f 16
#16 0x00007ffff73207af in llvm::InstVisitor<AdjointGenerator<AugmentedReturn const*>, void>::visitCall (this=0x7fffffff8de0, I=...) at /home/wmoses/llvms/llvm12/llvm/include/llvm/IR/Instruction.def:209
209 HANDLE_OTHER_INST(56, Call , CallInst ) // Call a function
(gdb) f 14
#14 0x00007ffff741c0f9 in AdjointGenerator<AugmentedReturn const*>::visitCallInst (this=0x7fffffff8de0, call=...) at /home/wmoses/git/Enzyme/enzyme/build12/Enzyme/CallDerivatives.inc:8018
8018 if (toadd) addToDiffe(call.getOperand(0), toadd, Builder2, call.getOperand(0)->getType());
(gdb) p call.dump()
%call = call [2 x double] @Faddeeva_erf([2 x double] %in, double 0.000000e+00) #1
$3 = void
(gdb) p toadd->dump()
%37 = insertvalue { double, double } %36, double %33, 1
$4 = voidI'm going to revert this as broken, @motabbara do you want to take another stab at this. |
|
yup. sorry for the mess up. |
fixes #1327