Skip to content

Commit

Permalink
Memcpy of vector of floats (#1955)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Jul 1, 2024
1 parent 8cc86db commit a7ec949
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion enzyme/Enzyme/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,14 @@ EnzymeFailure::EnzymeFailure(const llvm::Twine &RemarkName,

/// Convert a floating type to a string
static inline std::string tofltstr(Type *T) {
if (auto VT = dyn_cast<VectorType>(T)) {
#if LLVM_VERSION_MAJOR >= 12
auto len = VT->getElementCount().getFixedValue();
#else
auto len = VT->getNumElements();
#endif
return "vec" + std::to_string(len) + tofltstr(VT->getElementType());
}
switch (T->getTypeID()) {
case Type::HalfTyID:
return "half";
Expand Down Expand Up @@ -1127,7 +1135,7 @@ Function *getOrInsertMemcpyStrided(Module &M, Type *elementType, PointerType *T,
Function *getOrInsertMemcpyMat(Module &Mod, Type *elementType, PointerType *PT,
IntegerType *IT, unsigned dstalign,
unsigned srcalign) {
assert(elementType->isFloatingPointTy());
assert(elementType->isFPOrFPVectorTy());
#if LLVM_VERSION_MAJOR < 17
#if LLVM_VERSION_MAJOR >= 15
if (Mod.getContext().supportsTypedPointers()) {
Expand Down

0 comments on commit a7ec949

Please sign in to comment.