Skip to content

Commit

Permalink
[aievec] Lower broadcasts to insert/splat (#1675)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsetoain committed Aug 9, 2024
1 parent 75095f0 commit 5019cee
Show file tree
Hide file tree
Showing 7 changed files with 223 additions and 182 deletions.
2 changes: 2 additions & 0 deletions include/aie/Dialect/AIEVec/Utils/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ std::optional<int64_t> getTransferReadAlignmentOffset(TransferReadLikeOp readOp,
mlir::VectorType vType,
int64_t alignment);

mlir::VectorType getFlattenedVectorType(mlir::VectorType vecTy);

} // namespace xilinx::aievec

#endif // AIE_DIALECT_AIEVEC_UTILS_UTILS_H
11 changes: 1 addition & 10 deletions lib/Conversion/AIEVecToLLVM/AIEVecToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
#include "aie/Dialect/AIEVec/AIE1/IR/AIEVecAIE1Ops.h"
#include "aie/Dialect/AIEVec/AIEVecUtils.h"
#include "aie/Dialect/AIEVec/IR/AIEVecOps.h"
#include "aie/Dialect/AIEVec/Utils/Utils.h"
#include "aie/Dialect/XLLVM/XLLVMDialect.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/TypeUtilities.h"
#include <numeric>
#include <sstream>

using namespace mlir;
Expand Down Expand Up @@ -118,15 +118,6 @@ struct BufferParams {
uint32_t square;
};

static VectorType getFlattenedVectorType(VectorType vecTy) {
if (vecTy.getRank() == 1)
return vecTy;
auto shape = vecTy.getShape();
return VectorType::get(
{std::accumulate(shape.begin(), shape.end(), 1, std::multiplies<>())},
vecTy.getElementType());
}

// sgn_x: Sign mask of matrix X. If it is one matrix X is interpreted as
// signed, else it treated as unsigned.
// sgn_y: Sign mask of matrix Y. If it is one matrix Y is interpreted as
Expand Down
Loading

0 comments on commit 5019cee

Please sign in to comment.