mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Fix caffee2 to use MaybeAlign when using LLVM trunk
Summary: Trunk at 13 uses a different type for `CreateAlignedStore` and `CreateAlignedLoad` so updating usage here to reflect this.
Test Plan:
buck build mode/opt-clang-thinlto sigrid/predictor/v2:sigrid_remote_predictor -c cxx.extra_cxxflags="-Wforce-no-error -fbracket-depth=300" -c cxx.profile="fbcode//fdo/autofdo-bolt-compatible/sigrid/predictor/v2/sigrid_remote_predictor:autofdo-bolt-compatible" -c cxx.modules=False
Previously:
caffe2/torch/csrc/jit/tensorexpr/llvm_codegen.cpp:1079:21: error: no matching member function for call to 'CreateAlignedLoad'
value_ = irb_.CreateAlignedLoad(vaddr, 4);
~~~~~^~~~~~~~~~~~~~~~~
third-party-buck/platform009/build/llvm-fb/include/llvm/IR/IRBuilder.h:1681:13: note: candidate function not viable: no known conversion from 'int' to 'llvm::MaybeAlign' for 2nd argument
LoadInst *CreateAlignedLoad(Value *Ptr, MaybeAlign Align,
Now:
Passes
Differential Revision: D26562330
fbshipit-source-id: dbf9ca5247ccd4351861995c2c5480a7cc55c202
This commit is contained in:
parent
a61a8d059e
commit
a935118c90
|
|
@ -1076,7 +1076,11 @@ void LLVMCodeGenImpl::visit(const Load* v) {
|
|||
auto addr = irb_.CreateGEP(base, first_idx);
|
||||
auto vaddr = irb_.CreateBitOrPointerCast(
|
||||
addr, llvm::PointerType::get(loadType, 0));
|
||||
#if LLVM_VERSION_MAJOR >= 13
|
||||
value_ = irb_.CreateAlignedLoad(vaddr, llvm::MaybeAlign(4));
|
||||
#else
|
||||
value_ = irb_.CreateAlignedLoad(vaddr, 4);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1255,8 +1259,12 @@ void LLVMCodeGenImpl::visit(const Store* v) {
|
|||
auto addr = irb_.CreateGEP(base, first_idx);
|
||||
auto vaddr = irb_.CreateBitOrPointerCast(
|
||||
addr, llvm::PointerType::get(val->getType(), 0));
|
||||
irb_.CreateAlignedStore(val, vaddr, 4);
|
||||
|
||||
#if LLVM_VERSION_MAJOR >= 13
|
||||
irb_.CreateAlignedStore(val, vaddr, llvm::MaybeAlign(4));
|
||||
#else
|
||||
irb_.CreateAlignedStore(val, vaddr, 4);
|
||||
#endif
|
||||
value_ = llvm::ConstantInt::get(IntTy_, 0);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user