Integrate llvm 20230926 (#15043)
Co-authored-by: Groverkss <groverkss@gmail.com>
Co-authored-by: Jakub Kuderski <jakub@nod-labs.com>
diff --git a/compiler/src/iree/compiler/Codegen/Common/BufferizeCopyOnlyDispatchesPass.cpp b/compiler/src/iree/compiler/Codegen/Common/BufferizeCopyOnlyDispatchesPass.cpp
index ef24bfe..833788c 100644
--- a/compiler/src/iree/compiler/Codegen/Common/BufferizeCopyOnlyDispatchesPass.cpp
+++ b/compiler/src/iree/compiler/Codegen/Common/BufferizeCopyOnlyDispatchesPass.cpp
@@ -97,11 +97,6 @@
return emitError(
loc, "unexpected allocation while bufferizing copy only dispatches");
};
- bufferization::BufferizationOptions::DeallocationFn deallocationFn =
- [](OpBuilder &, Location loc, Value) -> LogicalResult {
- return emitError(
- loc, "unexpected deallocation while bufferizing copy only dispatches");
- };
bufferization::BufferizationOptions::MemCpyFn memcpyFn =
[](OpBuilder &builder, Location loc, Value from,
Value to) -> LogicalResult {
@@ -110,7 +105,7 @@
};
addIREEComprehensiveBufferizePasses(bufferizationPipeline, allocationFn,
- deallocationFn, memcpyFn);
+ memcpyFn);
if (failed(runPipeline(bufferizationPipeline, module))) {
return signalPassFailure();
}
diff --git a/compiler/src/iree/compiler/Codegen/Common/IREEComprehensiveBufferizePass.cpp b/compiler/src/iree/compiler/Codegen/Common/IREEComprehensiveBufferizePass.cpp
index 7cf545d..6a97ab0 100644
--- a/compiler/src/iree/compiler/Codegen/Common/IREEComprehensiveBufferizePass.cpp
+++ b/compiler/src/iree/compiler/Codegen/Common/IREEComprehensiveBufferizePass.cpp
@@ -63,11 +63,8 @@
explicit IREEComprehensiveBufferizePass(
std::optional<BufferizationOptions::AllocationFn> allocationFn =
std::nullopt,
- std::optional<BufferizationOptions::DeallocationFn> deallocationFn =
- std::nullopt,
std::optional<BufferizationOptions::MemCpyFn> memCpyFn = std::nullopt)
- : allocationFn(allocationFn), deallocationFn(deallocationFn),
- memCpyFn(memCpyFn) {}
+ : allocationFn(allocationFn), memCpyFn(memCpyFn) {}
void getDependentDialects(DialectRegistry ®istry) const override {
// clang-format off
@@ -91,7 +88,6 @@
private:
const std::optional<BufferizationOptions::AllocationFn> allocationFn;
- const std::optional<BufferizationOptions::DeallocationFn> deallocationFn;
const std::optional<BufferizationOptions::MemCpyFn> memCpyFn;
};
} // namespace
@@ -115,11 +111,6 @@
}
return builder.create<memref::AllocOp>(loc, type, dynamicSizes).getResult();
}
-static LogicalResult defaultDeallocationFn(OpBuilder &builder, Location loc,
- Value allocation) {
- builder.create<memref::DeallocOp>(loc, allocation);
- return success();
-}
static LogicalResult defaultMemCpyFn(OpBuilder &builder, Location loc,
Value from, Value to) {
Operation *copyOp = createLinalgCopyOp(builder, loc, from, to);
@@ -216,7 +207,6 @@
options.testAnalysisOnly = testAnalysisOnly;
options.printConflicts = printConflicts;
options.allocationFn = allocationFn;
- options.deallocationFn = deallocationFn;
options.memCpyFn = memCpyFn;
if (failed(runIREEOneShotBufferize(moduleOp, options))) {
@@ -239,16 +229,13 @@
std::unique_ptr<OperationPass<ModuleOp>> createIREEComprehensiveBufferizePass(
std::optional<BufferizationOptions::AllocationFn> allocationFn,
- std::optional<BufferizationOptions::DeallocationFn> deallocationFn,
std::optional<BufferizationOptions::MemCpyFn> memCpyFn) {
if (!allocationFn)
allocationFn = defaultAllocationFn;
- if (!deallocationFn)
- deallocationFn = defaultDeallocationFn;
if (!memCpyFn)
memCpyFn = defaultMemCpyFn;
- return std::make_unique<IREEComprehensiveBufferizePass>(
- allocationFn, deallocationFn, memCpyFn);
+ return std::make_unique<IREEComprehensiveBufferizePass>(allocationFn,
+ memCpyFn);
}
void addIREEPostBufferizationPasses(OpPassManager &passManager) {
@@ -265,12 +252,11 @@
void addIREEComprehensiveBufferizePasses(
OpPassManager &passManager,
std::optional<BufferizationOptions::AllocationFn> allocationFn,
- std::optional<BufferizationOptions::DeallocationFn> deallocationFn,
std::optional<BufferizationOptions::MemCpyFn> memCpyFn) {
passManager.addPass(createEliminateEmptyTensorsPass());
passManager.addPass(bufferization::createEmptyTensorToAllocTensorPass());
- passManager.addPass(createIREEComprehensiveBufferizePass(
- allocationFn, deallocationFn, memCpyFn));
+ passManager.addPass(
+ createIREEComprehensiveBufferizePass(allocationFn, memCpyFn));
addIREEPostBufferizationPasses(passManager);
}
diff --git a/compiler/src/iree/compiler/Codegen/Common/Passes.h b/compiler/src/iree/compiler/Codegen/Common/Passes.h
index 2fdcdcd..dd2b684 100644
--- a/compiler/src/iree/compiler/Codegen/Common/Passes.h
+++ b/compiler/src/iree/compiler/Codegen/Common/Passes.h
@@ -36,8 +36,6 @@
OpPassManager &passManager,
std::optional<BufferizationOptions::AllocationFn> allocationFn =
std::nullopt,
- std::optional<BufferizationOptions::DeallocationFn> deallocationFn =
- std::nullopt,
std::optional<BufferizationOptions::MemCpyFn> memCpyFn = std::nullopt);
std::unique_ptr<OperationPass<LLVM::LLVMFuncOp>> createAddFastMathFlagsPass();
@@ -174,8 +172,6 @@
std::unique_ptr<OperationPass<ModuleOp>> createIREEComprehensiveBufferizePass(
std::optional<BufferizationOptions::AllocationFn> allocationFn =
std::nullopt,
- std::optional<BufferizationOptions::DeallocationFn> deallocationFn =
- std::nullopt,
std::optional<BufferizationOptions::MemCpyFn> memCpyFn = std::nullopt);
/// Pass to resolve `memref.expand_strided_metadata` operations.
diff --git a/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp b/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp
index 6e79299..063b033 100644
--- a/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp
+++ b/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp
@@ -719,12 +719,6 @@
.getResult();
}
-static LogicalResult cpuComprehensiveBufferizeDeallocationFn(OpBuilder &builder,
- Location loc,
- Value allocation) {
- return success();
-}
-
static LogicalResult cpuComprehensiveBufferizeCopyFn(OpBuilder &builder,
Location loc, Value from,
Value to) {
@@ -752,13 +746,6 @@
.getResult();
}
-static LogicalResult gpuComprehensiveBufferizeDeallocationFn(OpBuilder &builder,
- Location loc,
- Value allocation) {
- builder.create<memref::DeallocOp>(loc, allocation);
- return success();
-}
-
static LogicalResult gpuComprehensiveBufferizeCopyFn(OpBuilder &builder,
Location loc, Value from,
Value to) {
@@ -847,12 +834,9 @@
using mlir::bufferization::BufferizationOptions;
BufferizationOptions::AllocationFn allocationFn =
cpuComprehensiveBufferizeAllocationFn;
- BufferizationOptions::DeallocationFn deallocationFn =
- cpuComprehensiveBufferizeDeallocationFn;
BufferizationOptions::MemCpyFn memCpyFn = cpuComprehensiveBufferizeCopyFn;
if (getTargetGpu()) {
allocationFn = gpuComprehensiveBufferizeAllocationFn;
- deallocationFn = gpuComprehensiveBufferizeDeallocationFn;
memCpyFn = gpuComprehensiveBufferizeCopyFn;
}
@@ -884,7 +868,6 @@
// 2. Run one-shot-bufferize, without the pass baggage.
IREEOneShotBufferizationOptions options = getBufferizationOptions();
options.allocationFn = allocationFn;
- options.deallocationFn = deallocationFn;
options.memCpyFn = memCpyFn;
options.testAnalysisOnly = getTestAnalysisOnly();
options.printConflicts = getPrintConflicts();
diff --git a/compiler/src/iree/compiler/Codegen/LLVMCPU/DispatchABI.cpp b/compiler/src/iree/compiler/Codegen/LLVMCPU/DispatchABI.cpp
index 101cef4..6524e5e 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMCPU/DispatchABI.cpp
+++ b/compiler/src/iree/compiler/Codegen/LLVMCPU/DispatchABI.cpp
@@ -1082,7 +1082,7 @@
loadImportOrdinal(forOp, importName, /*weak=*/true, builder);
auto importFunc = loadImportFunc(forOp, importOrdinal, builder);
Value nullPtrValue =
- builder.create<LLVM::NullOp>(loc, importFunc.first.getType());
+ builder.create<LLVM::ZeroOp>(loc, importFunc.first.getType());
return builder.create<LLVM::ICmpOp>(loc, builder.getI1Type(),
LLVM::ICmpPredicate::ne, importFunc.first,
nullPtrValue);
@@ -1101,7 +1101,7 @@
// null as in isImportFuncAvailable but we'll need to make the control flow.
assert(!weak && "calls to weak imports not yet implemented");
- Value nullPtrValue = builder.create<LLVM::NullOp>(
+ Value nullPtrValue = builder.create<LLVM::ZeroOp>(
loc, LLVM::LLVMPointerType::get(builder.getContext()));
auto callOp =
builder.create<LLVM::CallOp>(loc, TypeRange{builder.getI32Type()},
diff --git a/compiler/src/iree/compiler/Codegen/LLVMCPU/Passes.cpp b/compiler/src/iree/compiler/Codegen/LLVMCPU/Passes.cpp
index 6bdd559..d05fc84 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMCPU/Passes.cpp
+++ b/compiler/src/iree/compiler/Codegen/LLVMCPU/Passes.cpp
@@ -114,11 +114,6 @@
.getResult();
}
-static LogicalResult cpuDeallocationFn(OpBuilder &builder, Location loc,
- Value allocation) {
- return success();
-}
-
static LogicalResult cpuCopyFn(OpBuilder &builder, Location loc, Value from,
Value to) {
createLinalgCopyOp(builder, loc, from, to);
@@ -127,10 +122,8 @@
static void addBufferizePasses(OpPassManager &passManager) {
BufferizationOptions::AllocationFn allocationFn = cpuAllocationFn;
- BufferizationOptions::DeallocationFn deallocationFn = cpuDeallocationFn;
BufferizationOptions::MemCpyFn memcpyFn = cpuCopyFn;
- addIREEComprehensiveBufferizePasses(passManager, allocationFn, deallocationFn,
- memcpyFn);
+ addIREEComprehensiveBufferizePasses(passManager, allocationFn, memcpyFn);
}
static void addTileAndDistributePasses(OpPassManager &pm) {
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/Passes.cpp b/compiler/src/iree/compiler/Codegen/LLVMGPU/Passes.cpp
index cb2f2e6..d4503cc 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMGPU/Passes.cpp
+++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/Passes.cpp
@@ -53,11 +53,6 @@
.getResult();
}
-static LogicalResult gpuDeallocationFn(OpBuilder &builder, Location loc,
- Value allocation) {
- return success();
-}
-
static LogicalResult gpuCopyFn(OpBuilder &builder, Location loc, Value from,
Value to) {
bool needsBarrier = false;
@@ -79,10 +74,8 @@
static void addBufferizePasses(OpPassManager &passManager) {
BufferizationOptions::AllocationFn allocationFn = gpuAllocationFn;
- BufferizationOptions::DeallocationFn deallocationFn = gpuDeallocationFn;
BufferizationOptions::MemCpyFn memcpyFn = gpuCopyFn;
- addIREEComprehensiveBufferizePasses(passManager, allocationFn, deallocationFn,
- memcpyFn);
+ addIREEComprehensiveBufferizePasses(passManager, allocationFn, memcpyFn);
passManager.addPass(createCanonicalizerPass());
passManager.addPass(createCSEPass());
}
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/Utils/LLVMGPUUtils.cpp b/compiler/src/iree/compiler/Codegen/LLVMGPU/Utils/LLVMGPUUtils.cpp
index 997f150..61673bd 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMGPU/Utils/LLVMGPUUtils.cpp
+++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/Utils/LLVMGPUUtils.cpp
@@ -91,13 +91,13 @@
? maybeExtractOp.getVector().getDefiningOp<vector::CreateMaskOp>()
: transferRead.getMask().getDefiningOp<vector::CreateMaskOp>();
if (maybeExtractOp) {
- if (maybeExtractOp.getPosition().size() + 1 !=
+ if (maybeExtractOp.getStaticPosition().size() + 1 !=
llvm::cast<VectorType>(maskOp->getResultTypes().front()).getRank()) {
LDBG("----mask through extract unexpected position size -> Skip: "
<< maybeExtractOp);
return MaskResult{};
}
- if (maybeExtractOp.getPosition().size() != 1) {
+ if (maybeExtractOp.getStaticPosition().size() != 1) {
LDBG("----only mask through 2-D -> 1-D extract supported atm -> Skip: "
<< maybeExtractOp);
return MaskResult{};
@@ -114,8 +114,9 @@
Value count = maskResult.maskOp->getOperands().back();
vector::ExtractOp maybeExtractOp = maskResult.maybeExtractOp;
if (maybeExtractOp) {
- assert(maybeExtractOp.getPosition().size() == 1 && "expected single pos");
- int64_t sliceNum = maybeExtractOp.getPosition()[0];
+ assert(maybeExtractOp.getStaticPosition().size() == 1 &&
+ "expected single pos");
+ int64_t sliceNum = maybeExtractOp.getStaticPosition()[0];
// TODO: to support >2-D mask + extract, and all the cmp.
Location loc = op->getLoc();
Value zero = rewriter.create<arith::ConstantIndexOp>(loc, 0);
diff --git a/compiler/src/iree/compiler/Codegen/SPIRV/Passes.cpp b/compiler/src/iree/compiler/Codegen/SPIRV/Passes.cpp
index 19eed7b..129e429 100644
--- a/compiler/src/iree/compiler/Codegen/SPIRV/Passes.cpp
+++ b/compiler/src/iree/compiler/Codegen/SPIRV/Passes.cpp
@@ -81,11 +81,6 @@
.getResult();
}
-static LogicalResult gpuDeallocationFn(OpBuilder &builder, Location loc,
- Value allocation) {
- return success();
-}
-
static LogicalResult gpuCopyFn(OpBuilder &builder, Location loc, Value from,
Value to) {
auto fromType = llvm::cast<MemRefType>(from.getType());
@@ -106,10 +101,8 @@
static void addBufferizePasses(OpPassManager &passManager,
BufferizationOptions::AllocationFn fn) {
BufferizationOptions::AllocationFn allocationFn = fn;
- BufferizationOptions::DeallocationFn deallocationFn = gpuDeallocationFn;
BufferizationOptions::MemCpyFn memcpyFn = gpuCopyFn;
- addIREEComprehensiveBufferizePasses(passManager, allocationFn, deallocationFn,
- memcpyFn);
+ addIREEComprehensiveBufferizePasses(passManager, allocationFn, memcpyFn);
}
//===----------------------------------------------------------------------===//
diff --git a/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVBreakDownLargeVector.cpp b/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVBreakDownLargeVector.cpp
index 17de921..3c4e3e0 100644
--- a/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVBreakDownLargeVector.cpp
+++ b/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVBreakDownLargeVector.cpp
@@ -124,8 +124,8 @@
srcElement, shrVal);
Value elem =
rewriter.create<arith::AndIOp>(extractOp.getLoc(), shr, mask);
- result = rewriter.create<vector::InsertOp>(
- extractOp.getLoc(), extOp.getType(), elem, result, i);
+ result = rewriter.create<vector::InsertOp>(extractOp.getLoc(), elem,
+ result, i);
shrSize += midElemBitwidth;
}
diff --git a/third_party/llvm-project b/third_party/llvm-project
index 0b2197b..b0e28eb 160000
--- a/third_party/llvm-project
+++ b/third_party/llvm-project
@@ -1 +1 @@
-Subproject commit 0b2197b0cf9d557cb3a20e0aca3f727aea5b290d
+Subproject commit b0e28eb832710964067a17d845de15ada2da2b9c