Integrate LLVM to llvm/llvm-project@a7dcddcdd7fe (#25246) Bumps StableHLO to openxla/stablehlo@57f1d925, which carries the `tablegen_internal` fix for llvm/llvm-project@d6a4b2ad0b90. Local LLVM commits: - `1791e8bffe5f` [mlir][VectorToGPU] Reconsider cached slices after rejected candidates. Now also applied to the `VectorToNVGPU` copy of `getOpToConvert` made by llvm/llvm-project@a539adc11adc. - `a7dcddcdd7fe` [Bazel] Fixes a539adc11adc: adds the `VectorToNVGPU` and `VectorToGPUCommon` targets. IREE changes for: - llvm/llvm-project@3f7ff7194540: Vector op result accessors renamed. - llvm/llvm-project@1491d92be819, 88a56ff9a17c, e1fd616879c2: ADT warn-unused attribute; dead locals removed. - llvm/llvm-project@e1056bdfdc6c: `visitNonControlFlowArguments` takes `getLattice`. - llvm/llvm-project@a539adc11adc: mma-sync callers use `populatePrepareVectorToNVMMAPatterns`. - llvm/llvm-project@9f19eb1eca88: `SubsetOpInterfaceImpl.h` header rename. - llvm/llvm-project@d6f914f06a18: `VectorTransferSplit::LinalgCopy` is now `MemRefCopy`; `vector_lowering.mlir` CHECKs updated. - llvm/llvm-project@bcbb0f54f80c: `AllocTensorOp::getType` returns `TensorLikeType`. - llvm/llvm-project@0fa939a990bf: `PipelineTuningOptions` takes its options from the `PassBuilder` context. - llvm/llvm-project@1601e2ed65bf: ODS emits interface includes; Bazel deps added to 4 `IR` targets. Assisted-by: Claude Code --------- Signed-off-by: Jelle Schühmacher <schuehmacher@roofline.ai>
diff --git a/compiler/plugins/target/CUDA/CUDATarget.cpp b/compiler/plugins/target/CUDA/CUDATarget.cpp index 2dd3cec..5b3b7aa 100644 --- a/compiler/plugins/target/CUDA/CUDATarget.cpp +++ b/compiler/plugins/target/CUDA/CUDATarget.cpp
@@ -348,7 +348,7 @@ fam.registerPass([&] { return targetMachine.getTargetIRAnalysis(); }); - llvm::PipelineTuningOptions pto(&module.getContext().getLibraryOptions()); + llvm::PipelineTuningOptions pto; pto.SLPVectorization = false; llvm::PassInstrumentationCallbacks pic;
diff --git a/compiler/plugins/target/LLVMCPU/LLVMIRPasses.cpp b/compiler/plugins/target/LLVMCPU/LLVMIRPasses.cpp index 03f628b..ed70080 100644 --- a/compiler/plugins/target/LLVMCPU/LLVMIRPasses.cpp +++ b/compiler/plugins/target/LLVMCPU/LLVMIRPasses.cpp
@@ -38,8 +38,7 @@ /*DebugLogging=*/false); standardInstrumentations.registerCallbacks(passInstrumentationCallbacks); - llvm::PipelineTuningOptions tuningOptions( - &module->getContext().getLibraryOptions()); + llvm::PipelineTuningOptions tuningOptions; tuningOptions.LoopInterleaving = target.pipelineTuningOptions.LoopInterleaving; tuningOptions.LoopVectorization =
diff --git a/compiler/plugins/target/MetalSPIRV/MSLToMetalLib.cpp b/compiler/plugins/target/MetalSPIRV/MSLToMetalLib.cpp index c50969d..1d2c76c 100644 --- a/compiler/plugins/target/MetalSPIRV/MSLToMetalLib.cpp +++ b/compiler/plugins/target/MetalSPIRV/MSLToMetalLib.cpp
@@ -65,7 +65,7 @@ std::unique_ptr<llvm::MemoryBuffer> compileMSLToMetalLib(MetalTargetPlatform targetPlatform, llvm::StringRef mslCode, llvm::StringRef entryPoint) { - llvm::SmallString<32> mslFile, airFile, libFile; + llvm::SmallString<32> mslFile, libFile; int mslFd = 0; llvm::sys::fs::createTemporaryFile(entryPoint, "metal", mslFd, mslFile); llvm::sys::fs::createTemporaryFile(entryPoint, "metallib", libFile);
diff --git a/compiler/plugins/target/ROCM/ROCMTarget.cpp b/compiler/plugins/target/ROCM/ROCMTarget.cpp index 0f46d7e..9d84cff 100644 --- a/compiler/plugins/target/ROCM/ROCMTarget.cpp +++ b/compiler/plugins/target/ROCM/ROCMTarget.cpp
@@ -620,7 +620,7 @@ fam.registerPass([&] { return targetMachine.getTargetIRAnalysis(); }); - llvm::PipelineTuningOptions pto(&module.getContext().getLibraryOptions()); + llvm::PipelineTuningOptions pto; pto.SLPVectorization = slpVectorization; llvm::PassInstrumentationCallbacks pic;
diff --git a/compiler/src/iree/compiler/Codegen/Common/BlockDynamicDimensions.cpp b/compiler/src/iree/compiler/Codegen/Common/BlockDynamicDimensions.cpp index d4908f9..dd1331e 100644 --- a/compiler/src/iree/compiler/Codegen/Common/BlockDynamicDimensions.cpp +++ b/compiler/src/iree/compiler/Codegen/Common/BlockDynamicDimensions.cpp
@@ -226,7 +226,6 @@ std::optional<ReshapeOps> reshapes = blockDynamicDimensionsOfValue(rewriter, resultDivisibilityInfo, result); if (reshapes) { - llvm::SmallPtrSet<Operation *, 1> ignoreUses; auto replaceIf = [&](OpOperand &use) { Operation *user = use.getOwner(); if (user == reshapes->expandShapeOp) {
diff --git a/compiler/src/iree/compiler/Codegen/Common/CommonDialectRegistration.cpp b/compiler/src/iree/compiler/Codegen/Common/CommonDialectRegistration.cpp index 8bb62d3..de1fbee 100644 --- a/compiler/src/iree/compiler/Codegen/Common/CommonDialectRegistration.cpp +++ b/compiler/src/iree/compiler/Codegen/Common/CommonDialectRegistration.cpp
@@ -42,7 +42,7 @@ #include "mlir/Dialect/Tensor/IR/Tensor.h" #include "mlir/Dialect/Tensor/TransformOps/TensorTransformOps.h" #include "mlir/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.h" -#include "mlir/Dialect/Tensor/Transforms/SubsetInsertionOpInterfaceImpl.h" +#include "mlir/Dialect/Tensor/Transforms/SubsetOpInterfaceImpl.h" #include "mlir/Dialect/Transform/IR/TransformDialect.h" #include "mlir/Dialect/Transform/LoopExtension/LoopExtension.h" #include "mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h"
diff --git a/compiler/src/iree/compiler/Codegen/Common/GPU/GPUNestedLayoutDistributionPatterns.cpp b/compiler/src/iree/compiler/Codegen/Common/GPU/GPUNestedLayoutDistributionPatterns.cpp index 720fa2e..5b3a2b0 100644 --- a/compiler/src/iree/compiler/Codegen/Common/GPU/GPUNestedLayoutDistributionPatterns.cpp +++ b/compiler/src/iree/compiler/Codegen/Common/GPU/GPUNestedLayoutDistributionPatterns.cpp
@@ -830,7 +830,7 @@ LogicalResult matchAndRewrite(vector::BroadcastOp broadcastOp, DistributionSignature &signature, PatternRewriter &rewriter) const override { - VectorValue dstVector = broadcastOp.getVector(); + VectorValue dstVector = broadcastOp.getResult(); auto vectorLayout = dyn_cast<NestedLayoutAttr>(signature[dstVector]); if (!vectorLayout) { return rewriter.notifyMatchFailure(broadcastOp, @@ -2758,7 +2758,7 @@ // The user init is applied once at the end for exclusive mode. auto localScanOp = vector::ScanOp::create( rewriter, loc, kind, srcChunk, localIdentityInit, elemIdx, inclusive); - Value localScan = localScanOp.getDest(); + Value localScan = localScanOp.getResult(); Value localTotal = localScanOp.getAccumulatedValue(); // For exclusive scan, accumulated_value is the last dest element
diff --git a/compiler/src/iree/compiler/Codegen/Common/GPU/GPUTensorAlloc.cpp b/compiler/src/iree/compiler/Codegen/Common/GPU/GPUTensorAlloc.cpp index 9c3708e..6eaf999 100644 --- a/compiler/src/iree/compiler/Codegen/Common/GPU/GPUTensorAlloc.cpp +++ b/compiler/src/iree/compiler/Codegen/Common/GPU/GPUTensorAlloc.cpp
@@ -123,7 +123,7 @@ rewriter.setInsertionPoint(linalgOp); std::optional<Attribute> memorySpace = allocOp.getMemorySpace(); auto newAllocOp = bufferization::AllocTensorOp::create( - rewriter, allocOp.getLoc(), allocOp.getType(), + rewriter, allocOp.getLoc(), cast<TensorType>(allocOp.getType()), allocOp.getDynamicSizes(), /*copy=*/Value(), memorySpace ? cast<IntegerAttr>(*memorySpace) : IntegerAttr());
diff --git a/compiler/src/iree/compiler/Codegen/Common/Passes.td b/compiler/src/iree/compiler/Codegen/Common/Passes.td index b5be739..d599c56 100644 --- a/compiler/src/iree/compiler/Codegen/Common/Passes.td +++ b/compiler/src/iree/compiler/Codegen/Common/Passes.td
@@ -1146,7 +1146,7 @@ [{Split vector transfers between slow (masked) and fast " "(unmasked) variants. Possible options are:\n" "\tnone [default]: keep unsplit vector.transfer and pay the price\n" - "\tlinalg-copy: use linalg.fill + linalg.generic for the slow path\n" + "\tlinalg-copy: use memref.copy for the slow path\n" "\tvector-transfers: use extra small unmasked vector.transfers for" " the slow path\n}]>, ];
diff --git a/compiler/src/iree/compiler/Codegen/Common/SplitFullPartialTransfer.cpp b/compiler/src/iree/compiler/Codegen/Common/SplitFullPartialTransfer.cpp index 56ef4a3..a37f4be 100644 --- a/compiler/src/iree/compiler/Codegen/Common/SplitFullPartialTransfer.cpp +++ b/compiler/src/iree/compiler/Codegen/Common/SplitFullPartialTransfer.cpp
@@ -32,7 +32,7 @@ llvm::StringSwitch<vector::VectorTransferSplit>( splitVectorTransfersTo.getValue()) .Case("none", vector::VectorTransferSplit::None) - .Case("linalg-copy", vector::VectorTransferSplit::LinalgCopy) + .Case("linalg-copy", vector::VectorTransferSplit::MemRefCopy) .Case("vector-transfers", vector::VectorTransferSplit::VectorTransfer) .Default(vector::VectorTransferSplit::None));
diff --git a/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/BUILD.bazel b/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/BUILD.bazel index 6601bda..c0c7007 100644 --- a/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/BUILD.bazel +++ b/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/BUILD.bazel
@@ -107,6 +107,7 @@ "@llvm-project//mlir:Transforms", "@llvm-project//mlir:VectorDialect", "@llvm-project//mlir:VectorToGPU", + "@llvm-project//mlir:VectorToNVGPU", "@llvm-project//mlir:VectorTransforms", ], )
diff --git a/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CMakeLists.txt b/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CMakeLists.txt index a98181a..9cf25b4 100644 --- a/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CMakeLists.txt +++ b/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CMakeLists.txt
@@ -62,6 +62,7 @@ MLIRTransforms MLIRVectorDialect MLIRVectorToGPU + MLIRVectorToNVGPU MLIRVectorTransforms iree::compiler::Codegen::Common iree::compiler::Codegen::Common::GPU::CommonGPUPasses
diff --git a/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp b/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp index bb0eb1e..90e8e8f 100644 --- a/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp +++ b/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp
@@ -29,6 +29,7 @@ #include "mlir/Analysis/SliceAnalysis.h" #include "mlir/Analysis/TopologicalSortUtils.h" #include "mlir/Conversion/VectorToGPU/VectorToGPU.h" +#include "mlir/Conversion/VectorToNVGPU/VectorToNVGPU.h" #include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/Affine/LoopUtils.h" #include "mlir/Dialect/Arith/IR/Arith.h" @@ -227,7 +228,11 @@ void transform_dialect::ApplyPrepareVectorToMMAPatternsOp::populatePatterns( RewritePatternSet &patterns) { - populatePrepareVectorToMMAPatterns(patterns, getUseNvGpu()); + if (getUseNvGpu()) { + populatePrepareVectorToNVMMAPatterns(patterns); + } else { + populatePrepareVectorToMMAPatterns(patterns); + } } //===----------------------------------------------------------------------===//
diff --git a/compiler/src/iree/compiler/Codegen/Common/VectorLayoutAnalysis.cpp b/compiler/src/iree/compiler/Codegen/Common/VectorLayoutAnalysis.cpp index 4ee8ba6..f1b180f 100644 --- a/compiler/src/iree/compiler/Codegen/Common/VectorLayoutAnalysis.cpp +++ b/compiler/src/iree/compiler/Codegen/Common/VectorLayoutAnalysis.cpp
@@ -230,7 +230,7 @@ if (auto scanOp = dyn_cast<vector::ScanOp>(user)) { if (scanOp.getSource() == val) { // source to dest: same layout (shape preserved). - addCandidate(scanOp.getDest(), layout); + addCandidate(scanOp.getResult(), layout); // source to accumulated_value: project out scan dim. int64_t rank = cast<VectorType>(val.getType()).getRank(); SmallVector<bool> projMask(rank, false); @@ -411,7 +411,7 @@ // scan: dest layout -> source gets same layout, init gets projected layout. if (auto scanOp = dyn_cast<vector::ScanOp>(op)) { - VectorLayoutInterface layout = getResolvedLayout(scanOp.getDest()); + VectorLayoutInterface layout = getResolvedLayout(scanOp.getResult()); if (layout) { setLayoutOrClone(&scanOp.getSourceMutable(), layout); int64_t rank = scanOp.getSourceType().getRank();
diff --git a/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUAttrs.cpp b/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUAttrs.cpp index d92c69b..4d7f91e 100644 --- a/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUAttrs.cpp +++ b/compiler/src/iree/compiler/Codegen/Dialect/GPU/IR/IREEGPUAttrs.cpp
@@ -1243,15 +1243,15 @@ amdgpu::WMMAOp::create(builder, loc, hwVecTy, layout.mSize, layout.nSize, layout.kSize, lhs, rhs, hwAcc) .getResult(); - Value result = - IREE::Util::HoistableConversionOp::create( - builder, loc, /*tag=*/kRdna3DeinterleaveAcc, - /*inverseTag=*/kRdna3InterleaveAcc, hwResult, - [](OpBuilder &b, Location loc, ValueRange args) { - return SmallVector<Value>{ - vector::DeinterleaveOp::create(b, loc, args[0]).getRes1()}; - }) - .getResult(0); + Value result = IREE::Util::HoistableConversionOp::create( + builder, loc, /*tag=*/kRdna3DeinterleaveAcc, + /*inverseTag=*/kRdna3InterleaveAcc, hwResult, + [](OpBuilder &b, Location loc, ValueRange args) { + return SmallVector<Value>{ + vector::DeinterleaveOp::create(b, loc, args[0]) + .getResultEven()}; + }) + .getResult(0); return result; } return amdgpu::WMMAOp::create(builder, loc, resultType, layout.mSize, @@ -2087,8 +2087,8 @@ [elementType](OpBuilder &builder, Location loc, ValueRange args) { auto deinterleave = vector::DeinterleaveOp::create(builder, loc, args[0]); - Value evens = deinterleave.getRes1(); - Value odds = deinterleave.getRes2(); + Value evens = deinterleave.getResultEven(); + Value odds = deinterleave.getResultOdd(); if (isa<FloatType>(elementType)) { return SmallVector<Value>{ arith::AddFOp::create(builder, loc, evens, odds)};
diff --git a/compiler/src/iree/compiler/Codegen/Dialect/Map/Transforms/MapDistributeGenericOps.cpp b/compiler/src/iree/compiler/Codegen/Dialect/Map/Transforms/MapDistributeGenericOps.cpp index 53ea581..bdc2119 100644 --- a/compiler/src/iree/compiler/Codegen/Dialect/Map/Transforms/MapDistributeGenericOps.cpp +++ b/compiler/src/iree/compiler/Codegen/Dialect/Map/Transforms/MapDistributeGenericOps.cpp
@@ -65,7 +65,7 @@ LogicalResult matchAndRewrite(vector::BroadcastOp broadcastOp, DistributionSignature &signature, PatternRewriter &rewriter) const override { - auto dst = cast<VectorValue>(broadcastOp.getVector()); + auto dst = cast<VectorValue>(broadcastOp.getResult()); auto dstLayout = dyn_cast<PackLayoutAttr>(signature[dst]); if (!dstLayout) { return rewriter.notifyMatchFailure(broadcastOp, "not a PackLayout");
diff --git a/compiler/src/iree/compiler/Codegen/Interfaces/Interfaces.cpp b/compiler/src/iree/compiler/Codegen/Interfaces/Interfaces.cpp index 69483e8..9860a07 100644 --- a/compiler/src/iree/compiler/Codegen/Interfaces/Interfaces.cpp +++ b/compiler/src/iree/compiler/Codegen/Interfaces/Interfaces.cpp
@@ -32,7 +32,7 @@ #include "mlir/Dialect/Linalg/IR/ValueBoundsOpInterfaceImpl.h" #include "mlir/Dialect/Linalg/TransformOps/DialectExtension.h" #include "mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.h" -#include "mlir/Dialect/Linalg/Transforms/SubsetInsertionOpInterfaceImpl.h" +#include "mlir/Dialect/Linalg/Transforms/SubsetOpInterfaceImpl.h" #include "mlir/Dialect/Linalg/Transforms/TilingInterfaceImpl.h" #include "mlir/Dialect/MemRef/IR/ValueBoundsOpInterfaceImpl.h" #include "mlir/Dialect/MemRef/TransformOps/MemRefTransformOps.h" @@ -40,7 +40,7 @@ #include "mlir/Dialect/SCF/TransformOps/SCFTransformOps.h" #include "mlir/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.h" #include "mlir/Dialect/Tensor/TransformOps/TensorTransformOps.h" -#include "mlir/Dialect/Tensor/Transforms/SubsetInsertionOpInterfaceImpl.h" +#include "mlir/Dialect/Tensor/Transforms/SubsetOpInterfaceImpl.h" #include "mlir/Dialect/Transform/LoopExtension/LoopExtension.h" #include "mlir/Dialect/Vector/IR/ValueBoundsOpInterfaceImpl.h" #include "mlir/Dialect/Vector/TransformOps/VectorTransformOps.h"
diff --git a/compiler/src/iree/compiler/Codegen/Interfaces/VectorizableOpInterface.cpp b/compiler/src/iree/compiler/Codegen/Interfaces/VectorizableOpInterface.cpp index ac79fbb..05c597a 100644 --- a/compiler/src/iree/compiler/Codegen/Interfaces/VectorizableOpInterface.cpp +++ b/compiler/src/iree/compiler/Codegen/Interfaces/VectorizableOpInterface.cpp
@@ -1589,7 +1589,7 @@ // Write results back to tensors. Value output = vector::createWriteOrMaskedWrite( - rewriter, loc, vectorScanOp.getDest(), + rewriter, loc, vectorScanOp.getResult(), scanOp.getOutput(), inputIndices, /*useInBoundsInsteadOfMasking=*/!needsInputMasking) ->getResult(0);
diff --git a/compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPUVirtualVectorLowering.cpp b/compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPUVirtualVectorLowering.cpp index 05140f1..4a77b23 100644 --- a/compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPUVirtualVectorLowering.cpp +++ b/compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPUVirtualVectorLowering.cpp
@@ -170,7 +170,7 @@ llvm::StringSwitch<vector::VectorTransferSplit>( splitVectorTransfersTo.getValue()) .Case("none", vector::VectorTransferSplit::None) - .Case("linalg-copy", vector::VectorTransferSplit::LinalgCopy) + .Case("linalg-copy", vector::VectorTransferSplit::MemRefCopy) .Case("vector-transfers", vector::VectorTransferSplit::VectorTransfer) .Default(vector::VectorTransferSplit::None);
diff --git a/compiler/src/iree/compiler/Codegen/LLVMCPU/Passes.td b/compiler/src/iree/compiler/Codegen/LLVMCPU/Passes.td index 5d291e1..5e416d0 100644 --- a/compiler/src/iree/compiler/Codegen/LLVMCPU/Passes.td +++ b/compiler/src/iree/compiler/Codegen/LLVMCPU/Passes.td
@@ -281,7 +281,7 @@ [{Split vector transfers between slow (masked) and fast " "(unmasked) variants. Possible options are:\n" "\tnone [default]: keep unsplit vector.transfer and pay the price\n" - "\tlinalg-copy: use linalg.fill + linalg.generic for the slow path\n" + "\tlinalg-copy: use memref.copy for the slow path\n" "\tvector-transfers: use extra small unmasked vector.transfers for" " the slow path\n}]>, Option<"enableArmI8mm", "enable-arm-i8mm", "bool",
diff --git a/compiler/src/iree/compiler/Codegen/LLVMCPU/test/vector_lowering.mlir b/compiler/src/iree/compiler/Codegen/LLVMCPU/test/vector_lowering.mlir index 4cbe62f..88582f2 100644 --- a/compiler/src/iree/compiler/Codegen/LLVMCPU/test/vector_lowering.mlir +++ b/compiler/src/iree/compiler/Codegen/LLVMCPU/test/vector_lowering.mlir
@@ -61,7 +61,8 @@ // CHECK: scf.if // CHECK: scf.yield %{{.*}} // CHECK: } else { -// CHECK: linalg.fill +// CHECK: %[[CAST:.+]] = vector.type_cast +// CHECK: memref.store %{{.*}}, %[[CAST]][] // CHECK: memref.copy // CHECK: scf.yield %{{.*}} // CHECK: }
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/BUILD.bazel b/compiler/src/iree/compiler/Codegen/LLVMGPU/BUILD.bazel index ecfcd94..f7f3821 100644 --- a/compiler/src/iree/compiler/Codegen/LLVMGPU/BUILD.bazel +++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/BUILD.bazel
@@ -265,6 +265,7 @@ "@llvm-project//mlir:VectorDialect", "@llvm-project//mlir:VectorToGPU", "@llvm-project//mlir:VectorToLLVM", + "@llvm-project//mlir:VectorToNVGPU", "@llvm-project//mlir:VectorToSCF", "@llvm-project//mlir:VectorTransforms", "@llvm-project//mlir:VectorUtils",
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/CMakeLists.txt b/compiler/src/iree/compiler/Codegen/LLVMGPU/CMakeLists.txt index be4c866..07a12d3 100644 --- a/compiler/src/iree/compiler/Codegen/LLVMGPU/CMakeLists.txt +++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/CMakeLists.txt
@@ -200,6 +200,7 @@ MLIRVectorDialect MLIRVectorToGPU MLIRVectorToLLVM + MLIRVectorToNVGPU MLIRVectorToSCF MLIRVectorTransforms MLIRVectorUtils
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/LLVMGPULegalizeNDVectors.cpp b/compiler/src/iree/compiler/Codegen/LLVMGPU/LLVMGPULegalizeNDVectors.cpp index c1f725e..1ef9e36 100644 --- a/compiler/src/iree/compiler/Codegen/LLVMGPU/LLVMGPULegalizeNDVectors.cpp +++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/LLVMGPULegalizeNDVectors.cpp
@@ -643,7 +643,7 @@ LogicalResult matchAndRewrite(vector::FromElementsOp op, OneToNOpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { - VectorType resultType = op.getDest().getType(); + VectorType resultType = op.getResult().getType(); if (resultType.getRank() <= 1) { return failure(); } @@ -839,8 +839,8 @@ SmallVector<Value> res2Values; for (Value src : srcValues) { auto deinterleave = vector::DeinterleaveOp::create(rewriter, loc, src); - res1Values.push_back(deinterleave.getRes1()); - res2Values.push_back(deinterleave.getRes2()); + res1Values.push_back(deinterleave.getResultEven()); + res2Values.push_back(deinterleave.getResultOdd()); } rewriter.replaceOpWithMultiple(op, {res1Values, res2Values}); return success();
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/LLVMGPUTensorCoreVectorization.cpp b/compiler/src/iree/compiler/Codegen/LLVMGPU/LLVMGPUTensorCoreVectorization.cpp index 8bc2e2b..1d707be 100644 --- a/compiler/src/iree/compiler/Codegen/LLVMGPU/LLVMGPUTensorCoreVectorization.cpp +++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/LLVMGPUTensorCoreVectorization.cpp
@@ -13,6 +13,7 @@ #include "iree/compiler/Dialect/LinalgExt/Transforms/Passes.h" #include "llvm/Support/Debug.h" #include "mlir/Conversion/VectorToGPU/VectorToGPU.h" +#include "mlir/Conversion/VectorToNVGPU/VectorToNVGPU.h" #include "mlir/Dialect/Linalg/Transforms/Transforms.h" #include "mlir/Dialect/NVGPU/Utils/MMAUtils.h" #include "mlir/Dialect/Vector/IR/VectorOps.h" @@ -145,8 +146,7 @@ RewritePatternSet vectorContractPatterns(funcOp.getContext()); mlir::vector::populateCastAwayVectorLeadingOneDimPatterns( vectorContractPatterns); - mlir::populatePrepareVectorToMMAPatterns(vectorContractPatterns, - /*useMMASync=*/true); + mlir::populatePrepareVectorToNVMMAPatterns(vectorContractPatterns); if (failed(applyPatternsGreedily(getOperation(), std::move(vectorContractPatterns)))) { return signalPassFailure();
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/LLVMGPUVectorToGPU.cpp b/compiler/src/iree/compiler/Codegen/LLVMGPU/LLVMGPUVectorToGPU.cpp index cb099bf..63571cd 100644 --- a/compiler/src/iree/compiler/Codegen/LLVMGPU/LLVMGPUVectorToGPU.cpp +++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/LLVMGPUVectorToGPU.cpp
@@ -9,6 +9,7 @@ #include "iree/compiler/Codegen/LLVMGPU/Utils/LLVMGPUUtils.h" #include "iree/compiler/Codegen/Utils/GPUUtils.h" #include "mlir/Conversion/VectorToGPU/VectorToGPU.h" +#include "mlir/Conversion/VectorToNVGPU/VectorToNVGPU.h" #include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/Arith/IR/Arith.h" #include "mlir/Dialect/GPU/IR/GPUDialect.h" @@ -62,7 +63,11 @@ RewritePatternSet patterns(funcOp.getContext()); mlir::vector::populateCastAwayVectorLeadingOneDimPatterns(patterns); - populatePrepareVectorToMMAPatterns(patterns, targetMmaSync); + if (targetMmaSync) { + populatePrepareVectorToNVMMAPatterns(patterns); + } else { + populatePrepareVectorToMMAPatterns(patterns); + } if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) { return signalPassFailure(); }
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/TransformExtensions/BUILD.bazel b/compiler/src/iree/compiler/Codegen/LLVMGPU/TransformExtensions/BUILD.bazel index 3ee6e78..3273348 100644 --- a/compiler/src/iree/compiler/Codegen/LLVMGPU/TransformExtensions/BUILD.bazel +++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/TransformExtensions/BUILD.bazel
@@ -96,6 +96,7 @@ "@llvm-project//mlir:Transforms", "@llvm-project//mlir:VectorDialect", "@llvm-project//mlir:VectorToGPU", + "@llvm-project//mlir:VectorToNVGPU", "@llvm-project//mlir:VectorTransforms", "@llvm-project//mlir:ViewLikeInterface", ],
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/TransformExtensions/CMakeLists.txt b/compiler/src/iree/compiler/Codegen/LLVMGPU/TransformExtensions/CMakeLists.txt index a98db38..596f80b 100644 --- a/compiler/src/iree/compiler/Codegen/LLVMGPU/TransformExtensions/CMakeLists.txt +++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/TransformExtensions/CMakeLists.txt
@@ -59,6 +59,7 @@ MLIRTransforms MLIRVectorDialect MLIRVectorToGPU + MLIRVectorToNVGPU MLIRVectorTransforms MLIRViewLikeInterface iree::compiler::Codegen::Common
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/TransformExtensions/LLVMGPUExtensions.cpp b/compiler/src/iree/compiler/Codegen/LLVMGPU/TransformExtensions/LLVMGPUExtensions.cpp index 0438713..820ee3d 100644 --- a/compiler/src/iree/compiler/Codegen/LLVMGPU/TransformExtensions/LLVMGPUExtensions.cpp +++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/TransformExtensions/LLVMGPUExtensions.cpp
@@ -19,6 +19,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Debug.h" #include "mlir/Conversion/VectorToGPU/VectorToGPU.h" +#include "mlir/Conversion/VectorToNVGPU/VectorToNVGPU.h" #include "mlir/Dialect/AMDGPU/IR/AMDGPUDialect.h" #include "mlir/Dialect/Arith/IR/Arith.h" #include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h" @@ -688,7 +689,11 @@ // ops. Convert slice of contract operations to mma_sync/wmma ops. RewritePatternSet patterns(ctx); mlir::vector::populateCastAwayVectorLeadingOneDimPatterns(patterns); - populatePrepareVectorToMMAPatterns(patterns, getUseMmaSync()); + if (getUseMmaSync()) { + populatePrepareVectorToNVMMAPatterns(patterns); + } else { + populatePrepareVectorToMMAPatterns(patterns); + } if (failed(applyPatternsGreedily(target, std::move(patterns), config))) { target->emitOpError("vector to mma preparation patterns failed to apply"); return emitDefaultDefiniteFailure(target);
diff --git a/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVInitialVectorLowering.cpp b/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVInitialVectorLowering.cpp index 54d9868..3188301 100644 --- a/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVInitialVectorLowering.cpp +++ b/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVInitialVectorLowering.cpp
@@ -106,7 +106,7 @@ while (Operation *parentOp = op.getDefiningOp()) { Value source = TypeSwitch<Operation *, Value>(parentOp) .Case([](vector::BroadcastOp broadcast) { - return broadcast.getVector(); + return broadcast.getResult(); }) .Case<vector::ExtractOp, vector::ExtractStridedSliceOp, vector::ShapeCastOp>(
diff --git a/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVTileAndVectorizeToCooperativeOps.cpp b/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVTileAndVectorizeToCooperativeOps.cpp index a4987d5..932dc28 100644 --- a/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVTileAndVectorizeToCooperativeOps.cpp +++ b/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVTileAndVectorizeToCooperativeOps.cpp
@@ -434,8 +434,7 @@ RewritePatternSet patterns(context); vector::ContractionOp::getCanonicalizationPatterns(patterns, context); populateCombineVectorTransferReadBroadcastPatterns(patterns); - populatePrepareVectorToMMAPatterns(patterns, - /*useNvGPU=*/false); + populatePrepareVectorToMMAPatterns(patterns); if (failed(applyPatternsGreedily(funcOp, std::move(patterns)))) { return signalPassFailure(); }
diff --git a/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVVectorToGPUSubgroupMMAOps.cpp b/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVVectorToGPUSubgroupMMAOps.cpp index a6ccaad..17ba569 100644 --- a/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVVectorToGPUSubgroupMMAOps.cpp +++ b/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVVectorToGPUSubgroupMMAOps.cpp
@@ -38,7 +38,7 @@ RewritePatternSet patterns(funcOp.getContext()); mlir::vector::populateCastAwayVectorLeadingOneDimPatterns(patterns); - populatePrepareVectorToMMAPatterns(patterns, /*useNvGpu=*/false); + populatePrepareVectorToMMAPatterns(patterns); if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) { return signalPassFailure(); }
diff --git a/compiler/src/iree/compiler/Dialect/HAL/IR/BUILD.bazel b/compiler/src/iree/compiler/Dialect/HAL/IR/BUILD.bazel index b5a041d..69435de 100644 --- a/compiler/src/iree/compiler/Dialect/HAL/IR/BUILD.bazel +++ b/compiler/src/iree/compiler/Dialect/HAL/IR/BUILD.bazel
@@ -83,6 +83,7 @@ "@llvm-project//llvm:Support", "@llvm-project//mlir:ArithDialect", "@llvm-project//mlir:ControlFlowDialect", + "@llvm-project//mlir:ControlFlowInterfaces", "@llvm-project//mlir:FuncDialect", "@llvm-project//mlir:FunctionInterfaces", "@llvm-project//mlir:IR",
diff --git a/compiler/src/iree/compiler/Dialect/HAL/IR/CMakeLists.txt b/compiler/src/iree/compiler/Dialect/HAL/IR/CMakeLists.txt index 801893e..b934082 100644 --- a/compiler/src/iree/compiler/Dialect/HAL/IR/CMakeLists.txt +++ b/compiler/src/iree/compiler/Dialect/HAL/IR/CMakeLists.txt
@@ -43,6 +43,7 @@ LLVMSupport MLIRArithDialect MLIRControlFlowDialect + MLIRControlFlowInterfaces MLIRFuncDialect MLIRFunctionInterfaces MLIRIR
diff --git a/compiler/src/iree/compiler/Dialect/LinalgExt/IR/BUILD.bazel b/compiler/src/iree/compiler/Dialect/LinalgExt/IR/BUILD.bazel index 9480824..1c3133a 100644 --- a/compiler/src/iree/compiler/Dialect/LinalgExt/IR/BUILD.bazel +++ b/compiler/src/iree/compiler/Dialect/LinalgExt/IR/BUILD.bazel
@@ -92,6 +92,7 @@ "@llvm-project//mlir:FuncDialect", "@llvm-project//mlir:FunctionInterfaces", "@llvm-project//mlir:IR", + "@llvm-project//mlir:IndexingMapOpInterface", "@llvm-project//mlir:InferTypeOpInterface", "@llvm-project//mlir:InliningUtils", "@llvm-project//mlir:LinalgDialect",
diff --git a/compiler/src/iree/compiler/Dialect/LinalgExt/IR/CMakeLists.txt b/compiler/src/iree/compiler/Dialect/LinalgExt/IR/CMakeLists.txt index 2621f05..97b4145 100644 --- a/compiler/src/iree/compiler/Dialect/LinalgExt/IR/CMakeLists.txt +++ b/compiler/src/iree/compiler/Dialect/LinalgExt/IR/CMakeLists.txt
@@ -54,6 +54,7 @@ MLIRFuncDialect MLIRFunctionInterfaces MLIRIR + MLIRIndexingMapOpInterface MLIRInferTypeOpInterface MLIRLinalgDialect MLIRLinalgStructuredOpsIncGenLib
diff --git a/compiler/src/iree/compiler/Dialect/LinalgExt/Transforms/DecomposeWinograd.cpp b/compiler/src/iree/compiler/Dialect/LinalgExt/Transforms/DecomposeWinograd.cpp index 521b544..a897257 100644 --- a/compiler/src/iree/compiler/Dialect/LinalgExt/Transforms/DecomposeWinograd.cpp +++ b/compiler/src/iree/compiler/Dialect/LinalgExt/Transforms/DecomposeWinograd.cpp
@@ -124,8 +124,6 @@ const int64_t inputTileSize = transformOp.getInputTileSize(); const int64_t kernelSize = transformOp.getKernelSize(); ArrayRef<int64_t> kernelDims = transformOp.getKernelDimensions(); - llvm::SmallSetVector<int64_t, 2> kernelDimsSet(kernelDims.begin(), - kernelDims.end()); Type elementType = transformOp.getOutputType().getElementType(); Value zeroF32 = arith::ConstantOp::create( rewriter, loc, rewriter.getZeroAttr(elementType));
diff --git a/compiler/src/iree/compiler/Dialect/LinalgExt/Utils/Utils.cpp b/compiler/src/iree/compiler/Dialect/LinalgExt/Utils/Utils.cpp index f7e415b..b17ba85 100644 --- a/compiler/src/iree/compiler/Dialect/LinalgExt/Utils/Utils.cpp +++ b/compiler/src/iree/compiler/Dialect/LinalgExt/Utils/Utils.cpp
@@ -1236,8 +1236,6 @@ return false; } - llvm::SetVector<BlockArgument> rhsArgs; - llvm::SetVector<BlockArgument> outArgs; for (auto [index, yieldedVal] : llvm::enumerate(linalgOp.getBlock()->getTerminator()->getOperands())) { std::optional<ContractionOpSequenceArgs> args =
diff --git a/compiler/src/iree/compiler/Dialect/Stream/IR/BUILD.bazel b/compiler/src/iree/compiler/Dialect/Stream/IR/BUILD.bazel index 33c213a..b8ee3e3 100644 --- a/compiler/src/iree/compiler/Dialect/Stream/IR/BUILD.bazel +++ b/compiler/src/iree/compiler/Dialect/Stream/IR/BUILD.bazel
@@ -76,6 +76,7 @@ "@llvm-project//mlir:ArithDialect", "@llvm-project//mlir:ArithUtils", "@llvm-project//mlir:ComplexDialect", + "@llvm-project//mlir:ControlFlowInterfaces", "@llvm-project//mlir:FuncDialect", "@llvm-project//mlir:FunctionInterfaces", "@llvm-project//mlir:IR",
diff --git a/compiler/src/iree/compiler/Dialect/Stream/IR/CMakeLists.txt b/compiler/src/iree/compiler/Dialect/Stream/IR/CMakeLists.txt index b378213..0c7804d 100644 --- a/compiler/src/iree/compiler/Dialect/Stream/IR/CMakeLists.txt +++ b/compiler/src/iree/compiler/Dialect/Stream/IR/CMakeLists.txt
@@ -43,6 +43,7 @@ MLIRArithDialect MLIRArithUtils MLIRComplexDialect + MLIRControlFlowInterfaces MLIRFuncDialect MLIRFunctionInterfaces MLIRIR
diff --git a/compiler/src/iree/compiler/Dialect/TensorExt/IR/BUILD.bazel b/compiler/src/iree/compiler/Dialect/TensorExt/IR/BUILD.bazel index a278378..086a130 100644 --- a/compiler/src/iree/compiler/Dialect/TensorExt/IR/BUILD.bazel +++ b/compiler/src/iree/compiler/Dialect/TensorExt/IR/BUILD.bazel
@@ -83,6 +83,7 @@ "@llvm-project//mlir:SCFDialect", "@llvm-project//mlir:Support", "@llvm-project//mlir:TensorDialect", + "@llvm-project//mlir:ViewLikeInterface", ], )
diff --git a/compiler/src/iree/compiler/Dialect/TensorExt/IR/CMakeLists.txt b/compiler/src/iree/compiler/Dialect/TensorExt/IR/CMakeLists.txt index c841099..f79dbab 100644 --- a/compiler/src/iree/compiler/Dialect/TensorExt/IR/CMakeLists.txt +++ b/compiler/src/iree/compiler/Dialect/TensorExt/IR/CMakeLists.txt
@@ -54,6 +54,7 @@ MLIRSCFDialect MLIRSupport MLIRTensorDialect + MLIRViewLikeInterface iree::compiler::Dialect::Util::IR iree::compiler::Utils PUBLIC
diff --git a/compiler/src/iree/compiler/Dialect/Util/Analysis/IntegerDivisibilityAnalysis.cpp b/compiler/src/iree/compiler/Dialect/Util/Analysis/IntegerDivisibilityAnalysis.cpp index 9151832..e5f07fa 100644 --- a/compiler/src/iree/compiler/Dialect/Util/Analysis/IntegerDivisibilityAnalysis.cpp +++ b/compiler/src/iree/compiler/Dialect/Util/Analysis/IntegerDivisibilityAnalysis.cpp
@@ -71,17 +71,17 @@ void IntegerDivisibilityAnalysis::visitNonControlFlowArguments( Operation *op, const RegionSuccessor &successor, ValueRange successorInputs, - ArrayRef<IntegerDivisibilityLattice *> argLattices) { + ArrayRef<IntegerDivisibilityLattice *> argLattices, + GetLatticeFn getLattice) { // Get the constant divisibility, or query the lattice for Values. - auto getDivFromOfr = [&](std::optional<OpFoldResult> ofr, Block *block, + auto getDivFromOfr = [&](std::optional<OpFoldResult> ofr, bool isUnsigned) -> uint64_t { if (ofr.has_value()) { if (auto constBound = getConstantIntValue(*ofr)) { return constBound.value(); } auto value = cast<Value>(ofr.value()); - const IntegerDivisibilityLattice *lattice = - getLatticeElementFor(getProgramPointBefore(block), value); + const IntegerDivisibilityLattice *lattice = getLattice(value); if (lattice != nullptr && !lattice->getValue().isUninitialized()) { return isUnsigned ? lattice->getValue().getValue().udiv() : lattice->getValue().getValue().sdiv(); @@ -99,15 +99,14 @@ std::optional<SmallVector<OpFoldResult>> steps = loop.getLoopSteps(); if (!ivs || !lbs || !steps) { return SparseForwardDataFlowAnalysis::visitNonControlFlowArguments( - op, successor, successorInputs, argLattices); + op, successor, successorInputs, argLattices, getLattice); } for (auto [iv, lb, step] : llvm::zip_equal(*ivs, *lbs, *steps)) { IntegerDivisibilityLattice *ivEntry = getLatticeElement(iv); - Block *block = iv.getParentBlock(); - uint64_t stepUDiv = getDivFromOfr(step, block, /*unsigned=*/true); - uint64_t stepSDiv = getDivFromOfr(step, block, /*unsigned=*/false); - uint64_t lbUDiv = getDivFromOfr(lb, block, /*unsigned=*/true); - uint64_t lbSDiv = getDivFromOfr(lb, block, /*unsigned=*/false); + uint64_t stepUDiv = getDivFromOfr(step, /*unsigned=*/true); + uint64_t stepSDiv = getDivFromOfr(step, /*unsigned=*/false); + uint64_t lbUDiv = getDivFromOfr(lb, /*unsigned=*/true); + uint64_t lbSDiv = getDivFromOfr(lb, /*unsigned=*/false); ConstantIntDivisibility lbDiv(lbUDiv, lbSDiv); ConstantIntDivisibility stepDiv(stepUDiv, stepSDiv); @@ -122,7 +121,7 @@ } return SparseForwardDataFlowAnalysis::visitNonControlFlowArguments( - op, successor, successorInputs, argLattices); + op, successor, successorInputs, argLattices, getLattice); } } // namespace mlir::iree_compiler::IREE::Util
diff --git a/compiler/src/iree/compiler/Dialect/Util/Analysis/IntegerDivisibilityAnalysis.h b/compiler/src/iree/compiler/Dialect/Util/Analysis/IntegerDivisibilityAnalysis.h index f2bca23..c05b0f2 100644 --- a/compiler/src/iree/compiler/Dialect/Util/Analysis/IntegerDivisibilityAnalysis.h +++ b/compiler/src/iree/compiler/Dialect/Util/Analysis/IntegerDivisibilityAnalysis.h
@@ -43,7 +43,8 @@ void visitNonControlFlowArguments( Operation *op, const RegionSuccessor &successor, ValueRange successorInputs, - ArrayRef<IntegerDivisibilityLattice *> argLattices) override; + ArrayRef<IntegerDivisibilityLattice *> argLattices, + GetLatticeFn getLattice) override; }; } // namespace mlir::iree_compiler::IREE::Util
diff --git a/third_party/llvm-project b/third_party/llvm-project index 333b4ad..a7dcddc 160000 --- a/third_party/llvm-project +++ b/third_party/llvm-project
@@ -1 +1 @@ -Subproject commit 333b4ad05124f11ccb76d5ed377dde70d9238405 +Subproject commit a7dcddcdd7fe0d6bed9f79e0090ac6438b05f794
diff --git a/third_party/stablehlo b/third_party/stablehlo index c2eaf28..57f1d92 160000 --- a/third_party/stablehlo +++ b/third_party/stablehlo
@@ -1 +1 @@ -Subproject commit c2eaf28a5f5b6728c97414a8a09168d3e75943c9 +Subproject commit 57f1d925d4ea258fa882c37d02e0124c5d57a5b9