Skip to content

Commit 94b8804

Browse files
Groverkssgiacs-epic
authored andcommitted
Integrate LLVM at 2f925d75dee8b4012d747d889ac4bb1d8a31d5a0 (iree-org#19184)
Still carrying a revert for 1004865f1ca41a9581da8747f34b29862d3ebc3d Dropped the reverts on 3ad0148020ca91cc288bffd8ad36e25f7555a3bb and c02b8a01b7caf2e4ffe17a123f1bcf59192e4b39 after fixes upstream. Also carries a cherry pick for llvm/llvm-project#116650 Signed-off-by: Giacomo Serafini <[email protected]>
1 parent 737fcf5 commit 94b8804

File tree

6 files changed

+14
-16
lines changed

6 files changed

+14
-16
lines changed

compiler/src/iree/compiler/Codegen/Common/GPU/VectorReductionToGPU.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,12 @@ moveScalarAndBindingUniformCode(vector::WarpExecuteOnLane0Op warpOp) {
139139
op->moveBefore(warpOp);
140140
}
141141

142-
/// Pattern to convert InsertElement to broadcast, this is a workaround until
143-
/// MultiDimReduction distribution is supported.
144-
struct InsertElementToBroadcast final
145-
: OpRewritePattern<vector::InsertElementOp> {
146-
using OpRewritePattern<vector::InsertElementOp>::OpRewritePattern;
142+
/// Pattern to convert single element vector.insert to broadcast, this is a
143+
/// workaround until MultiDimReduction distribution is supported.
144+
struct InsertToBroadcast final : OpRewritePattern<vector::InsertOp> {
145+
using OpRewritePattern::OpRewritePattern;
147146

148-
LogicalResult matchAndRewrite(vector::InsertElementOp insertOp,
147+
LogicalResult matchAndRewrite(vector::InsertOp insertOp,
149148
PatternRewriter &rewriter) const override {
150149
if (insertOp.getDestVectorType().getNumElements() != 1)
151150
return failure();
@@ -209,7 +208,7 @@ struct VectorReductionToGPUPass final
209208
vector::populateVectorMultiReductionLoweringPatterns(
210209
patterns, vector::VectorMultiReductionLowering::InnerReduction);
211210
// Add clean up patterns after lowering of multidimreduce lowering.
212-
patterns.add<InsertElementToBroadcast>(ctx);
211+
patterns.add<InsertToBroadcast>(ctx);
213212
vector::ShapeCastOp::getCanonicalizationPatterns(patterns, ctx);
214213
vector::BroadcastOp::getCanonicalizationPatterns(patterns, ctx);
215214
vector::ExtractOp::getCanonicalizationPatterns(patterns, ctx);

compiler/src/iree/compiler/Codegen/Common/GPU/test/vector_reduction_to_gpu.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module {
4444
// CHECK-DAG: %[[TID:.*]] = gpu.thread_id x
4545
// CHECK-DAG: %[[VCST:.*]] = arith.constant dense<0.000000e+00> : vector<1xf32>
4646
// CHECK: %[[F:.*]] = scf.for %{{.*}} = %{{.*}} to %{{.*}} step %{{.*}} iter_args(%[[V0:.*]] = %[[VCST]]) -> (vector<1xf32>) {
47-
// CHECK-DAG: %[[E:.*]] = vector.extractelement %[[V0]][%[[C0]] : index] : vector<1xf32>
47+
// CHECK-DAG: %[[E:.*]] = vector.extract %[[V0]][0] : f32 from vector<1xf32>
4848
// CHECK-DAG: %[[ID:.*]] = affine.apply
4949
// CHECK-DAG: %[[V1:.*]] = vector.transfer_read %{{.*}}[%{{.*}}, %[[ID]]], %{{.*}} {in_bounds = [true]} : memref<128x384xf32>, vector<1xf32>
5050
// CHECK: %[[S:.*]] = vector.extract %[[V1]][0] : f32 from vector<1xf32>

compiler/src/iree/compiler/Codegen/Common/test/decompose_pack_unpack_ops.mlir

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ func.func @simple_KCRS_to_KCRSsr(%arg0: tensor<1x1x32x8xf32>, %arg1: tensor<1x1x
1212
// CHECK-RESHAPE: %[[EXPANDED:.+]] = tensor.expand_shape %[[IN]] {{\[}}[0], [1], [2, 3], [4, 5]] output_shape [1, 1, 1, 32, 1, 8] : tensor<1x1x32x8xf32> into tensor<1x1x1x32x1x8xf32>
1313
// CHECK-RESHAPE: %[[RESULT:.+]] = linalg.transpose ins(%[[EXPANDED]] : tensor<1x1x1x32x1x8xf32>) outs(%[[OUT]] : tensor<1x1x1x1x8x32xf32>) permutation = [0, 1, 2, 4, 5, 3]
1414

15-
// CHECK: %[[TILE:.+]] = tensor.extract_slice %[[IN]][0, 0, 0, 0] [1, 1, 32, 8] [1, 1, 1, 1] : tensor<1x1x32x8xf32> to tensor<32x8xf32>
16-
// CHECK: %[[EMPTY:.+]] = tensor.empty() : tensor<8x32xf32>
17-
// CHECK: %[[TRANS:.+]] = linalg.transpose ins(%[[TILE]] : tensor<32x8xf32>) outs(%[[EMPTY]] : tensor<8x32xf32>) permutation = [1, 0]
15+
// CHECK: %[[EMPTY:.+]] = tensor.empty() : tensor<1x1x8x32xf32>
16+
// CHECK: %[[TRANS:.+]] = linalg.transpose ins(%[[IN]] : tensor<1x1x32x8xf32>) outs(%[[EMPTY]] : tensor<1x1x8x32xf32>) permutation = [0, 1, 3, 2]
1817
// CHECK: %[[RESULT:.+]] = tensor.insert_slice %[[TRANS]] into %[[OUT]][0, 0, 0, 0, 0, 0] [1, 1, 1, 1, 8, 32] [1, 1, 1, 1, 1, 1]
1918

2019
// CHECK-ALL: return %[[RESULT]]

compiler/src/iree/compiler/Codegen/LLVMCPU/test/pipeline_split_reduction_tests.mlir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,5 +276,5 @@ func.func @split_reduction_double_reduction_unsupported() attributes {hal.execut
276276
}
277277

278278
// CHECK-LABEL: func.func @split_reduction_double_reduction_unsupported()
279-
// CHECK: vector.insertelement %{{.+}}, %{{.+}} : vector<4xi32>
280-
// CHECK-NOT: vector.insertelement %{{.+}}, %{{.+}} : vector<1xi32>
279+
// CHECK: vector.insert %{{.+}}, %{{.+}} : i32 into vector<4xi32>
280+
// CHECK-NOT: vector.insert %{{.+}}, %{{.+}} : i32 into vector<1xi32>

compiler/src/iree/compiler/Codegen/SPIRV/test/pipeline_matvec.mlir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ hal.executable @i4_dequant_unit_matmul_f16 {
106106
// CHECK: %[[VS1:.+]] = spirv.VectorShuffle [2 : i32, 3 : i32] %[[LD]]
107107
// CHECK: spirv.Bitcast %[[VS1]] : vector<2xi32> to vector<4xf16>
108108

109-
// CHECK: spirv.GroupNonUniformFAdd "Subgroup" "Reduce" {{.*}} : f16
109+
// CHECK: spirv.GroupNonUniformFAdd <Subgroup> <Reduce> {{.*}} : f16
110110

111111
// CHECK: spirv.mlir.selection
112112

@@ -223,6 +223,6 @@ hal.executable @i4_dequant_matvec_f16_subgroup_64 {
223223
// CHECK: %[[LD:.+]] = spirv.Load "Function" {{.*}} : vector<4xf16>
224224
// CHECK: %[[RES:.+]] = spirv.Dot %[[LD]], %[[CSTVEC4XF16_1]] : vector<4xf16> -> f16
225225

226-
// CHECK: spirv.GroupNonUniformFAdd "Subgroup" "Reduce" %[[RES]] : f16
226+
// CHECK: spirv.GroupNonUniformFAdd <Subgroup> <Reduce> %[[RES]] : f16
227227

228228
// CHECK: spirv.mlir.selection

third_party/llvm-project

Submodule llvm-project updated 3863 files

0 commit comments

Comments
 (0)