diff --git a/mlir/include/mlir/Dialect/Vector/EDSC/Intrinsics.h b/mlir/include/mlir/Dialect/Vector/EDSC/Intrinsics.h --- a/mlir/include/mlir/Dialect/Vector/EDSC/Intrinsics.h +++ b/mlir/include/mlir/Dialect/Vector/EDSC/Intrinsics.h @@ -16,10 +16,16 @@ using vector_broadcast = ValueBuilder; using vector_contract = ValueBuilder; -using vector_insert = ValueBuilder; -using vector_fma = ValueBuilder; using vector_extract = ValueBuilder; -using vector_extractelement = ValueBuilder; +using vector_extract_element = ValueBuilder; +using vector_extract_slices = ValueBuilder; +using vector_extract_strided_slice = + ValueBuilder; +using vector_fma = ValueBuilder; +using vector_insert = ValueBuilder; +using vector_insert_element = ValueBuilder; +using vector_insert_slices = ValueBuilder; +using vector_insert_strided_slice = ValueBuilder; using vector_matmul = ValueBuilder; using vector_outerproduct = ValueBuilder; using vector_print = OperationBuilder; @@ -27,11 +33,6 @@ using vector_transfer_write = OperationBuilder; using vector_transpose = ValueBuilder; using vector_type_cast = ValueBuilder; -using vector_extract_slices = ValueBuilder; -using vector_insert_slices = ValueBuilder; -using vector_extract_strided_slice = - ValueBuilder; -using vector_insert_strided_slice = ValueBuilder; } // namespace intrinsics } // namespace edsc diff --git a/mlir/include/mlir/Dialect/Vector/VectorOps.td b/mlir/include/mlir/Dialect/Vector/VectorOps.td --- a/mlir/include/mlir/Dialect/Vector/VectorOps.td +++ b/mlir/include/mlir/Dialect/Vector/VectorOps.td @@ -348,15 +348,21 @@ %1 = vector.extractelement %0[%c : i32]: vector<16xf32> ``` }]; + let assemblyFormat = [{ + $vector `[` $position `:` type($position) `]` attr-dict `:` type($vector) + }]; + + let builders = [OpBuilder< + "OpBuilder &builder, OperationState &result, Value source, " + "int64_t position">, + OpBuilder< + "OpBuilder &builder, OperationState &result, Value source, " + "Value position">]; let extraClassDeclaration = [{ VectorType getVectorType() { return vector().getType().cast(); } }]; - - let assemblyFormat = [{ - $vector `[` $position `:` type($position) `]` attr-dict `:` type($vector) - }]; } def Vector_ExtractOp : @@ -508,6 +514,17 @@ %1 = vector.insertelement %f, %0[%c : i32]: vector<16xf32> ``` }]; + let assemblyFormat = [{ + $source `,` $dest `[` $position `:` type($position) `]` attr-dict `:` + type($result) + }]; + + let builders = [OpBuilder< + "OpBuilder &builder, OperationState &result, Value source, " + "Value dest, int64_t position">, + OpBuilder< + "OpBuilder &builder, OperationState &result, Value source, " + "Value dest, Value position">]; let extraClassDeclaration = [{ Type getSourceType() { return source().getType(); } VectorType getDestVectorType() { @@ -515,10 +532,6 @@ } }]; - let assemblyFormat = [{ - $source `,` $dest `[` $position `:` type($position) `]` attr-dict `:` - type($result) - }]; } def Vector_InsertOp : diff --git a/mlir/integration_test/Dialect/Vector/CPU/test-transfer-to-loops.mlir b/mlir/integration_test/Dialect/Vector/CPU/test-transfer-to-loops.mlir new file mode 100644 --- /dev/null +++ b/mlir/integration_test/Dialect/Vector/CPU/test-transfer-to-loops.mlir @@ -0,0 +1,81 @@ +// RUN: mlir-opt %s -convert-vector-to-scf -lower-affine -convert-scf-to-std -convert-vector-to-llvm | \ +// RUN: mlir-cpu-runner -e main -entry-point-result=void \ +// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext,%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \ +// RUN: FileCheck %s + +#map0 = affine_map<(d0, d1) -> (d1, d0)> + +func @print_memref_f32(memref<*xf32>) + +func @alloc_2d_filled_f32(%arg0: index, %arg1: index) -> memref { + %c0 = constant 0 : index + %c1 = constant 1 : index + %c10 = constant 10 : index + %c100 = constant 100 : index + %0 = alloc(%arg0, %arg1) : memref + scf.for %arg5 = %c0 to %arg0 step %c1 { + scf.for %arg6 = %c0 to %arg1 step %c1 { + %arg66 = muli %arg6, %c100 : index + %tmp1 = addi %arg5, %arg66 : index + %tmp2 = index_cast %tmp1 : index to i32 + %tmp3 = sitofp %tmp2 : i32 to f32 + store %tmp3, %0[%arg5, %arg6] : memref + } + } + return %0 : memref +} + +func @main() { + %c0 = constant 0 : index + %c1 = constant 1 : index + %c2 = constant 2 : index + %c6 = constant 6 : index + %cst = constant -4.2e+01 : f32 + %0 = call @alloc_2d_filled_f32(%c6, %c6) : (index, index) -> memref + %converted = memref_cast %0 : memref to memref<*xf32> + call @print_memref_f32(%converted): (memref<*xf32>) -> () + // CHECK: Unranked{{.*}}data = + // CHECK: [ + // CHECK-SAME: [0, 100, 200, 300, 400, 500], + // CHECK-NEXT: [1, 101, 201, 301, 401, 501], + // CHECK-NEXT: [2, 102, 202, 302, 402, 502], + // CHECK-NEXT: [3, 103, 203, 303, 403, 503], + // CHECK-NEXT: [4, 104, 204, 304, 404, 504], + // CHECK-NEXT: [5, 105, 205, 305, 405, 505]] + + %init = vector.transfer_read %0[%c1, %c1], %cst : memref, vector<5x5xf32> + vector.print %init : vector<5x5xf32> + // 5x5 block rooted at {1, 1} + // CHECK-NEXT: ( ( 101, 201, 301, 401, 501 ), + // CHECK-SAME: ( 102, 202, 302, 402, 502 ), + // CHECK-SAME: ( 103, 203, 303, 403, 503 ), + // CHECK-SAME: ( 104, 204, 304, 404, 504 ), + // CHECK-SAME: ( 105, 205, 305, 405, 505 ) ) + + %1 = vector.transfer_read %0[%c1, %c1], %cst {permutation_map = #map0} : memref, vector<5x5xf32> + vector.print %1 : vector<5x5xf32> + // Transposed 5x5 block rooted @{1, 1} in memory. + // CHECK-NEXT: ( ( 101, 102, 103, 104, 105 ), + // CHECK-SAME: ( 201, 202, 203, 204, 205 ), + // CHECK-SAME: ( 301, 302, 303, 304, 305 ), + // CHECK-SAME: ( 401, 402, 403, 404, 405 ), + // CHECK-SAME: ( 501, 502, 503, 504, 505 ) ) + + // Transpose-write the transposed 5x5 block @{0, 0} in memory. + vector.transfer_write %1, %0[%c0, %c0] {permutation_map = #map0} : vector<5x5xf32>, memref + + %2 = vector.transfer_read %0[%c1, %c1], %cst : memref, vector<5x5xf32> + vector.print %2 : vector<5x5xf32> + // New 5x5 block rooted @{1, 1} in memory. + // Here we expect the boundaries from the original data + // (i.e. last row: 105 .. 505, last col: 501 .. 505) + // and the 4x4 subblock 202 .. 505 rooted @{0, 0} in the vector + // CHECK-NEXT: ( ( 202, 302, 402, 502, 501 ), + // CHECK-SAME: ( 203, 303, 403, 503, 502 ), + // CHECK-SAME: ( 204, 304, 404, 504, 503 ), + // CHECK-SAME: ( 205, 305, 405, 505, 504 ), + // CHECK-SAME: ( 105, 205, 305, 405, 505 ) ) + + dealloc %0 : memref + return +} diff --git a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp --- a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp +++ b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp @@ -1893,11 +1893,17 @@ // Adjust the allocation size to consider alignment. if (Optional alignment = allocOp.alignment()) { accessAlignment = createIndexConstant(rewriter, loc, *alignment); - cumulativeSize = rewriter.create( - loc, - rewriter.create(loc, cumulativeSize, accessAlignment), - one); + } else if (!memRefType.getElementType().isSignlessIntOrIndexOrFloat()) { + // In the case where no alignment is specified, we may want to override + // `malloc's` behavior. `malloc` typically aligns at the size of the + // biggest scalar on a target HW. For non-scalars, use the natural + // alignment of the LLVM type given by the LLVM DataLayout. + accessAlignment = + this->getSizeInBytes(loc, memRefType.getElementType(), rewriter); } + if (accessAlignment) + cumulativeSize = + rewriter.create(loc, cumulativeSize, accessAlignment); callArgs.push_back(cumulativeSize); } auto allocFuncSymbol = rewriter.getSymbolRefAttr(allocFunc); diff --git a/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp b/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp --- a/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp +++ b/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp @@ -35,8 +35,6 @@ #include "mlir/Pass/Pass.h" #include "mlir/Transforms/Passes.h" -#define ALIGNMENT_SIZE 128 - using namespace mlir; using namespace mlir::edsc; using namespace mlir::edsc::intrinsics; @@ -234,8 +232,7 @@ op->getParentWithTrait(); assert(scope && "Expected op to be inside automatic allocation scope"); b.setInsertionPointToStart(&scope->getRegion(0).front()); - Value res = std_alloca(memRefMinorVectorType, ValueRange{}, - b.getI64IntegerAttr(ALIGNMENT_SIZE)); + Value res = std_alloca(memRefMinorVectorType); return res; } @@ -494,8 +491,10 @@ MemRefType VectorTransferRewriter::tmpMemRefType( TransferOpTy transfer) const { auto vectorType = transfer.getVectorType(); - return MemRefType::get(vectorType.getShape(), vectorType.getElementType(), {}, - 0); + return MemRefType::get(vectorType.getShape().drop_back(), + VectorType::get(vectorType.getShape().take_back(), + vectorType.getElementType()), + {}, 0); } /// Lowers TransferReadOp into a combination of: @@ -585,8 +584,7 @@ steps.push_back(std_constant_index(step)); // 2. Emit alloc-copy-load-dealloc. - Value tmp = std_alloc(tmpMemRefType(transfer), ValueRange{}, - rewriter.getI64IntegerAttr(ALIGNMENT_SIZE)); + Value tmp = setAllocAtFunctionEntry(tmpMemRefType(transfer), transfer); StdIndexedValue local(tmp); Value vec = vector_type_cast(tmp); loopNestBuilder(lbs, ubs, steps, [&](ValueRange loopIvs) { @@ -595,10 +593,15 @@ if (coalescedIdx >= 0) std::swap(ivs.back(), ivs[coalescedIdx]); // Computes clippedScalarAccessExprs in the loop nest scope (ivs exist). - local(ivs) = remote(clip(transfer, memRefBoundsCapture, ivs)); + SmallVector indices = clip(transfer, memRefBoundsCapture, ivs); + ArrayRef indicesRef(indices), ivsRef(ivs); + Value pos = + std_index_cast(IntegerType::get(32, op->getContext()), ivsRef.back()); + Value vector = vector_insert_element(remote(indicesRef), + local(ivsRef.drop_back()), pos); + local(ivsRef.drop_back()) = vector; }); Value vectorValue = std_load(vec); - (std_dealloc(tmp)); // vexing parse // 3. Propagate. rewriter.replaceOp(op, vectorValue); @@ -667,8 +670,7 @@ steps.push_back(std_constant_index(step)); // 2. Emit alloc-store-copy-dealloc. - Value tmp = std_alloc(tmpMemRefType(transfer), ValueRange{}, - rewriter.getI64IntegerAttr(ALIGNMENT_SIZE)); + Value tmp = setAllocAtFunctionEntry(tmpMemRefType(transfer), transfer); StdIndexedValue local(tmp); Value vec = vector_type_cast(tmp); std_store(vectorValue, vec); @@ -678,10 +680,15 @@ if (coalescedIdx >= 0) std::swap(ivs.back(), ivs[coalescedIdx]); // Computes clippedScalarAccessExprs in the loop nest scope (ivs exist). - remote(clip(transfer, memRefBoundsCapture, ivs)) = local(ivs); + SmallVector indices = clip(transfer, memRefBoundsCapture, ivs); + ArrayRef indicesRef(indices), ivsRef(ivs); + Value pos = + std_index_cast(IntegerType::get(32, op->getContext()), ivsRef.back()); + Value scalar = vector_extract_element(local(ivsRef.drop_back()), pos); + remote(indices) = scalar; }); - (std_dealloc(tmp)); // vexing parse... + // 3. Erase. rewriter.eraseOp(op); return success(); } diff --git a/mlir/lib/Dialect/Vector/VectorOps.cpp b/mlir/lib/Dialect/Vector/VectorOps.cpp --- a/mlir/lib/Dialect/Vector/VectorOps.cpp +++ b/mlir/lib/Dialect/Vector/VectorOps.cpp @@ -537,6 +537,18 @@ // ExtractElementOp //===----------------------------------------------------------------------===// +void vector::ExtractElementOp::build(OpBuilder &builder, OperationState &result, + Value source, Value position) { + result.addOperands({source, position}); + result.addTypes(source.getType().cast().getElementType()); +} + +void vector::ExtractElementOp::build(OpBuilder &builder, OperationState &result, + Value source, int64_t position) { + Value pos = builder.create(result.location, position, 32); + build(builder, result, source, pos); +} + static LogicalResult verify(vector::ExtractElementOp op) { VectorType vectorType = op.getVectorType(); if (vectorType.getRank() != 1) @@ -1007,6 +1019,18 @@ // InsertElementOp //===----------------------------------------------------------------------===// +void InsertElementOp::build(OpBuilder &builder, OperationState &result, + Value source, Value dest, Value position) { + result.addOperands({source, dest, position}); + result.addTypes(dest.getType()); +} + +void InsertElementOp::build(OpBuilder &builder, OperationState &result, + Value source, Value dest, int64_t position) { + Value pos = builder.create(result.location, position, 32); + build(builder, result, source, dest, pos); +} + static LogicalResult verify(InsertElementOp op) { auto dstVectorType = op.getDestVectorType(); if (dstVectorType.getRank() != 1) diff --git a/mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir b/mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir --- a/mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir +++ b/mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir @@ -130,8 +130,7 @@ // CHECK-NEXT: llvm.mul %{{.*}}, %[[sizeof]] : !llvm.i64 // CHECK-NEXT: %[[one_1:.*]] = llvm.mlir.constant(1 : index) : !llvm.i64 // CHECK-NEXT: %[[alignment:.*]] = llvm.mlir.constant(8 : index) : !llvm.i64 -// CHECK-NEXT: %[[alignmentMinus1:.*]] = llvm.add {{.*}}, %[[alignment]] : !llvm.i64 -// CHECK-NEXT: %[[allocsize:.*]] = llvm.sub %[[alignmentMinus1]], %[[one_1]] : !llvm.i64 +// CHECK-NEXT: %[[allocsize:.*]] = llvm.add {{.*}}, %[[alignment]] : !llvm.i64 // CHECK-NEXT: %[[allocated:.*]] = llvm.call @malloc(%[[allocsize]]) : (!llvm.i64) -> !llvm.ptr // CHECK-NEXT: %[[ptr:.*]] = llvm.bitcast %{{.*}} : !llvm.ptr to !llvm.ptr // CHECK-NEXT: llvm.mlir.undef : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> @@ -154,8 +153,7 @@ // BAREPTR-NEXT: llvm.mul %{{.*}}, %[[sizeof]] : !llvm.i64 // BAREPTR-NEXT: %[[one_1:.*]] = llvm.mlir.constant(1 : index) : !llvm.i64 // BAREPTR-NEXT: %[[alignment:.*]] = llvm.mlir.constant(8 : index) : !llvm.i64 -// BAREPTR-NEXT: %[[alignmentMinus1:.*]] = llvm.add {{.*}}, %[[alignment]] : !llvm.i64 -// BAREPTR-NEXT: %[[allocsize:.*]] = llvm.sub %[[alignmentMinus1]], %[[one_1]] : !llvm.i64 +// BAREPTR-NEXT: %[[allocsize:.*]] = llvm.add {{.*}}, %[[alignment]] : !llvm.i64 // BAREPTR-NEXT: %[[allocated:.*]] = llvm.call @malloc(%[[allocsize]]) : (!llvm.i64) -> !llvm.ptr // BAREPTR-NEXT: %[[ptr:.*]] = llvm.bitcast %{{.*}} : !llvm.ptr to !llvm.ptr // BAREPTR-NEXT: llvm.mlir.undef : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> diff --git a/mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir b/mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir --- a/mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir +++ b/mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir @@ -19,7 +19,7 @@ // CHECK: %[[FILTERED1:.*]] = select // CHECK: {{.*}} = select // CHECK: %[[FILTERED2:.*]] = select - // CHECK-NEXT: %{{.*}} = load {{.*}}[%[[FILTERED1]], %[[FILTERED2]]] : memref<7x42xf32> + // CHECK: %{{.*}} = load {{.*}}[%[[FILTERED1]], %[[FILTERED2]]] : memref<7x42xf32> } } return @@ -58,6 +58,7 @@ // CHECK-LABEL: func @materialize_read(%{{.*}}: index, %{{.*}}: index, %{{.*}}: index, %{{.*}}: index) { func @materialize_read(%M: index, %N: index, %O: index, %P: index) { %f0 = constant 0.0: f32 + // CHECK-DAG: %[[ALLOC:.*]] = alloca() : memref<5x4xvector<3xf32>> // CHECK-DAG: %[[C0:.*]] = constant 0 : index // CHECK-DAG: %[[C1:.*]] = constant 1 : index // CHECK-DAG: %[[C3:.*]] = constant 3 : index @@ -68,7 +69,6 @@ // CHECK-NEXT: affine.for %[[I1:.*]] = 0 to %{{.*}} { // CHECK-NEXT: affine.for %[[I2:.*]] = 0 to %{{.*}} { // CHECK-NEXT: affine.for %[[I3:.*]] = 0 to %{{.*}} step 5 { - // CHECK: %[[ALLOC:.*]] = alloc() {alignment = 128 : i64} : memref<5x4x3xf32> // CHECK-NEXT: scf.for %[[I4:.*]] = %[[C0]] to %[[C3]] step %[[C1]] { // CHECK-NEXT: scf.for %[[I5:.*]] = %[[C0]] to %[[C4]] step %[[C1]] { // CHECK-NEXT: scf.for %[[I6:.*]] = %[[C0]] to %[[C5]] step %[[C1]] { @@ -97,13 +97,15 @@ // CHECK-NEXT: {{.*}} = select // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}}, %[[C0]] : index // CHECK-NEXT: %[[L3:.*]] = select + // CHECK-NEXT: %[[VIDX:.*]] = index_cast %[[I4]] // // CHECK-NEXT: {{.*}} = load %{{.*}}[%[[L0]], %[[L1]], %[[L2]], %[[L3]]] : memref - // CHECK-NEXT: store {{.*}}, %[[ALLOC]][%[[I6]], %[[I5]], %[[I4]]] : memref<5x4x3xf32> + // CHECK-NEXT: %[[VEC:.*]] = load %[[ALLOC]][%[[I6]], %[[I5]]] : memref<5x4xvector<3xf32>> + // CHECK-NEXT: %[[RVEC:.*]] = vector.insertelement %25, %[[VEC]][%[[VIDX]] : i32] : vector<3xf32> + // CHECK-NEXT: store %[[RVEC]], %[[ALLOC]][%[[I6]], %[[I5]]] : memref<5x4xvector<3xf32>> // CHECK-NEXT: } // CHECK-NEXT: } // CHECK-NEXT: } - // CHECK-NEXT: dealloc %[[ALLOC]] : memref<5x4x3xf32> // CHECK-NEXT: } // CHECK-NEXT: } // CHECK-NEXT: } @@ -134,6 +136,7 @@ // CHECK-LABEL:func @materialize_write(%{{.*}}: index, %{{.*}}: index, %{{.*}}: index, %{{.*}}: index) { func @materialize_write(%M: index, %N: index, %O: index, %P: index) { + // CHECK-DAG: %[[ALLOC:.*]] = alloca() : memref<5x4xvector<3xf32>> // CHECK-DAG: %{{.*}} = constant dense<1.000000e+00> : vector<5x4x3xf32> // CHECK-DAG: %[[C0:.*]] = constant 0 : index // CHECK-DAG: %[[C1:.*]] = constant 1 : index @@ -145,8 +148,7 @@ // CHECK-NEXT: affine.for %[[I1:.*]] = 0 to %{{.*}} step 4 { // CHECK-NEXT: affine.for %[[I2:.*]] = 0 to %{{.*}} { // CHECK-NEXT: affine.for %[[I3:.*]] = 0 to %{{.*}} step 5 { - // CHECK: %[[ALLOC:.*]] = alloc() {alignment = 128 : i64} : memref<5x4x3xf32> - // CHECK-NEXT: %[[VECTOR_VIEW:.*]] = vector.type_cast {{.*}} : memref<5x4x3xf32> + // CHECK-NEXT: %[[VECTOR_VIEW:.*]] = vector.type_cast {{.*}} : memref<5x4xvector<3xf32>> // CHECK: store %{{.*}}, {{.*}} : memref> // CHECK-NEXT: scf.for %[[I4:.*]] = %[[C0]] to %[[C3]] step %[[C1]] { // CHECK-NEXT: scf.for %[[I5:.*]] = %[[C0]] to %[[C4]] step %[[C1]] { @@ -177,13 +179,14 @@ // CHECK-NEXT: {{.*}} = select {{.*}}, {{.*}}, {{.*}} : index // CHECK-NEXT: {{.*}} = cmpi "slt", {{.*}}, %[[C0]] : index // CHECK-NEXT: %[[S3:.*]] = select {{.*}}, %[[C0]], {{.*}} : index + // CHECK-NEXT: %[[VIDX:.*]] = index_cast %[[I4]] // - // CHECK-NEXT: {{.*}} = load {{.*}}[%[[I6]], %[[I5]], %[[I4]]] : memref<5x4x3xf32> - // CHECK: store {{.*}}, {{.*}}[%[[S0]], %[[S1]], %[[S2]], %[[S3]]] : memref + // CHECK-NEXT: %[[VEC:.*]] = load {{.*}}[%[[I6]], %[[I5]]] : memref<5x4xvector<3xf32>> + // CHECK-NEXT: %[[SCAL:.*]] = vector.extractelement %[[VEC]][%[[VIDX]] : i32] : vector<3xf32> + // CHECK: store %[[SCAL]], {{.*}}[%[[S0]], %[[S1]], %[[S2]], %[[S3]]] : memref // CHECK-NEXT: } // CHECK-NEXT: } // CHECK-NEXT: } - // CHECK-NEXT: dealloc {{.*}} : memref<5x4x3xf32> // CHECK-NEXT: } // CHECK-NEXT: } // CHECK-NEXT: } @@ -232,7 +235,7 @@ %f7 = constant 7.0: f32 // CHECK-DAG: %[[splat:.*]] = constant dense<7.000000e+00> : vector<15xf32> - // CHECK-DAG: %[[alloc:.*]] = alloca() {alignment = 128 : i64} : memref<3xvector<15xf32>> + // CHECK-DAG: %[[alloc:.*]] = alloca() : memref<3xvector<15xf32>> // CHECK-DAG: %[[C0:.*]] = constant 0 : index // CHECK-DAG: %[[dim:.*]] = dim %[[A]], %[[C0]] : memref // CHECK: affine.for %[[I:.*]] = 0 to 3 { @@ -307,7 +310,7 @@ // FULL-UNROLL-SAME: %[[vec:[a-zA-Z0-9]+]]: vector<3x15xf32> func @transfer_write_progressive(%A : memref, %base: index, %vec: vector<3x15xf32>) { // CHECK: %[[C0:.*]] = constant 0 : index - // CHECK: %[[alloc:.*]] = alloca() {alignment = 128 : i64} : memref<3xvector<15xf32>> + // CHECK: %[[alloc:.*]] = alloca() : memref<3xvector<15xf32>> // CHECK: %[[vmemref:.*]] = vector.type_cast %[[alloc]] : memref<3xvector<15xf32>> to memref> // CHECK: store %[[vec]], %[[vmemref]][] : memref> // CHECK: %[[dim:.*]] = dim %[[A]], %[[C0]] : memref @@ -363,7 +366,7 @@ // FULL-UNROLL-SAME: %[[vec:[a-zA-Z0-9]+]]: vector<3x15xf32> func @transfer_write_progressive_unmasked(%A : memref, %base: index, %vec: vector<3x15xf32>) { // CHECK-NOT: scf.if - // CHECK-NEXT: %[[alloc:.*]] = alloca() {alignment = 128 : i64} : memref<3xvector<15xf32>> + // CHECK-NEXT: %[[alloc:.*]] = alloca() : memref<3xvector<15xf32>> // CHECK-NEXT: %[[vmemref:.*]] = vector.type_cast %[[alloc]] : memref<3xvector<15xf32>> to memref> // CHECK-NEXT: store %[[vec]], %[[vmemref]][] : memref> // CHECK-NEXT: affine.for %[[I:.*]] = 0 to 3 { @@ -416,7 +419,7 @@ // CHECK: %[[cst:.*]] = constant 0.000000e+00 : f32 // CHECK: %[[c2:.*]] = constant 2 : index // CHECK: %[[cst0:.*]] = constant dense<0.000000e+00> : vector<3xf32> -// CHECK: %[[m:.*]] = alloca() {alignment = 128 : i64} : memref<3xvector<3xf32>> +// CHECK: %[[m:.*]] = alloca() : memref<3xvector<3xf32>> // CHECK: %[[d:.*]] = dim %[[A]], %[[c2]] : memref // CHECK: affine.for %[[arg1:.*]] = 0 to 3 { // CHECK: %[[cmp:.*]] = cmpi "slt", %[[arg1]], %[[d]] : index @@ -445,7 +448,7 @@ // CHECK-SAME: %[[B:.*]]: memref) // CHECK: %[[c0:.*]] = constant 0 : index // CHECK: %[[c2:.*]] = constant 2 : index -// CHECK: %[[m:.*]] = alloca() {alignment = 128 : i64} : memref<3xvector<3xf32>> +// CHECK: %[[m:.*]] = alloca() : memref<3xvector<3xf32>> // CHECK: %[[cast:.*]] = vector.type_cast %[[m]] : memref<3xvector<3xf32>> to memref> // CHECK: store %[[A]], %[[cast]][] : memref> // CHECK: %[[d:.*]] = dim %[[B]], %[[c2]] : memref diff --git a/mlir/test/EDSC/builder-api-test.cpp b/mlir/test/EDSC/builder-api-test.cpp --- a/mlir/test/EDSC/builder-api-test.cpp +++ b/mlir/test/EDSC/builder-api-test.cpp @@ -1089,7 +1089,7 @@ ScopedContext scope(builder, f.getLoc()); auto i32Type = builder.getI32Type(); auto vectorType = VectorType::get(/*shape=*/{8}, i32Type); - vector_extractelement( + vector_extract_element( i32Type, std_constant(vectorType, builder.getI32VectorAttr({10})), std_constant_int(0, i32Type));