#include "mlir/Conversion/VectorToXeGPU/VectorToXeGPU.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/XeGPU/IR/XeGPU.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/TypeSwitch.h"
#include <algorithm>
#include <optional>
namespace mlir {
#define GEN_PASS_DEF_CONVERTVECTORTOXEGPU
#include "mlir/Conversion/Passes.h.inc"
}
usingnamespacemlir;
namespace {
static bool isZeroConstant(Value val) { … }
static LogicalResult storeLoadPreconditions(PatternRewriter &rewriter,
Operation *op, VectorType vecTy) { … }
static LogicalResult transferPreconditions(PatternRewriter &rewriter,
VectorTransferOpInterface xferOp) { … }
static xegpu::CreateNdDescOp
createNdDescriptor(PatternRewriter &rewriter, Location loc,
xegpu::TensorDescType descType, TypedValue<MemRefType> src,
Operation::operand_range offsets) { … }
struct TransferReadLowering : public OpRewritePattern<vector::TransferReadOp> { … };
struct TransferWriteLowering
: public OpRewritePattern<vector::TransferWriteOp> { … };
struct LoadLowering : public OpRewritePattern<vector::LoadOp> { … };
struct StoreLowering : public OpRewritePattern<vector::StoreOp> { … };
struct ConvertVectorToXeGPUPass
: public impl::ConvertVectorToXeGPUBase<ConvertVectorToXeGPUPass> { … };
}
void mlir::populateVectorToXeGPUConversionPatterns(
RewritePatternSet &patterns) { … }
std::unique_ptr<Pass> mlir::createConvertVectorToXeGPUPass() { … }