[Mlir-commits] [mlir] a89035d - Revert "[MLIR] Create memref dialect and move several dialect-specific ops from std."
Alexander Belyaev
llvmlistbot at llvm.org
Thu Feb 18 03:51:14 PST 2021
Author: Alexander Belyaev
Date: 2021-02-18T12:49:52+01:00
New Revision: a89035d750c6f3f07ceab2c22eedb86afd386bc7
URL: https://github.com/llvm/llvm-project/commit/a89035d750c6f3f07ceab2c22eedb86afd386bc7
DIFF: https://github.com/llvm/llvm-project/commit/a89035d750c6f3f07ceab2c22eedb86afd386bc7.diff
LOG: Revert "[MLIR] Create memref dialect and move several dialect-specific ops from std."
This commit introduced a cyclic dependency:
Memref dialect depends on Standard because it used ConstantIndexOp.
Std depends on the MemRef dialect in its EDSC/Intrinsics.h
Working on a fix.
This reverts commit 8aa6c3765b924d86f623d452777eb76b83bf2787.
Added:
Modified:
mlir/docs/BufferDeallocationInternals.md
mlir/docs/Dialects/Linalg.md
mlir/docs/Traits.md
mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp
mlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp
mlir/examples/toy/Ch7/mlir/LowerToAffineLoops.cpp
mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h
mlir/include/mlir/Dialect/CMakeLists.txt
mlir/include/mlir/Dialect/GPU/GPUOps.td
mlir/include/mlir/Dialect/Linalg/EDSC/FoldedIntrinsics.h
mlir/include/mlir/Dialect/Linalg/Passes.h
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
mlir/include/mlir/Dialect/StandardOps/EDSC/Intrinsics.h
mlir/include/mlir/Dialect/StandardOps/IR/Ops.h
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.td
mlir/include/mlir/Dialect/Vector/VectorTransforms.h
mlir/include/mlir/IR/OpDefinition.h
mlir/include/mlir/InitAllDialects.h
mlir/include/mlir/Transforms/Passes.td
mlir/include/mlir/Transforms/Utils.h
mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp
mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp
mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
mlir/lib/Dialect/Affine/IR/AffineOps.cpp
mlir/lib/Dialect/CMakeLists.txt
mlir/lib/Dialect/GPU/Transforms/AllReduceLowering.cpp
mlir/lib/Dialect/Linalg/IR/CMakeLists.txt
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp
mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
mlir/lib/Dialect/StandardOps/Transforms/TensorConstantBufferize.cpp
mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp
mlir/lib/Dialect/Vector/VectorOps.cpp
mlir/lib/Dialect/Vector/VectorTransforms.cpp
mlir/lib/Transforms/BufferDeallocation.cpp
mlir/lib/Transforms/BufferOptimizations.cpp
mlir/lib/Transforms/BufferResultsToOutParams.cpp
mlir/lib/Transforms/LoopFusion.cpp
mlir/lib/Transforms/MemRefDataFlowOpt.cpp
mlir/lib/Transforms/NormalizeMemRefs.cpp
mlir/lib/Transforms/PipelineDataTransfer.cpp
mlir/lib/Transforms/Utils/LoopUtils.cpp
mlir/lib/Transforms/Utils/Utils.cpp
mlir/test/Analysis/test-alias-analysis.mlir
mlir/test/Analysis/test-liveness.mlir
mlir/test/CAPI/ir.c
mlir/test/Conversion/AffineToStandard/lower-affine-to-vector.mlir
mlir/test/Conversion/AffineToStandard/lower-affine.mlir
mlir/test/Conversion/AsyncToLLVM/convert-to-llvm.mlir
mlir/test/Conversion/GPUCommon/memory-attrbution.mlir
mlir/test/Conversion/GPUToSPIRV/load-store.mlir
mlir/test/Conversion/GPUToVulkan/lower-gpu-launch-vulkan-launch.mlir
mlir/test/Conversion/LinalgToVector/linalg-to-vector.mlir
mlir/test/Conversion/SCFToGPU/no_blocks_no_threads.mlir
mlir/test/Conversion/SCFToGPU/parallel_loop.mlir
mlir/test/Conversion/SCFToGPU/step_one.mlir
mlir/test/Conversion/SCFToGPU/step_positive.mlir
mlir/test/Conversion/SCFToSPIRV/for.mlir
mlir/test/Conversion/SCFToSPIRV/if.mlir
mlir/test/Conversion/SPIRVToLLVM/lower-host-to-llvm-calls.mlir
mlir/test/Conversion/StandardToLLVM/calling-convention.mlir
mlir/test/Conversion/StandardToLLVM/convert-dynamic-memref-ops.mlir
mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir
mlir/test/Conversion/StandardToLLVM/convert-to-llvmir.mlir
mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir
mlir/test/Conversion/StandardToSPIRV/alloc.mlir
mlir/test/Conversion/StandardToSPIRV/legalization.mlir
mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir
mlir/test/Conversion/StandardToSPIRV/subview-to-spirv.mlir
mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir
mlir/test/Dialect/Affine/SuperVectorize/vector_utils.mlir
mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir
mlir/test/Dialect/Affine/SuperVectorize/vectorize_2d.mlir
mlir/test/Dialect/Affine/affine-data-copy.mlir
mlir/test/Dialect/Affine/affine-loop-invariant-code-motion.mlir
mlir/test/Dialect/Affine/affine-loop-normalize.mlir
mlir/test/Dialect/Affine/canonicalize.mlir
mlir/test/Dialect/Affine/dma-generate.mlir
mlir/test/Dialect/Affine/dma.mlir
mlir/test/Dialect/Affine/invalid.mlir
mlir/test/Dialect/Affine/load-store-invalid.mlir
mlir/test/Dialect/Affine/load-store.mlir
mlir/test/Dialect/Affine/loop-tiling-validity.mlir
mlir/test/Dialect/Affine/memref-stride-calculation.mlir
mlir/test/Dialect/Affine/ops.mlir
mlir/test/Dialect/Affine/parallelize.mlir
mlir/test/Dialect/Affine/slicing-utils.mlir
mlir/test/Dialect/Affine/unroll.mlir
mlir/test/Dialect/Async/async-parallel-for.mlir
mlir/test/Dialect/Async/async-to-async-runtime.mlir
mlir/test/Dialect/GPU/multiple-all-reduce.mlir
mlir/test/Dialect/Linalg/affine.mlir
mlir/test/Dialect/Linalg/bufferize.mlir
mlir/test/Dialect/Linalg/canonicalize.mlir
mlir/test/Dialect/Linalg/fold-affine-min-scf.mlir
mlir/test/Dialect/Linalg/forward-vector-transfers.mlir
mlir/test/Dialect/Linalg/fusion-pattern.mlir
mlir/test/Dialect/Linalg/fusion-sequence.mlir
mlir/test/Dialect/Linalg/fusion.mlir
mlir/test/Dialect/Linalg/hoisting.mlir
mlir/test/Dialect/Linalg/invalid.mlir
mlir/test/Dialect/Linalg/loops.mlir
mlir/test/Dialect/Linalg/promote.mlir
mlir/test/Dialect/Linalg/promotion_options.mlir
mlir/test/Dialect/Linalg/roundtrip.mlir
mlir/test/Dialect/Linalg/sparse_1d.mlir
mlir/test/Dialect/Linalg/sparse_2d.mlir
mlir/test/Dialect/Linalg/sparse_3d.mlir
mlir/test/Dialect/Linalg/sparse_lower.mlir
mlir/test/Dialect/Linalg/sparse_nd.mlir
mlir/test/Dialect/Linalg/standard.mlir
mlir/test/Dialect/Linalg/transform-patterns.mlir
mlir/test/Dialect/OpenACC/invalid.mlir
mlir/test/Dialect/OpenACC/ops.mlir
mlir/test/Dialect/SCF/canonicalize.mlir
mlir/test/Dialect/SCF/for-loop-specialization.mlir
mlir/test/Dialect/SCF/loop-unroll.mlir
mlir/test/Dialect/SCF/parallel-loop-fusion.mlir
mlir/test/Dialect/SCF/parallel-loop-specialization.mlir
mlir/test/Dialect/SCF/parallel-loop-tiling.mlir
mlir/test/Dialect/Standard/canonicalize.mlir
mlir/test/Dialect/Standard/invalid.mlir
mlir/test/Dialect/Standard/ops.mlir
mlir/test/Dialect/Tensor/bufferize.mlir
mlir/test/Dialect/Tensor/canonicalize.mlir
mlir/test/Dialect/Vector/canonicalize.mlir
mlir/test/Dialect/Vector/vector-contract-matvec-transforms.mlir
mlir/test/Dialect/Vector/vector-transfer-full-partial-split.mlir
mlir/test/Dialect/Vector/vector-transforms.mlir
mlir/test/Examples/Toy/Ch5/affine-lowering.mlir
mlir/test/Examples/Toy/Ch6/affine-lowering.mlir
mlir/test/Examples/Toy/Ch7/affine-lowering.mlir
mlir/test/IR/core-ops.mlir
mlir/test/IR/invalid-ops.mlir
mlir/test/IR/memory-ops.mlir
mlir/test/IR/parser.mlir
mlir/test/IR/slice.mlir
mlir/test/Transforms/buffer-deallocation.mlir
mlir/test/Transforms/buffer-hoisting.mlir
mlir/test/Transforms/buffer-loop-hoisting.mlir
mlir/test/Transforms/buffer-results-to-out-params.mlir
mlir/test/Transforms/canonicalize-block-merge.mlir
mlir/test/Transforms/canonicalize.mlir
mlir/test/Transforms/constant-fold.mlir
mlir/test/Transforms/copy-removal.mlir
mlir/test/Transforms/cse.mlir
mlir/test/Transforms/loop-fusion-dependence-check.mlir
mlir/test/Transforms/loop-fusion-slice-computation.mlir
mlir/test/Transforms/loop-fusion-transformation.mlir
mlir/test/Transforms/loop-fusion.mlir
mlir/test/Transforms/loop-invariant-code-motion.mlir
mlir/test/Transforms/memref-bound-check.mlir
mlir/test/Transforms/memref-dataflow-opt.mlir
mlir/test/Transforms/memref-dependence-check.mlir
mlir/test/Transforms/normalize-memrefs-ops.mlir
mlir/test/Transforms/normalize-memrefs.mlir
mlir/test/Transforms/pipeline-data-transfer.mlir
mlir/test/Transforms/promote-buffers-to-stack.mlir
mlir/test/lib/Transforms/TestLinalgTransforms.cpp
mlir/test/lib/Transforms/TestMemRefStrideCalculation.cpp
mlir/test/lib/Transforms/TestVectorTransforms.cpp
mlir/test/mlir-cpu-runner/async-value.mlir
mlir/test/mlir-cpu-runner/async.mlir
mlir/test/mlir-cpu-runner/bare_ptr_call_conv.mlir
mlir/test/mlir-cpu-runner/global_memref.mlir
mlir/test/mlir-cpu-runner/memref_reinterpret_cast.mlir
mlir/test/mlir-cpu-runner/memref_reshape.mlir
mlir/test/mlir-cpu-runner/sgemm_naive_codegen.mlir
mlir/test/mlir-cpu-runner/unranked_memref.mlir
mlir/test/mlir-cpu-runner/utils.mlir
mlir/test/mlir-opt/commandline.mlir
mlir/test/mlir-reduce/multiple-function.mlir
mlir/test/mlir-reduce/simple-test.mlir
mlir/unittests/ExecutionEngine/Invoke.cpp
Removed:
mlir/include/mlir/Dialect/MemRef/CMakeLists.txt
mlir/include/mlir/Dialect/MemRef/IR/CMakeLists.txt
mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
mlir/include/mlir/Dialect/MemRef/IR/MemRefBase.td
mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
mlir/lib/Dialect/MemRef/CMakeLists.txt
mlir/lib/Dialect/MemRef/IR/CMakeLists.txt
mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
################################################################################
diff --git a/mlir/docs/BufferDeallocationInternals.md b/mlir/docs/BufferDeallocationInternals.md
index 9626acad8825..acc775fd9f30 100644
--- a/mlir/docs/BufferDeallocationInternals.md
+++ b/mlir/docs/BufferDeallocationInternals.md
@@ -779,8 +779,8 @@ the deallocation of the source value.
## Known Limitations
BufferDeallocation introduces additional copies using allocations from the
-“memref” dialect (“memref.alloc”). Analogous, all deallocations use the
-“memref” dialect-free operation “memref.dealloc”. The actual copy process is
-realized using “linalg.copy”. Furthermore, buffers are essentially immutable
-after their creation in a block. Another limitations are known in the case
-using unstructered control flow.
+“std” dialect (“std.alloc”). Analogous, all deallocations use the “std”
+dialect-free operation “std.dealloc”. The actual copy process is realized using
+“linalg.copy”. Furthermore, buffers are essentially immutable after their
+creation in a block. Another limitations are known in the case using
+unstructered control flow.
diff --git a/mlir/docs/Dialects/Linalg.md b/mlir/docs/Dialects/Linalg.md
index f7678c2834e1..dc9353c9748b 100644
--- a/mlir/docs/Dialects/Linalg.md
+++ b/mlir/docs/Dialects/Linalg.md
@@ -406,9 +406,9 @@ into a form that will resemble:
#map0 = affine_map<(d0, d1)[s0, s1, s2] -> (d0 * s1 + s0 + d1 * s2)>
func @example(%arg0: memref<?x?xf32>, %arg1: memref<?x?xf32>, %arg2: memref<?x?xf32>) {
- %0 = memref.cast %arg0 : memref<?x?xf32> to memref<?x?xf32, #map0>
- %1 = memref.cast %arg1 : memref<?x?xf32> to memref<?x?xf32, #map0>
- %2 = memref.cast %arg2 : memref<?x?xf32> to memref<?x?xf32, #map0>
+ %0 = memref_cast %arg0 : memref<?x?xf32> to memref<?x?xf32, #map0>
+ %1 = memref_cast %arg1 : memref<?x?xf32> to memref<?x?xf32, #map0>
+ %2 = memref_cast %arg2 : memref<?x?xf32> to memref<?x?xf32, #map0>
call @pointwise_add(%0, %1, %2) : (memref<?x?xf32, #map0>, memref<?x?xf32, #map0>, memref<?x?xf32, #map0>) -> ()
return
}
@@ -518,9 +518,9 @@ A set of ops that manipulate metadata but do not move memory. These ops take
generally alias the operand `view`. At the moment the existing ops are:
```
-* `memref.view`,
+* `std.view`,
* `std.subview`,
-* `memref.transpose`.
+* `std.transpose`.
* `linalg.range`,
* `linalg.slice`,
* `linalg.reshape`,
diff --git a/mlir/docs/Traits.md b/mlir/docs/Traits.md
index b38f44ae317e..0b85929aab93 100644
--- a/mlir/docs/Traits.md
+++ b/mlir/docs/Traits.md
@@ -211,7 +211,7 @@ are nested inside of other operations that themselves have this trait.
This trait is carried by region holding operations that define a new scope for
automatic allocation. Such allocations are automatically freed when control is
transferred back from the regions of such operations. As an example, allocations
-performed by [`memref.alloca`](Dialects/Standard.md#stdalloca-allocaop) are
+performed by [`std.alloca`](Dialects/Standard.md#stdalloca-allocaop) are
automatically freed when control leaves the region of its closest surrounding op
that has the trait AutomaticAllocationScope.
diff --git a/mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp b/mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp
index 94ba7c3ef3bd..46d8fe40e5d4 100644
--- a/mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp
+++ b/mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp
@@ -16,7 +16,6 @@
#include "toy/Passes.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
@@ -37,7 +36,7 @@ static MemRefType convertTensorToMemRef(TensorType type) {
/// Insert an allocation and deallocation for the given MemRefType.
static Value insertAllocAndDealloc(MemRefType type, Location loc,
PatternRewriter &rewriter) {
- auto alloc = rewriter.create<memref::AllocOp>(loc, type);
+ auto alloc = rewriter.create<AllocOp>(loc, type);
// Make sure to allocate at the beginning of the block.
auto *parentBlock = alloc->getBlock();
@@ -45,7 +44,7 @@ static Value insertAllocAndDealloc(MemRefType type, Location loc,
// Make sure to deallocate this alloc at the end of the block. This is fine
// as toy functions have no control flow.
- auto dealloc = rewriter.create<memref::DeallocOp>(loc, alloc);
+ auto dealloc = rewriter.create<DeallocOp>(loc, alloc);
dealloc->moveBefore(&parentBlock->back());
return alloc;
}
@@ -153,8 +152,8 @@ struct ConstantOpLowering : public OpRewritePattern<toy::ConstantOp> {
if (!valueShape.empty()) {
for (auto i : llvm::seq<int64_t>(
- 0, *std::max_element(valueShape.begin(), valueShape.end())))
- constantIndices.push_back(rewriter.create<ConstantIndexOp>(loc, i));
+ 0, *std::max_element(valueShape.begin(), valueShape.end())))
+ constantIndices.push_back(rewriter.create<ConstantIndexOp>(loc, i));
} else {
// This is the case of a tensor of rank 0.
constantIndices.push_back(rewriter.create<ConstantIndexOp>(loc, 0));
@@ -285,8 +284,7 @@ void ToyToAffineLoweringPass::runOnFunction() {
// We define the specific operations, or dialects, that are legal targets for
// this lowering. In our case, we are lowering to a combination of the
// `Affine` and `Standard` dialects.
- target.addLegalDialect<AffineDialect, memref::MemRefDialect,
- StandardOpsDialect>();
+ target.addLegalDialect<AffineDialect, StandardOpsDialect>();
// We also define the Toy dialect as Illegal so that the conversion will fail
// if any of these operations are *not* converted. Given that we actually want
diff --git a/mlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp b/mlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp
index ecffe77b35dc..2089b6579ccb 100644
--- a/mlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp
+++ b/mlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp
@@ -16,7 +16,6 @@
#include "toy/Passes.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
@@ -37,7 +36,7 @@ static MemRefType convertTensorToMemRef(TensorType type) {
/// Insert an allocation and deallocation for the given MemRefType.
static Value insertAllocAndDealloc(MemRefType type, Location loc,
PatternRewriter &rewriter) {
- auto alloc = rewriter.create<memref::AllocOp>(loc, type);
+ auto alloc = rewriter.create<AllocOp>(loc, type);
// Make sure to allocate at the beginning of the block.
auto *parentBlock = alloc->getBlock();
@@ -45,7 +44,7 @@ static Value insertAllocAndDealloc(MemRefType type, Location loc,
// Make sure to deallocate this alloc at the end of the block. This is fine
// as toy functions have no control flow.
- auto dealloc = rewriter.create<memref::DeallocOp>(loc, alloc);
+ auto dealloc = rewriter.create<DeallocOp>(loc, alloc);
dealloc->moveBefore(&parentBlock->back());
return alloc;
}
@@ -153,8 +152,8 @@ struct ConstantOpLowering : public OpRewritePattern<toy::ConstantOp> {
if (!valueShape.empty()) {
for (auto i : llvm::seq<int64_t>(
- 0, *std::max_element(valueShape.begin(), valueShape.end())))
- constantIndices.push_back(rewriter.create<ConstantIndexOp>(loc, i));
+ 0, *std::max_element(valueShape.begin(), valueShape.end())))
+ constantIndices.push_back(rewriter.create<ConstantIndexOp>(loc, i));
} else {
// This is the case of a tensor of rank 0.
constantIndices.push_back(rewriter.create<ConstantIndexOp>(loc, 0));
@@ -284,8 +283,7 @@ void ToyToAffineLoweringPass::runOnFunction() {
// We define the specific operations, or dialects, that are legal targets for
// this lowering. In our case, we are lowering to a combination of the
// `Affine` and `Standard` dialects.
- target.addLegalDialect<AffineDialect, memref::MemRefDialect,
- StandardOpsDialect>();
+ target.addLegalDialect<AffineDialect, StandardOpsDialect>();
// We also define the Toy dialect as Illegal so that the conversion will fail
// if any of these operations are *not* converted. Given that we actually want
diff --git a/mlir/examples/toy/Ch7/mlir/LowerToAffineLoops.cpp b/mlir/examples/toy/Ch7/mlir/LowerToAffineLoops.cpp
index 94ba7c3ef3bd..46d8fe40e5d4 100644
--- a/mlir/examples/toy/Ch7/mlir/LowerToAffineLoops.cpp
+++ b/mlir/examples/toy/Ch7/mlir/LowerToAffineLoops.cpp
@@ -16,7 +16,6 @@
#include "toy/Passes.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
@@ -37,7 +36,7 @@ static MemRefType convertTensorToMemRef(TensorType type) {
/// Insert an allocation and deallocation for the given MemRefType.
static Value insertAllocAndDealloc(MemRefType type, Location loc,
PatternRewriter &rewriter) {
- auto alloc = rewriter.create<memref::AllocOp>(loc, type);
+ auto alloc = rewriter.create<AllocOp>(loc, type);
// Make sure to allocate at the beginning of the block.
auto *parentBlock = alloc->getBlock();
@@ -45,7 +44,7 @@ static Value insertAllocAndDealloc(MemRefType type, Location loc,
// Make sure to deallocate this alloc at the end of the block. This is fine
// as toy functions have no control flow.
- auto dealloc = rewriter.create<memref::DeallocOp>(loc, alloc);
+ auto dealloc = rewriter.create<DeallocOp>(loc, alloc);
dealloc->moveBefore(&parentBlock->back());
return alloc;
}
@@ -153,8 +152,8 @@ struct ConstantOpLowering : public OpRewritePattern<toy::ConstantOp> {
if (!valueShape.empty()) {
for (auto i : llvm::seq<int64_t>(
- 0, *std::max_element(valueShape.begin(), valueShape.end())))
- constantIndices.push_back(rewriter.create<ConstantIndexOp>(loc, i));
+ 0, *std::max_element(valueShape.begin(), valueShape.end())))
+ constantIndices.push_back(rewriter.create<ConstantIndexOp>(loc, i));
} else {
// This is the case of a tensor of rank 0.
constantIndices.push_back(rewriter.create<ConstantIndexOp>(loc, 0));
@@ -285,8 +284,7 @@ void ToyToAffineLoweringPass::runOnFunction() {
// We define the specific operations, or dialects, that are legal targets for
// this lowering. In our case, we are lowering to a combination of the
// `Affine` and `Standard` dialects.
- target.addLegalDialect<AffineDialect, memref::MemRefDialect,
- StandardOpsDialect>();
+ target.addLegalDialect<AffineDialect, StandardOpsDialect>();
// We also define the Toy dialect as Illegal so that the conversion will fail
// if any of these operations are *not* converted. Given that we actually want
diff --git a/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h b/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h
index ca623a3c050e..02fefc689bac 100644
--- a/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h
+++ b/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h
@@ -72,8 +72,7 @@ void populateStdToLLVMConversionPatterns(LLVMTypeConverter &converter,
/// Creates a pass to convert the Standard dialect into the LLVMIR dialect.
/// stdlib malloc/free is used by default for allocating memrefs allocated with
-/// memref.alloc, while LLVM's alloca is used for those allocated with
-/// memref.alloca.
+/// std.alloc, while LLVM's alloca is used for those allocated with std.alloca.
std::unique_ptr<OperationPass<ModuleOp>>
createLowerToLLVMPass(const LowerToLLVMOptions &options =
LowerToLLVMOptions::getDefaultOptions());
diff --git a/mlir/include/mlir/Dialect/CMakeLists.txt b/mlir/include/mlir/Dialect/CMakeLists.txt
index e00886adb32e..193e93d56fe4 100644
--- a/mlir/include/mlir/Dialect/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/CMakeLists.txt
@@ -8,7 +8,6 @@ add_subdirectory(GPU)
add_subdirectory(Math)
add_subdirectory(Linalg)
add_subdirectory(LLVMIR)
-add_subdirectory(MemRef)
add_subdirectory(OpenACC)
add_subdirectory(OpenMP)
add_subdirectory(PDL)
diff --git a/mlir/include/mlir/Dialect/GPU/GPUOps.td b/mlir/include/mlir/Dialect/GPU/GPUOps.td
index 0b07e7223d53..915347e0647e 100644
--- a/mlir/include/mlir/Dialect/GPU/GPUOps.td
+++ b/mlir/include/mlir/Dialect/GPU/GPUOps.td
@@ -812,7 +812,7 @@ def GPU_AllocOp : GPU_Op<"alloc", [
let summary = "GPU memory allocation operation.";
let description = [{
The `gpu.alloc` operation allocates a region of memory on the GPU. It is
- similar to the `memref.alloc` op, but supports asynchronous GPU execution.
+ similar to the `std.alloc` op, but supports asynchronous GPU execution.
The op does not execute before all async dependencies have finished
executing.
@@ -850,7 +850,7 @@ def GPU_DeallocOp : GPU_Op<"dealloc", [GPU_AsyncOpInterface]> {
let description = [{
The `gpu.dealloc` operation frees the region of memory referenced by a
memref which was originally created by the `gpu.alloc` operation. It is
- similar to the `memref.dealloc` op, but supports asynchronous GPU execution.
+ similar to the `std.dealloc` op, but supports asynchronous GPU execution.
The op does not execute before all async dependencies have finished
executing.
diff --git a/mlir/include/mlir/Dialect/Linalg/EDSC/FoldedIntrinsics.h b/mlir/include/mlir/Dialect/Linalg/EDSC/FoldedIntrinsics.h
index 0e184ac96a39..d98ec90a47e0 100644
--- a/mlir/include/mlir/Dialect/Linalg/EDSC/FoldedIntrinsics.h
+++ b/mlir/include/mlir/Dialect/Linalg/EDSC/FoldedIntrinsics.h
@@ -35,9 +35,6 @@ struct FoldedValueBuilder {
};
using folded_math_tanh = FoldedValueBuilder<math::TanhOp>;
-using folded_memref_alloc = FoldedValueBuilder<memref::AllocOp>;
-using folded_memref_cast = FoldedValueBuilder<memref::CastOp>;
-using folded_memref_view = FoldedValueBuilder<memref::ViewOp>;
using folded_std_constant_index = FoldedValueBuilder<ConstantIndexOp>;
using folded_std_constant_float = FoldedValueBuilder<ConstantFloatOp>;
using folded_std_constant_int = FoldedValueBuilder<ConstantIntOp>;
@@ -46,6 +43,7 @@ using folded_std_dim = FoldedValueBuilder<DimOp>;
using folded_std_muli = FoldedValueBuilder<MulIOp>;
using folded_std_addi = FoldedValueBuilder<AddIOp>;
using folded_std_addf = FoldedValueBuilder<AddFOp>;
+using folded_std_alloc = FoldedValueBuilder<AllocOp>;
using folded_std_constant = FoldedValueBuilder<ConstantOp>;
using folded_std_constant_float = FoldedValueBuilder<ConstantFloatOp>;
using folded_std_constant_index = FoldedValueBuilder<ConstantIndexOp>;
@@ -54,11 +52,13 @@ using folded_std_dim = FoldedValueBuilder<DimOp>;
using folded_std_index_cast = FoldedValueBuilder<IndexCastOp>;
using folded_std_muli = FoldedValueBuilder<MulIOp>;
using folded_std_mulf = FoldedValueBuilder<MulFOp>;
+using folded_std_memref_cast = FoldedValueBuilder<MemRefCastOp>;
using folded_std_select = FoldedValueBuilder<SelectOp>;
using folded_std_load = FoldedValueBuilder<LoadOp>;
using folded_std_subi = FoldedValueBuilder<SubIOp>;
using folded_std_sub_view = FoldedValueBuilder<SubViewOp>;
using folded_std_tensor_load = FoldedValueBuilder<TensorLoadOp>;
+using folded_std_view = FoldedValueBuilder<ViewOp>;
using folded_std_zero_extendi = FoldedValueBuilder<ZeroExtendIOp>;
using folded_std_sign_extendi = FoldedValueBuilder<SignExtendIOp>;
using folded_tensor_extract = FoldedValueBuilder<tensor::ExtractOp>;
diff --git a/mlir/include/mlir/Dialect/Linalg/Passes.h b/mlir/include/mlir/Dialect/Linalg/Passes.h
index 7442c820d5e8..5d68328acc7e 100644
--- a/mlir/include/mlir/Dialect/Linalg/Passes.h
+++ b/mlir/include/mlir/Dialect/Linalg/Passes.h
@@ -34,11 +34,11 @@ createLinalgPromotionPass(bool dynamicBuffers, bool useAlloca);
std::unique_ptr<OperationPass<FuncOp>> createLinalgPromotionPass();
/// Create a pass to convert Linalg operations to scf.for loops and
-/// std.load/memref.store accesses.
+/// std.load/std.store accesses.
std::unique_ptr<OperationPass<FuncOp>> createConvertLinalgToLoopsPass();
/// Create a pass to convert Linalg operations to scf.parallel loops and
-/// std.load/memref.store accesses.
+/// std.load/std.store accesses.
std::unique_ptr<OperationPass<FuncOp>> createConvertLinalgToParallelLoopsPass();
/// Create a pass to convert Linalg operations to affine.for loops and
diff --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
index 697288b9b5e6..5c0d1dc3a2fa 100644
--- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
@@ -822,7 +822,7 @@ struct PadTensorOpVectorizationPattern : public OpRewritePattern<PadTensorOp> {
/// Match and rewrite for the pattern:
/// ```
/// %alloc = ...
-/// [optional] %view = memref.view %alloc ...
+/// [optional] %view = std.view %alloc ...
/// %subView = subview %allocOrView ...
/// [optional] linalg.fill(%allocOrView, %cst) ...
/// ...
@@ -832,7 +832,7 @@ struct PadTensorOpVectorizationPattern : public OpRewritePattern<PadTensorOp> {
/// into
/// ```
/// [unchanged] %alloc = ...
-/// [unchanged] [optional] %view = memref.view %alloc ...
+/// [unchanged] [optional] %view = std.view %alloc ...
/// [unchanged] [unchanged] %subView = subview %allocOrView ...
/// ...
/// vector.transfer_read %in[...], %cst ...
@@ -853,7 +853,7 @@ struct LinalgCopyVTRForwardingPattern
/// Match and rewrite for the pattern:
/// ```
/// %alloc = ...
-/// [optional] %view = memref.view %alloc ...
+/// [optional] %view = std.view %alloc ...
/// %subView = subview %allocOrView...
/// ...
/// vector.transfer_write %..., %allocOrView[...]
@@ -862,7 +862,7 @@ struct LinalgCopyVTRForwardingPattern
/// into
/// ```
/// [unchanged] %alloc = ...
-/// [unchanged] [optional] %view = memref.view %alloc ...
+/// [unchanged] [optional] %view = std.view %alloc ...
/// [unchanged] %subView = subview %allocOrView...
/// ...
/// vector.transfer_write %..., %out[...]
diff --git a/mlir/include/mlir/Dialect/MemRef/CMakeLists.txt b/mlir/include/mlir/Dialect/MemRef/CMakeLists.txt
deleted file mode 100644
index f33061b2d87c..000000000000
--- a/mlir/include/mlir/Dialect/MemRef/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-add_subdirectory(IR)
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/CMakeLists.txt b/mlir/include/mlir/Dialect/MemRef/IR/CMakeLists.txt
deleted file mode 100644
index 762f8dd133cd..000000000000
--- a/mlir/include/mlir/Dialect/MemRef/IR/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-add_mlir_dialect(MemRefOps memref)
-add_mlir_doc(MemRefOps -gen-dialect-doc MemRefOps Dialects/)
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h b/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
deleted file mode 100644
index 941dfa01504d..000000000000
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//===- MemRef.h - MemRef dialect --------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef MLIR_DIALECT_MEMREF_IR_MEMREF_H_
-#define MLIR_DIALECT_MEMREF_IR_MEMREF_H_
-
-#include "mlir/IR/BuiltinTypes.h"
-#include "mlir/IR/Dialect.h"
-#include "mlir/IR/OpDefinition.h"
-#include "mlir/IR/OpImplementation.h"
-#include "mlir/Interfaces/CallInterfaces.h"
-#include "mlir/Interfaces/CastInterfaces.h"
-#include "mlir/Interfaces/SideEffectInterfaces.h"
-#include "mlir/Interfaces/ViewLikeInterface.h"
-
-//===----------------------------------------------------------------------===//
-// MemRef Dialect
-//===----------------------------------------------------------------------===//
-
-#include "mlir/Dialect/MemRef/IR/MemRefOpsDialect.h.inc"
-
-//===----------------------------------------------------------------------===//
-// MemRef Dialect Operations
-//===----------------------------------------------------------------------===//
-
-#define GET_OP_CLASSES
-#include "mlir/Dialect/MemRef/IR/MemRefOps.h.inc"
-
-#endif // MLIR_DIALECT_MEMREF_IR_MEMREF_H_
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRefBase.td b/mlir/include/mlir/Dialect/MemRef/IR/MemRefBase.td
deleted file mode 100644
index d728c5604118..000000000000
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefBase.td
+++ /dev/null
@@ -1,24 +0,0 @@
-//===- MemRefBase.td - Base definitions for memref dialect -*- tablegen -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef MEMREF_BASE
-#define MEMREF_BASE
-
-include "mlir/IR/OpBase.td"
-
-def MemRef_Dialect : Dialect {
- let name = "memref";
- let cppNamespace = "::mlir::memref";
- let description = [{
- The `memref` dialect is intended to hold core memref creation and
- manipulation ops, which are not strongly associated with any particular
- other dialect or domain abstraction.
- }];
-}
-
-#endif // MEMREF_BASE
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
deleted file mode 100644
index d821d29d4715..000000000000
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
+++ /dev/null
@@ -1,681 +0,0 @@
-//===- MemRefOps.td - MemRef op definitions ----------------*- tablegen -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef MEMREF_OPS
-#define MEMREF_OPS
-
-include "mlir/Dialect/MemRef/IR/MemRefBase.td"
-include "mlir/Interfaces/CastInterfaces.td"
-include "mlir/Interfaces/SideEffectInterfaces.td"
-include "mlir/Interfaces/ViewLikeInterface.td"
-include "mlir/IR/SymbolInterfaces.td"
-
-class MemRef_Op<string mnemonic, list<OpTrait> traits = []>
- : Op<MemRef_Dialect, mnemonic, traits> {
- let printer = [{ return ::print(p, *this); }];
- let verifier = [{ return ::verify(*this); }];
- let parser = [{ return ::parse$cppClass(parser, result); }];
-}
-
-//===----------------------------------------------------------------------===//
-// AllocLikeOp
-//===----------------------------------------------------------------------===//
-
-// Base class for memref allocating ops: alloca and alloc.
-//
-// %0 = alloclike(%m)[%s] : memref<8x?xf32, (d0, d1)[s0] -> ((d0 + s0), d1)>
-//
-class AllocLikeOp<string mnemonic,
- Resource resource,
- list<OpTrait> traits = []> :
- MemRef_Op<mnemonic,
- !listconcat([
- AttrSizedOperandSegments
- ], traits)> {
-
- let arguments = (ins Variadic<Index>:$dynamicSizes,
- // The symbolic operands (the ones in square brackets) bind
- // to the symbols of the memref's layout map.
- Variadic<Index>:$symbolOperands,
- Confined<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$alignment);
- let results = (outs Res<AnyMemRef, "", [MemAlloc<resource>]>:$memref);
-
- let builders = [
- OpBuilderDAG<(ins "MemRefType":$memrefType,
- CArg<"IntegerAttr", "IntegerAttr()">:$alignment), [{
- return build($_builder, $_state, memrefType, {}, alignment);
- }]>,
- OpBuilderDAG<(ins "MemRefType":$memrefType, "ValueRange":$dynamicSizes,
- CArg<"IntegerAttr", "IntegerAttr()">:$alignment), [{
- return build($_builder, $_state, memrefType, dynamicSizes, {}, alignment);
- }]>,
- OpBuilderDAG<(ins "MemRefType":$memrefType, "ValueRange":$dynamicSizes,
- "ValueRange":$symbolOperands,
- CArg<"IntegerAttr", "{}">:$alignment), [{
- $_state.types.push_back(memrefType);
- $_state.addOperands(dynamicSizes);
- $_state.addOperands(symbolOperands);
- $_state.addAttribute(getOperandSegmentSizeAttr(),
- $_builder.getI32VectorAttr({
- static_cast<int32_t>(dynamicSizes.size()),
- static_cast<int32_t>(symbolOperands.size())}));
- if (alignment)
- $_state.addAttribute(getAlignmentAttrName(), alignment);
- }]>];
-
- let extraClassDeclaration = [{
- static StringRef getAlignmentAttrName() { return "alignment"; }
-
- MemRefType getType() { return getResult().getType().cast<MemRefType>(); }
-
- /// Returns the dynamic sizes for this alloc operation if specified.
- operand_range getDynamicSizes() { return dynamicSizes(); }
- }];
-
- let assemblyFormat = [{
- `(`$dynamicSizes`)` (`` `[` $symbolOperands^ `]`)? attr-dict `:` type($memref)
- }];
-
- let hasCanonicalizer = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// BaseCastOp
-//===----------------------------------------------------------------------===//
-
-// Base class for standard cast operations. Requires single operand and result,
-// but does not constrain them to specific types.
-class CastOp<string mnemonic, list<OpTrait> traits = []> :
- MemRef_Op<mnemonic, traits # [
- NoSideEffect, SameOperandsAndResultShape,
- DeclareOpInterfaceMethods<CastOpInterface>
- ]> {
- let results = (outs AnyType);
-
- let builders = [
- OpBuilderDAG<(ins "Value":$source, "Type":$destType), [{
- impl::buildCastOp($_builder, $_state, source, destType);
- }]>
- ];
-
- let parser = [{
- return impl::parseCastOp(parser, result);
- }];
- let printer = [{
- return printStandardCastOp(this->getOperation(), p);
- }];
-
- // Cast operations are fully verified by its traits.
- let verifier = ?;
-}
-
-//===----------------------------------------------------------------------===//
-// AllocOp
-//===----------------------------------------------------------------------===//
-
-def MemRef_AllocOp : AllocLikeOp<"alloc", DefaultResource> {
- let summary = "memory allocation operation";
- let description = [{
- The `alloc` operation allocates a region of memory, as specified by its
- memref type.
-
- Example:
-
- ```mlir
- %0 = memref.alloc() : memref<8x64xf32, 1>
- ```
-
- The optional list of dimension operands are bound to the dynamic dimensions
- specified in its memref type. In the example below, the ssa value '%d' is
- bound to the second dimension of the memref (which is dynamic).
-
- ```mlir
- %0 = memref.alloc(%d) : memref<8x?xf32, 1>
- ```
-
- The optional list of symbol operands are bound to the symbols of the
- memrefs affine map. In the example below, the ssa value '%s' is bound to
- the symbol 's0' in the affine map specified in the allocs memref type.
-
- ```mlir
- %0 = memref.alloc()[%s] : memref<8x64xf32,
- affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1>
- ```
-
- This operation returns a single ssa value of memref type, which can be used
- by subsequent load and store operations.
-
- The optional `alignment` attribute may be specified to ensure that the
- region of memory that will be indexed is aligned at the specified byte
- boundary.
-
- ```mlir
- %0 = memref.alloc()[%s] {alignment = 8} :
- memref<8x64xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1>
- ```
- }];
-}
-
-//===----------------------------------------------------------------------===//
-// AllocaOp
-//===----------------------------------------------------------------------===//
-
-def MemRef_AllocaOp : AllocLikeOp<"alloca", AutomaticAllocationScopeResource> {
- let summary = "stack memory allocation operation";
- let description = [{
- The `alloca` operation allocates memory on the stack, to be automatically
- released when control transfers back from the region of its closest
- surrounding operation with an
- [`AutomaticAllocationScope`](../Traits.md#automaticallocationscope) trait.
- The amount of memory allocated is specified by its memref and additional
- operands. For example:
-
- ```mlir
- %0 = memref.alloca() : memref<8x64xf32>
- ```
-
- The optional list of dimension operands are bound to the dynamic dimensions
- specified in its memref type. In the example below, the SSA value '%d' is
- bound to the second dimension of the memref (which is dynamic).
-
- ```mlir
- %0 = memref.alloca(%d) : memref<8x?xf32>
- ```
-
- The optional list of symbol operands are bound to the symbols of the
- memref's affine map. In the example below, the SSA value '%s' is bound to
- the symbol 's0' in the affine map specified in the allocs memref type.
-
- ```mlir
- %0 = memref.alloca()[%s] : memref<8x64xf32,
- affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>>
- ```
-
- This operation returns a single SSA value of memref type, which can be used
- by subsequent load and store operations. An optional alignment attribute, if
- specified, guarantees alignment at least to that boundary. If not specified,
- an alignment on any convenient boundary compatible with the type will be
- chosen.
- }];
-}
-
-//===----------------------------------------------------------------------===//
-// CastOp
-//===----------------------------------------------------------------------===//
-
-def MemRef_CastOp : CastOp<"cast", [NoSideEffect]> {
- let summary = "memref cast operation";
- let description = [{
- Syntax:
-
- ```
- operation ::= ssa-id `=` `memref.cast` ssa-use `:` type `to` type
- ```
-
- The `memref.cast` operation converts a memref from one type to an equivalent
- type with a compatible shape. The source and destination types are
- compatible if:
-
- a. Both are ranked memref types with the same element type, address space,
- and rank and:
- 1. Both have the same layout or both have compatible strided layouts.
- 2. The individual sizes (resp. offset and strides in the case of strided
- memrefs) may convert constant dimensions to dynamic dimensions and
- vice-versa.
-
- If the cast converts any dimensions from an unknown to a known size, then it
- acts as an assertion that fails at runtime if the dynamic dimensions
- disagree with resultant destination size.
-
- Example:
-
- ```mlir
- // Assert that the input dynamic shape matches the destination static shape.
- %2 = memref.cast %1 : memref<?x?xf32> to memref<4x4xf32>
- // Erase static shape information, replacing it with dynamic information.
- %3 = memref.cast %1 : memref<4xf32> to memref<?xf32>
-
- // The same holds true for offsets and strides.
-
- // Assert that the input dynamic shape matches the destination static stride.
- %4 = memref.cast %1 : memref<12x4xf32, offset:?, strides: [?, ?]> to
- memref<12x4xf32, offset:5, strides: [4, 1]>
- // Erase static offset and stride information, replacing it with
- // dynamic information.
- %5 = memref.cast %1 : memref<12x4xf32, offset:5, strides: [4, 1]> to
- memref<12x4xf32, offset:?, strides: [?, ?]>
- ```
-
- b. Either or both memref types are unranked with the same element type, and
- address space.
-
- Example:
-
- ```mlir
- Cast to concrete shape.
- %4 = memref.cast %1 : memref<*xf32> to memref<4x?xf32>
-
- Erase rank information.
- %5 = memref.cast %1 : memref<4x?xf32> to memref<*xf32>
- ```
- }];
-
- let arguments = (ins AnyRankedOrUnrankedMemRef:$source);
- let results = (outs AnyRankedOrUnrankedMemRef:$dest);
- let assemblyFormat = "$source attr-dict `:` type($source) `to` type($dest)";
- let verifier = "return impl::verifyCastOp(*this, areCastCompatible);";
- let builders = [
- OpBuilderDAG<(ins "Value":$source, "Type":$destType), [{
- impl::buildCastOp($_builder, $_state, source, destType);
- }]>
- ];
-
- let extraClassDeclaration = [{
- /// Fold the given CastOp into consumer op.
- static bool canFoldIntoConsumerOp(CastOp castOp);
- }];
-
- let hasFolder = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// DeallocOp
-//===----------------------------------------------------------------------===//
-
-def MemRef_DeallocOp : MemRef_Op<"dealloc", [MemRefsNormalizable]> {
- let summary = "memory deallocation operation";
- let description = [{
- The `dealloc` operation frees the region of memory referenced by a memref
- which was originally created by the `alloc` operation.
- The `dealloc` operation should not be called on memrefs which alias an
- alloc'd memref (e.g. memrefs returned by `view` operations).
-
- Example:
-
- ```mlir
- %0 = memref.alloc() : memref<8x64xf32, (d0, d1) -> (d0, d1), 1>
- memref.dealloc %0 : memref<8x64xf32, (d0, d1) -> (d0, d1), 1>
- ```
- }];
-
- let arguments = (ins Arg<AnyMemRef, "", [MemFree]>:$memref);
-
- let hasCanonicalizer = 1;
- let hasFolder = 1;
- let assemblyFormat = "$memref attr-dict `:` type($memref)";
-}
-
-//===----------------------------------------------------------------------===//
-// GetGlobalOp
-//===----------------------------------------------------------------------===//
-
-def MemRef_GetGlobalOp : MemRef_Op<"get_global",
- [NoSideEffect, DeclareOpInterfaceMethods<SymbolUserOpInterface>]> {
- let summary = "get the memref pointing to a global variable";
- let description = [{
- The `memref.get_global` operation retrieves the memref pointing to a
- named global variable. If the global variable is marked constant, writing
- to the result memref (such as through a `memref.store` operation) is
- undefined.
-
- Example:
-
- ```mlir
- %x = memref.get_global @foo : memref<2xf32>
- ```
- }];
-
- let arguments = (ins FlatSymbolRefAttr:$name);
- let results = (outs AnyStaticShapeMemRef:$result);
- let assemblyFormat = "$name `:` type($result) attr-dict";
-
- // `GetGlobalOp` is fully verified by its traits.
- let verifier = ?;
-}
-
-//===----------------------------------------------------------------------===//
-// GlobalOp
-//===----------------------------------------------------------------------===//
-
-def MemRef_GlobalOp : MemRef_Op<"global", [Symbol]> {
- let summary = "declare or define a global memref variable";
- let description = [{
- The `memref.global` operation declares or defines a named global variable.
- The backing memory for the variable is allocated statically and is described
- by the type of the variable (which should be a statically shaped memref
- type). The operation is a declaration if no `inital_value` is specified,
- else it is a definition. The `initial_value` can either be a unit attribute
- to represent a definition of an uninitialized global variable, or an
- elements attribute to represent the definition of a global variable with an
- initial value. The global variable can also be marked constant using the
- `constant` unit attribute. Writing to such constant global variables is
- undefined.
-
- The global variable can be accessed by using the `memref.get_global` to
- retrieve the memref for the global variable. Note that the memref
- for such global variable itself is immutable (i.e., memref.get_global for a
- given global variable will always return the same memref descriptor).
-
- Example:
-
- ```mlir
- // Private variable with an initial value.
- memref.global "private" @x : memref<2xf32> = dense<0.0,2.0>
-
- // Declaration of an external variable.
- memref.global "private" @y : memref<4xi32>
-
- // Uninitialized externally visible variable.
- memref.global @z : memref<3xf16> = uninitialized
-
- // Externally visible constant variable.
- memref.global constant @c : memref<2xi32> = dense<1, 4>
- ```
- }];
-
- let arguments = (ins
- SymbolNameAttr:$sym_name,
- OptionalAttr<StrAttr>:$sym_visibility,
- TypeAttr:$type,
- OptionalAttr<AnyAttr>:$initial_value,
- UnitAttr:$constant
- );
-
- let assemblyFormat = [{
- ($sym_visibility^)?
- (`constant` $constant^)?
- $sym_name `:`
- custom<GlobalMemrefOpTypeAndInitialValue>($type, $initial_value)
- attr-dict
- }];
-
- let extraClassDeclaration = [{
- bool isExternal() { return !initial_value(); }
- bool isUninitialized() {
- return !isExternal() && initial_value().getValue().isa<UnitAttr>();
- }
- }];
-}
-
-//===----------------------------------------------------------------------===//
-// PrefetchOp
-//===----------------------------------------------------------------------===//
-
-def MemRef_PrefetchOp : MemRef_Op<"prefetch"> {
- let summary = "prefetch operation";
- let description = [{
- The "prefetch" op prefetches data from a memref location described with
- subscript indices similar to std.load, and with three attributes: a
- read/write specifier, a locality hint, and a cache type specifier as shown
- below:
-
- ```mlir
- memref.prefetch %0[%i, %j], read, locality<3>, data : memref<400x400xi32>
- ```
-
- The read/write specifier is either 'read' or 'write', the locality hint
- ranges from locality<0> (no locality) to locality<3> (extremely local keep
- in cache). The cache type specifier is either 'data' or 'instr'
- and specifies whether the prefetch is performed on data cache or on
- instruction cache.
- }];
-
- let arguments = (ins AnyMemRef:$memref, Variadic<Index>:$indices,
- BoolAttr:$isWrite,
- Confined<I32Attr, [IntMinValue<0>,
- IntMaxValue<3>]>:$localityHint,
- BoolAttr:$isDataCache);
-
- let extraClassDeclaration = [{
- MemRefType getMemRefType() {
- return memref().getType().cast<MemRefType>();
- }
- static StringRef getLocalityHintAttrName() { return "localityHint"; }
- static StringRef getIsWriteAttrName() { return "isWrite"; }
- static StringRef getIsDataCacheAttrName() { return "isDataCache"; }
- }];
-
- let hasFolder = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// ReshapeOp
-//===----------------------------------------------------------------------===//
-
-def MemRef_ReshapeOp: MemRef_Op<"reshape", [
- ViewLikeOpInterface, NoSideEffect]> {
- let summary = "memref reshape operation";
- let description = [{
- The `reshape` operation converts a memref from one type to an
- equivalent type with a provided shape. The data is never copied or
- modified. The source and destination types are compatible if both have the
- same element type, same number of elements, address space and identity
- layout map. The following combinations are possible:
-
- a. Source type is ranked or unranked. Shape argument has static size.
- Result type is ranked.
-
- ```mlir
- // Reshape statically-shaped memref.
- %dst = memref.reshape %src(%shape)
- : (memref<4x1xf32>, memref<1xi32>) to memref<4xf32>
- %dst0 = memref.reshape %src(%shape0)
- : (memref<4x1xf32>, memref<2xi32>) to memref<2x2xf32>
- // Flatten unranked memref.
- %dst = memref.reshape %src(%shape)
- : (memref<*xf32>, memref<1xi32>) to memref<?xf32>
- ```
-
- b. Source type is ranked or unranked. Shape argument has dynamic size.
- Result type is unranked.
-
- ```mlir
- // Reshape dynamically-shaped 1D memref.
- %dst = memref.reshape %src(%shape)
- : (memref<?xf32>, memref<?xi32>) to memref<*xf32>
- // Reshape unranked memref.
- %dst = memref.reshape %src(%shape)
- : (memref<*xf32>, memref<?xi32>) to memref<*xf32>
- ```
- }];
-
- let arguments = (ins
- AnyRankedOrUnrankedMemRef:$source,
- MemRefRankOf<[AnySignlessInteger, Index], [1]>:$shape
- );
- let results = (outs AnyRankedOrUnrankedMemRef:$result);
-
- let builders = [OpBuilderDAG<
- (ins "MemRefType":$resultType, "Value":$operand, "Value":$shape), [{
- $_state.addOperands(operand);
- $_state.addOperands(shape);
- $_state.addTypes(resultType);
- }]>];
-
- let extraClassDeclaration = [{
- MemRefType getType() { return getResult().getType().cast<MemRefType>(); }
- Value getViewSource() { return source(); }
- }];
-
- let assemblyFormat = [{
- $source `(` $shape `)` attr-dict `:` functional-type(operands, results)
- }];
-}
-
-//===----------------------------------------------------------------------===//
-// StoreOp
-//===----------------------------------------------------------------------===//
-
-def MemRef_StoreOp : MemRef_Op<"store",
- [TypesMatchWith<"type of 'value' matches element type of 'memref'",
- "memref", "value",
- "$_self.cast<MemRefType>().getElementType()">,
- MemRefsNormalizable]> {
- let summary = "store operation";
- let description = [{
- Store a value to a memref location given by indices. The value stored should
- have the same type as the elemental type of the memref. The number of
- arguments provided within brackets need to match the rank of the memref.
-
- In an affine context, the indices of a store are restricted to SSA values
- bound to surrounding loop induction variables,
- [symbols](Affine.md#restrictions-on-dimensions-and-symbols), results of a
- [`constant` operation](#stdconstant-constantop), or the result of an
- [`affine.apply`](Affine.md#affineapply-affineapplyop) operation that can in
- turn take as arguments all of the aforementioned SSA values or the
- recursively result of such an `affine.apply` operation.
-
- Example:
-
- ```mlir
- memref.store %100, %A[%1, 1023] : memref<4x?xf32, #layout, memspace0>
- ```
-
- **Context:** The `load` and `store` operations are specifically crafted to
- fully resolve a reference to an element of a memref, and (in polyhedral
- `affine.if` and `affine.for` operations) the compiler can follow use-def
- chains (e.g. through [`affine.apply`](Affine.md#affineapply-affineapplyop)
- operations) to precisely analyze references at compile-time using polyhedral
- techniques. This is possible because of the
- [restrictions on dimensions and symbols](Affine.md#restrictions-on-dimensions-and-symbols)
- in these contexts.
- }];
-
- let arguments = (ins AnyType:$value,
- Arg<AnyMemRef, "the reference to store to",
- [MemWrite]>:$memref,
- Variadic<Index>:$indices);
-
- let builders = [
- OpBuilderDAG<(ins "Value":$valueToStore, "Value":$memref), [{
- $_state.addOperands(valueToStore);
- $_state.addOperands(memref);
- }]>];
-
- let extraClassDeclaration = [{
- Value getValueToStore() { return getOperand(0); }
-
- Value getMemRef() { return getOperand(1); }
- void setMemRef(Value value) { setOperand(1, value); }
- MemRefType getMemRefType() {
- return getMemRef().getType().cast<MemRefType>();
- }
-
- operand_range getIndices() {
- return {operand_begin() + 2, operand_end()};
- }
- }];
-
- let hasFolder = 1;
-
- let assemblyFormat = [{
- $value `,` $memref `[` $indices `]` attr-dict `:` type($memref)
- }];
-}
-
-//===----------------------------------------------------------------------===//
-// TransposeOp
-//===----------------------------------------------------------------------===//
-
-def MemRef_TransposeOp : MemRef_Op<"transpose", [NoSideEffect]>,
- Arguments<(ins AnyStridedMemRef:$in, AffineMapAttr:$permutation)>,
- Results<(outs AnyStridedMemRef)> {
- let summary = "`transpose` produces a new strided memref (metadata-only)";
- let description = [{
- The `transpose` op produces a strided memref whose sizes and strides
- are a permutation of the original `in` memref. This is purely a metadata
- transformation.
-
- Example:
-
- ```mlir
- %1 = memref.transpose %0 (i, j) -> (j, i) : memref<?x?xf32> to memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d1 * s0 + d0)>>
- ```
- }];
-
- let builders = [
- OpBuilderDAG<(ins "Value":$in, "AffineMapAttr":$permutation,
- CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>];
-
- let extraClassDeclaration = [{
- static StringRef getPermutationAttrName() { return "permutation"; }
- ShapedType getShapedType() { return in().getType().cast<ShapedType>(); }
- }];
-
- let hasFolder = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// ViewOp
-//===----------------------------------------------------------------------===//
-
-def MemRef_ViewOp : MemRef_Op<"view", [
- DeclareOpInterfaceMethods<ViewLikeOpInterface>, NoSideEffect]> {
- let summary = "memref view operation";
- let description = [{
- The "view" operation extracts an N-D contiguous memref with empty layout map
- with arbitrary element type from a 1-D contiguous memref with empty layout
- map of i8 element type. The ViewOp supports the following arguments:
-
- * A single dynamic byte-shift operand must be specified which represents a
- a shift of the base 1-D memref pointer from which to create the resulting
- contiguous memref view with identity layout.
- * A dynamic size operand that must be specified for each dynamic dimension
- in the resulting view memref type.
-
- The "view" operation gives a structured indexing form to a flat 1-D buffer.
- Unlike "subview" it can perform a type change. The type change behavior
- requires the op to have special semantics because, e.g. a byte shift of 3
- cannot be represented as an offset on f64.
- For now, a "view" op:
-
- 1. Only takes a contiguous source memref with 0 offset and empty layout.
- 2. Must specify a byte_shift operand (in the future, a special integer
- attribute may be added to support the folded case).
- 3. Returns a contiguous memref with 0 offset and empty layout.
-
- Example:
-
- ```mlir
- // Allocate a flat 1D/i8 memref.
- %0 = memref.alloc() : memref<2048xi8>
-
- // ViewOp with dynamic offset and static sizes.
- %1 = memref.view %0[%offset_1024][] : memref<2048xi8> to memref<64x4xf32>
-
- // ViewOp with dynamic offset and two dynamic size.
- %2 = memref.view %0[%offset_1024][%size0, %size1] :
- memref<2048xi8> to memref<?x4x?xf32>
- ```
- }];
-
- let arguments = (ins MemRefRankOf<[I8], [1]>:$source,
- Index:$byte_shift,
- Variadic<Index>:$sizes);
- let results = (outs AnyMemRef);
-
- let extraClassDeclaration = [{
- /// The result of a view is always a memref.
- MemRefType getType() { return getResult().getType().cast<MemRefType>(); }
-
- /// Returns the dynamic sizes for this view operation. This is redundant
- /// with `sizes` but needed in template implementations. More specifically:
- /// ```
- /// template <typename AnyMemRefDefOp>
- /// bool isMemRefSizeValidSymbol(AnyMemRefDefOp memrefDefOp, unsigned index,
- /// Region *region)
- /// ```
- operand_range getDynamicSizes() {
- return {sizes().begin(), sizes().end()};
- }
- }];
-
- let hasCanonicalizer = 1;
-}
-
-#endif // MEMREF_OPS
diff --git a/mlir/include/mlir/Dialect/StandardOps/EDSC/Intrinsics.h b/mlir/include/mlir/Dialect/StandardOps/EDSC/Intrinsics.h
index 28abc560657d..7815ee6d21eb 100644
--- a/mlir/include/mlir/Dialect/StandardOps/EDSC/Intrinsics.h
+++ b/mlir/include/mlir/Dialect/StandardOps/EDSC/Intrinsics.h
@@ -8,7 +8,6 @@
#ifndef MLIR_DIALECT_STANDARDOPS_EDSC_INTRINSICS_H_
#define MLIR_DIALECT_STANDARDOPS_EDSC_INTRINSICS_H_
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/EDSC/Builders.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
@@ -16,19 +15,16 @@ namespace mlir {
namespace edsc {
namespace intrinsics {
-using memref_alloc = ValueBuilder<memref::AllocOp>;
-using memref_alloca = ValueBuilder<memref::AllocaOp>;
-using memref_cast = ValueBuilder<memref::CastOp>;
-using memref_dealloc = OperationBuilder<memref::DeallocOp>;
-using memref_store = OperationBuilder<memref::StoreOp>;
-using memref_view = ValueBuilder<memref::ViewOp>;
using std_addi = ValueBuilder<AddIOp>;
using std_addf = ValueBuilder<AddFOp>;
+using std_alloc = ValueBuilder<AllocOp>;
+using std_alloca = ValueBuilder<AllocaOp>;
using std_call = OperationBuilder<CallOp>;
using std_constant = ValueBuilder<ConstantOp>;
using std_constant_float = ValueBuilder<ConstantFloatOp>;
using std_constant_index = ValueBuilder<ConstantIndexOp>;
using std_constant_int = ValueBuilder<ConstantIntOp>;
+using std_dealloc = OperationBuilder<DeallocOp>;
using std_divis = ValueBuilder<SignedDivIOp>;
using std_diviu = ValueBuilder<UnsignedDivIOp>;
using std_dim = ValueBuilder<DimOp>;
@@ -37,16 +33,19 @@ using std_fptrunc = ValueBuilder<FPTruncOp>;
using std_index_cast = ValueBuilder<IndexCastOp>;
using std_muli = ValueBuilder<MulIOp>;
using std_mulf = ValueBuilder<MulFOp>;
+using std_memref_cast = ValueBuilder<MemRefCastOp>;
using std_ret = OperationBuilder<ReturnOp>;
using std_select = ValueBuilder<SelectOp>;
using std_load = ValueBuilder<LoadOp>;
using std_sign_extendi = ValueBuilder<SignExtendIOp>;
using std_splat = ValueBuilder<SplatOp>;
+using std_store = OperationBuilder<StoreOp>;
using std_subf = ValueBuilder<SubFOp>;
using std_subi = ValueBuilder<SubIOp>;
using std_sub_view = ValueBuilder<SubViewOp>;
using std_tensor_load = ValueBuilder<TensorLoadOp>;
using std_tensor_store = OperationBuilder<TensorStoreOp>;
+using std_view = ValueBuilder<ViewOp>;
using std_zero_extendi = ValueBuilder<ZeroExtendIOp>;
using tensor_extract = ValueBuilder<tensor::ExtractOp>;
@@ -71,7 +70,7 @@ CondBranchOp std_cond_br(Value cond, Block *trueBranch, ValueRange trueOperands,
/// Provide an index notation around sdt_load and std_store.
using StdIndexedValue =
- TemplatedIndexedValue<intrinsics::std_load, intrinsics::memref_store>;
+ TemplatedIndexedValue<intrinsics::std_load, intrinsics::std_store>;
} // namespace intrinsics
} // namespace edsc
} // namespace mlir
diff --git a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h
index 5615fbac39c4..a7142d298b66 100644
--- a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h
+++ b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h
@@ -316,6 +316,45 @@ llvm::Optional<llvm::SmallDenseSet<unsigned>>
computeRankReductionMask(ArrayRef<int64_t> originalShape,
ArrayRef<int64_t> reducedShape);
+/// Determines whether MemRefCastOp casts to a more dynamic version of the
+/// source memref. This is useful to to fold a memref_cast into a consuming op
+/// and implement canonicalization patterns for ops in
diff erent dialects that
+/// may consume the results of memref_cast operations. Such foldable memref_cast
+/// operations are typically inserted as `view` and `subview` ops and are
+/// canonicalized, to preserve the type compatibility of their uses.
+///
+/// Returns true when all conditions are met:
+/// 1. source and result are ranked memrefs with strided semantics and same
+/// element type and rank.
+/// 2. each of the source's size, offset or stride has more static information
+/// than the corresponding result's size, offset or stride.
+///
+/// Example 1:
+/// ```mlir
+/// %1 = memref_cast %0 : memref<8x16xf32> to memref<?x?xf32>
+/// %2 = consumer %1 ... : memref<?x?xf32> ...
+/// ```
+///
+/// may fold into:
+///
+/// ```mlir
+/// %2 = consumer %0 ... : memref<8x16xf32> ...
+/// ```
+///
+/// Example 2:
+/// ```
+/// %1 = memref_cast %0 : memref<?x16xf32, affine_map<(i, j)->(16 * i + j)>>
+/// to memref<?x?xf32>
+/// consumer %1 : memref<?x?xf32> ...
+/// ```
+///
+/// may fold into:
+///
+/// ```
+/// consumer %0 ... : memref<?x16xf32, affine_map<(i, j)->(16 * i + j)>>
+/// ```
+bool canFoldIntoConsumerOp(MemRefCastOp castOp);
+
/// Compute `lhs` `pred` `rhs`, where `pred` is one of the known integer
/// comparison predicates.
bool applyCmpPredicate(CmpIPredicate predicate, const APInt &lhs,
diff --git a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
index 8985e3ee79ce..29863c82c502 100644
--- a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
+++ b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
@@ -43,12 +43,10 @@ class Std_Op<string mnemonic, list<OpTrait> traits = []> :
let parser = [{ return ::parse$cppClass(parser, result); }];
}
-// Base class for arithmetic cast operations. Requires single operand and
-// result, but does not constrain them to specific types.
-class ArithmeticCastOp<string mnemonic, list<OpTrait> traits = []> :
+// Base class for standard cast operations. Requires single operand and result,
+// but does not constrain them to specific types.
+class CastOp<string mnemonic, list<OpTrait> traits = []> :
Std_Op<mnemonic, traits # [
- ElementwiseMappable,
- DeclareOpInterfaceMethods<VectorUnrollOpInterface>,
NoSideEffect, SameOperandsAndResultShape,
DeclareOpInterfaceMethods<CastOpInterface>
]> {
@@ -71,6 +69,13 @@ class ArithmeticCastOp<string mnemonic, list<OpTrait> traits = []> :
let verifier = ?;
}
+// Base class for arithmetic cast operations.
+class ArithmeticCastOp<string mnemonic, list<OpTrait> traits = []> :
+ CastOp<mnemonic,
+ !listconcat(traits, [ElementwiseMappable,
+ DeclareOpInterfaceMethods<VectorUnrollOpInterface>])> {
+}
+
// Base class for unary ops. Requires single operand and result. Individual
// classes will have `operand` accessor.
class UnaryOp<string mnemonic, list<OpTrait> traits = []> :
@@ -187,6 +192,64 @@ class FloatTernaryOp<string mnemonic, list<OpTrait> traits = []> :
[DeclareOpInterfaceMethods<VectorUnrollOpInterface>])>,
Arguments<(ins FloatLike:$a, FloatLike:$b, FloatLike:$c)>;
+// Base class for memref allocating ops: alloca and alloc.
+//
+// %0 = alloclike(%m)[%s] : memref<8x?xf32, (d0, d1)[s0] -> ((d0 + s0), d1)>
+//
+class AllocLikeOp<string mnemonic,
+ Resource resource,
+ list<OpTrait> traits = []> :
+ Std_Op<mnemonic,
+ !listconcat([
+ AttrSizedOperandSegments
+ ], traits)> {
+
+ let arguments = (ins Variadic<Index>:$dynamicSizes,
+ // The symbolic operands (the ones in square brackets) bind
+ // to the symbols of the memref's layout map.
+ Variadic<Index>:$symbolOperands,
+ Confined<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$alignment);
+ let results = (outs Res<AnyMemRef, "", [MemAlloc<resource>]>:$memref);
+
+ let builders = [
+ OpBuilderDAG<(ins "MemRefType":$memrefType,
+ CArg<"IntegerAttr", "IntegerAttr()">:$alignment), [{
+ return build($_builder, $_state, memrefType, {}, alignment);
+ }]>,
+ OpBuilderDAG<(ins "MemRefType":$memrefType, "ValueRange":$dynamicSizes,
+ CArg<"IntegerAttr", "IntegerAttr()">:$alignment), [{
+ return build($_builder, $_state, memrefType, dynamicSizes, {}, alignment);
+ }]>,
+ OpBuilderDAG<(ins "MemRefType":$memrefType, "ValueRange":$dynamicSizes,
+ "ValueRange":$symbolOperands,
+ CArg<"IntegerAttr", "{}">:$alignment), [{
+ $_state.types.push_back(memrefType);
+ $_state.addOperands(dynamicSizes);
+ $_state.addOperands(symbolOperands);
+ $_state.addAttribute(getOperandSegmentSizeAttr(),
+ $_builder.getI32VectorAttr({
+ static_cast<int32_t>(dynamicSizes.size()),
+ static_cast<int32_t>(symbolOperands.size())}));
+ if (alignment)
+ $_state.addAttribute(getAlignmentAttrName(), alignment);
+ }]>];
+
+ let extraClassDeclaration = [{
+ static StringRef getAlignmentAttrName() { return "alignment"; }
+
+ MemRefType getType() { return getResult().getType().cast<MemRefType>(); }
+
+ /// Returns the dynamic sizes for this alloc operation if specified.
+ operand_range getDynamicSizes() { return dynamicSizes(); }
+ }];
+
+ let assemblyFormat = [{
+ `(`$dynamicSizes`)` (`` `[` $symbolOperands^ `]`)? attr-dict `:` type($memref)
+ }];
+
+ let hasCanonicalizer = 1;
+}
+
// Base class for ops with static/dynamic offset, sizes and strides
// attributes/arguments.
class BaseOpWithOffsetSizesAndStrides<string mnemonic, list<OpTrait> traits = []> :
@@ -302,6 +365,96 @@ def AddIOp : IntBinaryOp<"addi", [Commutative]> {
let hasFolder = 1;
}
+//===----------------------------------------------------------------------===//
+// AllocOp
+//===----------------------------------------------------------------------===//
+
+def AllocOp : AllocLikeOp<"alloc", DefaultResource> {
+ let summary = "memory allocation operation";
+ let description = [{
+ The `alloc` operation allocates a region of memory, as specified by its
+ memref type.
+
+ Example:
+
+ ```mlir
+ %0 = alloc() : memref<8x64xf32, 1>
+ ```
+
+ The optional list of dimension operands are bound to the dynamic dimensions
+ specified in its memref type. In the example below, the ssa value '%d' is
+ bound to the second dimension of the memref (which is dynamic).
+
+ ```mlir
+ %0 = alloc(%d) : memref<8x?xf32, 1>
+ ```
+
+ The optional list of symbol operands are bound to the symbols of the
+ memrefs affine map. In the example below, the ssa value '%s' is bound to
+ the symbol 's0' in the affine map specified in the allocs memref type.
+
+ ```mlir
+ %0 = alloc()[%s] : memref<8x64xf32,
+ affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1>
+ ```
+
+ This operation returns a single ssa value of memref type, which can be used
+ by subsequent load and store operations.
+
+ The optional `alignment` attribute may be specified to ensure that the
+ region of memory that will be indexed is aligned at the specified byte
+ boundary.
+
+ ```mlir
+ %0 = alloc()[%s] {alignment = 8} :
+ memref<8x64xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1>
+ ```
+ }];
+}
+
+//===----------------------------------------------------------------------===//
+// AllocaOp
+//===----------------------------------------------------------------------===//
+
+def AllocaOp : AllocLikeOp<"alloca", AutomaticAllocationScopeResource> {
+ let summary = "stack memory allocation operation";
+ let description = [{
+ The `alloca` operation allocates memory on the stack, to be automatically
+ released when control transfers back from the region of its closest
+ surrounding operation with an
+ [`AutomaticAllocationScope`](../Traits.md#automaticallocationscope) trait.
+ The amount of memory allocated is specified by its memref and additional
+ operands. For example:
+
+ ```mlir
+ %0 = alloca() : memref<8x64xf32>
+ ```
+
+ The optional list of dimension operands are bound to the dynamic dimensions
+ specified in its memref type. In the example below, the SSA value '%d' is
+ bound to the second dimension of the memref (which is dynamic).
+
+ ```mlir
+ %0 = alloca(%d) : memref<8x?xf32>
+ ```
+
+ The optional list of symbol operands are bound to the symbols of the
+ memref's affine map. In the example below, the SSA value '%s' is bound to
+ the symbol 's0' in the affine map specified in the allocs memref type.
+
+ ```mlir
+ %0 = alloca()[%s] : memref<8x64xf32,
+ affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>>
+ ```
+
+ This operation returns a single SSA value of memref type, which can be used
+ by subsequent load and store operations. An optional alignment attribute, if
+ specified, guarantees alignment at least to that boundary. If not specified,
+ an alignment on any convenient boundary compatible with the type will be
+ chosen.
+ }];
+}
+
//===----------------------------------------------------------------------===//
// AndOp
//===----------------------------------------------------------------------===//
@@ -1187,6 +1340,33 @@ def CopySignOp : FloatBinaryOp<"copysign"> {
}];
}
+//===----------------------------------------------------------------------===//
+// DeallocOp
+//===----------------------------------------------------------------------===//
+
+def DeallocOp : Std_Op<"dealloc", [MemRefsNormalizable]> {
+ let summary = "memory deallocation operation";
+ let description = [{
+ The `dealloc` operation frees the region of memory referenced by a memref
+ which was originally created by the `alloc` operation.
+ The `dealloc` operation should not be called on memrefs which alias an
+ alloc'd memref (e.g. memrefs returned by `view` operations).
+
+ Example:
+
+ ```mlir
+ %0 = alloc() : memref<8x64xf32, (d0, d1) -> (d0, d1), 1>
+ dealloc %0 : memref<8x64xf32, (d0, d1) -> (d0, d1), 1>
+ ```
+ }];
+
+ let arguments = (ins Arg<AnyMemRef, "", [MemFree]>:$memref);
+
+ let hasCanonicalizer = 1;
+ let hasFolder = 1;
+ let assemblyFormat = "$memref attr-dict `:` type($memref)";
+}
+
//===----------------------------------------------------------------------===//
// DimOp
//===----------------------------------------------------------------------===//
@@ -1339,6 +1519,98 @@ def FPTruncOp : ArithmeticCastOp<"fptrunc">, Arguments<(ins AnyType:$in)> {
}];
}
+//===----------------------------------------------------------------------===//
+// GlobalMemrefOp
+//===----------------------------------------------------------------------===//
+
+def GlobalMemrefOp : Std_Op<"global_memref", [Symbol]> {
+ let summary = "declare or define a global memref variable";
+ let description = [{
+ The `global_memref` operation declares or defines a named global variable.
+ The backing memory for the variable is allocated statically and is described
+ by the type of the variable (which should be a statically shaped memref
+ type). The operation is a declaration if no `inital_value` is specified,
+ else it is a definition. The `initial_value` can either be a unit attribute
+ to represent a definition of an uninitialized global variable, or an
+ elements attribute to represent the definition of a global variable with an
+ initial value. The global variable can also be marked constant using the
+ `constant` unit attribute. Writing to such constant global variables is
+ undefined.
+
+ The global variable can be accessed by using the `get_global_memref` to
+ retrieve the memref for the global variable. Note that the memref
+ for such global variable itself is immutable (i.e., get_global_memref for a
+ given global variable will always return the same memref descriptor).
+
+ Example:
+
+ ```mlir
+ // Private variable with an initial value.
+ global_memref "private" @x : memref<2xf32> = dense<0.0,2.0>
+
+ // Declaration of an external variable.
+ global_memref "private" @y : memref<4xi32>
+
+ // Uninitialized externally visible variable.
+ global_memref @z : memref<3xf16> = uninitialized
+
+ // Externally visible constant variable.
+ global_memref constant @c : memref<2xi32> = dense<1, 4>
+ ```
+ }];
+
+ let arguments = (ins
+ SymbolNameAttr:$sym_name,
+ OptionalAttr<StrAttr>:$sym_visibility,
+ TypeAttr:$type,
+ OptionalAttr<AnyAttr>:$initial_value,
+ UnitAttr:$constant
+ );
+
+ let assemblyFormat = [{
+ ($sym_visibility^)?
+ (`constant` $constant^)?
+ $sym_name `:`
+ custom<GlobalMemrefOpTypeAndInitialValue>($type, $initial_value)
+ attr-dict
+ }];
+
+ let extraClassDeclaration = [{
+ bool isExternal() { return !initial_value(); }
+ bool isUninitialized() {
+ return !isExternal() && initial_value().getValue().isa<UnitAttr>();
+ }
+ }];
+}
+
+//===----------------------------------------------------------------------===//
+// GetGlobalMemrefOp
+//===----------------------------------------------------------------------===//
+
+def GetGlobalMemrefOp : Std_Op<"get_global_memref",
+ [NoSideEffect, DeclareOpInterfaceMethods<SymbolUserOpInterface>]> {
+ let summary = "get the memref pointing to a global variable";
+ let description = [{
+ The `get_global_memref` operation retrieves the memref pointing to a
+ named global variable. If the global variable is marked constant, writing
+ to the result memref (such as through a `std.store` operation) is
+ undefined.
+
+ Example:
+
+ ```mlir
+ %x = get_global_memref @foo : memref<2xf32>
+ ```
+ }];
+
+ let arguments = (ins FlatSymbolRefAttr:$name);
+ let results = (outs AnyStaticShapeMemRef:$result);
+ let assemblyFormat = "$name `:` type($result) attr-dict";
+
+ // `GetGlobalMemrefOp` is fully verified by its traits.
+ let verifier = ?;
+}
+
//===----------------------------------------------------------------------===//
// IndexCastOp
//===----------------------------------------------------------------------===//
@@ -1430,6 +1702,76 @@ def LoadOp : Std_Op<"load",
let assemblyFormat = "$memref `[` $indices `]` attr-dict `:` type($memref)";
}
+//===----------------------------------------------------------------------===//
+// MemRefCastOp
+//===----------------------------------------------------------------------===//
+
+def MemRefCastOp : CastOp<"memref_cast", [
+ DeclareOpInterfaceMethods<ViewLikeOpInterface>
+ ]> {
+ let summary = "memref cast operation";
+ let description = [{
+ Syntax:
+
+ ```
+ operation ::= ssa-id `=` `std.memref_cast` ssa-use `:` type `to` type
+ ```
+
+ The `memref_cast` operation converts a memref from one type to an equivalent
+ type with a compatible shape. The source and destination types are
+ compatible if:
+
+ a. Both are ranked memref types with the same element type, address space,
+ and rank and:
+ 1. Both have the same layout or both have compatible strided layouts.
+ 2. The individual sizes (resp. offset and strides in the case of strided
+ memrefs) may convert constant dimensions to dynamic dimensions and
+ vice-versa.
+
+ If the cast converts any dimensions from an unknown to a known size, then it
+ acts as an assertion that fails at runtime if the dynamic dimensions
+ disagree with resultant destination size.
+
+ Example:
+
+ ```mlir
+ // Assert that the input dynamic shape matches the destination static shape.
+ %2 = memref_cast %1 : memref<?x?xf32> to memref<4x4xf32>
+ // Erase static shape information, replacing it with dynamic information.
+ %3 = memref_cast %1 : memref<4xf32> to memref<?xf32>
+
+ // The same holds true for offsets and strides.
+
+ // Assert that the input dynamic shape matches the destination static stride.
+ %4 = memref_cast %1 : memref<12x4xf32, offset:?, strides: [?, ?]> to
+ memref<12x4xf32, offset:5, strides: [4, 1]>
+ // Erase static offset and stride information, replacing it with
+ // dynamic information.
+ %5 = memref_cast %1 : memref<12x4xf32, offset:5, strides: [4, 1]> to
+ memref<12x4xf32, offset:?, strides: [?, ?]>
+ ```
+
+ b. Either or both memref types are unranked with the same element type, and
+ address space.
+
+ Example:
+
+ ```mlir
+ Cast to concrete shape.
+ %4 = memref_cast %1 : memref<*xf32> to memref<4x?xf32>
+
+ Erase rank information.
+ %5 = memref_cast %1 : memref<4x?xf32> to memref<*xf32>
+ ```
+ }];
+
+ let arguments = (ins AnyRankedOrUnrankedMemRef:$source);
+ let results = (outs AnyRankedOrUnrankedMemRef);
+
+ let hasFolder = 1;
+}
+
+
//===----------------------------------------------------------------------===//
// MemRefReinterpretCastOp
//===----------------------------------------------------------------------===//
@@ -1700,6 +2042,47 @@ def OrOp : IntBinaryOp<"or", [Commutative]> {
let hasFolder = 1;
}
+//===----------------------------------------------------------------------===//
+// PrefetchOp
+//===----------------------------------------------------------------------===//
+
+def PrefetchOp : Std_Op<"prefetch"> {
+ let summary = "prefetch operation";
+ let description = [{
+ The "prefetch" op prefetches data from a memref location described with
+ subscript indices similar to std.load, and with three attributes: a
+ read/write specifier, a locality hint, and a cache type specifier as shown
+ below:
+
+ ```mlir
+ prefetch %0[%i, %j], read, locality<3>, data : memref<400x400xi32>
+ ```
+
+ The read/write specifier is either 'read' or 'write', the locality hint
+ ranges from locality<0> (no locality) to locality<3> (extremely local keep
+ in cache). The cache type specifier is either 'data' or 'instr'
+ and specifies whether the prefetch is performed on data cache or on
+ instruction cache.
+ }];
+
+ let arguments = (ins AnyMemRef:$memref, Variadic<Index>:$indices,
+ BoolAttr:$isWrite,
+ Confined<I32Attr, [IntMinValue<0>,
+ IntMaxValue<3>]>:$localityHint,
+ BoolAttr:$isDataCache);
+
+ let extraClassDeclaration = [{
+ MemRefType getMemRefType() {
+ return memref().getType().cast<MemRefType>();
+ }
+ static StringRef getLocalityHintAttrName() { return "localityHint"; }
+ static StringRef getIsWriteAttrName() { return "isWrite"; }
+ static StringRef getIsDataCacheAttrName() { return "isDataCache"; }
+ }];
+
+ let hasFolder = 1;
+}
+
//===----------------------------------------------------------------------===//
// RankOp
//===----------------------------------------------------------------------===//
@@ -2109,6 +2492,77 @@ def SplatOp : Std_Op<"splat", [NoSideEffect,
let assemblyFormat = "$input attr-dict `:` type($aggregate)";
}
+//===----------------------------------------------------------------------===//
+// StoreOp
+//===----------------------------------------------------------------------===//
+
+def StoreOp : Std_Op<"store",
+ [TypesMatchWith<"type of 'value' matches element type of 'memref'",
+ "memref", "value",
+ "$_self.cast<MemRefType>().getElementType()">,
+ MemRefsNormalizable]> {
+ let summary = "store operation";
+ let description = [{
+ Store a value to a memref location given by indices. The value stored should
+ have the same type as the elemental type of the memref. The number of
+ arguments provided within brackets need to match the rank of the memref.
+
+ In an affine context, the indices of a store are restricted to SSA values
+ bound to surrounding loop induction variables,
+ [symbols](Affine.md#restrictions-on-dimensions-and-symbols), results of a
+ [`constant` operation](#stdconstant-constantop), or the result of an
+ [`affine.apply`](Affine.md#affineapply-affineapplyop) operation that can in turn
+ take as arguments all of the aforementioned SSA values or the recursively
+ result of such an `affine.apply` operation.
+
+ Example:
+
+ ```mlir
+ store %100, %A[%1, 1023] : memref<4x?xf32, #layout, memspace0>
+ ```
+
+ **Context:** The `load` and `store` operations are specifically crafted to
+ fully resolve a reference to an element of a memref, and (in polyhedral
+ `affine.if` and `affine.for` operations) the compiler can follow use-def
+ chains (e.g. through [`affine.apply`](Affine.md#affineapply-affineapplyop)
+ operations) to precisely analyze references at compile-time using polyhedral
+ techniques. This is possible because of the
+ [restrictions on dimensions and symbols](Affine.md#restrictions-on-dimensions-and-symbols)
+ in these contexts.
+ }];
+
+ let arguments = (ins AnyType:$value,
+ Arg<AnyMemRef, "the reference to store to",
+ [MemWrite]>:$memref,
+ Variadic<Index>:$indices);
+
+ let builders = [
+ OpBuilderDAG<(ins "Value":$valueToStore, "Value":$memref), [{
+ $_state.addOperands(valueToStore);
+ $_state.addOperands(memref);
+ }]>];
+
+ let extraClassDeclaration = [{
+ Value getValueToStore() { return getOperand(0); }
+
+ Value getMemRef() { return getOperand(1); }
+ void setMemRef(Value value) { setOperand(1, value); }
+ MemRefType getMemRefType() {
+ return getMemRef().getType().cast<MemRefType>();
+ }
+
+ operand_range getIndices() {
+ return {operand_begin() + 2, operand_end()};
+ }
+ }];
+
+ let hasFolder = 1;
+
+ let assemblyFormat = [{
+ $value `,` $memref `[` $indices `]` attr-dict `:` type($memref)
+ }];
+}
+
//===----------------------------------------------------------------------===//
// SubFOp
//===----------------------------------------------------------------------===//
@@ -2706,6 +3160,38 @@ def TensorToMemrefOp : Std_Op<"tensor_to_memref",
let hasCanonicalizer = 1;
}
+//===----------------------------------------------------------------------===//
+// TransposeOp
+//===----------------------------------------------------------------------===//
+
+def TransposeOp : Std_Op<"transpose", [NoSideEffect]>,
+ Arguments<(ins AnyStridedMemRef:$in, AffineMapAttr:$permutation)>,
+ Results<(outs AnyStridedMemRef)> {
+ let summary = "`transpose` produces a new strided memref (metadata-only)";
+ let description = [{
+ The `transpose` op produces a strided memref whose sizes and strides
+ are a permutation of the original `in` memref. This is purely a metadata
+ transformation.
+
+ Example:
+
+ ```mlir
+ %1 = transpose %0 (i, j) -> (j, i) : memref<?x?xf32> to memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d1 * s0 + d0)>>
+ ```
+ }];
+
+ let builders = [
+ OpBuilderDAG<(ins "Value":$in, "AffineMapAttr":$permutation,
+ CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs)>];
+
+ let extraClassDeclaration = [{
+ static StringRef getPermutationAttrName() { return "permutation"; }
+ ShapedType getShapedType() { return in().getType().cast<ShapedType>(); }
+ }];
+
+ let hasFolder = 1;
+}
+
//===----------------------------------------------------------------------===//
// TruncateIOp
//===----------------------------------------------------------------------===//
@@ -2853,6 +3339,74 @@ def UnsignedShiftRightOp : IntBinaryOp<"shift_right_unsigned"> {
}];
}
+//===----------------------------------------------------------------------===//
+// ViewOp
+//===----------------------------------------------------------------------===//
+
+def ViewOp : Std_Op<"view", [
+ DeclareOpInterfaceMethods<ViewLikeOpInterface>, NoSideEffect]> {
+ let summary = "memref view operation";
+ let description = [{
+ The "view" operation extracts an N-D contiguous memref with empty layout map
+ with arbitrary element type from a 1-D contiguous memref with empty layout
+ map of i8 element type. The ViewOp supports the following arguments:
+
+ * A single dynamic byte-shift operand must be specified which represents a
+ a shift of the base 1-D memref pointer from which to create the resulting
+ contiguous memref view with identity layout.
+ * A dynamic size operand that must be specified for each dynamic dimension
+ in the resulting view memref type.
+
+ The "view" operation gives a structured indexing form to a flat 1-D buffer.
+ Unlike "subview" it can perform a type change. The type change behavior
+ requires the op to have special semantics because, e.g. a byte shift of 3
+ cannot be represented as an offset on f64.
+ For now, a "view" op:
+
+ 1. Only takes a contiguous source memref with 0 offset and empty layout.
+ 2. Must specify a byte_shift operand (in the future, a special integer
+ attribute may be added to support the folded case).
+ 3. Returns a contiguous memref with 0 offset and empty layout.
+
+ Example:
+
+ ```mlir
+ // Allocate a flat 1D/i8 memref.
+ %0 = alloc() : memref<2048xi8>
+
+ // ViewOp with dynamic offset and static sizes.
+ %1 = view %0[%offset_1024][] : memref<2048xi8> to memref<64x4xf32>
+
+ // ViewOp with dynamic offset and two dynamic size.
+ %2 = view %0[%offset_1024][%size0, %size1] :
+ memref<2048xi8> to memref<?x4x?xf32>
+ ```
+ }];
+
+ let arguments = (ins MemRefRankOf<[I8], [1]>:$source,
+ Index:$byte_shift,
+ Variadic<Index>:$sizes);
+ let results = (outs AnyMemRef);
+
+ let extraClassDeclaration = [{
+ /// The result of a view is always a memref.
+ MemRefType getType() { return getResult().getType().cast<MemRefType>(); }
+
+ /// Returns the dynamic sizes for this view operation. This is redundant
+ /// with `sizes` but needed in template implementations. More specifically:
+ /// ```
+ /// template <typename AnyMemRefDefOp>
+ /// bool isMemRefSizeValidSymbol(AnyMemRefDefOp memrefDefOp, unsigned index,
+ /// Region *region)
+ /// ```
+ operand_range getDynamicSizes() {
+ return {sizes().begin(), sizes().end()};
+ }
+ }];
+
+ let hasCanonicalizer = 1;
+}
+
//===----------------------------------------------------------------------===//
// XOrOp
//===----------------------------------------------------------------------===//
diff --git a/mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.td b/mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.td
index 86ca00adea82..9b27f2f03677 100644
--- a/mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.td
@@ -44,7 +44,7 @@ def FuncBufferize : Pass<"func-bufferize", "ModuleOp"> {
implement the `ReturnLike` trait are not rewritten in general, as they
require that the corresponding parent operation is also rewritten.
Finally, this pass fails for unknown terminators, as we cannot decide
- whether they need rewriting.
+ whether they need rewriting.
}];
let constructor = "mlir::createFuncBufferizePass()";
}
@@ -54,7 +54,7 @@ def TensorConstantBufferize : Pass<"tensor-constant-bufferize", "ModuleOp"> {
let description = [{
This pass bufferizes tensor constants.
- This pass needs to be a module pass because it inserts memref.global
+ This pass needs to be a module pass because it inserts std.global_memref
ops into the module, which cannot be done safely from a function pass due to
multi-threading. Most other bufferization passes can run in parallel at
function granularity.
diff --git a/mlir/include/mlir/Dialect/Vector/VectorTransforms.h b/mlir/include/mlir/Dialect/Vector/VectorTransforms.h
index ff3dbfdcad1f..a258903d5a3a 100644
--- a/mlir/include/mlir/Dialect/Vector/VectorTransforms.h
+++ b/mlir/include/mlir/Dialect/Vector/VectorTransforms.h
@@ -180,11 +180,11 @@ struct UnrollVectorPattern : public RewritePattern {
/// ```
/// %1:3 = scf.if (%inBounds) {
/// // fastpath, direct cast
-/// memref.cast %A: memref<A...> to compatibleMemRefType
+/// memref_cast %A: memref<A...> to compatibleMemRefType
/// scf.yield %view : compatibleMemRefType, index, index
/// } else {
/// // slowpath, masked vector.transfer or linalg.copy.
-/// memref.cast %alloc: memref<B...> to compatibleMemRefType
+/// memref_cast %alloc: memref<B...> to compatibleMemRefType
/// scf.yield %4 : compatibleMemRefType, index, index
// }
/// %0 = vector.transfer_read %1#0[%1#1, %1#2] {masked = [false ... false]}
diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h
index df2b12e2990f..8028d463677d 100644
--- a/mlir/include/mlir/IR/OpDefinition.h
+++ b/mlir/include/mlir/IR/OpDefinition.h
@@ -1126,7 +1126,7 @@ class AffineScope : public TraitBase<ConcreteType, AffineScope> {
/// A trait of region holding operations that define a new scope for automatic
/// allocations, i.e., allocations that are freed when control is transferred
/// back from the operation's region. Any operations performing such allocations
-/// (for eg. memref.alloca) will have their allocations automatically freed at
+/// (for eg. std.alloca) will have their allocations automatically freed at
/// their closest enclosing operation with this trait.
template <typename ConcreteType>
class AutomaticAllocationScope
diff --git a/mlir/include/mlir/InitAllDialects.h b/mlir/include/mlir/InitAllDialects.h
index 7667f61c1afa..e9e11dac4152 100644
--- a/mlir/include/mlir/InitAllDialects.h
+++ b/mlir/include/mlir/InitAllDialects.h
@@ -29,7 +29,6 @@
#include "mlir/Dialect/LLVMIR/ROCDLDialect.h"
#include "mlir/Dialect/Linalg/IR/LinalgOps.h"
#include "mlir/Dialect/Math/IR/Math.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/OpenACC/OpenACC.h"
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
#include "mlir/Dialect/PDL/IR/PDL.h"
@@ -63,7 +62,6 @@ inline void registerAllDialects(DialectRegistry ®istry) {
LLVM::LLVMArmSVEDialect,
linalg::LinalgDialect,
math::MathDialect,
- memref::MemRefDialect,
scf::SCFDialect,
omp::OpenMPDialect,
pdl::PDLDialect,
diff --git a/mlir/include/mlir/Transforms/Passes.td b/mlir/include/mlir/Transforms/Passes.td
index de9556363e51..a03b439af339 100644
--- a/mlir/include/mlir/Transforms/Passes.td
+++ b/mlir/include/mlir/Transforms/Passes.td
@@ -535,7 +535,7 @@ def NormalizeMemRefs : Pass<"normalize-memrefs", "ModuleOp"> {
contained in the op. Operations marked with the [MemRefsNormalizable]
(https://mlir.llvm.org/docs/Traits/#memrefsnormalizable) trait are
expected to be normalizable. Supported operations include affine
- operations, memref.alloc, memref.dealloc, and std.return.
+ operations, std.alloc, std.dealloc, and std.return.
Given an appropriate layout map specified in the code, this transformation
can express tiled or linearized access to multi-dimensional data
diff --git a/mlir/include/mlir/Transforms/Utils.h b/mlir/include/mlir/Transforms/Utils.h
index f9cc0e274dc8..81b4dfd0a01b 100644
--- a/mlir/include/mlir/Transforms/Utils.h
+++ b/mlir/include/mlir/Transforms/Utils.h
@@ -16,7 +16,6 @@
#ifndef MLIR_TRANSFORMS_UTILS_H
#define MLIR_TRANSFORMS_UTILS_H
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/AffineMap.h"
#include "llvm/ADT/ArrayRef.h"
@@ -89,7 +88,7 @@ LogicalResult replaceAllMemRefUsesWith(Value oldMemRef, Value newMemRef,
/// Rewrites the memref defined by this alloc op to have an identity layout map
/// and updates all its indexing uses. Returns failure if any of its uses
/// escape (while leaving the IR in a valid state).
-LogicalResult normalizeMemRef(memref::AllocOp op);
+LogicalResult normalizeMemRef(AllocOp op);
/// Uses the old memref type map layout and computes the new memref type to have
/// a new shape and a layout map, where the old layout map has been normalized
diff --git a/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp b/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
index e3c850ffaf7a..ef04f688ba39 100644
--- a/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
+++ b/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
@@ -15,7 +15,6 @@
#include "../PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Vector/VectorOps.h"
@@ -45,8 +44,7 @@ class AffineApplyExpander
: builder(builder), dimValues(dimValues), symbolValues(symbolValues),
loc(loc) {}
- template <typename OpTy>
- Value buildBinaryExpr(AffineBinaryOpExpr expr) {
+ template <typename OpTy> Value buildBinaryExpr(AffineBinaryOpExpr expr) {
auto lhs = visit(expr.getLHS());
auto rhs = visit(expr.getRHS());
if (!lhs || !rhs)
@@ -588,7 +586,7 @@ class AffineLoadLowering : public OpRewritePattern<AffineLoadOp> {
};
/// Apply the affine map from an 'affine.prefetch' operation to its operands,
-/// and feed the results to a newly created 'memref.prefetch' operation (which
+/// and feed the results to a newly created 'std.prefetch' operation (which
/// replaces the original 'affine.prefetch').
class AffinePrefetchLowering : public OpRewritePattern<AffinePrefetchOp> {
public:
@@ -603,16 +601,16 @@ class AffinePrefetchLowering : public OpRewritePattern<AffinePrefetchOp> {
if (!resultOperands)
return failure();
- // Build memref.prefetch memref[expandedMap.results].
- rewriter.replaceOpWithNewOp<memref::PrefetchOp>(
- op, op.memref(), *resultOperands, op.isWrite(), op.localityHint(),
- op.isDataCache());
+ // Build std.prefetch memref[expandedMap.results].
+ rewriter.replaceOpWithNewOp<PrefetchOp>(op, op.memref(), *resultOperands,
+ op.isWrite(), op.localityHint(),
+ op.isDataCache());
return success();
}
};
/// Apply the affine map from an 'affine.store' operation to its operands, and
-/// feed the results to a newly created 'memref.store' operation (which replaces
+/// feed the results to a newly created 'std.store' operation (which replaces
/// the original 'affine.store').
class AffineStoreLowering : public OpRewritePattern<AffineStoreOp> {
public:
@@ -627,8 +625,8 @@ class AffineStoreLowering : public OpRewritePattern<AffineStoreOp> {
if (!maybeExpandedMap)
return failure();
- // Build memref.store valueToStore, memref[expandedMap.results].
- rewriter.replaceOpWithNewOp<memref::StoreOp>(
+ // Build std.store valueToStore, memref[expandedMap.results].
+ rewriter.replaceOpWithNewOp<mlir::StoreOp>(
op, op.getValueToStore(), op.getMemRef(), *maybeExpandedMap);
return success();
}
@@ -779,8 +777,8 @@ class LowerAffinePass : public ConvertAffineToStandardBase<LowerAffinePass> {
populateAffineToStdConversionPatterns(patterns, &getContext());
populateAffineToVectorConversionPatterns(patterns, &getContext());
ConversionTarget target(getContext());
- target.addLegalDialect<memref::MemRefDialect, scf::SCFDialect,
- StandardOpsDialect, VectorDialect>();
+ target
+ .addLegalDialect<scf::SCFDialect, StandardOpsDialect, VectorDialect>();
if (failed(applyPartialConversion(getOperation(), target,
std::move(patterns))))
signalPassFailure();
diff --git a/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp b/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
index 0e16cc515542..276b124a9f10 100644
--- a/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
+++ b/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
@@ -93,7 +93,7 @@ createTypeCanonicalizedMemRefOperands(OpBuilder &b, Location loc,
continue;
}
Value cast =
- b.create<memref::CastOp>(loc, eraseStridedLayout(memrefType), op);
+ b.create<MemRefCastOp>(loc, eraseStridedLayout(memrefType), op);
res.push_back(cast);
}
return res;
@@ -143,12 +143,12 @@ LogicalResult mlir::linalg::CopyTransposeRewrite::matchAndRewrite(
// If either inputPerm or outputPerm are non-identities, insert transposes.
auto inputPerm = op.inputPermutation();
if (inputPerm.hasValue() && !inputPerm->isIdentity())
- in = rewriter.create<memref::TransposeOp>(op.getLoc(), in,
- AffineMapAttr::get(*inputPerm));
+ in = rewriter.create<TransposeOp>(op.getLoc(), in,
+ AffineMapAttr::get(*inputPerm));
auto outputPerm = op.outputPermutation();
if (outputPerm.hasValue() && !outputPerm->isIdentity())
- out = rewriter.create<memref::TransposeOp>(op.getLoc(), out,
- AffineMapAttr::get(*outputPerm));
+ out = rewriter.create<TransposeOp>(op.getLoc(), out,
+ AffineMapAttr::get(*outputPerm));
// If nothing was transposed, fail and let the conversion kick in.
if (in == op.input() && out == op.output())
@@ -213,8 +213,7 @@ struct ConvertLinalgToStandardPass
void ConvertLinalgToStandardPass::runOnOperation() {
auto module = getOperation();
ConversionTarget target(getContext());
- target.addLegalDialect<AffineDialect, memref::MemRefDialect, scf::SCFDialect,
- StandardOpsDialect>();
+ target.addLegalDialect<AffineDialect, scf::SCFDialect, StandardOpsDialect>();
target.addLegalOp<ModuleOp, FuncOp, ModuleTerminatorOp, ReturnOp>();
target.addLegalOp<linalg::ReshapeOp, linalg::RangeOp>();
OwningRewritePatternList patterns;
diff --git a/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp b/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
index c7cad5d00daa..c011dfde2ab0 100644
--- a/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
+++ b/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
@@ -18,7 +18,6 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/GPU/ParallelLoopMapper.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/AffineExpr.h"
@@ -648,7 +647,6 @@ void mlir::populateParallelLoopToGPUPatterns(OwningRewritePatternList &patterns,
}
void mlir::configureParallelLoopToGPULegality(ConversionTarget &target) {
- target.addLegalDialect<memref::MemRefDialect>();
target.addDynamicallyLegalOp<scf::ParallelOp>([](scf::ParallelOp parallelOp) {
return !parallelOp->getAttr(gpu::getMappingAttrName());
});
diff --git a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
index 50e9d7a7ccad..0b28d2589a46 100644
--- a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
+++ b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
@@ -17,7 +17,6 @@
#include "mlir/Dialect/LLVMIR/FunctionCallUtils.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/Math/IR/Math.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/BlockAndValueMapping.h"
@@ -1861,13 +1860,13 @@ struct AllocLikeOpLowering : public ConvertToLLVMPattern {
struct AllocOpLowering : public AllocLikeOpLowering {
AllocOpLowering(LLVMTypeConverter &converter)
- : AllocLikeOpLowering(memref::AllocOp::getOperationName(), converter) {}
+ : AllocLikeOpLowering(AllocOp::getOperationName(), converter) {}
std::tuple<Value, Value> allocateBuffer(ConversionPatternRewriter &rewriter,
Location loc, Value sizeBytes,
Operation *op) const override {
// Heap allocations.
- memref::AllocOp allocOp = cast<memref::AllocOp>(op);
+ AllocOp allocOp = cast<AllocOp>(op);
MemRefType memRefType = allocOp.getType();
Value alignment;
@@ -1914,7 +1913,7 @@ struct AllocOpLowering : public AllocLikeOpLowering {
struct AlignedAllocOpLowering : public AllocLikeOpLowering {
AlignedAllocOpLowering(LLVMTypeConverter &converter)
- : AllocLikeOpLowering(memref::AllocOp::getOperationName(), converter) {}
+ : AllocLikeOpLowering(AllocOp::getOperationName(), converter) {}
/// Returns the memref's element size in bytes.
// TODO: there are other places where this is used. Expose publicly?
@@ -1947,7 +1946,7 @@ struct AlignedAllocOpLowering : public AllocLikeOpLowering {
/// Returns the alignment to be used for the allocation call itself.
/// aligned_alloc requires the allocation size to be a power of two, and the
/// allocation size to be a multiple of alignment,
- int64_t getAllocationAlignment(memref::AllocOp allocOp) const {
+ int64_t getAllocationAlignment(AllocOp allocOp) const {
if (Optional<uint64_t> alignment = allocOp.alignment())
return *alignment;
@@ -1963,7 +1962,7 @@ struct AlignedAllocOpLowering : public AllocLikeOpLowering {
Location loc, Value sizeBytes,
Operation *op) const override {
// Heap allocations.
- memref::AllocOp allocOp = cast<memref::AllocOp>(op);
+ AllocOp allocOp = cast<AllocOp>(op);
MemRefType memRefType = allocOp.getType();
int64_t alignment = getAllocationAlignment(allocOp);
Value allocAlignment = createIndexConstant(rewriter, loc, alignment);
@@ -1994,7 +1993,7 @@ constexpr uint64_t AlignedAllocOpLowering::kMinAlignedAllocAlignment;
struct AllocaOpLowering : public AllocLikeOpLowering {
AllocaOpLowering(LLVMTypeConverter &converter)
- : AllocLikeOpLowering(memref::AllocaOp::getOperationName(), converter) {}
+ : AllocLikeOpLowering(AllocaOp::getOperationName(), converter) {}
/// Allocates the underlying buffer using the right call. `allocatedBytePtr`
/// is set to null for stack allocations. `accessAlignment` is set if
@@ -2005,7 +2004,7 @@ struct AllocaOpLowering : public AllocLikeOpLowering {
// With alloca, one gets a pointer to the element type right away.
// For stack allocations.
- auto allocaOp = cast<memref::AllocaOp>(op);
+ auto allocaOp = cast<AllocaOp>(op);
auto elementPtrType = this->getElementPtrType(allocaOp.getType());
auto allocatedElementPtr = rewriter.create<LLVM::AllocaOp>(
@@ -2177,17 +2176,17 @@ struct CallIndirectOpLowering : public CallOpInterfaceLowering<CallIndirectOp> {
// A `dealloc` is converted into a call to `free` on the underlying data buffer.
// The memref descriptor being an SSA value, there is no need to clean it up
// in any way.
-struct DeallocOpLowering : public ConvertOpToLLVMPattern<memref::DeallocOp> {
- using ConvertOpToLLVMPattern<memref::DeallocOp>::ConvertOpToLLVMPattern;
+struct DeallocOpLowering : public ConvertOpToLLVMPattern<DeallocOp> {
+ using ConvertOpToLLVMPattern<DeallocOp>::ConvertOpToLLVMPattern;
explicit DeallocOpLowering(LLVMTypeConverter &converter)
- : ConvertOpToLLVMPattern<memref::DeallocOp>(converter) {}
+ : ConvertOpToLLVMPattern<DeallocOp>(converter) {}
LogicalResult
- matchAndRewrite(memref::DeallocOp op, ArrayRef<Value> operands,
+ matchAndRewrite(DeallocOp op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
assert(operands.size() == 1 && "dealloc takes one operand");
- memref::DeallocOp::Adaptor transformed(operands);
+ DeallocOp::Adaptor transformed(operands);
// Insert the `free` declaration if it is not already present.
auto freeFunc = LLVM::lookupOrCreateFreeFn(op->getParentOfType<ModuleOp>());
@@ -2206,7 +2205,7 @@ static Type convertGlobalMemrefTypeToLLVM(MemRefType type,
LLVMTypeConverter &typeConverter) {
// LLVM type for a global memref will be a multi-dimension array. For
// declarations or uninitialized global memrefs, we can potentially flatten
- // this to a 1D array. However, for memref.global's with an initial value,
+ // this to a 1D array. However, for global_memref's with an initial value,
// we do not intend to flatten the ElementsAttribute when going from std ->
// LLVM dialect, so the LLVM type needs to me a multi-dimension array.
Type elementType = unwrap(typeConverter.convertType(type.getElementType()));
@@ -2218,12 +2217,11 @@ static Type convertGlobalMemrefTypeToLLVM(MemRefType type,
}
/// GlobalMemrefOp is lowered to a LLVM Global Variable.
-struct GlobalMemrefOpLowering
- : public ConvertOpToLLVMPattern<memref::GlobalOp> {
- using ConvertOpToLLVMPattern<memref::GlobalOp>::ConvertOpToLLVMPattern;
+struct GlobalMemrefOpLowering : public ConvertOpToLLVMPattern<GlobalMemrefOp> {
+ using ConvertOpToLLVMPattern<GlobalMemrefOp>::ConvertOpToLLVMPattern;
LogicalResult
- matchAndRewrite(memref::GlobalOp global, ArrayRef<Value> operands,
+ matchAndRewrite(GlobalMemrefOp global, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
MemRefType type = global.type().cast<MemRefType>();
if (!isConvertibleAndHasIdentityMaps(type))
@@ -2257,15 +2255,14 @@ struct GlobalMemrefOpLowering
/// `AllocLikeOpLowering` to reuse the Memref descriptor construction.
struct GetGlobalMemrefOpLowering : public AllocLikeOpLowering {
GetGlobalMemrefOpLowering(LLVMTypeConverter &converter)
- : AllocLikeOpLowering(memref::GetGlobalOp::getOperationName(),
- converter) {}
+ : AllocLikeOpLowering(GetGlobalMemrefOp::getOperationName(), converter) {}
- /// Buffer "allocation" for memref.get_global op is getting the address of
+ /// Buffer "allocation" for get_global_memref op is getting the address of
/// the global variable referenced.
std::tuple<Value, Value> allocateBuffer(ConversionPatternRewriter &rewriter,
Location loc, Value sizeBytes,
Operation *op) const override {
- auto getGlobalOp = cast<memref::GetGlobalOp>(op);
+ auto getGlobalOp = cast<GetGlobalMemrefOp>(op);
MemRefType type = getGlobalOp.result().getType().cast<MemRefType>();
unsigned memSpace = type.getMemorySpace();
@@ -2284,7 +2281,7 @@ struct GetGlobalMemrefOpLowering : public AllocLikeOpLowering {
createIndexConstant(rewriter, loc, 0));
auto gep = rewriter.create<LLVM::GEPOp>(loc, elementPtrType, operands);
- // We do not expect the memref obtained using `memref.get_global` to be
+ // We do not expect the memref obtained using `get_global_memref` to be
// ever deallocated. Set the allocated pointer to be known bad value to
// help debug if that ever happens.
auto intPtrType = getIntPtrType(memSpace);
@@ -2353,17 +2350,17 @@ struct RsqrtOpLowering : public ConvertOpToLLVMPattern<math::RsqrtOp> {
}
};
-struct MemRefCastOpLowering : public ConvertOpToLLVMPattern<memref::CastOp> {
- using ConvertOpToLLVMPattern<memref::CastOp>::ConvertOpToLLVMPattern;
+struct MemRefCastOpLowering : public ConvertOpToLLVMPattern<MemRefCastOp> {
+ using ConvertOpToLLVMPattern<MemRefCastOp>::ConvertOpToLLVMPattern;
- LogicalResult match(memref::CastOp memRefCastOp) const override {
+ LogicalResult match(MemRefCastOp memRefCastOp) const override {
Type srcType = memRefCastOp.getOperand().getType();
Type dstType = memRefCastOp.getType();
- // memref::CastOp reduce to bitcast in the ranked MemRef case and can be
- // used for type erasure. For now they must preserve underlying element type
- // and require source and result type to have the same rank. Therefore,
- // perform a sanity check that the underlying structs are the same. Once op
+ // MemRefCastOp reduce to bitcast in the ranked MemRef case and can be used
+ // for type erasure. For now they must preserve underlying element type and
+ // require source and result type to have the same rank. Therefore, perform
+ // a sanity check that the underlying structs are the same. Once op
// semantics are relaxed we can revisit.
if (srcType.isa<MemRefType>() && dstType.isa<MemRefType>())
return success(typeConverter->convertType(srcType) ==
@@ -2380,9 +2377,9 @@ struct MemRefCastOpLowering : public ConvertOpToLLVMPattern<memref::CastOp> {
: failure();
}
- void rewrite(memref::CastOp memRefCastOp, ArrayRef<Value> operands,
+ void rewrite(MemRefCastOp memRefCastOp, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
- memref::CastOp::Adaptor transformed(operands);
+ MemRefCastOp::Adaptor transformed(operands);
auto srcType = memRefCastOp.getOperand().getType();
auto dstType = memRefCastOp.getType();
@@ -2867,14 +2864,14 @@ struct LoadOpLowering : public LoadStoreOpLowering<LoadOp> {
// Store operation is lowered to obtaining a pointer to the indexed element,
// and storing the given value to it.
-struct StoreOpLowering : public LoadStoreOpLowering<memref::StoreOp> {
+struct StoreOpLowering : public LoadStoreOpLowering<StoreOp> {
using Base::Base;
LogicalResult
- matchAndRewrite(memref::StoreOp op, ArrayRef<Value> operands,
+ matchAndRewrite(StoreOp op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
auto type = op.getMemRefType();
- memref::StoreOp::Adaptor transformed(operands);
+ StoreOp::Adaptor transformed(operands);
Value dataPtr =
getStridedElementPtr(op.getLoc(), type, transformed.memref(),
@@ -2887,13 +2884,13 @@ struct StoreOpLowering : public LoadStoreOpLowering<memref::StoreOp> {
// The prefetch operation is lowered in a way similar to the load operation
// except that the llvm.prefetch operation is used for replacement.
-struct PrefetchOpLowering : public LoadStoreOpLowering<memref::PrefetchOp> {
+struct PrefetchOpLowering : public LoadStoreOpLowering<PrefetchOp> {
using Base::Base;
LogicalResult
- matchAndRewrite(memref::PrefetchOp prefetchOp, ArrayRef<Value> operands,
+ matchAndRewrite(PrefetchOp prefetchOp, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
- memref::PrefetchOp::Adaptor transformed(operands);
+ PrefetchOp::Adaptor transformed(operands);
auto type = prefetchOp.getMemRefType();
auto loc = prefetchOp.getLoc();
@@ -3375,15 +3372,15 @@ struct SubViewOpLowering : public ConvertOpToLLVMPattern<SubViewOp> {
/// and stride. Size and stride are permutations of the original values.
/// 4. A store of the resulting ViewDescriptor to the alloca'ed pointer.
/// The transpose op is replaced by the alloca'ed pointer.
-class TransposeOpLowering : public ConvertOpToLLVMPattern<memref::TransposeOp> {
+class TransposeOpLowering : public ConvertOpToLLVMPattern<TransposeOp> {
public:
- using ConvertOpToLLVMPattern<memref::TransposeOp>::ConvertOpToLLVMPattern;
+ using ConvertOpToLLVMPattern<TransposeOp>::ConvertOpToLLVMPattern;
LogicalResult
- matchAndRewrite(memref::TransposeOp transposeOp, ArrayRef<Value> operands,
+ matchAndRewrite(TransposeOp transposeOp, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
auto loc = transposeOp.getLoc();
- memref::TransposeOpAdaptor adaptor(operands);
+ TransposeOpAdaptor adaptor(operands);
MemRefDescriptor viewMemRef(adaptor.in());
// No permutation, early exit.
@@ -3423,8 +3420,8 @@ class TransposeOpLowering : public ConvertOpToLLVMPattern<memref::TransposeOp> {
/// 2. Updates to the descriptor to introduce the data ptr, offset, size
/// and stride.
/// The view op is replaced by the descriptor.
-struct ViewOpLowering : public ConvertOpToLLVMPattern<memref::ViewOp> {
- using ConvertOpToLLVMPattern<memref::ViewOp>::ConvertOpToLLVMPattern;
+struct ViewOpLowering : public ConvertOpToLLVMPattern<ViewOp> {
+ using ConvertOpToLLVMPattern<ViewOp>::ConvertOpToLLVMPattern;
// Build and return the value for the idx^th shape dimension, either by
// returning the constant shape dimension or counting the proper dynamic size.
@@ -3460,10 +3457,10 @@ struct ViewOpLowering : public ConvertOpToLLVMPattern<memref::ViewOp> {
}
LogicalResult
- matchAndRewrite(memref::ViewOp viewOp, ArrayRef<Value> operands,
+ matchAndRewrite(ViewOp viewOp, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
auto loc = viewOp.getLoc();
- memref::ViewOpAdaptor adaptor(operands);
+ ViewOpAdaptor adaptor(operands);
auto viewMemRefType = viewOp.getType();
auto targetElementTy =
diff --git a/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp b/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp
index 4a21e407d643..4c4705da6a48 100644
--- a/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp
+++ b/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp
@@ -14,7 +14,6 @@
#include "../PassDetail.h"
#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRV.h"
#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Vector/VectorOps.h"
@@ -28,7 +27,7 @@ static Value getMemRefOperand(LoadOp op) { return op.memref(); }
static Value getMemRefOperand(vector::TransferReadOp op) { return op.source(); }
-static Value getMemRefOperand(memref::StoreOp op) { return op.memref(); }
+static Value getMemRefOperand(StoreOp op) { return op.memref(); }
static Value getMemRefOperand(vector::TransferWriteOp op) {
return op.source();
@@ -84,11 +83,11 @@ void LoadOpOfSubViewFolder<vector::TransferReadOp>::replaceOp(
}
template <>
-void StoreOpOfSubViewFolder<memref::StoreOp>::replaceOp(
- memref::StoreOp storeOp, SubViewOp subViewOp, ArrayRef<Value> sourceIndices,
+void StoreOpOfSubViewFolder<StoreOp>::replaceOp(
+ StoreOp storeOp, SubViewOp subViewOp, ArrayRef<Value> sourceIndices,
PatternRewriter &rewriter) const {
- rewriter.replaceOpWithNewOp<memref::StoreOp>(
- storeOp, storeOp.value(), subViewOp.source(), sourceIndices);
+ rewriter.replaceOpWithNewOp<StoreOp>(storeOp, storeOp.value(),
+ subViewOp.source(), sourceIndices);
}
template <>
@@ -196,7 +195,7 @@ void mlir::populateStdLegalizationPatternsForSPIRVLowering(
MLIRContext *context, OwningRewritePatternList &patterns) {
patterns.insert<LoadOpOfSubViewFolder<LoadOp>,
LoadOpOfSubViewFolder<vector::TransferReadOp>,
- StoreOpOfSubViewFolder<memref::StoreOp>,
+ StoreOpOfSubViewFolder<StoreOp>,
StoreOpOfSubViewFolder<vector::TransferWriteOp>>(context);
}
diff --git a/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp b/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp
index f9456c9f9794..2775f778719a 100644
--- a/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp
+++ b/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp
@@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/Math/IR/Math.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
@@ -236,12 +235,12 @@ namespace {
/// to Workgroup memory when the size is constant. Note that this pattern needs
/// to be applied in a pass that runs at least at spv.module scope since it wil
/// ladd global variables into the spv.module.
-class AllocOpPattern final : public OpConversionPattern<memref::AllocOp> {
+class AllocOpPattern final : public OpConversionPattern<AllocOp> {
public:
- using OpConversionPattern<memref::AllocOp>::OpConversionPattern;
+ using OpConversionPattern<AllocOp>::OpConversionPattern;
LogicalResult
- matchAndRewrite(memref::AllocOp operation, ArrayRef<Value> operands,
+ matchAndRewrite(AllocOp operation, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
MemRefType allocType = operation.getType();
if (!isAllocationSupported(allocType))
@@ -278,12 +277,12 @@ class AllocOpPattern final : public OpConversionPattern<memref::AllocOp> {
/// Removed a deallocation if it is a supported allocation. Currently only
/// removes deallocation if the memory space is workgroup memory.
-class DeallocOpPattern final : public OpConversionPattern<memref::DeallocOp> {
+class DeallocOpPattern final : public OpConversionPattern<DeallocOp> {
public:
- using OpConversionPattern<memref::DeallocOp>::OpConversionPattern;
+ using OpConversionPattern<DeallocOp>::OpConversionPattern;
LogicalResult
- matchAndRewrite(memref::DeallocOp operation, ArrayRef<Value> operands,
+ matchAndRewrite(DeallocOp operation, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
MemRefType deallocType = operation.memref().getType().cast<MemRefType>();
if (!isAllocationSupported(deallocType))
@@ -469,23 +468,23 @@ class SelectOpPattern final : public OpConversionPattern<SelectOp> {
ConversionPatternRewriter &rewriter) const override;
};
-/// Converts memref.store to spv.Store on integers.
-class IntStoreOpPattern final : public OpConversionPattern<memref::StoreOp> {
+/// Converts std.store to spv.Store on integers.
+class IntStoreOpPattern final : public OpConversionPattern<StoreOp> {
public:
- using OpConversionPattern<memref::StoreOp>::OpConversionPattern;
+ using OpConversionPattern<StoreOp>::OpConversionPattern;
LogicalResult
- matchAndRewrite(memref::StoreOp storeOp, ArrayRef<Value> operands,
+ matchAndRewrite(StoreOp storeOp, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override;
};
-/// Converts memref.store to spv.Store.
-class StoreOpPattern final : public OpConversionPattern<memref::StoreOp> {
+/// Converts std.store to spv.Store.
+class StoreOpPattern final : public OpConversionPattern<StoreOp> {
public:
- using OpConversionPattern<memref::StoreOp>::OpConversionPattern;
+ using OpConversionPattern<StoreOp>::OpConversionPattern;
LogicalResult
- matchAndRewrite(memref::StoreOp storeOp, ArrayRef<Value> operands,
+ matchAndRewrite(StoreOp storeOp, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override;
};
@@ -1039,10 +1038,9 @@ SelectOpPattern::matchAndRewrite(SelectOp op, ArrayRef<Value> operands,
//===----------------------------------------------------------------------===//
LogicalResult
-IntStoreOpPattern::matchAndRewrite(memref::StoreOp storeOp,
- ArrayRef<Value> operands,
+IntStoreOpPattern::matchAndRewrite(StoreOp storeOp, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const {
- memref::StoreOpAdaptor storeOperands(operands);
+ StoreOpAdaptor storeOperands(operands);
auto memrefType = storeOp.memref().getType().cast<MemRefType>();
if (!memrefType.getElementType().isSignlessInteger())
return failure();
@@ -1119,10 +1117,9 @@ IntStoreOpPattern::matchAndRewrite(memref::StoreOp storeOp,
}
LogicalResult
-StoreOpPattern::matchAndRewrite(memref::StoreOp storeOp,
- ArrayRef<Value> operands,
+StoreOpPattern::matchAndRewrite(StoreOp storeOp, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const {
- memref::StoreOpAdaptor storeOperands(operands);
+ StoreOpAdaptor storeOperands(operands);
auto memrefType = storeOp.memref().getType().cast<MemRefType>();
if (memrefType.getElementType().isSignlessInteger())
return failure();
diff --git a/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp b/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
index 620480e569f0..503a2f001345 100644
--- a/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
+++ b/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
@@ -250,7 +250,7 @@ static Value setAllocAtFunctionEntry(MemRefType memRefMinorVectorType,
op->getParentWithTrait<OpTrait::AutomaticAllocationScope>();
assert(scope && "Expected op to be inside automatic allocation scope");
b.setInsertionPointToStart(&scope->getRegion(0).front());
- Value res = memref_alloca(memRefMinorVectorType);
+ Value res = std_alloca(memRefMinorVectorType);
return res;
}
@@ -312,7 +312,7 @@ LogicalResult NDTransferOpHelper<TransferReadOp>::doReplace() {
return {vector};
}
// 3.b. Otherwise, just go through the temporary `alloc`.
- memref_store(vector, alloc, majorIvs);
+ std_store(vector, alloc, majorIvs);
return {};
},
[&]() -> scf::ValueVector {
@@ -324,7 +324,7 @@ LogicalResult NDTransferOpHelper<TransferReadOp>::doReplace() {
return {vector};
}
// 3.d. Otherwise, just go through the temporary `alloc`.
- memref_store(vector, alloc, majorIvs);
+ std_store(vector, alloc, majorIvs);
return {};
});
@@ -339,7 +339,7 @@ LogicalResult NDTransferOpHelper<TransferReadOp>::doReplace() {
result = vector_insert(loaded1D, result, majorIvs);
// 5.b. Otherwise, just go through the temporary `alloc`.
else
- memref_store(loaded1D, alloc, majorIvs);
+ std_store(loaded1D, alloc, majorIvs);
}
});
@@ -357,8 +357,8 @@ LogicalResult NDTransferOpHelper<TransferWriteOp>::doReplace() {
Value alloc;
if (!options.unroll) {
alloc = setAllocAtFunctionEntry(memRefMinorVectorType, op);
- memref_store(xferOp.vector(),
- vector_type_cast(MemRefType::get({}, vectorType), alloc));
+ std_store(xferOp.vector(),
+ vector_type_cast(MemRefType::get({}, vectorType), alloc));
}
emitLoops([&](ValueRange majorIvs, ValueRange leadingOffsets,
@@ -665,7 +665,7 @@ LogicalResult VectorTransferRewriter<TransferWriteOp>::matchAndRewrite(
Value tmp = setAllocAtFunctionEntry(tmpMemRefType(transfer), transfer);
StdIndexedValue local(tmp);
Value vec = vector_type_cast(tmp);
- memref_store(vectorValue, vec);
+ std_store(vectorValue, vec);
loopNestBuilder(lbs, ubs, steps, [&](ValueRange loopIvs) {
auto ivsStorage = llvm::to_vector<8>(loopIvs);
// Swap the ivsStorage which will reorder memory accesses.
diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index 100d2fa02756..f1a276f1da98 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -8,7 +8,6 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/BuiltinOps.h"
@@ -336,7 +335,7 @@ static bool isDimOpValidSymbol(DimOp dimOp, Region *region) {
"expect only `dim` operations with a constant index");
int64_t i = index.getValue();
return TypeSwitch<Operation *, bool>(dimOp.memrefOrTensor().getDefiningOp())
- .Case<memref::ViewOp, SubViewOp, memref::AllocOp>(
+ .Case<ViewOp, SubViewOp, AllocOp>(
[&](auto op) { return isMemRefSizeValidSymbol(op, i, region); })
.Default([](Operation *) { return false; });
}
@@ -916,12 +915,12 @@ void AffineApplyOp::getCanonicalizationPatterns(
//===----------------------------------------------------------------------===//
/// This is a common class used for patterns of the form
-/// "someop(memrefcast) -> someop". It folds the source of any memref.cast
+/// "someop(memrefcast) -> someop". It folds the source of any memref_cast
/// into the root operation directly.
static LogicalResult foldMemRefCast(Operation *op) {
bool folded = false;
for (OpOperand &operand : op->getOpOperands()) {
- auto cast = operand.get().getDefiningOp<memref::CastOp>();
+ auto cast = operand.get().getDefiningOp<MemRefCastOp>();
if (cast && !cast.getOperand().getType().isa<UnrankedMemRefType>()) {
operand.set(cast.getOperand());
folded = true;
diff --git a/mlir/lib/Dialect/CMakeLists.txt b/mlir/lib/Dialect/CMakeLists.txt
index 15aec30b27e1..ddeaa2edb704 100644
--- a/mlir/lib/Dialect/CMakeLists.txt
+++ b/mlir/lib/Dialect/CMakeLists.txt
@@ -8,7 +8,6 @@ add_subdirectory(GPU)
add_subdirectory(Linalg)
add_subdirectory(LLVMIR)
add_subdirectory(Math)
-add_subdirectory(MemRef)
add_subdirectory(OpenACC)
add_subdirectory(OpenMP)
add_subdirectory(PDL)
diff --git a/mlir/lib/Dialect/GPU/Transforms/AllReduceLowering.cpp b/mlir/lib/Dialect/GPU/Transforms/AllReduceLowering.cpp
index 4dfea7bd304f..669c75524a51 100644
--- a/mlir/lib/Dialect/GPU/Transforms/AllReduceLowering.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/AllReduceLowering.cpp
@@ -13,7 +13,6 @@
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/GPU/Passes.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Builders.h"
@@ -108,7 +107,7 @@ struct GpuAllReduceRewriter {
createPredicatedBlock(isFirstLane, [&] {
Value subgroupId = getDivideBySubgroupSize(invocationIdx);
Value index = create<IndexCastOp>(indexType, subgroupId);
- create<memref::StoreOp>(subgroupReduce, buffer, index);
+ create<StoreOp>(subgroupReduce, buffer, index);
});
create<gpu::BarrierOp>();
@@ -128,7 +127,7 @@ struct GpuAllReduceRewriter {
Value value = create<LoadOp>(valueType, buffer, index);
Value result =
createSubgroupReduce(numSubgroups, laneId, value, accumFactory);
- create<memref::StoreOp>(result, buffer, zero);
+ create<StoreOp>(result, buffer, zero);
});
// Synchronize workgroup and load result from workgroup memory.
@@ -140,14 +139,12 @@ struct GpuAllReduceRewriter {
private:
// Shortcut to create an op from rewriter using loc as the first argument.
- template <typename T, typename... Args>
- T create(Args... args) {
+ template <typename T, typename... Args> T create(Args... args) {
return rewriter.create<T>(loc, std::forward<Args>(args)...);
}
// Creates dimension op of type T, with the result casted to int32.
- template <typename T>
- Value getDimOp(StringRef dimension) {
+ template <typename T> Value getDimOp(StringRef dimension) {
Value dim = create<T>(indexType, rewriter.getStringAttr(dimension));
return create<IndexCastOp>(int32Type, dim);
}
@@ -239,8 +236,7 @@ struct GpuAllReduceRewriter {
}
/// Returns an accumulator factory that creates an op of type T.
- template <typename T>
- AccumulatorFactory getFactory() {
+ template <typename T> AccumulatorFactory getFactory() {
return [&](Value lhs, Value rhs) {
return create<T>(lhs.getType(), lhs, rhs);
};
diff --git a/mlir/lib/Dialect/Linalg/IR/CMakeLists.txt b/mlir/lib/Dialect/Linalg/IR/CMakeLists.txt
index 686b0abf5fc1..8522919bacb3 100644
--- a/mlir/lib/Dialect/Linalg/IR/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/IR/CMakeLists.txt
@@ -17,6 +17,5 @@ add_mlir_dialect_library(MLIRLinalg
MLIRSideEffectInterfaces
MLIRViewLikeInterface
MLIRStandard
- MLIRMemRef
MLIRTensor
)
diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
index d73da7ed4604..7c348672dc37 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
@@ -108,12 +108,12 @@ static void dispatchIndexOpFoldResult(OpFoldResult ofr,
/// ```
/// someop(memrefcast) -> someop
/// ```
-/// It folds the source of the memref.cast into the root operation directly.
+/// It folds the source of the memref_cast into the root operation directly.
static LogicalResult foldMemRefCast(Operation *op) {
bool folded = false;
for (OpOperand &operand : op->getOpOperands()) {
- auto castOp = operand.get().getDefiningOp<memref::CastOp>();
- if (castOp && memref::CastOp::canFoldIntoConsumerOp(castOp)) {
+ auto castOp = operand.get().getDefiningOp<MemRefCastOp>();
+ if (castOp && canFoldIntoConsumerOp(castOp)) {
operand.set(castOp.getOperand());
folded = true;
}
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
index df28e6d6a8c1..8e0d22d45c0e 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
@@ -25,8 +25,8 @@ using namespace ::mlir::linalg;
static Value cloneMemref(Location loc, Value memref, OpBuilder &b) {
auto memrefType = memref.getType().cast<MemRefType>();
- auto alloc = b.create<memref::AllocOp>(loc, memrefType,
- getDynOperands(loc, memref, b));
+ auto alloc =
+ b.create<AllocOp>(loc, memrefType, getDynOperands(loc, memref, b));
b.create<linalg::CopyOp>(loc, memref, alloc);
return alloc;
}
@@ -60,17 +60,17 @@ allocateBuffersForResults(Location loc, LinalgOp linalgOp,
continue;
}
- if (auto alloc = resultTensor.getDefiningOp<memref::AllocOp>()) {
+ if (auto alloc = resultTensor.getDefiningOp<AllocOp>()) {
resultBuffers.push_back(resultTensor);
continue;
}
// Allocate buffers for statically-shaped results.
if (memrefType.hasStaticShape()) {
- resultBuffers.push_back(b.create<memref::AllocOp>(loc, memrefType));
+ resultBuffers.push_back(b.create<AllocOp>(loc, memrefType));
continue;
}
- resultBuffers.push_back(b.create<memref::AllocOp>(
+ resultBuffers.push_back(b.create<AllocOp>(
loc, memrefType, getDynOperands(loc, resultTensor, b)));
}
return success();
@@ -148,7 +148,7 @@ class BufferizeInitTensorOp : public OpConversionPattern<InitTensorOp> {
matchAndRewrite(InitTensorOp op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const final {
linalg::InitTensorOpAdaptor adaptor(operands, op->getAttrDictionary());
- rewriter.replaceOpWithNewOp<memref::AllocOp>(
+ rewriter.replaceOpWithNewOp<AllocOp>(
op, getTypeConverter()->convertType(op.getType()).cast<MemRefType>(),
adaptor.sizes());
return success();
@@ -231,8 +231,8 @@ class SubTensorOpConverter : public OpConversionPattern<SubTensorOp> {
// op.sizes() capture exactly the dynamic alloc operands matching the
// subviewMemRefType thanks to subview/subtensor canonicalization and
// verification.
- Value alloc = rewriter.create<memref::AllocOp>(
- op.getLoc(), subviewMemRefType, op.sizes());
+ Value alloc =
+ rewriter.create<AllocOp>(op.getLoc(), subviewMemRefType, op.sizes());
Value subView = rewriter.create<SubViewOp>(
op.getLoc(), sourceMemref, op.getMixedOffsets(), op.getMixedSizes(),
op.getMixedStrides());
@@ -295,7 +295,7 @@ struct LinalgBufferizePass : public LinalgBufferizeBase<LinalgBufferizePass> {
// Mark all Standard operations legal.
target.addLegalDialect<AffineDialect, math::MathDialect,
- memref::MemRefDialect, StandardOpsDialect>();
+ StandardOpsDialect>();
target.addIllegalOp<InitTensorOp, SubTensorOp, SubTensorInsertOp>();
// Mark all Linalg operations illegal as long as they work on tensors.
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
index 2c72335a4abd..a0cb80fe3032 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
@@ -14,7 +14,6 @@
#include "mlir/Dialect/Linalg/Transforms/Hoisting.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Linalg/IR/LinalgOps.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/Utils.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
@@ -41,7 +40,7 @@ void mlir::linalg::hoistViewAllocOps(FuncOp func) {
while (changed) {
changed = false;
func.walk([&changed](Operation *op) {
- if (!isa<memref::AllocOp, memref::AllocaOp, memref::DeallocOp>(op))
+ if (!isa<AllocOp, AllocaOp, DeallocOp>(op))
return;
LLVM_DEBUG(DBGS() << "Candidate for hoisting: " << *op << "\n");
@@ -67,15 +66,14 @@ void mlir::linalg::hoistViewAllocOps(FuncOp func) {
v = op->getResult(0);
}
if (v && !llvm::all_of(v.getUses(), [&](OpOperand &operand) {
- return isa<ViewLikeOpInterface, memref::DeallocOp>(
- operand.getOwner());
+ return isa<ViewLikeOpInterface, DeallocOp>(operand.getOwner());
})) {
LLVM_DEBUG(DBGS() << "Found non view-like or dealloc use: bail\n");
return;
}
// Move AllocOp before the loop.
- if (isa<memref::AllocOp, memref::AllocaOp>(op))
+ if (isa<AllocOp, AllocaOp>(op))
(void)loop.moveOutOfLoop({op});
else // Move DeallocOp outside of the loop.
op->moveAfter(loop);
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp b/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
index 7f21e1daa3bf..f99bf85d3cbe 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
@@ -40,7 +40,7 @@ using folded_affine_min = FoldedValueBuilder<AffineMinOp>;
using folded_linalg_range = FoldedValueBuilder<linalg::RangeOp>;
using folded_std_dim = FoldedValueBuilder<DimOp>;
using folded_std_subview = FoldedValueBuilder<SubViewOp>;
-using folded_memref_view = FoldedValueBuilder<memref::ViewOp>;
+using folded_std_view = FoldedValueBuilder<ViewOp>;
#define DEBUG_TYPE "linalg-promotion"
@@ -59,22 +59,22 @@ static Value allocBuffer(const LinalgPromotionOptions &options,
if (!dynamicBuffers)
if (auto cst = size.getDefiningOp<ConstantIndexOp>())
return options.useAlloca
- ? memref_alloca(MemRefType::get(width * cst.getValue(),
- IntegerType::get(ctx, 8)),
- ValueRange{}, alignment_attr)
+ ? std_alloca(MemRefType::get(width * cst.getValue(),
+ IntegerType::get(ctx, 8)),
+ ValueRange{}, alignment_attr)
.value
- : memref_alloc(MemRefType::get(width * cst.getValue(),
- IntegerType::get(ctx, 8)),
- ValueRange{}, alignment_attr)
+ : std_alloc(MemRefType::get(width * cst.getValue(),
+ IntegerType::get(ctx, 8)),
+ ValueRange{}, alignment_attr)
.value;
Value mul =
folded_std_muli(folder, folded_std_constant_index(folder, width), size);
return options.useAlloca
- ? memref_alloca(MemRefType::get(-1, IntegerType::get(ctx, 8)), mul,
- alignment_attr)
+ ? std_alloca(MemRefType::get(-1, IntegerType::get(ctx, 8)), mul,
+ alignment_attr)
.value
- : memref_alloc(MemRefType::get(-1, IntegerType::get(ctx, 8)), mul,
- alignment_attr)
+ : std_alloc(MemRefType::get(-1, IntegerType::get(ctx, 8)), mul,
+ alignment_attr)
.value;
}
@@ -100,7 +100,7 @@ static Optional<Value> defaultAllocBufferCallBack(
dynamicBuffers, folder, alignment);
SmallVector<int64_t, 4> dynSizes(boundingSubViewSize.size(),
ShapedType::kDynamicSize);
- Value view = folded_memref_view(
+ Value view = folded_std_view(
folder, MemRefType::get(dynSizes, viewType.getElementType()), buffer,
zero, boundingSubViewSize);
return view;
@@ -112,10 +112,10 @@ static Optional<Value> defaultAllocBufferCallBack(
static LogicalResult
defaultDeallocBufferCallBack(const LinalgPromotionOptions &options,
OpBuilder &b, Value fullLocalView) {
- auto viewOp = fullLocalView.getDefiningOp<memref::ViewOp>();
+ auto viewOp = fullLocalView.getDefiningOp<ViewOp>();
assert(viewOp && "expected full local view to be a ViewOp");
if (!options.useAlloca)
- memref_dealloc(viewOp.source());
+ std_dealloc(viewOp.source());
return success();
}
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp b/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp
index 4ae8178562ae..1898ba688c15 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp
@@ -546,7 +546,7 @@ static Value genOutputBuffer(CodeGen &codegen, PatternRewriter &rewriter,
// introduces a dense initialization component that may negatively
// impact the running complexity of the sparse kernel.
Value init = rewriter.create<TensorToMemrefOp>(loc, denseTp, tensor);
- Value alloc = rewriter.create<memref::AllocOp>(loc, denseTp, args);
+ Value alloc = rewriter.create<AllocOp>(loc, denseTp, args);
rewriter.create<linalg::CopyOp>(loc, init, alloc);
return alloc;
}
@@ -737,7 +737,7 @@ static void genTensorStore(Merger &merger, CodeGen &codegen,
if (codegen.curVecLength > 1)
genVectorStore(codegen, rewriter, rhs, ptr, args);
else
- rewriter.create<memref::StoreOp>(loc, rhs, ptr, args);
+ rewriter.create<StoreOp>(loc, rhs, ptr, args);
}
/// Generates a pointer/index load from the sparse storage scheme.
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
index d8e708aa07c8..fdad9d879927 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
@@ -566,7 +566,7 @@ void mlir::linalg::populateLinalgTilingCanonicalizationPatterns(
SubTensorOp::getCanonicalizationPatterns(patterns, ctx);
SubViewOp::getCanonicalizationPatterns(patterns, ctx);
tensor::CastOp::getCanonicalizationPatterns(patterns, ctx);
- memref::ViewOp::getCanonicalizationPatterns(patterns, ctx);
+ ViewOp::getCanonicalizationPatterns(patterns, ctx);
CanonicalizationPatternList<
#define GET_OP_LIST
#include "mlir/Dialect/Linalg/IR/LinalgStructuredOps.cpp.inc"
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
index cd18ae1704eb..e350d8931753 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
@@ -110,7 +110,7 @@ static Value buildVectorWrite(OpBuilder &builder, Value value, Value dest) {
value = vector_broadcast(vectorType, value);
write = vector_transfer_write(value, dest, indices);
} else {
- write = memref_store(value, dest);
+ write = std_store(value, dest);
}
LLVM_DEBUG(dbgs() << "\n[" DEBUG_TYPE "]: vectorized op: " << *write);
if (!write->getResults().empty())
@@ -543,7 +543,7 @@ LogicalResult ConvOpVectorization<ConvOp, N>::matchAndRewrite(
rewriter.getAffineMapArrayAttr(indexingMaps),
rewriter.getStrArrayAttr(iteratorTypes));
- rewriter.create<memref::StoreOp>(loc, result, output, ValueRange(zeros));
+ rewriter.create<StoreOp>(loc, result, output, ValueRange(zeros));
rewriter.eraseOp(op);
return success();
}
@@ -685,8 +685,8 @@ LogicalResult LinalgCopyVTRForwardingPattern::matchAndRewrite(
// Transfer into `view`.
Value viewOrAlloc = xferOp.source();
- if (!viewOrAlloc.getDefiningOp<memref::ViewOp>() &&
- !viewOrAlloc.getDefiningOp<memref::AllocOp>())
+ if (!viewOrAlloc.getDefiningOp<ViewOp>() &&
+ !viewOrAlloc.getDefiningOp<AllocOp>())
return failure();
LLVM_DEBUG(llvm::dbgs() << "\n[" DEBUG_TYPE "]: " << viewOrAlloc);
@@ -764,8 +764,8 @@ LogicalResult LinalgCopyVTWForwardingPattern::matchAndRewrite(
vector::TransferWriteOp xferOp, PatternRewriter &rewriter) const {
// Transfer into `viewOrAlloc`.
Value viewOrAlloc = xferOp.source();
- if (!viewOrAlloc.getDefiningOp<memref::ViewOp>() &&
- !viewOrAlloc.getDefiningOp<memref::AllocOp>())
+ if (!viewOrAlloc.getDefiningOp<ViewOp>() &&
+ !viewOrAlloc.getDefiningOp<AllocOp>())
return failure();
// Ensure there is exactly one subview of `viewOrAlloc` defining `subView`.
diff --git a/mlir/lib/Dialect/MemRef/CMakeLists.txt b/mlir/lib/Dialect/MemRef/CMakeLists.txt
deleted file mode 100644
index f33061b2d87c..000000000000
--- a/mlir/lib/Dialect/MemRef/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-add_subdirectory(IR)
diff --git a/mlir/lib/Dialect/MemRef/IR/CMakeLists.txt b/mlir/lib/Dialect/MemRef/IR/CMakeLists.txt
deleted file mode 100644
index 115f4ed28c16..000000000000
--- a/mlir/lib/Dialect/MemRef/IR/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-add_mlir_dialect_library(MLIRMemRef
- MemRefDialect.cpp
- MemRefOps.cpp
-
- ADDITIONAL_HEADER_DIRS
- ${PROJECT_SOURCE_DIR}/inlude/mlir/Dialect/MemRefDialect
-
- DEPENDS
- MLIRMemRefOpsIncGen
-
- LINK_COMPONENTS
- Core
-
- LINK_LIBS PUBLIC
- MLIRIR
- MLIRSupport
-)
diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
deleted file mode 100644
index 60ea5d3b7024..000000000000
--- a/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Transforms/InliningUtils.h"
-
-using namespace mlir;
-using namespace mlir::memref;
-
-//===----------------------------------------------------------------------===//
-// MemRefDialect Dialect Interfaces
-//===----------------------------------------------------------------------===//
-
-namespace {
-struct MemRefInlinerInterface : public DialectInlinerInterface {
- using DialectInlinerInterface::DialectInlinerInterface;
- bool isLegalToInline(Region *dest, Region *src, bool wouldBeCloned,
- BlockAndValueMapping &valueMapping) const final {
- return true;
- }
- bool isLegalToInline(Operation *, Region *, bool wouldBeCloned,
- BlockAndValueMapping &) const final {
- return true;
- }
-};
-} // end anonymous namespace
-
-void MemRefDialect::initialize() {
- addOperations<
-#define GET_OP_LIST
-#include "mlir/Dialect/MemRef/IR/MemRefOps.cpp.inc"
- >();
- addInterfaces<MemRefInlinerInterface>();
-}
diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
deleted file mode 100644
index efe9ea714f60..000000000000
--- a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
+++ /dev/null
@@ -1,878 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
-#include "mlir/IR/AffineMap.h"
-#include "mlir/IR/Builders.h"
-#include "mlir/IR/BuiltinTypes.h"
-#include "mlir/IR/Matchers.h"
-#include "mlir/IR/PatternMatch.h"
-#include "mlir/IR/TypeUtilities.h"
-#include "llvm/ADT/STLExtras.h"
-
-using namespace mlir;
-using namespace mlir::memref;
-
-/// Matches a ConstantIndexOp.
-/// TODO: This should probably just be a general matcher that uses m_Constant
-/// and checks the operation for an index type.
-static detail::op_matcher<ConstantIndexOp> m_ConstantIndex() {
- return detail::op_matcher<ConstantIndexOp>();
-}
-
-//===----------------------------------------------------------------------===//
-// Common canonicalization pattern support logic
-//===----------------------------------------------------------------------===//
-
-/// This is a common class used for patterns of the form
-/// "someop(memrefcast) -> someop". It folds the source of any memref.cast
-/// into the root operation directly.
-static LogicalResult foldMemRefCast(Operation *op) {
- bool folded = false;
- for (OpOperand &operand : op->getOpOperands()) {
- auto cast = operand.get().getDefiningOp<CastOp>();
- if (cast && !cast.getOperand().getType().isa<UnrankedMemRefType>()) {
- operand.set(cast.getOperand());
- folded = true;
- }
- }
- return success(folded);
-}
-
-//===----------------------------------------------------------------------===//
-// Helpers for Tensor[Load|Store]Op, TensorToMemrefOp, and GlobalOp
-//===----------------------------------------------------------------------===//
-
-static Type getTensorTypeFromMemRefType(Type type) {
- if (auto memref = type.dyn_cast<MemRefType>())
- return RankedTensorType::get(memref.getShape(), memref.getElementType());
- if (auto memref = type.dyn_cast<UnrankedMemRefType>())
- return UnrankedTensorType::get(memref.getElementType());
- return NoneType::get(type.getContext());
-}
-
-//===----------------------------------------------------------------------===//
-// AllocOp / AllocaOp
-//===----------------------------------------------------------------------===//
-
-template <typename AllocLikeOp>
-static LogicalResult verifyAllocLikeOp(AllocLikeOp op) {
- static_assert(llvm::is_one_of<AllocLikeOp, AllocOp, AllocaOp>::value,
- "applies to only alloc or alloca");
- auto memRefType = op.getResult().getType().template dyn_cast<MemRefType>();
- if (!memRefType)
- return op.emitOpError("result must be a memref");
-
- if (static_cast<int64_t>(op.dynamicSizes().size()) !=
- memRefType.getNumDynamicDims())
- return op.emitOpError("dimension operand count does not equal memref "
- "dynamic dimension count");
-
- unsigned numSymbols = 0;
- if (!memRefType.getAffineMaps().empty())
- numSymbols = memRefType.getAffineMaps().front().getNumSymbols();
- if (op.symbolOperands().size() != numSymbols)
- return op.emitOpError(
- "symbol operand count does not equal memref symbol count");
-
- return success();
-}
-
-static LogicalResult verify(AllocOp op) { return verifyAllocLikeOp(op); }
-
-static LogicalResult verify(AllocaOp op) {
- // An alloca op needs to have an ancestor with an allocation scope trait.
- if (!op->getParentWithTrait<OpTrait::AutomaticAllocationScope>())
- return op.emitOpError(
- "requires an ancestor op with AutomaticAllocationScope trait");
-
- return verifyAllocLikeOp(op);
-}
-
-namespace {
-/// Fold constant dimensions into an alloc like operation.
-template <typename AllocLikeOp>
-struct SimplifyAllocConst : public OpRewritePattern<AllocLikeOp> {
- using OpRewritePattern<AllocLikeOp>::OpRewritePattern;
-
- LogicalResult matchAndRewrite(AllocLikeOp alloc,
- PatternRewriter &rewriter) const override {
- // Check to see if any dimensions operands are constants. If so, we can
- // substitute and drop them.
- if (llvm::none_of(alloc.getOperands(), [](Value operand) {
- return matchPattern(operand, m_ConstantIndex());
- }))
- return failure();
-
- auto memrefType = alloc.getType();
-
- // Ok, we have one or more constant operands. Collect the non-constant ones
- // and keep track of the resultant memref type to build.
- SmallVector<int64_t, 4> newShapeConstants;
- newShapeConstants.reserve(memrefType.getRank());
- SmallVector<Value, 4> newOperands;
-
- unsigned dynamicDimPos = 0;
- for (unsigned dim = 0, e = memrefType.getRank(); dim < e; ++dim) {
- int64_t dimSize = memrefType.getDimSize(dim);
- // If this is already static dimension, keep it.
- if (dimSize != -1) {
- newShapeConstants.push_back(dimSize);
- continue;
- }
- auto *defOp = alloc.getOperand(dynamicDimPos).getDefiningOp();
- if (auto constantIndexOp = dyn_cast_or_null<ConstantIndexOp>(defOp)) {
- // Dynamic shape dimension will be folded.
- newShapeConstants.push_back(constantIndexOp.getValue());
- } else {
- // Dynamic shape dimension not folded; copy operand from old memref.
- newShapeConstants.push_back(-1);
- newOperands.push_back(alloc.getOperand(dynamicDimPos));
- }
- dynamicDimPos++;
- }
-
- // Create new memref type (which will have fewer dynamic dimensions).
- MemRefType newMemRefType =
- MemRefType::Builder(memrefType).setShape(newShapeConstants);
- assert(static_cast<int64_t>(newOperands.size()) ==
- newMemRefType.getNumDynamicDims());
-
- // Create and insert the alloc op for the new memref.
- auto newAlloc = rewriter.create<AllocLikeOp>(alloc.getLoc(), newMemRefType,
- newOperands, IntegerAttr());
- // Insert a cast so we have the same type as the old alloc.
- auto resultCast =
- rewriter.create<CastOp>(alloc.getLoc(), newAlloc, alloc.getType());
-
- rewriter.replaceOp(alloc, {resultCast});
- return success();
- }
-};
-
-/// Fold alloc operations with no uses. Alloc has side effects on the heap,
-/// but can still be deleted if it has zero uses.
-struct SimplifyDeadAlloc : public OpRewritePattern<AllocOp> {
- using OpRewritePattern<AllocOp>::OpRewritePattern;
-
- LogicalResult matchAndRewrite(AllocOp alloc,
- PatternRewriter &rewriter) const override {
- if (alloc.use_empty()) {
- rewriter.eraseOp(alloc);
- return success();
- }
- return failure();
- }
-};
-} // end anonymous namespace.
-
-void AllocOp::getCanonicalizationPatterns(OwningRewritePatternList &results,
- MLIRContext *context) {
- results.insert<SimplifyAllocConst<AllocOp>, SimplifyDeadAlloc>(context);
-}
-
-void AllocaOp::getCanonicalizationPatterns(OwningRewritePatternList &results,
- MLIRContext *context) {
- results.insert<SimplifyAllocConst<AllocaOp>>(context);
-}
-
-//===----------------------------------------------------------------------===//
-// CastOp
-//===----------------------------------------------------------------------===//
-
-/// Determines whether MemRef_CastOp casts to a more dynamic version of the
-/// source memref. This is useful to to fold a memref.cast into a consuming op
-/// and implement canonicalization patterns for ops in
diff erent dialects that
-/// may consume the results of memref.cast operations. Such foldable memref.cast
-/// operations are typically inserted as `view` and `subview` ops are
-/// canonicalized, to preserve the type compatibility of their uses.
-///
-/// Returns true when all conditions are met:
-/// 1. source and result are ranked memrefs with strided semantics and same
-/// element type and rank.
-/// 2. each of the source's size, offset or stride has more static information
-/// than the corresponding result's size, offset or stride.
-///
-/// Example 1:
-/// ```mlir
-/// %1 = memref.cast %0 : memref<8x16xf32> to memref<?x?xf32>
-/// %2 = consumer %1 ... : memref<?x?xf32> ...
-/// ```
-///
-/// may fold into:
-///
-/// ```mlir
-/// %2 = consumer %0 ... : memref<8x16xf32> ...
-/// ```
-///
-/// Example 2:
-/// ```
-/// %1 = memref.cast %0 : memref<?x16xf32, affine_map<(i, j)->(16 * i + j)>>
-/// to memref<?x?xf32>
-/// consumer %1 : memref<?x?xf32> ...
-/// ```
-///
-/// may fold into:
-///
-/// ```
-/// consumer %0 ... : memref<?x16xf32, affine_map<(i, j)->(16 * i + j)>>
-/// ```
-bool CastOp::canFoldIntoConsumerOp(CastOp castOp) {
- MemRefType sourceType = castOp.source().getType().dyn_cast<MemRefType>();
- MemRefType resultType = castOp.getType().dyn_cast<MemRefType>();
-
- // Requires ranked MemRefType.
- if (!sourceType || !resultType)
- return false;
-
- // Requires same elemental type.
- if (sourceType.getElementType() != resultType.getElementType())
- return false;
-
- // Requires same rank.
- if (sourceType.getRank() != resultType.getRank())
- return false;
-
- // Only fold casts between strided memref forms.
- int64_t sourceOffset, resultOffset;
- SmallVector<int64_t, 4> sourceStrides, resultStrides;
- if (failed(getStridesAndOffset(sourceType, sourceStrides, sourceOffset)) ||
- failed(getStridesAndOffset(resultType, resultStrides, resultOffset)))
- return false;
-
- // If cast is towards more static sizes along any dimension, don't fold.
- for (auto it : llvm::zip(sourceType.getShape(), resultType.getShape())) {
- auto ss = std::get<0>(it), st = std::get<1>(it);
- if (ss != st)
- if (MemRefType::isDynamic(ss) && !MemRefType::isDynamic(st))
- return false;
- }
-
- // If cast is towards more static offset along any dimension, don't fold.
- if (sourceOffset != resultOffset)
- if (MemRefType::isDynamicStrideOrOffset(sourceOffset) &&
- !MemRefType::isDynamicStrideOrOffset(resultOffset))
- return false;
-
- // If cast is towards more static strides along any dimension, don't fold.
- for (auto it : llvm::zip(sourceStrides, resultStrides)) {
- auto ss = std::get<0>(it), st = std::get<1>(it);
- if (ss != st)
- if (MemRefType::isDynamicStrideOrOffset(ss) &&
- !MemRefType::isDynamicStrideOrOffset(st))
- return false;
- }
-
- return true;
-}
-
-bool CastOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
- if (inputs.size() != 1 || outputs.size() != 1)
- return false;
- Type a = inputs.front(), b = outputs.front();
- auto aT = a.dyn_cast<MemRefType>();
- auto bT = b.dyn_cast<MemRefType>();
-
- auto uaT = a.dyn_cast<UnrankedMemRefType>();
- auto ubT = b.dyn_cast<UnrankedMemRefType>();
-
- if (aT && bT) {
- if (aT.getElementType() != bT.getElementType())
- return false;
- if (aT.getAffineMaps() != bT.getAffineMaps()) {
- int64_t aOffset, bOffset;
- SmallVector<int64_t, 4> aStrides, bStrides;
- if (failed(getStridesAndOffset(aT, aStrides, aOffset)) ||
- failed(getStridesAndOffset(bT, bStrides, bOffset)) ||
- aStrides.size() != bStrides.size())
- return false;
-
- // Strides along a dimension/offset are compatible if the value in the
- // source memref is static and the value in the target memref is the
- // same. They are also compatible if either one is dynamic (see
- // description of MemRefCastOp for details).
- auto checkCompatible = [](int64_t a, int64_t b) {
- return (a == MemRefType::getDynamicStrideOrOffset() ||
- b == MemRefType::getDynamicStrideOrOffset() || a == b);
- };
- if (!checkCompatible(aOffset, bOffset))
- return false;
- for (auto aStride : enumerate(aStrides))
- if (!checkCompatible(aStride.value(), bStrides[aStride.index()]))
- return false;
- }
- if (aT.getMemorySpace() != bT.getMemorySpace())
- return false;
-
- // They must have the same rank, and any specified dimensions must match.
- if (aT.getRank() != bT.getRank())
- return false;
-
- for (unsigned i = 0, e = aT.getRank(); i != e; ++i) {
- int64_t aDim = aT.getDimSize(i), bDim = bT.getDimSize(i);
- if (aDim != -1 && bDim != -1 && aDim != bDim)
- return false;
- }
- return true;
- } else {
- if (!aT && !uaT)
- return false;
- if (!bT && !ubT)
- return false;
- // Unranked to unranked casting is unsupported
- if (uaT && ubT)
- return false;
-
- auto aEltType = (aT) ? aT.getElementType() : uaT.getElementType();
- auto bEltType = (bT) ? bT.getElementType() : ubT.getElementType();
- if (aEltType != bEltType)
- return false;
-
- auto aMemSpace = (aT) ? aT.getMemorySpace() : uaT.getMemorySpace();
- auto bMemSpace = (bT) ? bT.getMemorySpace() : ubT.getMemorySpace();
- if (aMemSpace != bMemSpace)
- return false;
-
- return true;
- }
-
- return false;
-}
-
-OpFoldResult CastOp::fold(ArrayRef<Attribute> operands) {
- return succeeded(foldMemRefCast(*this)) ? getResult() : Value();
-}
-
-//===----------------------------------------------------------------------===//
-// DeallocOp
-//===----------------------------------------------------------------------===//
-namespace {
-/// Fold Dealloc operations that are deallocating an AllocOp that is only used
-/// by other Dealloc operations.
-struct SimplifyDeadDealloc : public OpRewritePattern<DeallocOp> {
- using OpRewritePattern<DeallocOp>::OpRewritePattern;
-
- LogicalResult matchAndRewrite(DeallocOp dealloc,
- PatternRewriter &rewriter) const override {
- // Check that the memref operand's defining operation is an AllocOp.
- Value memref = dealloc.memref();
- if (!isa_and_nonnull<AllocOp>(memref.getDefiningOp()))
- return failure();
-
- // Check that all of the uses of the AllocOp are other DeallocOps.
- for (auto *user : memref.getUsers())
- if (!isa<DeallocOp>(user))
- return failure();
-
- // Erase the dealloc operation.
- rewriter.eraseOp(dealloc);
- return success();
- }
-};
-} // end anonymous namespace.
-
-static LogicalResult verify(DeallocOp op) {
- if (!op.memref().getType().isa<MemRefType>())
- return op.emitOpError("operand must be a memref");
- return success();
-}
-
-void DeallocOp::getCanonicalizationPatterns(OwningRewritePatternList &results,
- MLIRContext *context) {
- results.insert<SimplifyDeadDealloc>(context);
-}
-
-LogicalResult DeallocOp::fold(ArrayRef<Attribute> cstOperands,
- SmallVectorImpl<OpFoldResult> &results) {
- /// dealloc(memrefcast) -> dealloc
- return foldMemRefCast(*this);
-}
-
-//===----------------------------------------------------------------------===//
-// GlobalOp
-//===----------------------------------------------------------------------===//
-
-static void printGlobalMemrefOpTypeAndInitialValue(OpAsmPrinter &p, GlobalOp op,
- TypeAttr type,
- Attribute initialValue) {
- p << type;
- if (!op.isExternal()) {
- p << " = ";
- if (op.isUninitialized())
- p << "uninitialized";
- else
- p.printAttributeWithoutType(initialValue);
- }
-}
-
-static ParseResult
-parseGlobalMemrefOpTypeAndInitialValue(OpAsmParser &parser, TypeAttr &typeAttr,
- Attribute &initialValue) {
- Type type;
- if (parser.parseType(type))
- return failure();
-
- auto memrefType = type.dyn_cast<MemRefType>();
- if (!memrefType || !memrefType.hasStaticShape())
- return parser.emitError(parser.getNameLoc())
- << "type should be static shaped memref, but got " << type;
- typeAttr = TypeAttr::get(type);
-
- if (parser.parseOptionalEqual())
- return success();
-
- if (succeeded(parser.parseOptionalKeyword("uninitialized"))) {
- initialValue = UnitAttr::get(parser.getBuilder().getContext());
- return success();
- }
-
- Type tensorType = getTensorTypeFromMemRefType(memrefType);
- if (parser.parseAttribute(initialValue, tensorType))
- return failure();
- if (!initialValue.isa<ElementsAttr>())
- return parser.emitError(parser.getNameLoc())
- << "initial value should be a unit or elements attribute";
- return success();
-}
-
-static LogicalResult verify(GlobalOp op) {
- auto memrefType = op.type().dyn_cast<MemRefType>();
- if (!memrefType || !memrefType.hasStaticShape())
- return op.emitOpError("type should be static shaped memref, but got ")
- << op.type();
-
- // Verify that the initial value, if present, is either a unit attribute or
- // an elements attribute.
- if (op.initial_value().hasValue()) {
- Attribute initValue = op.initial_value().getValue();
- if (!initValue.isa<UnitAttr>() && !initValue.isa<ElementsAttr>())
- return op.emitOpError("initial value should be a unit or elements "
- "attribute, but got ")
- << initValue;
-
- // Check that the type of the initial value is compatible with the type of
- // the global variable.
- if (initValue.isa<ElementsAttr>()) {
- Type initType = initValue.getType();
- Type tensorType = getTensorTypeFromMemRefType(memrefType);
- if (initType != tensorType)
- return op.emitOpError("initial value expected to be of type ")
- << tensorType << ", but was of type " << initType;
- }
- }
-
- // TODO: verify visibility for declarations.
- return success();
-}
-
-//===----------------------------------------------------------------------===//
-// GetGlobalOp
-//===----------------------------------------------------------------------===//
-
-LogicalResult
-GetGlobalOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
- // Verify that the result type is same as the type of the referenced
- // memref.global op.
- auto global =
- symbolTable.lookupNearestSymbolFrom<GlobalOp>(*this, nameAttr());
- if (!global)
- return emitOpError("'")
- << name() << "' does not reference a valid global memref";
-
- Type resultType = result().getType();
- if (global.type() != resultType)
- return emitOpError("result type ")
- << resultType << " does not match type " << global.type()
- << " of the global memref @" << name();
- return success();
-}
-
-//===----------------------------------------------------------------------===//
-// PrefetchOp
-//===----------------------------------------------------------------------===//
-
-static void print(OpAsmPrinter &p, PrefetchOp op) {
- p << PrefetchOp::getOperationName() << " " << op.memref() << '[';
- p.printOperands(op.indices());
- p << ']' << ", " << (op.isWrite() ? "write" : "read");
- p << ", locality<" << op.localityHint();
- p << ">, " << (op.isDataCache() ? "data" : "instr");
- p.printOptionalAttrDict(
- op.getAttrs(),
- /*elidedAttrs=*/{"localityHint", "isWrite", "isDataCache"});
- p << " : " << op.getMemRefType();
-}
-
-static ParseResult parsePrefetchOp(OpAsmParser &parser,
- OperationState &result) {
- OpAsmParser::OperandType memrefInfo;
- SmallVector<OpAsmParser::OperandType, 4> indexInfo;
- IntegerAttr localityHint;
- MemRefType type;
- StringRef readOrWrite, cacheType;
-
- auto indexTy = parser.getBuilder().getIndexType();
- auto i32Type = parser.getBuilder().getIntegerType(32);
- if (parser.parseOperand(memrefInfo) ||
- parser.parseOperandList(indexInfo, OpAsmParser::Delimiter::Square) ||
- parser.parseComma() || parser.parseKeyword(&readOrWrite) ||
- parser.parseComma() || parser.parseKeyword("locality") ||
- parser.parseLess() ||
- parser.parseAttribute(localityHint, i32Type, "localityHint",
- result.attributes) ||
- parser.parseGreater() || parser.parseComma() ||
- parser.parseKeyword(&cacheType) || parser.parseColonType(type) ||
- parser.resolveOperand(memrefInfo, type, result.operands) ||
- parser.resolveOperands(indexInfo, indexTy, result.operands))
- return failure();
-
- if (!readOrWrite.equals("read") && !readOrWrite.equals("write"))
- return parser.emitError(parser.getNameLoc(),
- "rw specifier has to be 'read' or 'write'");
- result.addAttribute(
- PrefetchOp::getIsWriteAttrName(),
- parser.getBuilder().getBoolAttr(readOrWrite.equals("write")));
-
- if (!cacheType.equals("data") && !cacheType.equals("instr"))
- return parser.emitError(parser.getNameLoc(),
- "cache type has to be 'data' or 'instr'");
-
- result.addAttribute(
- PrefetchOp::getIsDataCacheAttrName(),
- parser.getBuilder().getBoolAttr(cacheType.equals("data")));
-
- return success();
-}
-
-static LogicalResult verify(PrefetchOp op) {
- if (op.getNumOperands() != 1 + op.getMemRefType().getRank())
- return op.emitOpError("too few indices");
-
- return success();
-}
-
-LogicalResult PrefetchOp::fold(ArrayRef<Attribute> cstOperands,
- SmallVectorImpl<OpFoldResult> &results) {
- // prefetch(memrefcast) -> prefetch
- return foldMemRefCast(*this);
-}
-
-//===----------------------------------------------------------------------===//
-// ReshapeOp
-//===----------------------------------------------------------------------===//
-
-static LogicalResult verify(ReshapeOp op) {
- Type operandType = op.source().getType();
- Type resultType = op.result().getType();
-
- Type operandElementType = operandType.cast<ShapedType>().getElementType();
- Type resultElementType = resultType.cast<ShapedType>().getElementType();
- if (operandElementType != resultElementType)
- return op.emitOpError("element types of source and destination memref "
- "types should be the same");
-
- if (auto operandMemRefType = operandType.dyn_cast<MemRefType>())
- if (!operandMemRefType.getAffineMaps().empty())
- return op.emitOpError(
- "source memref type should have identity affine map");
-
- int64_t shapeSize = op.shape().getType().cast<MemRefType>().getDimSize(0);
- auto resultMemRefType = resultType.dyn_cast<MemRefType>();
- if (resultMemRefType) {
- if (!resultMemRefType.getAffineMaps().empty())
- return op.emitOpError(
- "result memref type should have identity affine map");
- if (shapeSize == ShapedType::kDynamicSize)
- return op.emitOpError("cannot use shape operand with dynamic length to "
- "reshape to statically-ranked memref type");
- if (shapeSize != resultMemRefType.getRank())
- return op.emitOpError(
- "length of shape operand
diff ers from the result's memref rank");
- }
- return success();
-}
-
-//===----------------------------------------------------------------------===//
-// StoreOp
-//===----------------------------------------------------------------------===//
-
-static LogicalResult verify(StoreOp op) {
- if (op.getNumOperands() != 2 + op.getMemRefType().getRank())
- return op.emitOpError("store index operand count not equal to memref rank");
-
- return success();
-}
-
-LogicalResult StoreOp::fold(ArrayRef<Attribute> cstOperands,
- SmallVectorImpl<OpFoldResult> &results) {
- /// store(memrefcast) -> store
- return foldMemRefCast(*this);
-}
-
-//===----------------------------------------------------------------------===//
-// TransposeOp
-//===----------------------------------------------------------------------===//
-
-/// Build a strided memref type by applying `permutationMap` tp `memRefType`.
-static MemRefType inferTransposeResultType(MemRefType memRefType,
- AffineMap permutationMap) {
- auto rank = memRefType.getRank();
- auto originalSizes = memRefType.getShape();
- // Compute permuted sizes.
- SmallVector<int64_t, 4> sizes(rank, 0);
- for (auto en : llvm::enumerate(permutationMap.getResults()))
- sizes[en.index()] =
- originalSizes[en.value().cast<AffineDimExpr>().getPosition()];
-
- // Compute permuted strides.
- int64_t offset;
- SmallVector<int64_t, 4> strides;
- auto res = getStridesAndOffset(memRefType, strides, offset);
- assert(succeeded(res) && strides.size() == static_cast<unsigned>(rank));
- (void)res;
- auto map =
- makeStridedLinearLayoutMap(strides, offset, memRefType.getContext());
- map = permutationMap ? map.compose(permutationMap) : map;
- return MemRefType::Builder(memRefType).setShape(sizes).setAffineMaps(map);
-}
-
-void TransposeOp::build(OpBuilder &b, OperationState &result, Value in,
- AffineMapAttr permutation,
- ArrayRef<NamedAttribute> attrs) {
- auto permutationMap = permutation.getValue();
- assert(permutationMap);
-
- auto memRefType = in.getType().cast<MemRefType>();
- // Compute result type.
- MemRefType resultType = inferTransposeResultType(memRefType, permutationMap);
-
- build(b, result, resultType, in, attrs);
- result.addAttribute(TransposeOp::getPermutationAttrName(), permutation);
-}
-
-// transpose $in $permutation attr-dict : type($in) `to` type(results)
-static void print(OpAsmPrinter &p, TransposeOp op) {
- p << "transpose " << op.in() << " " << op.permutation();
- p.printOptionalAttrDict(op.getAttrs(),
- {TransposeOp::getPermutationAttrName()});
- p << " : " << op.in().getType() << " to " << op.getType();
-}
-
-static ParseResult parseTransposeOp(OpAsmParser &parser,
- OperationState &result) {
- OpAsmParser::OperandType in;
- AffineMap permutation;
- MemRefType srcType, dstType;
- if (parser.parseOperand(in) || parser.parseAffineMap(permutation) ||
- parser.parseOptionalAttrDict(result.attributes) ||
- parser.parseColonType(srcType) ||
- parser.resolveOperand(in, srcType, result.operands) ||
- parser.parseKeywordType("to", dstType) ||
- parser.addTypeToList(dstType, result.types))
- return failure();
-
- result.addAttribute(TransposeOp::getPermutationAttrName(),
- AffineMapAttr::get(permutation));
- return success();
-}
-
-static LogicalResult verify(TransposeOp op) {
- if (!op.permutation().isPermutation())
- return op.emitOpError("expected a permutation map");
- if (op.permutation().getNumDims() != op.getShapedType().getRank())
- return op.emitOpError(
- "expected a permutation map of same rank as the input");
-
- auto srcType = op.in().getType().cast<MemRefType>();
- auto dstType = op.getType().cast<MemRefType>();
- auto transposedType = inferTransposeResultType(srcType, op.permutation());
- if (dstType != transposedType)
- return op.emitOpError("output type ")
- << dstType << " does not match transposed input type " << srcType
- << ", " << transposedType;
- return success();
-}
-
-OpFoldResult TransposeOp::fold(ArrayRef<Attribute>) {
- if (succeeded(foldMemRefCast(*this)))
- return getResult();
- return {};
-}
-
-//===----------------------------------------------------------------------===//
-// ViewOp
-//===----------------------------------------------------------------------===//
-
-static ParseResult parseViewOp(OpAsmParser &parser, OperationState &result) {
- OpAsmParser::OperandType srcInfo;
- SmallVector<OpAsmParser::OperandType, 1> offsetInfo;
- SmallVector<OpAsmParser::OperandType, 4> sizesInfo;
- auto indexType = parser.getBuilder().getIndexType();
- Type srcType, dstType;
- llvm::SMLoc offsetLoc;
- if (parser.parseOperand(srcInfo) || parser.getCurrentLocation(&offsetLoc) ||
- parser.parseOperandList(offsetInfo, OpAsmParser::Delimiter::Square))
- return failure();
-
- if (offsetInfo.size() != 1)
- return parser.emitError(offsetLoc) << "expects 1 offset operand";
-
- return failure(
- parser.parseOperandList(sizesInfo, OpAsmParser::Delimiter::Square) ||
- parser.parseOptionalAttrDict(result.attributes) ||
- parser.parseColonType(srcType) ||
- parser.resolveOperand(srcInfo, srcType, result.operands) ||
- parser.resolveOperands(offsetInfo, indexType, result.operands) ||
- parser.resolveOperands(sizesInfo, indexType, result.operands) ||
- parser.parseKeywordType("to", dstType) ||
- parser.addTypeToList(dstType, result.types));
-}
-
-static void print(OpAsmPrinter &p, ViewOp op) {
- p << op.getOperationName() << ' ' << op.getOperand(0) << '[';
- p.printOperand(op.byte_shift());
- p << "][" << op.sizes() << ']';
- p.printOptionalAttrDict(op.getAttrs());
- p << " : " << op.getOperand(0).getType() << " to " << op.getType();
-}
-
-static LogicalResult verify(ViewOp op) {
- auto baseType = op.getOperand(0).getType().cast<MemRefType>();
- auto viewType = op.getType();
-
- // The base memref should have identity layout map (or none).
- if (baseType.getAffineMaps().size() > 1 ||
- (baseType.getAffineMaps().size() == 1 &&
- !baseType.getAffineMaps()[0].isIdentity()))
- return op.emitError("unsupported map for base memref type ") << baseType;
-
- // The result memref should have identity layout map (or none).
- if (viewType.getAffineMaps().size() > 1 ||
- (viewType.getAffineMaps().size() == 1 &&
- !viewType.getAffineMaps()[0].isIdentity()))
- return op.emitError("unsupported map for result memref type ") << viewType;
-
- // The base memref and the view memref should be in the same memory space.
- if (baseType.getMemorySpace() != viewType.getMemorySpace())
- return op.emitError("
diff erent memory spaces specified for base memref "
- "type ")
- << baseType << " and view memref type " << viewType;
-
- // Verify that we have the correct number of sizes for the result type.
- unsigned numDynamicDims = viewType.getNumDynamicDims();
- if (op.sizes().size() != numDynamicDims)
- return op.emitError("incorrect number of size operands for type ")
- << viewType;
-
- return success();
-}
-
-Value ViewOp::getViewSource() { return source(); }
-
-namespace {
-
-struct ViewOpShapeFolder : public OpRewritePattern<ViewOp> {
- using OpRewritePattern<ViewOp>::OpRewritePattern;
-
- LogicalResult matchAndRewrite(ViewOp viewOp,
- PatternRewriter &rewriter) const override {
- // Return if none of the operands are constants.
- if (llvm::none_of(viewOp.getOperands(), [](Value operand) {
- return matchPattern(operand, m_ConstantIndex());
- }))
- return failure();
-
- // Get result memref type.
- auto memrefType = viewOp.getType();
-
- // Get offset from old memref view type 'memRefType'.
- int64_t oldOffset;
- SmallVector<int64_t, 4> oldStrides;
- if (failed(getStridesAndOffset(memrefType, oldStrides, oldOffset)))
- return failure();
- assert(oldOffset == 0 && "Expected 0 offset");
-
- SmallVector<Value, 4> newOperands;
-
- // Offset cannot be folded into result type.
-
- // Fold any dynamic dim operands which are produced by a constant.
- SmallVector<int64_t, 4> newShapeConstants;
- newShapeConstants.reserve(memrefType.getRank());
-
- unsigned dynamicDimPos = 0;
- unsigned rank = memrefType.getRank();
- for (unsigned dim = 0, e = rank; dim < e; ++dim) {
- int64_t dimSize = memrefType.getDimSize(dim);
- // If this is already static dimension, keep it.
- if (!ShapedType::isDynamic(dimSize)) {
- newShapeConstants.push_back(dimSize);
- continue;
- }
- auto *defOp = viewOp.sizes()[dynamicDimPos].getDefiningOp();
- if (auto constantIndexOp = dyn_cast_or_null<ConstantIndexOp>(defOp)) {
- // Dynamic shape dimension will be folded.
- newShapeConstants.push_back(constantIndexOp.getValue());
- } else {
- // Dynamic shape dimension not folded; copy operand from old memref.
- newShapeConstants.push_back(dimSize);
- newOperands.push_back(viewOp.sizes()[dynamicDimPos]);
- }
- dynamicDimPos++;
- }
-
- // Create new memref type with constant folded dims.
- MemRefType newMemRefType =
- MemRefType::Builder(memrefType).setShape(newShapeConstants);
- // Nothing new, don't fold.
- if (newMemRefType == memrefType)
- return failure();
-
- // Create new ViewOp.
- auto newViewOp = rewriter.create<ViewOp>(viewOp.getLoc(), newMemRefType,
- viewOp.getOperand(0),
- viewOp.byte_shift(), newOperands);
- // Insert a cast so we have the same type as the old memref type.
- rewriter.replaceOpWithNewOp<CastOp>(viewOp, newViewOp, viewOp.getType());
- return success();
- }
-};
-
-struct ViewOpMemrefCastFolder : public OpRewritePattern<ViewOp> {
- using OpRewritePattern<ViewOp>::OpRewritePattern;
-
- LogicalResult matchAndRewrite(ViewOp viewOp,
- PatternRewriter &rewriter) const override {
- Value memrefOperand = viewOp.getOperand(0);
- CastOp memrefCastOp = memrefOperand.getDefiningOp<CastOp>();
- if (!memrefCastOp)
- return failure();
- Value allocOperand = memrefCastOp.getOperand();
- AllocOp allocOp = allocOperand.getDefiningOp<AllocOp>();
- if (!allocOp)
- return failure();
- rewriter.replaceOpWithNewOp<ViewOp>(viewOp, viewOp.getType(), allocOperand,
- viewOp.byte_shift(), viewOp.sizes());
- return success();
- }
-};
-
-} // end anonymous namespace
-
-void ViewOp::getCanonicalizationPatterns(OwningRewritePatternList &results,
- MLIRContext *context) {
- results.insert<ViewOpShapeFolder, ViewOpMemrefCastFolder>(context);
-}
-
-//===----------------------------------------------------------------------===//
-// TableGen'd op method definitions
-//===----------------------------------------------------------------------===//
-
-#define GET_OP_CLASSES
-#include "mlir/Dialect/MemRef/IR/MemRefOps.cpp.inc"
diff --git a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp
index 0eba9568bf41..f2fc78e4290e 100644
--- a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp
@@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/Passes.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/Transforms.h"
@@ -53,7 +52,7 @@ static bool haveNoReadsAfterWriteExceptSameIndex(
ParallelOp firstPloop, ParallelOp secondPloop,
const BlockAndValueMapping &firstToSecondPloopIndices) {
DenseMap<Value, SmallVector<ValueRange, 1>> bufferStores;
- firstPloop.getBody()->walk([&](memref::StoreOp store) {
+ firstPloop.getBody()->walk([&](StoreOp store) {
bufferStores[store.getMemRef()].push_back(store.indices());
});
auto walkResult = secondPloop.getBody()->walk([&](LoadOp load) {
diff --git a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
index bc9457bf1989..52b41ca305d1 100644
--- a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
+++ b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
@@ -9,7 +9,6 @@
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/CommonFolders.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
@@ -195,7 +194,6 @@ static void printStandardCastOp(Operation *op, OpAsmPrinter &p) {
}
void StandardOpsDialect::initialize() {
- getContext()->loadDialect<memref::MemRefDialect>();
getContext()->loadDialect<tensor::TensorDialect>();
addOperations<DmaStartOp, DmaWaitOp,
#define GET_OP_LIST
@@ -224,12 +222,12 @@ static detail::op_matcher<ConstantIndexOp> m_ConstantIndex() {
//===----------------------------------------------------------------------===//
/// This is a common class used for patterns of the form
-/// "someop(memrefcast) -> someop". It folds the source of any memref.cast
+/// "someop(memrefcast) -> someop". It folds the source of any memref_cast
/// into the root operation directly.
static LogicalResult foldMemRefCast(Operation *op) {
bool folded = false;
for (OpOperand &operand : op->getOpOperands()) {
- auto cast = operand.get().getDefiningOp<memref::CastOp>();
+ auto cast = operand.get().getDefiningOp<MemRefCastOp>();
if (cast && !cast.getOperand().getType().isa<UnrankedMemRefType>()) {
operand.set(cast.getOperand());
folded = true;
@@ -301,6 +299,131 @@ static SmallVector<int64_t, 4> extractFromI64ArrayAttr(Attribute attr) {
}));
}
+//===----------------------------------------------------------------------===//
+// AllocOp / AllocaOp
+//===----------------------------------------------------------------------===//
+
+template <typename AllocLikeOp>
+static LogicalResult verifyAllocLikeOp(AllocLikeOp op) {
+ static_assert(llvm::is_one_of<AllocLikeOp, AllocOp, AllocaOp>::value,
+ "applies to only alloc or alloca");
+ auto memRefType = op.getResult().getType().template dyn_cast<MemRefType>();
+ if (!memRefType)
+ return op.emitOpError("result must be a memref");
+
+ if (static_cast<int64_t>(op.dynamicSizes().size()) !=
+ memRefType.getNumDynamicDims())
+ return op.emitOpError("dimension operand count does not equal memref "
+ "dynamic dimension count");
+
+ unsigned numSymbols = 0;
+ if (!memRefType.getAffineMaps().empty())
+ numSymbols = memRefType.getAffineMaps().front().getNumSymbols();
+ if (op.symbolOperands().size() != numSymbols)
+ return op.emitOpError(
+ "symbol operand count does not equal memref symbol count");
+
+ return success();
+}
+
+static LogicalResult verify(AllocOp op) { return verifyAllocLikeOp(op); }
+
+static LogicalResult verify(AllocaOp op) {
+ // An alloca op needs to have an ancestor with an allocation scope trait.
+ if (!op->getParentWithTrait<OpTrait::AutomaticAllocationScope>())
+ return op.emitOpError(
+ "requires an ancestor op with AutomaticAllocationScope trait");
+
+ return verifyAllocLikeOp(op);
+}
+
+namespace {
+/// Fold constant dimensions into an alloc like operation.
+template <typename AllocLikeOp>
+struct SimplifyAllocConst : public OpRewritePattern<AllocLikeOp> {
+ using OpRewritePattern<AllocLikeOp>::OpRewritePattern;
+
+ LogicalResult matchAndRewrite(AllocLikeOp alloc,
+ PatternRewriter &rewriter) const override {
+ // Check to see if any dimensions operands are constants. If so, we can
+ // substitute and drop them.
+ if (llvm::none_of(alloc.getOperands(), [](Value operand) {
+ return matchPattern(operand, m_ConstantIndex());
+ }))
+ return failure();
+
+ auto memrefType = alloc.getType();
+
+ // Ok, we have one or more constant operands. Collect the non-constant ones
+ // and keep track of the resultant memref type to build.
+ SmallVector<int64_t, 4> newShapeConstants;
+ newShapeConstants.reserve(memrefType.getRank());
+ SmallVector<Value, 4> newOperands;
+
+ unsigned dynamicDimPos = 0;
+ for (unsigned dim = 0, e = memrefType.getRank(); dim < e; ++dim) {
+ int64_t dimSize = memrefType.getDimSize(dim);
+ // If this is already static dimension, keep it.
+ if (dimSize != -1) {
+ newShapeConstants.push_back(dimSize);
+ continue;
+ }
+ auto *defOp = alloc.getOperand(dynamicDimPos).getDefiningOp();
+ if (auto constantIndexOp = dyn_cast_or_null<ConstantIndexOp>(defOp)) {
+ // Dynamic shape dimension will be folded.
+ newShapeConstants.push_back(constantIndexOp.getValue());
+ } else {
+ // Dynamic shape dimension not folded; copy operand from old memref.
+ newShapeConstants.push_back(-1);
+ newOperands.push_back(alloc.getOperand(dynamicDimPos));
+ }
+ dynamicDimPos++;
+ }
+
+ // Create new memref type (which will have fewer dynamic dimensions).
+ MemRefType newMemRefType =
+ MemRefType::Builder(memrefType).setShape(newShapeConstants);
+ assert(static_cast<int64_t>(newOperands.size()) ==
+ newMemRefType.getNumDynamicDims());
+
+ // Create and insert the alloc op for the new memref.
+ auto newAlloc = rewriter.create<AllocLikeOp>(alloc.getLoc(), newMemRefType,
+ newOperands, IntegerAttr());
+ // Insert a cast so we have the same type as the old alloc.
+ auto resultCast = rewriter.create<MemRefCastOp>(alloc.getLoc(), newAlloc,
+ alloc.getType());
+
+ rewriter.replaceOp(alloc, {resultCast});
+ return success();
+ }
+};
+
+/// Fold alloc operations with no uses. Alloc has side effects on the heap,
+/// but can still be deleted if it has zero uses.
+struct SimplifyDeadAlloc : public OpRewritePattern<AllocOp> {
+ using OpRewritePattern<AllocOp>::OpRewritePattern;
+
+ LogicalResult matchAndRewrite(AllocOp alloc,
+ PatternRewriter &rewriter) const override {
+ if (alloc.use_empty()) {
+ rewriter.eraseOp(alloc);
+ return success();
+ }
+ return failure();
+ }
+};
+} // end anonymous namespace.
+
+void AllocOp::getCanonicalizationPatterns(OwningRewritePatternList &results,
+ MLIRContext *context) {
+ results.insert<SimplifyAllocConst<AllocOp>, SimplifyDeadAlloc>(context);
+}
+
+void AllocaOp::getCanonicalizationPatterns(OwningRewritePatternList &results,
+ MLIRContext *context) {
+ results.insert<SimplifyAllocConst<AllocaOp>>(context);
+}
+
//===----------------------------------------------------------------------===//
// AndOp
//===----------------------------------------------------------------------===//
@@ -1204,6 +1327,51 @@ void ConstantIndexOp::build(OpBuilder &builder, OperationState &result,
ConstantOp::build(builder, result, type, builder.getIntegerAttr(type, value));
}
+//===----------------------------------------------------------------------===//
+// DeallocOp
+//===----------------------------------------------------------------------===//
+namespace {
+/// Fold Dealloc operations that are deallocating an AllocOp that is only used
+/// by other Dealloc operations.
+struct SimplifyDeadDealloc : public OpRewritePattern<DeallocOp> {
+ using OpRewritePattern<DeallocOp>::OpRewritePattern;
+
+ LogicalResult matchAndRewrite(DeallocOp dealloc,
+ PatternRewriter &rewriter) const override {
+ // Check that the memref operand's defining operation is an AllocOp.
+ Value memref = dealloc.memref();
+ if (!isa_and_nonnull<AllocOp>(memref.getDefiningOp()))
+ return failure();
+
+ // Check that all of the uses of the AllocOp are other DeallocOps.
+ for (auto *user : memref.getUsers())
+ if (!isa<DeallocOp>(user))
+ return failure();
+
+ // Erase the dealloc operation.
+ rewriter.eraseOp(dealloc);
+ return success();
+ }
+};
+} // end anonymous namespace.
+
+static LogicalResult verify(DeallocOp op) {
+ if (!op.memref().getType().isa<MemRefType>())
+ return op.emitOpError("operand must be a memref");
+ return success();
+}
+
+void DeallocOp::getCanonicalizationPatterns(OwningRewritePatternList &results,
+ MLIRContext *context) {
+ results.insert<SimplifyDeadDealloc>(context);
+}
+
+LogicalResult DeallocOp::fold(ArrayRef<Attribute> cstOperands,
+ SmallVectorImpl<OpFoldResult> &results) {
+ /// dealloc(memrefcast) -> dealloc
+ return foldMemRefCast(*this);
+}
+
//===----------------------------------------------------------------------===//
// DimOp
//===----------------------------------------------------------------------===//
@@ -1309,11 +1477,11 @@ OpFoldResult DimOp::fold(ArrayRef<Attribute> operands) {
if (!memrefType)
return {};
- if (auto alloc = dyn_cast_or_null<memref::AllocOp>(definingOp))
+ if (auto alloc = dyn_cast_or_null<AllocOp>(definingOp))
return *(alloc.getDynamicSizes().begin() +
memrefType.getDynamicDimIndex(unsignedIndex));
- if (auto view = dyn_cast_or_null<memref::ViewOp>(definingOp))
+ if (auto view = dyn_cast_or_null<ViewOp>(definingOp))
return *(view.getDynamicSizes().begin() +
memrefType.getDynamicDimIndex(unsignedIndex));
@@ -1688,6 +1856,106 @@ bool FPTruncOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
return areVectorCastSimpleCompatible(a, b, areCastCompatible);
}
+//===----------------------------------------------------------------------===//
+// GlobalMemrefOp
+//===----------------------------------------------------------------------===//
+
+static void printGlobalMemrefOpTypeAndInitialValue(OpAsmPrinter &p,
+ GlobalMemrefOp op,
+ TypeAttr type,
+ Attribute initialValue) {
+ p << type;
+ if (!op.isExternal()) {
+ p << " = ";
+ if (op.isUninitialized())
+ p << "uninitialized";
+ else
+ p.printAttributeWithoutType(initialValue);
+ }
+}
+
+static ParseResult
+parseGlobalMemrefOpTypeAndInitialValue(OpAsmParser &parser, TypeAttr &typeAttr,
+ Attribute &initialValue) {
+ Type type;
+ if (parser.parseType(type))
+ return failure();
+
+ auto memrefType = type.dyn_cast<MemRefType>();
+ if (!memrefType || !memrefType.hasStaticShape())
+ return parser.emitError(parser.getNameLoc())
+ << "type should be static shaped memref, but got " << type;
+ typeAttr = TypeAttr::get(type);
+
+ if (parser.parseOptionalEqual())
+ return success();
+
+ if (succeeded(parser.parseOptionalKeyword("uninitialized"))) {
+ initialValue = UnitAttr::get(parser.getBuilder().getContext());
+ return success();
+ }
+
+ Type tensorType = getTensorTypeFromMemRefType(memrefType);
+ if (parser.parseAttribute(initialValue, tensorType))
+ return failure();
+ if (!initialValue.isa<ElementsAttr>())
+ return parser.emitError(parser.getNameLoc())
+ << "initial value should be a unit or elements attribute";
+ return success();
+}
+
+static LogicalResult verify(GlobalMemrefOp op) {
+ auto memrefType = op.type().dyn_cast<MemRefType>();
+ if (!memrefType || !memrefType.hasStaticShape())
+ return op.emitOpError("type should be static shaped memref, but got ")
+ << op.type();
+
+ // Verify that the initial value, if present, is either a unit attribute or
+ // an elements attribute.
+ if (op.initial_value().hasValue()) {
+ Attribute initValue = op.initial_value().getValue();
+ if (!initValue.isa<UnitAttr>() && !initValue.isa<ElementsAttr>())
+ return op.emitOpError("initial value should be a unit or elements "
+ "attribute, but got ")
+ << initValue;
+
+ // Check that the type of the initial value is compatible with the type of
+ // the global variable.
+ if (initValue.isa<ElementsAttr>()) {
+ Type initType = initValue.getType();
+ Type tensorType = getTensorTypeFromMemRefType(memrefType);
+ if (initType != tensorType)
+ return op.emitOpError("initial value expected to be of type ")
+ << tensorType << ", but was of type " << initType;
+ }
+ }
+
+ // TODO: verify visibility for declarations.
+ return success();
+}
+
+//===----------------------------------------------------------------------===//
+// GetGlobalMemrefOp
+//===----------------------------------------------------------------------===//
+
+LogicalResult
+GetGlobalMemrefOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
+ // Verify that the result type is same as the type of the referenced
+ // global_memref op.
+ auto global =
+ symbolTable.lookupNearestSymbolFrom<GlobalMemrefOp>(*this, nameAttr());
+ if (!global)
+ return emitOpError("'")
+ << name() << "' does not reference a valid global memref";
+
+ Type resultType = result().getType();
+ if (global.type() != resultType)
+ return emitOpError("result type ")
+ << resultType << " does not match type " << global.type()
+ << " of the global memref @" << name();
+ return success();
+}
+
//===----------------------------------------------------------------------===//
// IndexCastOp
//===----------------------------------------------------------------------===//
@@ -1766,6 +2034,89 @@ void LoadOp::getCanonicalizationPatterns(OwningRewritePatternList &results,
results.insert<LoadOfTensorToMemref>(context);
}
+//===----------------------------------------------------------------------===//
+// MemRefCastOp
+//===----------------------------------------------------------------------===//
+
+Value MemRefCastOp::getViewSource() { return source(); }
+
+bool MemRefCastOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
+ if (inputs.size() != 1 || outputs.size() != 1)
+ return false;
+ Type a = inputs.front(), b = outputs.front();
+ auto aT = a.dyn_cast<MemRefType>();
+ auto bT = b.dyn_cast<MemRefType>();
+
+ auto uaT = a.dyn_cast<UnrankedMemRefType>();
+ auto ubT = b.dyn_cast<UnrankedMemRefType>();
+
+ if (aT && bT) {
+ if (aT.getElementType() != bT.getElementType())
+ return false;
+ if (aT.getAffineMaps() != bT.getAffineMaps()) {
+ int64_t aOffset, bOffset;
+ SmallVector<int64_t, 4> aStrides, bStrides;
+ if (failed(getStridesAndOffset(aT, aStrides, aOffset)) ||
+ failed(getStridesAndOffset(bT, bStrides, bOffset)) ||
+ aStrides.size() != bStrides.size())
+ return false;
+
+ // Strides along a dimension/offset are compatible if the value in the
+ // source memref is static and the value in the target memref is the
+ // same. They are also compatible if either one is dynamic (see
+ // description of MemRefCastOp for details).
+ auto checkCompatible = [](int64_t a, int64_t b) {
+ return (a == MemRefType::getDynamicStrideOrOffset() ||
+ b == MemRefType::getDynamicStrideOrOffset() || a == b);
+ };
+ if (!checkCompatible(aOffset, bOffset))
+ return false;
+ for (auto aStride : enumerate(aStrides))
+ if (!checkCompatible(aStride.value(), bStrides[aStride.index()]))
+ return false;
+ }
+ if (aT.getMemorySpace() != bT.getMemorySpace())
+ return false;
+
+ // They must have the same rank, and any specified dimensions must match.
+ if (aT.getRank() != bT.getRank())
+ return false;
+
+ for (unsigned i = 0, e = aT.getRank(); i != e; ++i) {
+ int64_t aDim = aT.getDimSize(i), bDim = bT.getDimSize(i);
+ if (aDim != -1 && bDim != -1 && aDim != bDim)
+ return false;
+ }
+ return true;
+ } else {
+ if (!aT && !uaT)
+ return false;
+ if (!bT && !ubT)
+ return false;
+ // Unranked to unranked casting is unsupported
+ if (uaT && ubT)
+ return false;
+
+ auto aEltType = (aT) ? aT.getElementType() : uaT.getElementType();
+ auto bEltType = (bT) ? bT.getElementType() : ubT.getElementType();
+ if (aEltType != bEltType)
+ return false;
+
+ auto aMemSpace = (aT) ? aT.getMemorySpace() : uaT.getMemorySpace();
+ auto bMemSpace = (bT) ? bT.getMemorySpace() : ubT.getMemorySpace();
+ if (aMemSpace != bMemSpace)
+ return false;
+
+ return true;
+ }
+
+ return false;
+}
+
+OpFoldResult MemRefCastOp::fold(ArrayRef<Attribute> operands) {
+ return succeeded(foldMemRefCast(*this)) ? getResult() : Value();
+}
+
//===----------------------------------------------------------------------===//
// MemRefReinterpretCastOp
//===----------------------------------------------------------------------===//
@@ -1954,6 +2305,76 @@ OpFoldResult OrOp::fold(ArrayRef<Attribute> operands) {
[](APInt a, APInt b) { return a | b; });
}
+//===----------------------------------------------------------------------===//
+// PrefetchOp
+//===----------------------------------------------------------------------===//
+
+static void print(OpAsmPrinter &p, PrefetchOp op) {
+ p << PrefetchOp::getOperationName() << " " << op.memref() << '[';
+ p.printOperands(op.indices());
+ p << ']' << ", " << (op.isWrite() ? "write" : "read");
+ p << ", locality<" << op.localityHint();
+ p << ">, " << (op.isDataCache() ? "data" : "instr");
+ p.printOptionalAttrDict(
+ op.getAttrs(),
+ /*elidedAttrs=*/{"localityHint", "isWrite", "isDataCache"});
+ p << " : " << op.getMemRefType();
+}
+
+static ParseResult parsePrefetchOp(OpAsmParser &parser,
+ OperationState &result) {
+ OpAsmParser::OperandType memrefInfo;
+ SmallVector<OpAsmParser::OperandType, 4> indexInfo;
+ IntegerAttr localityHint;
+ MemRefType type;
+ StringRef readOrWrite, cacheType;
+
+ auto indexTy = parser.getBuilder().getIndexType();
+ auto i32Type = parser.getBuilder().getIntegerType(32);
+ if (parser.parseOperand(memrefInfo) ||
+ parser.parseOperandList(indexInfo, OpAsmParser::Delimiter::Square) ||
+ parser.parseComma() || parser.parseKeyword(&readOrWrite) ||
+ parser.parseComma() || parser.parseKeyword("locality") ||
+ parser.parseLess() ||
+ parser.parseAttribute(localityHint, i32Type, "localityHint",
+ result.attributes) ||
+ parser.parseGreater() || parser.parseComma() ||
+ parser.parseKeyword(&cacheType) || parser.parseColonType(type) ||
+ parser.resolveOperand(memrefInfo, type, result.operands) ||
+ parser.resolveOperands(indexInfo, indexTy, result.operands))
+ return failure();
+
+ if (!readOrWrite.equals("read") && !readOrWrite.equals("write"))
+ return parser.emitError(parser.getNameLoc(),
+ "rw specifier has to be 'read' or 'write'");
+ result.addAttribute(
+ PrefetchOp::getIsWriteAttrName(),
+ parser.getBuilder().getBoolAttr(readOrWrite.equals("write")));
+
+ if (!cacheType.equals("data") && !cacheType.equals("instr"))
+ return parser.emitError(parser.getNameLoc(),
+ "cache type has to be 'data' or 'instr'");
+
+ result.addAttribute(
+ PrefetchOp::getIsDataCacheAttrName(),
+ parser.getBuilder().getBoolAttr(cacheType.equals("data")));
+
+ return success();
+}
+
+static LogicalResult verify(PrefetchOp op) {
+ if (op.getNumOperands() != 1 + op.getMemRefType().getRank())
+ return op.emitOpError("too few indices");
+
+ return success();
+}
+
+LogicalResult PrefetchOp::fold(ArrayRef<Attribute> cstOperands,
+ SmallVectorImpl<OpFoldResult> &results) {
+ // prefetch(memrefcast) -> prefetch
+ return foldMemRefCast(*this);
+}
+
//===----------------------------------------------------------------------===//
// RankOp
//===----------------------------------------------------------------------===//
@@ -2292,6 +2713,23 @@ OpFoldResult SplatOp::fold(ArrayRef<Attribute> operands) {
return SplatElementsAttr::get(shapedType, {constOperand});
}
+//===----------------------------------------------------------------------===//
+// StoreOp
+//===----------------------------------------------------------------------===//
+
+static LogicalResult verify(StoreOp op) {
+ if (op.getNumOperands() != 2 + op.getMemRefType().getRank())
+ return op.emitOpError("store index operand count not equal to memref rank");
+
+ return success();
+}
+
+LogicalResult StoreOp::fold(ArrayRef<Attribute> cstOperands,
+ SmallVectorImpl<OpFoldResult> &results) {
+ /// store(memrefcast) -> store
+ return foldMemRefCast(*this);
+}
+
//===----------------------------------------------------------------------===//
// SubFOp
//===----------------------------------------------------------------------===//
@@ -2779,7 +3217,7 @@ void canonicalizeSubViewPart(SmallVectorImpl<OpFoldResult> &values,
static void replaceWithNewOp(PatternRewriter &rewriter, SubViewOp op,
SubViewOp newOp) {
- rewriter.replaceOpWithNewOp<memref::CastOp>(op, newOp, op.getType());
+ rewriter.replaceOpWithNewOp<MemRefCastOp>(op, newOp, op.getType());
}
static void replaceWithNewOp(PatternRewriter &rewriter, SubTensorOp op,
@@ -2823,21 +3261,107 @@ class OpWithOffsetSizesAndStridesConstantArgumentFolder final
} // end anonymous namespace
+/// Determines whether MemRefCastOp casts to a more dynamic version of the
+/// source memref. This is useful to to fold a memref_cast into a consuming op
+/// and implement canonicalization patterns for ops in
diff erent dialects that
+/// may consume the results of memref_cast operations. Such foldable memref_cast
+/// operations are typically inserted as `view` and `subview` ops are
+/// canonicalized, to preserve the type compatibility of their uses.
+///
+/// Returns true when all conditions are met:
+/// 1. source and result are ranked memrefs with strided semantics and same
+/// element type and rank.
+/// 2. each of the source's size, offset or stride has more static information
+/// than the corresponding result's size, offset or stride.
+///
+/// Example 1:
+/// ```mlir
+/// %1 = memref_cast %0 : memref<8x16xf32> to memref<?x?xf32>
+/// %2 = consumer %1 ... : memref<?x?xf32> ...
+/// ```
+///
+/// may fold into:
+///
+/// ```mlir
+/// %2 = consumer %0 ... : memref<8x16xf32> ...
+/// ```
+///
+/// Example 2:
+/// ```
+/// %1 = memref_cast %0 : memref<?x16xf32, affine_map<(i, j)->(16 * i + j)>>
+/// to memref<?x?xf32>
+/// consumer %1 : memref<?x?xf32> ...
+/// ```
+///
+/// may fold into:
+///
+/// ```
+/// consumer %0 ... : memref<?x16xf32, affine_map<(i, j)->(16 * i + j)>>
+/// ```
+bool mlir::canFoldIntoConsumerOp(MemRefCastOp castOp) {
+ MemRefType sourceType = castOp.source().getType().dyn_cast<MemRefType>();
+ MemRefType resultType = castOp.getType().dyn_cast<MemRefType>();
+
+ // Requires ranked MemRefType.
+ if (!sourceType || !resultType)
+ return false;
+
+ // Requires same elemental type.
+ if (sourceType.getElementType() != resultType.getElementType())
+ return false;
+
+ // Requires same rank.
+ if (sourceType.getRank() != resultType.getRank())
+ return false;
+
+ // Only fold casts between strided memref forms.
+ int64_t sourceOffset, resultOffset;
+ SmallVector<int64_t, 4> sourceStrides, resultStrides;
+ if (failed(getStridesAndOffset(sourceType, sourceStrides, sourceOffset)) ||
+ failed(getStridesAndOffset(resultType, resultStrides, resultOffset)))
+ return false;
+
+ // If cast is towards more static sizes along any dimension, don't fold.
+ for (auto it : llvm::zip(sourceType.getShape(), resultType.getShape())) {
+ auto ss = std::get<0>(it), st = std::get<1>(it);
+ if (ss != st)
+ if (MemRefType::isDynamic(ss) && !MemRefType::isDynamic(st))
+ return false;
+ }
+
+ // If cast is towards more static offset along any dimension, don't fold.
+ if (sourceOffset != resultOffset)
+ if (MemRefType::isDynamicStrideOrOffset(sourceOffset) &&
+ !MemRefType::isDynamicStrideOrOffset(resultOffset))
+ return false;
+
+ // If cast is towards more static strides along any dimension, don't fold.
+ for (auto it : llvm::zip(sourceStrides, resultStrides)) {
+ auto ss = std::get<0>(it), st = std::get<1>(it);
+ if (ss != st)
+ if (MemRefType::isDynamicStrideOrOffset(ss) &&
+ !MemRefType::isDynamicStrideOrOffset(st))
+ return false;
+ }
+
+ return true;
+}
+
namespace {
/// Pattern to rewrite a subview op with MemRefCast arguments.
-/// This essentially pushes memref.cast past its consuming subview when
+/// This essentially pushes memref_cast past its consuming subview when
/// `canFoldIntoConsumerOp` is true.
///
/// Example:
/// ```
-/// %0 = memref.cast %V : memref<16x16xf32> to memref<?x?xf32>
+/// %0 = memref_cast %V : memref<16x16xf32> to memref<?x?xf32>
/// %1 = subview %0[0, 0][3, 4][1, 1] :
/// memref<?x?xf32> to memref<3x4xf32, offset:?, strides:[?, 1]>
/// ```
/// is rewritten into:
/// ```
/// %0 = subview %V: memref<16x16xf32> to memref<3x4xf32, #[[map0]]>
-/// %1 = memref.cast %0: memref<3x4xf32, offset:0, strides:[16, 1]> to
+/// %1 = memref_cast %0: memref<3x4xf32, offset:0, strides:[16, 1]> to
/// memref<3x4xf32, offset:?, strides:[?, 1]>
/// ```
class SubViewOpMemRefCastFolder final : public OpRewritePattern<SubViewOp> {
@@ -2852,11 +3376,11 @@ class SubViewOpMemRefCastFolder final : public OpRewritePattern<SubViewOp> {
}))
return failure();
- auto castOp = subViewOp.source().getDefiningOp<memref::CastOp>();
+ auto castOp = subViewOp.source().getDefiningOp<MemRefCastOp>();
if (!castOp)
return failure();
- if (!memref::CastOp::canFoldIntoConsumerOp(castOp))
+ if (!canFoldIntoConsumerOp(castOp))
return failure();
/// Deduce the resultType of the SubViewOp using `inferSubViewResultType` on
@@ -2889,8 +3413,8 @@ class SubViewOpMemRefCastFolder final : public OpRewritePattern<SubViewOp> {
subViewOp.getLoc(), resultType, castOp.source(), subViewOp.offsets(),
subViewOp.sizes(), subViewOp.strides(), subViewOp.static_offsets(),
subViewOp.static_sizes(), subViewOp.static_strides());
- rewriter.replaceOpWithNewOp<memref::CastOp>(subViewOp, subViewOp.getType(),
- newSubView);
+ rewriter.replaceOpWithNewOp<MemRefCastOp>(subViewOp, subViewOp.getType(),
+ newSubView);
return success();
}
};
@@ -3113,8 +3637,8 @@ struct TensorCastToMemref : public OpRewritePattern<TensorToMemrefOp> {
srcTensorType.getElementType());
Value memref = rewriter.create<TensorToMemrefOp>(
tensorToMemRef.getLoc(), memrefType, tensorCastOperand.getOperand());
- rewriter.replaceOpWithNewOp<memref::CastOp>(
- tensorToMemRef, tensorToMemRef.getType(), memref);
+ rewriter.replaceOpWithNewOp<MemRefCastOp>(tensorToMemRef,
+ tensorToMemRef.getType(), memref);
return success();
}
};
@@ -3125,6 +3649,96 @@ void TensorToMemrefOp::getCanonicalizationPatterns(
results.insert<TensorCastToMemref>(context);
}
+//===----------------------------------------------------------------------===//
+// TransposeOp
+//===----------------------------------------------------------------------===//
+
+/// Build a strided memref type by applying `permutationMap` tp `memRefType`.
+static MemRefType inferTransposeResultType(MemRefType memRefType,
+ AffineMap permutationMap) {
+ auto rank = memRefType.getRank();
+ auto originalSizes = memRefType.getShape();
+ // Compute permuted sizes.
+ SmallVector<int64_t, 4> sizes(rank, 0);
+ for (auto en : llvm::enumerate(permutationMap.getResults()))
+ sizes[en.index()] =
+ originalSizes[en.value().cast<AffineDimExpr>().getPosition()];
+
+ // Compute permuted strides.
+ int64_t offset;
+ SmallVector<int64_t, 4> strides;
+ auto res = getStridesAndOffset(memRefType, strides, offset);
+ assert(succeeded(res) && strides.size() == static_cast<unsigned>(rank));
+ (void)res;
+ auto map =
+ makeStridedLinearLayoutMap(strides, offset, memRefType.getContext());
+ map = permutationMap ? map.compose(permutationMap) : map;
+ return MemRefType::Builder(memRefType).setShape(sizes).setAffineMaps(map);
+}
+
+void TransposeOp::build(OpBuilder &b, OperationState &result, Value in,
+ AffineMapAttr permutation,
+ ArrayRef<NamedAttribute> attrs) {
+ auto permutationMap = permutation.getValue();
+ assert(permutationMap);
+
+ auto memRefType = in.getType().cast<MemRefType>();
+ // Compute result type.
+ MemRefType resultType = inferTransposeResultType(memRefType, permutationMap);
+
+ build(b, result, resultType, in, attrs);
+ result.addAttribute(TransposeOp::getPermutationAttrName(), permutation);
+}
+
+// transpose $in $permutation attr-dict : type($in) `to` type(results)
+static void print(OpAsmPrinter &p, TransposeOp op) {
+ p << "transpose " << op.in() << " " << op.permutation();
+ p.printOptionalAttrDict(op.getAttrs(),
+ {TransposeOp::getPermutationAttrName()});
+ p << " : " << op.in().getType() << " to " << op.getType();
+}
+
+static ParseResult parseTransposeOp(OpAsmParser &parser,
+ OperationState &result) {
+ OpAsmParser::OperandType in;
+ AffineMap permutation;
+ MemRefType srcType, dstType;
+ if (parser.parseOperand(in) || parser.parseAffineMap(permutation) ||
+ parser.parseOptionalAttrDict(result.attributes) ||
+ parser.parseColonType(srcType) ||
+ parser.resolveOperand(in, srcType, result.operands) ||
+ parser.parseKeywordType("to", dstType) ||
+ parser.addTypeToList(dstType, result.types))
+ return failure();
+
+ result.addAttribute(TransposeOp::getPermutationAttrName(),
+ AffineMapAttr::get(permutation));
+ return success();
+}
+
+static LogicalResult verify(TransposeOp op) {
+ if (!op.permutation().isPermutation())
+ return op.emitOpError("expected a permutation map");
+ if (op.permutation().getNumDims() != op.getShapedType().getRank())
+ return op.emitOpError(
+ "expected a permutation map of same rank as the input");
+
+ auto srcType = op.in().getType().cast<MemRefType>();
+ auto dstType = op.getType().cast<MemRefType>();
+ auto transposedType = inferTransposeResultType(srcType, op.permutation());
+ if (dstType != transposedType)
+ return op.emitOpError("output type ")
+ << dstType << " does not match transposed input type " << srcType
+ << ", " << transposedType;
+ return success();
+}
+
+OpFoldResult TransposeOp::fold(ArrayRef<Attribute>) {
+ if (succeeded(foldMemRefCast(*this)))
+ return getResult();
+ return {};
+}
+
//===----------------------------------------------------------------------===//
// TruncateIOp
//===----------------------------------------------------------------------===//
@@ -3201,6 +3815,172 @@ OpFoldResult UnsignedRemIOp::fold(ArrayRef<Attribute> operands) {
return IntegerAttr::get(lhs.getType(), lhs.getValue().urem(rhsValue));
}
+//===----------------------------------------------------------------------===//
+// ViewOp
+//===----------------------------------------------------------------------===//
+
+static ParseResult parseViewOp(OpAsmParser &parser, OperationState &result) {
+ OpAsmParser::OperandType srcInfo;
+ SmallVector<OpAsmParser::OperandType, 1> offsetInfo;
+ SmallVector<OpAsmParser::OperandType, 4> sizesInfo;
+ auto indexType = parser.getBuilder().getIndexType();
+ Type srcType, dstType;
+ llvm::SMLoc offsetLoc;
+ if (parser.parseOperand(srcInfo) || parser.getCurrentLocation(&offsetLoc) ||
+ parser.parseOperandList(offsetInfo, OpAsmParser::Delimiter::Square))
+ return failure();
+
+ if (offsetInfo.size() != 1)
+ return parser.emitError(offsetLoc) << "expects 1 offset operand";
+
+ return failure(
+ parser.parseOperandList(sizesInfo, OpAsmParser::Delimiter::Square) ||
+ parser.parseOptionalAttrDict(result.attributes) ||
+ parser.parseColonType(srcType) ||
+ parser.resolveOperand(srcInfo, srcType, result.operands) ||
+ parser.resolveOperands(offsetInfo, indexType, result.operands) ||
+ parser.resolveOperands(sizesInfo, indexType, result.operands) ||
+ parser.parseKeywordType("to", dstType) ||
+ parser.addTypeToList(dstType, result.types));
+}
+
+static void print(OpAsmPrinter &p, ViewOp op) {
+ p << op.getOperationName() << ' ' << op.getOperand(0) << '[';
+ p.printOperand(op.byte_shift());
+ p << "][" << op.sizes() << ']';
+ p.printOptionalAttrDict(op.getAttrs());
+ p << " : " << op.getOperand(0).getType() << " to " << op.getType();
+}
+
+static LogicalResult verify(ViewOp op) {
+ auto baseType = op.getOperand(0).getType().cast<MemRefType>();
+ auto viewType = op.getType();
+
+ // The base memref should have identity layout map (or none).
+ if (baseType.getAffineMaps().size() > 1 ||
+ (baseType.getAffineMaps().size() == 1 &&
+ !baseType.getAffineMaps()[0].isIdentity()))
+ return op.emitError("unsupported map for base memref type ") << baseType;
+
+ // The result memref should have identity layout map (or none).
+ if (viewType.getAffineMaps().size() > 1 ||
+ (viewType.getAffineMaps().size() == 1 &&
+ !viewType.getAffineMaps()[0].isIdentity()))
+ return op.emitError("unsupported map for result memref type ") << viewType;
+
+ // The base memref and the view memref should be in the same memory space.
+ if (baseType.getMemorySpace() != viewType.getMemorySpace())
+ return op.emitError("
diff erent memory spaces specified for base memref "
+ "type ")
+ << baseType << " and view memref type " << viewType;
+
+ // Verify that we have the correct number of sizes for the result type.
+ unsigned numDynamicDims = viewType.getNumDynamicDims();
+ if (op.sizes().size() != numDynamicDims)
+ return op.emitError("incorrect number of size operands for type ")
+ << viewType;
+
+ return success();
+}
+
+Value ViewOp::getViewSource() { return source(); }
+
+namespace {
+
+struct ViewOpShapeFolder : public OpRewritePattern<ViewOp> {
+ using OpRewritePattern<ViewOp>::OpRewritePattern;
+
+ LogicalResult matchAndRewrite(ViewOp viewOp,
+ PatternRewriter &rewriter) const override {
+ // Return if none of the operands are constants.
+ if (llvm::none_of(viewOp.getOperands(), [](Value operand) {
+ return matchPattern(operand, m_ConstantIndex());
+ }))
+ return failure();
+
+ // Get result memref type.
+ auto memrefType = viewOp.getType();
+
+ // Get offset from old memref view type 'memRefType'.
+ int64_t oldOffset;
+ SmallVector<int64_t, 4> oldStrides;
+ if (failed(getStridesAndOffset(memrefType, oldStrides, oldOffset)))
+ return failure();
+ assert(oldOffset == 0 && "Expected 0 offset");
+
+ SmallVector<Value, 4> newOperands;
+
+ // Offset cannot be folded into result type.
+
+ // Fold any dynamic dim operands which are produced by a constant.
+ SmallVector<int64_t, 4> newShapeConstants;
+ newShapeConstants.reserve(memrefType.getRank());
+
+ unsigned dynamicDimPos = 0;
+ unsigned rank = memrefType.getRank();
+ for (unsigned dim = 0, e = rank; dim < e; ++dim) {
+ int64_t dimSize = memrefType.getDimSize(dim);
+ // If this is already static dimension, keep it.
+ if (!ShapedType::isDynamic(dimSize)) {
+ newShapeConstants.push_back(dimSize);
+ continue;
+ }
+ auto *defOp = viewOp.sizes()[dynamicDimPos].getDefiningOp();
+ if (auto constantIndexOp = dyn_cast_or_null<ConstantIndexOp>(defOp)) {
+ // Dynamic shape dimension will be folded.
+ newShapeConstants.push_back(constantIndexOp.getValue());
+ } else {
+ // Dynamic shape dimension not folded; copy operand from old memref.
+ newShapeConstants.push_back(dimSize);
+ newOperands.push_back(viewOp.sizes()[dynamicDimPos]);
+ }
+ dynamicDimPos++;
+ }
+
+ // Create new memref type with constant folded dims.
+ MemRefType newMemRefType =
+ MemRefType::Builder(memrefType).setShape(newShapeConstants);
+ // Nothing new, don't fold.
+ if (newMemRefType == memrefType)
+ return failure();
+
+ // Create new ViewOp.
+ auto newViewOp = rewriter.create<ViewOp>(viewOp.getLoc(), newMemRefType,
+ viewOp.getOperand(0),
+ viewOp.byte_shift(), newOperands);
+ // Insert a cast so we have the same type as the old memref type.
+ rewriter.replaceOpWithNewOp<MemRefCastOp>(viewOp, newViewOp,
+ viewOp.getType());
+ return success();
+ }
+};
+
+struct ViewOpMemrefCastFolder : public OpRewritePattern<ViewOp> {
+ using OpRewritePattern<ViewOp>::OpRewritePattern;
+
+ LogicalResult matchAndRewrite(ViewOp viewOp,
+ PatternRewriter &rewriter) const override {
+ Value memrefOperand = viewOp.getOperand(0);
+ MemRefCastOp memrefCastOp = memrefOperand.getDefiningOp<MemRefCastOp>();
+ if (!memrefCastOp)
+ return failure();
+ Value allocOperand = memrefCastOp.getOperand();
+ AllocOp allocOp = allocOperand.getDefiningOp<AllocOp>();
+ if (!allocOp)
+ return failure();
+ rewriter.replaceOpWithNewOp<ViewOp>(viewOp, viewOp.getType(), allocOperand,
+ viewOp.byte_shift(), viewOp.sizes());
+ return success();
+ }
+};
+
+} // end anonymous namespace
+
+void ViewOp::getCanonicalizationPatterns(OwningRewritePatternList &results,
+ MLIRContext *context) {
+ results.insert<ViewOpShapeFolder, ViewOpMemrefCastFolder>(context);
+}
+
//===----------------------------------------------------------------------===//
// XOrOp
//===----------------------------------------------------------------------===//
diff --git a/mlir/lib/Dialect/StandardOps/Transforms/TensorConstantBufferize.cpp b/mlir/lib/Dialect/StandardOps/Transforms/TensorConstantBufferize.cpp
index dd55ef704057..e42860e87942 100644
--- a/mlir/lib/Dialect/StandardOps/Transforms/TensorConstantBufferize.cpp
+++ b/mlir/lib/Dialect/StandardOps/Transforms/TensorConstantBufferize.cpp
@@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/StandardOps/Transforms/Passes.h"
#include "mlir/IR/BlockAndValueMapping.h"
@@ -27,13 +26,13 @@ namespace {
class GlobalCreator {
public:
explicit GlobalCreator(ModuleOp module);
- memref::GlobalOp getGlobalFor(Attribute attr) {
+ GlobalMemrefOp getGlobalFor(Attribute attr) {
assert(globals.find(attr) != globals.end() && "unknown constant attr");
return globals[attr];
}
private:
- DenseMap<Attribute, memref::GlobalOp> globals;
+ DenseMap<Attribute, GlobalMemrefOp> globals;
};
GlobalCreator::GlobalCreator(ModuleOp module) {
@@ -59,7 +58,7 @@ GlobalCreator::GlobalCreator(ModuleOp module) {
interleave(type.getShape(), os, "x");
os << "x" << type.getElementType();
- auto global = globalBuilder.create<memref::GlobalOp>(
+ auto global = globalBuilder.create<GlobalMemrefOp>(
op.getLoc(), (Twine("__constant_") + os.str()).str(),
/*sym_visibility=*/globalBuilder.getStringAttr("private"),
/*type=*/
@@ -90,8 +89,8 @@ class BufferizeTensorConstantOp : public OpConversionPattern<ConstantOp> {
return failure();
auto globalMemref = globals.getGlobalFor(op.value());
- rewriter.replaceOpWithNewOp<memref::GetGlobalOp>(op, globalMemref.type(),
- globalMemref.getName());
+ rewriter.replaceOpWithNewOp<GetGlobalMemrefOp>(op, globalMemref.type(),
+ globalMemref.getName());
return success();
}
GlobalCreator &globals;
diff --git a/mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp
index 9b8a2bdd2965..66de78758692 100644
--- a/mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp
@@ -12,7 +12,6 @@
#include "mlir/Transforms/Bufferize.h"
#include "PassDetail.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
@@ -29,7 +28,7 @@ class BufferizeCastOp : public OpConversionPattern<tensor::CastOp> {
matchAndRewrite(tensor::CastOp op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
auto resultType = getTypeConverter()->convertType(op.getType());
- rewriter.replaceOpWithNewOp<memref::CastOp>(op, resultType, operands[0]);
+ rewriter.replaceOpWithNewOp<MemRefCastOp>(op, resultType, operands[0]);
return success();
}
};
@@ -61,12 +60,11 @@ class BufferizeFromElementsOp
int numberOfElements = op.elements().size();
auto resultType = MemRefType::get(
{numberOfElements}, op.getType().cast<TensorType>().getElementType());
- Value result = rewriter.create<memref::AllocOp>(op.getLoc(), resultType);
+ Value result = rewriter.create<AllocOp>(op.getLoc(), resultType);
for (auto element : llvm::enumerate(op.elements())) {
Value index =
rewriter.create<ConstantIndexOp>(op.getLoc(), element.index());
- rewriter.create<memref::StoreOp>(op.getLoc(), element.value(), result,
- index);
+ rewriter.create<StoreOp>(op.getLoc(), element.value(), result, index);
}
rewriter.replaceOp(op, {result});
return success();
@@ -88,8 +86,8 @@ class BufferizeGenerateOp : public OpConversionPattern<tensor::GenerateOp> {
RankedTensorType tensorType = op.getType().cast<RankedTensorType>();
MemRefType memrefType =
MemRefType::get(tensorType.getShape(), tensorType.getElementType());
- Value result = rewriter.create<memref::AllocOp>(
- loc, memrefType, transformed.dynamicExtents());
+ Value result =
+ rewriter.create<AllocOp>(loc, memrefType, transformed.dynamicExtents());
// Collect loop bounds.
int64_t rank = tensorType.getRank();
@@ -127,9 +125,9 @@ class BufferizeGenerateOp : public OpConversionPattern<tensor::GenerateOp> {
// about creating that.
Operation *elementYield = parallelBody->getTerminator()->getPrevNode();
rewriter.setInsertionPointAfter(elementYield);
- rewriter.replaceOpWithNewOp<memref::StoreOp>(
- elementYield, elementYield->getOperands()[0], result,
- parallelBody->getArguments());
+ rewriter.replaceOpWithNewOp<StoreOp>(elementYield,
+ elementYield->getOperands()[0], result,
+ parallelBody->getArguments());
rewriter.replaceOp(op, {result});
return success();
@@ -157,7 +155,6 @@ struct TensorBufferizePass : public TensorBufferizeBase<TensorBufferizePass> {
populateTensorBufferizePatterns(context, typeConverter, patterns);
target.addIllegalOp<tensor::CastOp, tensor::ExtractOp,
tensor::FromElementsOp, tensor::GenerateOp>();
- target.addLegalDialect<memref::MemRefDialect>();
target.addLegalDialect<StandardOpsDialect>();
target.addLegalDialect<scf::SCFDialect>();
diff --git a/mlir/lib/Dialect/Vector/VectorOps.cpp b/mlir/lib/Dialect/Vector/VectorOps.cpp
index 94feb61925e1..af884f9d6ce6 100644
--- a/mlir/lib/Dialect/Vector/VectorOps.cpp
+++ b/mlir/lib/Dialect/Vector/VectorOps.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/Vector/VectorOps.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Utils/StructuredOpsUtils.h"
#include "mlir/Dialect/Vector/VectorUtils.h"
@@ -2396,12 +2395,12 @@ static LogicalResult verify(TransferReadOp op) {
/// ```
/// someop(memrefcast) -> someop
/// ```
-/// It folds the source of the memref.cast into the root operation directly.
+/// It folds the source of the memref_cast into the root operation directly.
static LogicalResult foldMemRefCast(Operation *op) {
bool folded = false;
for (OpOperand &operand : op->getOpOperands()) {
- auto castOp = operand.get().getDefiningOp<memref::CastOp>();
- if (castOp && memref::CastOp::canFoldIntoConsumerOp(castOp)) {
+ auto castOp = operand.get().getDefiningOp<MemRefCastOp>();
+ if (castOp && canFoldIntoConsumerOp(castOp)) {
operand.set(castOp.getOperand());
folded = true;
}
diff --git a/mlir/lib/Dialect/Vector/VectorTransforms.cpp b/mlir/lib/Dialect/Vector/VectorTransforms.cpp
index 182b1f82bc2e..200eb55076f7 100644
--- a/mlir/lib/Dialect/Vector/VectorTransforms.cpp
+++ b/mlir/lib/Dialect/Vector/VectorTransforms.cpp
@@ -16,7 +16,6 @@
#include "mlir/Dialect/Affine/EDSC/Intrinsics.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Linalg/EDSC/Intrinsics.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/EDSC/Intrinsics.h"
#include "mlir/Dialect/StandardOps/EDSC/Intrinsics.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
@@ -2317,7 +2316,7 @@ LogicalResult mlir::vector::splitFullAndPartialTransferPrecondition(
/// b. using a dynamic shape and/or stride for the dimensions that don't
/// agree.
static MemRefType getCastCompatibleMemRefType(MemRefType aT, MemRefType bT) {
- if (memref::CastOp::areCastCompatible(aT, bT))
+ if (MemRefCastOp::areCastCompatible(aT, bT))
return aT;
if (aT.getRank() != bT.getRank())
return MemRefType();
@@ -2388,13 +2387,13 @@ static Value createScopedSubViewIntersection(VectorTransferOpInterface xferOp,
/// Produce IR resembling:
/// ```
/// %1:3 = scf.if (%inBounds) {
-/// memref.cast %A: memref<A...> to compatibleMemRefType
+/// memref_cast %A: memref<A...> to compatibleMemRefType
/// scf.yield %view, ... : compatibleMemRefType, index, index
/// } else {
/// %2 = linalg.fill(%alloc, %pad)
/// %3 = subview %view [...][...][...]
/// linalg.copy(%3, %alloc)
-/// memref.cast %alloc: memref<B...> to compatibleMemRefType
+/// memref_cast %alloc: memref<B...> to compatibleMemRefType
/// scf.yield %4, ... : compatibleMemRefType, index, index
/// }
/// ```
@@ -2412,7 +2411,7 @@ static scf::IfOp createScopedFullPartialLinalgCopy(
[&]() -> scf::ValueVector {
Value res = memref;
if (compatibleMemRefType != xferOp.getShapedType())
- res = memref_cast(memref, compatibleMemRefType);
+ res = std_memref_cast(memref, compatibleMemRefType);
scf::ValueVector viewAndIndices{res};
viewAndIndices.insert(viewAndIndices.end(), xferOp.indices().begin(),
xferOp.indices().end());
@@ -2425,7 +2424,7 @@ static scf::IfOp createScopedFullPartialLinalgCopy(
Value memRefSubView = createScopedSubViewIntersection(
cast<VectorTransferOpInterface>(xferOp.getOperation()), alloc);
linalg_copy(memRefSubView, alloc);
- Value casted = memref_cast(alloc, compatibleMemRefType);
+ Value casted = std_memref_cast(alloc, compatibleMemRefType);
scf::ValueVector viewAndIndices{casted};
viewAndIndices.insert(viewAndIndices.end(), xferOp.getTransferRank(),
zero);
@@ -2441,14 +2440,14 @@ static scf::IfOp createScopedFullPartialLinalgCopy(
/// Produce IR resembling:
/// ```
/// %1:3 = scf.if (%inBounds) {
-/// memref.cast %A: memref<A...> to compatibleMemRefType
+/// memref_cast %A: memref<A...> to compatibleMemRefType
/// scf.yield %view, ... : compatibleMemRefType, index, index
/// } else {
/// %2 = vector.transfer_read %view[...], %pad : memref<A...>, vector<...>
/// %3 = vector.type_cast %extra_alloc :
/// memref<...> to memref<vector<...>>
/// store %2, %3[] : memref<vector<...>>
-/// %4 = memref.cast %alloc: memref<B...> to compatibleMemRefType
+/// %4 = memref_cast %alloc: memref<B...> to compatibleMemRefType
/// scf.yield %4, ... : compatibleMemRefType, index, index
/// }
/// ```
@@ -2466,7 +2465,7 @@ static scf::IfOp createScopedFullPartialVectorTransferRead(
[&]() -> scf::ValueVector {
Value res = memref;
if (compatibleMemRefType != xferOp.getShapedType())
- res = memref_cast(memref, compatibleMemRefType);
+ res = std_memref_cast(memref, compatibleMemRefType);
scf::ValueVector viewAndIndices{res};
viewAndIndices.insert(viewAndIndices.end(), xferOp.indices().begin(),
xferOp.indices().end());
@@ -2476,10 +2475,10 @@ static scf::IfOp createScopedFullPartialVectorTransferRead(
Operation *newXfer =
ScopedContext::getBuilderRef().clone(*xferOp.getOperation());
Value vector = cast<VectorTransferOpInterface>(newXfer).vector();
- memref_store(vector, vector_type_cast(
- MemRefType::get({}, vector.getType()), alloc));
+ std_store(vector, vector_type_cast(
+ MemRefType::get({}, vector.getType()), alloc));
- Value casted = memref_cast(alloc, compatibleMemRefType);
+ Value casted = std_memref_cast(alloc, compatibleMemRefType);
scf::ValueVector viewAndIndices{casted};
viewAndIndices.insert(viewAndIndices.end(), xferOp.getTransferRank(),
zero);
@@ -2506,11 +2505,11 @@ static scf::IfOp createScopedFullPartialVectorTransferRead(
/// ```
/// %1:3 = scf.if (%inBounds) {
/// // fastpath, direct cast
-/// memref.cast %A: memref<A...> to compatibleMemRefType
+/// memref_cast %A: memref<A...> to compatibleMemRefType
/// scf.yield %view : compatibleMemRefType, index, index
/// } else {
/// // slowpath, masked vector.transfer or linalg.copy.
-/// memref.cast %alloc: memref<B...> to compatibleMemRefType
+/// memref_cast %alloc: memref<B...> to compatibleMemRefType
/// scf.yield %4 : compatibleMemRefType, index, index
// }
/// %0 = vector.transfer_read %1#0[%1#1, %1#2] {masked = [false ... false]}
@@ -2565,8 +2564,8 @@ LogicalResult mlir::vector::splitFullAndPartialTransfer(
b.setInsertionPointToStart(&funcOp.getRegion().front());
auto shape = xferOp.getVectorType().getShape();
Type elementType = xferOp.getVectorType().getElementType();
- alloc = memref_alloca(MemRefType::get(shape, elementType), ValueRange{},
- b.getI64IntegerAttr(32));
+ alloc = std_alloca(MemRefType::get(shape, elementType), ValueRange{},
+ b.getI64IntegerAttr(32));
}
MemRefType compatibleMemRefType =
diff --git a/mlir/lib/Transforms/BufferDeallocation.cpp b/mlir/lib/Transforms/BufferDeallocation.cpp
index aa837cb0e77c..a4155695fdf7 100644
--- a/mlir/lib/Transforms/BufferDeallocation.cpp
+++ b/mlir/lib/Transforms/BufferDeallocation.cpp
@@ -53,7 +53,6 @@
#include "PassDetail.h"
#include "mlir/Dialect/Linalg/IR/LinalgOps.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/StandardOps/Utils/Utils.h"
#include "mlir/IR/Operation.h"
@@ -426,8 +425,8 @@ class BufferDeallocation : BufferPlacementTransformationBase {
// TODO: provide a generic interface to create dialect-specific
// Alloc and CopyOp nodes.
- auto alloc = builder.create<memref::AllocOp>(terminator->getLoc(),
- memRefType, dynamicOperands);
+ auto alloc = builder.create<AllocOp>(terminator->getLoc(), memRefType,
+ dynamicOperands);
// Create a new copy operation that copies to contents of the old
// allocation to the new one.
@@ -500,7 +499,7 @@ class BufferDeallocation : BufferPlacementTransformationBase {
continue;
// If there is no dealloc node, insert one in the right place.
OpBuilder builder(nextOp);
- builder.create<memref::DeallocOp>(alloc.getLoc(), alloc);
+ builder.create<DeallocOp>(alloc.getLoc(), alloc);
}
}
}
diff --git a/mlir/lib/Transforms/BufferOptimizations.cpp b/mlir/lib/Transforms/BufferOptimizations.cpp
index 5fe9dda02b83..6c1e1fe0c9cf 100644
--- a/mlir/lib/Transforms/BufferOptimizations.cpp
+++ b/mlir/lib/Transforms/BufferOptimizations.cpp
@@ -12,7 +12,6 @@
// convert heap-based allocations to stack-based allocations, if possible.
#include "PassDetail.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/Operation.h"
#include "mlir/Interfaces/LoopLikeInterface.h"
#include "mlir/Pass/Pass.h"
@@ -34,7 +33,7 @@ static bool defaultIsSmallAlloc(Value alloc, unsigned maximumSizeInBytes,
unsigned bitwidthOfIndexType,
unsigned maxRankOfAllocatedMemRef) {
auto type = alloc.getType().dyn_cast<ShapedType>();
- if (!type || !alloc.getDefiningOp<memref::AllocOp>())
+ if (!type || !alloc.getDefiningOp<AllocOp>())
return false;
if (!type.hasStaticShape()) {
// Check if the dynamic shape dimension of the alloc is produced by RankOp.
@@ -318,7 +317,7 @@ class BufferPlacementPromotion : BufferPlacementTransformationBase {
// `AutomaticAllocationScope` determined during the initialization phase.
OpBuilder builder(startOperation);
Operation *allocOp = alloc.getDefiningOp();
- Operation *alloca = builder.create<memref::AllocaOp>(
+ Operation *alloca = builder.create<AllocaOp>(
alloc.getLoc(), alloc.getType().cast<MemRefType>(),
allocOp->getOperands());
diff --git a/mlir/lib/Transforms/BufferResultsToOutParams.cpp b/mlir/lib/Transforms/BufferResultsToOutParams.cpp
index 0920d1321e42..87f1a2ef936f 100644
--- a/mlir/lib/Transforms/BufferResultsToOutParams.cpp
+++ b/mlir/lib/Transforms/BufferResultsToOutParams.cpp
@@ -8,7 +8,6 @@
#include "PassDetail.h"
#include "mlir/Dialect/Linalg/IR/LinalgOps.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Operation.h"
#include "mlir/Pass/Pass.h"
@@ -100,7 +99,7 @@ static LogicalResult updateCalls(ModuleOp module) {
didFail = true;
return;
}
- Value outParam = builder.create<memref::AllocOp>(
+ Value outParam = builder.create<AllocOp>(
op.getLoc(), memref.getType().cast<MemRefType>());
memref.replaceAllUsesWith(outParam);
outParams.push_back(outParam);
diff --git a/mlir/lib/Transforms/LoopFusion.cpp b/mlir/lib/Transforms/LoopFusion.cpp
index 04227ab7b0e5..e13616e1d71c 100644
--- a/mlir/lib/Transforms/LoopFusion.cpp
+++ b/mlir/lib/Transforms/LoopFusion.cpp
@@ -16,7 +16,6 @@
#include "mlir/Analysis/LoopAnalysis.h"
#include "mlir/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Builders.h"
@@ -926,7 +925,7 @@ static Value createPrivateMemRef(AffineForOp forOp, Operation *srcStoreOpInst,
// consumer loop nests to reduce their live range. Currently they are added
// at the beginning of the function, because loop nests can be reordered
// during the fusion pass.
- Value newMemRef = top.create<memref::AllocOp>(forOp.getLoc(), newMemRefType);
+ Value newMemRef = top.create<AllocOp>(forOp.getLoc(), newMemRefType);
// Build an AffineMap to remap access functions based on lower bound offsets.
SmallVector<AffineExpr, 4> remapExprs;
@@ -1896,7 +1895,7 @@ struct GreedyFusion {
continue;
// Use list expected to match the dep graph info.
auto *op = memref.getDefiningOp();
- if (isa_and_nonnull<memref::AllocOp>(op))
+ if (isa_and_nonnull<AllocOp>(op))
op->erase();
}
}
diff --git a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp
index 401aaaf1c7cd..7924b46a83d5 100644
--- a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp
+++ b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp
@@ -17,7 +17,6 @@
#include "mlir/Analysis/AffineAnalysis.h"
#include "mlir/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Dominance.h"
#include "mlir/Transforms/Passes.h"
@@ -169,7 +168,7 @@ void MemRefDataFlowOpt::forwardStoreToLoad(AffineReadOpInterface loadOp) {
// Perform the actual store to load forwarding.
Value storeVal =
- cast<AffineWriteOpInterface>(lastWriteStoreOp).getValueToStore();
+ cast<AffineWriteOpInterface>(lastWriteStoreOp).getValueToStore();
loadOp.getValue().replaceAllUsesWith(storeVal);
// Record the memref for a later sweep to optimize away.
memrefsToErase.insert(loadOp.getMemRef());
@@ -204,12 +203,12 @@ void MemRefDataFlowOpt::runOnFunction() {
for (auto memref : memrefsToErase) {
// If the memref hasn't been alloc'ed in this function, skip.
Operation *defOp = memref.getDefiningOp();
- if (!defOp || !isa<memref::AllocOp>(defOp))
+ if (!defOp || !isa<AllocOp>(defOp))
// TODO: if the memref was returned by a 'call' operation, we
// could still erase it if the call had no side-effects.
continue;
if (llvm::any_of(memref.getUsers(), [&](Operation *ownerOp) {
- return !isa<AffineWriteOpInterface, memref::DeallocOp>(ownerOp);
+ return !isa<AffineWriteOpInterface, DeallocOp>(ownerOp);
}))
continue;
diff --git a/mlir/lib/Transforms/NormalizeMemRefs.cpp b/mlir/lib/Transforms/NormalizeMemRefs.cpp
index 44ab3bc334b7..110e30234af2 100644
--- a/mlir/lib/Transforms/NormalizeMemRefs.cpp
+++ b/mlir/lib/Transforms/NormalizeMemRefs.cpp
@@ -13,7 +13,6 @@
#include "PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Transforms/Passes.h"
#include "mlir/Transforms/Utils.h"
#include "llvm/ADT/SmallSet.h"
@@ -153,7 +152,7 @@ bool NormalizeMemRefs::areMemRefsNormalizable(FuncOp funcOp) {
return true;
if (funcOp
- .walk([&](memref::AllocOp allocOp) -> WalkResult {
+ .walk([&](AllocOp allocOp) -> WalkResult {
Value oldMemRef = allocOp.getResult();
if (!isMemRefNormalizable(oldMemRef.getUsers()))
return WalkResult::interrupt();
@@ -327,9 +326,9 @@ void NormalizeMemRefs::normalizeFuncOpMemRefs(FuncOp funcOp,
// Turn memrefs' non-identity layouts maps into ones with identity. Collect
// alloc ops first and then process since normalizeMemRef replaces/erases ops
// during memref rewriting.
- SmallVector<memref::AllocOp, 4> allocOps;
- funcOp.walk([&](memref::AllocOp op) { allocOps.push_back(op); });
- for (memref::AllocOp allocOp : allocOps)
+ SmallVector<AllocOp, 4> allocOps;
+ funcOp.walk([&](AllocOp op) { allocOps.push_back(op); });
+ for (AllocOp allocOp : allocOps)
(void)normalizeMemRef(allocOp);
// We use this OpBuilder to create new memref layout later.
diff --git a/mlir/lib/Transforms/PipelineDataTransfer.cpp b/mlir/lib/Transforms/PipelineDataTransfer.cpp
index abf1f60ea620..025b1b217476 100644
--- a/mlir/lib/Transforms/PipelineDataTransfer.cpp
+++ b/mlir/lib/Transforms/PipelineDataTransfer.cpp
@@ -88,8 +88,8 @@ static bool doubleBuffer(Value oldMemRef, AffineForOp forOp) {
auto allocOperands = getDynOperands(forOp.getLoc(), oldMemRef, bOuter);
// Create and place the alloc right before the 'affine.for' operation.
- Value newMemRef = bOuter.create<memref::AllocOp>(
- forOp.getLoc(), newMemRefType, allocOperands);
+ Value newMemRef =
+ bOuter.create<AllocOp>(forOp.getLoc(), newMemRefType, allocOperands);
// Create 'iv mod 2' value to index the leading dimension.
auto d0 = bInner.getAffineDimExpr(0);
@@ -115,7 +115,7 @@ static bool doubleBuffer(Value oldMemRef, AffineForOp forOp) {
}
// Insert the dealloc op right after the for loop.
bOuter.setInsertionPointAfter(forOp);
- bOuter.create<memref::DeallocOp>(forOp.getLoc(), newMemRef);
+ bOuter.create<DeallocOp>(forOp.getLoc(), newMemRef);
return true;
}
@@ -201,7 +201,7 @@ static void findMatchingStartFinishInsts(
bool escapingUses = false;
for (auto *user : memref.getUsers()) {
// We can double buffer regardless of dealloc's outside the loop.
- if (isa<memref::DeallocOp>(user))
+ if (isa<DeallocOp>(user))
continue;
if (!forOp.getBody()->findAncestorOpInBlock(*user)) {
LLVM_DEBUG(llvm::dbgs()
@@ -274,8 +274,7 @@ void PipelineDataTransfer::runOnAffineForOp(AffineForOp forOp) {
if (oldMemRef.use_empty()) {
allocOp->erase();
} else if (oldMemRef.hasOneUse()) {
- if (auto dealloc =
- dyn_cast<memref::DeallocOp>(*oldMemRef.user_begin())) {
+ if (auto dealloc = dyn_cast<DeallocOp>(*oldMemRef.user_begin())) {
dealloc.erase();
allocOp->erase();
}
@@ -297,8 +296,7 @@ void PipelineDataTransfer::runOnAffineForOp(AffineForOp forOp) {
if (oldTagMemRef.use_empty()) {
tagAllocOp->erase();
} else if (oldTagMemRef.hasOneUse()) {
- if (auto dealloc =
- dyn_cast<memref::DeallocOp>(*oldTagMemRef.user_begin())) {
+ if (auto dealloc = dyn_cast<DeallocOp>(*oldTagMemRef.user_begin())) {
dealloc.erase();
tagAllocOp->erase();
}
diff --git a/mlir/lib/Transforms/Utils/LoopUtils.cpp b/mlir/lib/Transforms/Utils/LoopUtils.cpp
index e4cbba327ab2..a8c32c84d124 100644
--- a/mlir/lib/Transforms/Utils/LoopUtils.cpp
+++ b/mlir/lib/Transforms/Utils/LoopUtils.cpp
@@ -18,7 +18,6 @@
#include "mlir/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/BlockAndValueMapping.h"
@@ -2471,8 +2470,7 @@ static LogicalResult generateCopy(
// Create the fast memory space buffer just before the 'affine.for'
// operation.
- fastMemRef =
- prologue.create<memref::AllocOp>(loc, fastMemRefType).getResult();
+ fastMemRef = prologue.create<AllocOp>(loc, fastMemRefType).getResult();
// Record it.
fastBufferMap[memref] = fastMemRef;
// fastMemRefType is a constant shaped memref.
@@ -2542,7 +2540,7 @@ static LogicalResult generateCopy(
// Create a tag (single element 1-d memref) for the DMA.
auto tagMemRefType = MemRefType::get({1}, top.getIntegerType(32), {},
copyOptions.tagMemorySpace);
- auto tagMemRef = prologue.create<memref::AllocOp>(loc, tagMemRefType);
+ auto tagMemRef = prologue.create<AllocOp>(loc, tagMemRefType);
SmallVector<Value, 4> tagIndices({zeroIndex});
auto tagAffineMap = b.getMultiDimIdentityMap(tagIndices.size());
@@ -2570,7 +2568,7 @@ static LogicalResult generateCopy(
numElementsSSA);
// Generate dealloc for the tag.
- auto tagDeallocOp = epilogue.create<memref::DeallocOp>(loc, tagMemRef);
+ auto tagDeallocOp = epilogue.create<DeallocOp>(loc, tagMemRef);
if (*nEnd == end && isCopyOutAtEndOfBlock)
// Since new ops are being appended (for outgoing DMAs), adjust the end to
// mark end of range of the original.
@@ -2579,7 +2577,7 @@ static LogicalResult generateCopy(
// Generate dealloc for the buffer.
if (!existingBuf) {
- auto bufDeallocOp = epilogue.create<memref::DeallocOp>(loc, fastMemRef);
+ auto bufDeallocOp = epilogue.create<DeallocOp>(loc, fastMemRef);
// When generating pointwise copies, `nEnd' has to be set to deallocOp on
// the fast buffer (since it marks the new end insertion point).
if (!copyOptions.generateDma && *nEnd == end && isCopyOutAtEndOfBlock)
diff --git a/mlir/lib/Transforms/Utils/Utils.cpp b/mlir/lib/Transforms/Utils/Utils.cpp
index 9b55c09093e8..f99159b25054 100644
--- a/mlir/lib/Transforms/Utils/Utils.cpp
+++ b/mlir/lib/Transforms/Utils/Utils.cpp
@@ -253,7 +253,7 @@ LogicalResult mlir::replaceAllMemRefUsesWith(
// Skip dealloc's - no replacement is necessary, and a memref replacement
// at other uses doesn't hurt these dealloc's.
- if (isa<memref::DeallocOp>(op) && !replaceInDeallocOp)
+ if (isa<DeallocOp>(op) && !replaceInDeallocOp)
continue;
// Check if the memref was used in a non-dereferencing context. It is fine
@@ -380,7 +380,7 @@ void mlir::createAffineComputationSlice(
}
// TODO: Currently works for static memrefs with a single layout map.
-LogicalResult mlir::normalizeMemRef(memref::AllocOp allocOp) {
+LogicalResult mlir::normalizeMemRef(AllocOp allocOp) {
MemRefType memrefType = allocOp.getType();
OpBuilder b(allocOp);
@@ -396,8 +396,8 @@ LogicalResult mlir::normalizeMemRef(memref::AllocOp allocOp) {
Value oldMemRef = allocOp.getResult();
SmallVector<Value, 4> symbolOperands(allocOp.symbolOperands());
- memref::AllocOp newAlloc = b.create<memref::AllocOp>(
- allocOp.getLoc(), newMemRefType, allocOp.alignmentAttr());
+ AllocOp newAlloc = b.create<AllocOp>(allocOp.getLoc(), newMemRefType,
+ allocOp.alignmentAttr());
AffineMap layoutMap = memrefType.getAffineMaps().front();
// Replace all uses of the old memref.
if (failed(replaceAllMemRefUsesWith(oldMemRef, /*newMemRef=*/newAlloc,
@@ -414,9 +414,8 @@ LogicalResult mlir::normalizeMemRef(memref::AllocOp allocOp) {
}
// Replace any uses of the original alloc op and erase it. All remaining uses
// have to be dealloc's; RAMUW above would've failed otherwise.
- assert(llvm::all_of(oldMemRef.getUsers(), [](Operation *op) {
- return isa<memref::DeallocOp>(op);
- }));
+ assert(llvm::all_of(oldMemRef.getUsers(),
+ [](Operation *op) { return isa<DeallocOp>(op); }));
oldMemRef.replaceAllUsesWith(newAlloc);
allocOp.erase();
return success();
diff --git a/mlir/test/Analysis/test-alias-analysis.mlir b/mlir/test/Analysis/test-alias-analysis.mlir
index a53e9e1f05f2..cb0f6484f1e3 100644
--- a/mlir/test/Analysis/test-alias-analysis.mlir
+++ b/mlir/test/Analysis/test-alias-analysis.mlir
@@ -23,10 +23,10 @@
// CHECK-DAG: alloc_2#0 <-> func.region0#0: MayAlias
// CHECK-DAG: alloc_2#0 <-> func.region0#1: MayAlias
func @simple(%arg: memref<2xf32>, %arg1: memref<2xf32>) attributes {test.ptr = "func"} {
- %0 = memref.alloca() {test.ptr = "alloca_1"} : memref<8x64xf32>
- %1 = memref.alloca() {test.ptr = "alloca_2"} : memref<8x64xf32>
- %2 = memref.alloc() {test.ptr = "alloc_1"} : memref<8x64xf32>
- %3 = memref.alloc() {test.ptr = "alloc_2"} : memref<8x64xf32>
+ %0 = alloca() {test.ptr = "alloca_1"} : memref<8x64xf32>
+ %1 = alloca() {test.ptr = "alloca_2"} : memref<8x64xf32>
+ %2 = alloc() {test.ptr = "alloc_1"} : memref<8x64xf32>
+ %3 = alloc() {test.ptr = "alloc_2"} : memref<8x64xf32>
return
}
@@ -50,9 +50,9 @@ func @simple(%arg: memref<2xf32>, %arg1: memref<2xf32>) attributes {test.ptr = "
// CHECK-DAG: func.region0.block1#0 <-> func.region0.block2#0: MustAlias
func @control_flow(%arg: memref<2xf32>, %cond: i1) attributes {test.ptr = "func"} {
- %0 = memref.alloca() {test.ptr = "alloca_1"} : memref<8x64xf32>
- %1 = memref.alloca() {test.ptr = "alloca_2"} : memref<8x64xf32>
- %2 = memref.alloc() {test.ptr = "alloc_1"} : memref<8x64xf32>
+ %0 = alloca() {test.ptr = "alloca_1"} : memref<8x64xf32>
+ %1 = alloca() {test.ptr = "alloca_2"} : memref<8x64xf32>
+ %2 = alloc() {test.ptr = "alloc_1"} : memref<8x64xf32>
cond_br %cond, ^bb1(%0 : memref<8x64xf32>), ^bb2(%0 : memref<8x64xf32>)
@@ -83,9 +83,9 @@ func @control_flow(%arg: memref<2xf32>, %cond: i1) attributes {test.ptr = "func"
// CHECK-DAG: func.region0.block1#0 <-> func.region0.block2#0: MayAlias
func @control_flow_merge(%arg: memref<2xf32>, %cond: i1) attributes {test.ptr = "func"} {
- %0 = memref.alloca() {test.ptr = "alloca_1"} : memref<8x64xf32>
- %1 = memref.alloca() {test.ptr = "alloca_2"} : memref<8x64xf32>
- %2 = memref.alloc() {test.ptr = "alloc_1"} : memref<8x64xf32>
+ %0 = alloca() {test.ptr = "alloca_1"} : memref<8x64xf32>
+ %1 = alloca() {test.ptr = "alloca_2"} : memref<8x64xf32>
+ %2 = alloc() {test.ptr = "alloc_1"} : memref<8x64xf32>
cond_br %cond, ^bb1(%0 : memref<8x64xf32>), ^bb2(%2 : memref<8x64xf32>)
@@ -123,9 +123,9 @@ func @control_flow_merge(%arg: memref<2xf32>, %cond: i1) attributes {test.ptr =
// CHECK-DAG: if_alloc#0 <-> func.region0#0: MayAlias
// CHECK-DAG: if_alloc#0 <-> func.region0#1: MayAlias
func @region_control_flow(%arg: memref<2xf32>, %cond: i1) attributes {test.ptr = "func"} {
- %0 = memref.alloca() {test.ptr = "alloca_1"} : memref<8x64xf32>
- %1 = memref.alloca() {test.ptr = "alloca_2"} : memref<8x64xf32>
- %2 = memref.alloc() {test.ptr = "alloc_1"} : memref<8x64xf32>
+ %0 = alloca() {test.ptr = "alloca_1"} : memref<8x64xf32>
+ %1 = alloca() {test.ptr = "alloca_2"} : memref<8x64xf32>
+ %2 = alloc() {test.ptr = "alloc_1"} : memref<8x64xf32>
%3 = scf.if %cond -> (memref<8x64xf32>) {
scf.yield %0 : memref<8x64xf32>
@@ -181,9 +181,9 @@ func @region_control_flow(%arg: memref<2xf32>, %cond: i1) attributes {test.ptr =
// CHECK-DAG: for_alloca.region0#1 <-> func.region0#3: NoAlias
func @region_loop_control_flow(%arg: memref<2xf32>, %loopI0 : index,
%loopI1 : index, %loopI2 : index) attributes {test.ptr = "func"} {
- %0 = memref.alloca() {test.ptr = "alloca_1"} : memref<8x64xf32>
- %1 = memref.alloca() {test.ptr = "alloca_2"} : memref<8x64xf32>
- %2 = memref.alloc() {test.ptr = "alloc_1"} : memref<8x64xf32>
+ %0 = alloca() {test.ptr = "alloca_1"} : memref<8x64xf32>
+ %1 = alloca() {test.ptr = "alloca_2"} : memref<8x64xf32>
+ %2 = alloc() {test.ptr = "alloc_1"} : memref<8x64xf32>
%result = scf.for %i0 = %loopI0 to %loopI1 step %loopI2 iter_args(%si = %0) -> (memref<8x64xf32>) {
scf.yield %si : memref<8x64xf32>
@@ -201,11 +201,11 @@ func @region_loop_control_flow(%arg: memref<2xf32>, %loopI0 : index,
// CHECK-DAG: view#0 <-> func.region0#0: NoAlias
// CHECK-DAG: view#0 <-> func.region0#1: NoAlias
func @view_like(%arg: memref<2xf32>, %size: index) attributes {test.ptr = "func"} {
- %1 = memref.alloc() {test.ptr = "alloc_1"} : memref<8x64xf32>
+ %1 = alloc() {test.ptr = "alloc_1"} : memref<8x64xf32>
%c0 = constant 0 : index
- %2 = memref.alloca (%size) {test.ptr = "alloca_1"} : memref<?xi8>
- %3 = memref.view %2[%c0][] {test.ptr = "view"} : memref<?xi8> to memref<8x64xf32>
+ %2 = alloca (%size) {test.ptr = "alloca_1"} : memref<?xi8>
+ %3 = view %2[%c0][] {test.ptr = "view"} : memref<?xi8> to memref<8x64xf32>
return
}
@@ -225,7 +225,7 @@ func @view_like(%arg: memref<2xf32>, %size: index) attributes {test.ptr = "func"
// CHECK-DAG: constant_3#0 <-> func.region0#0: MayAlias
func @constants(%arg: memref<2xf32>) attributes {test.ptr = "func"} {
- %1 = memref.alloc() {test.ptr = "alloc_1"} : memref<8x64xf32>
+ %1 = alloc() {test.ptr = "alloc_1"} : memref<8x64xf32>
%c0 = constant {test.ptr = "constant_1"} 0 : index
%c0_2 = constant {test.ptr = "constant_2"} 0 : index
diff --git a/mlir/test/Analysis/test-liveness.mlir b/mlir/test/Analysis/test-liveness.mlir
index ffb64dbd93df..11648e4819a3 100644
--- a/mlir/test/Analysis/test-liveness.mlir
+++ b/mlir/test/Analysis/test-liveness.mlir
@@ -221,7 +221,7 @@ func @nested_region(
// CHECK-NEXT: LiveOut:{{ *$}}
%2 = addi %0, %arg5 : i32
%3 = addi %2, %0 : i32
- memref.store %3, %buffer[] : memref<i32>
+ store %3, %buffer[] : memref<i32>
}
return %1 : i32
}
@@ -265,7 +265,7 @@ func @nested_region2(
%2 = addi %0, %arg5 : i32
scf.for %arg7 = %arg0 to %arg1 step %arg2 {
%3 = addi %2, %0 : i32
- memref.store %3, %buffer[] : memref<i32>
+ store %3, %buffer[] : memref<i32>
}
}
return %1 : i32
@@ -299,7 +299,7 @@ func @nested_region3(
// CHECK-NEXT: LiveIn: arg5 at 0 arg6 at 0 val_7
// CHECK-NEXT: LiveOut:{{ *$}}
%2 = addi %0, %arg5 : i32
- memref.store %2, %buffer[] : memref<i32>
+ store %2, %buffer[] : memref<i32>
}
br ^exit
@@ -312,7 +312,7 @@ func @nested_region3(
// CHECK-NEXT: LiveIn: arg6 at 0 val_7 val_8
// CHECK-NEXT: LiveOut:{{ *$}}
%2 = addi %0, %1 : i32
- memref.store %2, %buffer[] : memref<i32>
+ store %2, %buffer[] : memref<i32>
}
return %1 : i32
}
diff --git a/mlir/test/CAPI/ir.c b/mlir/test/CAPI/ir.c
index 13ba4fc647fe..8b785ee897bb 100644
--- a/mlir/test/CAPI/ir.c
+++ b/mlir/test/CAPI/ir.c
@@ -60,7 +60,7 @@ void populateLoopBody(MlirContext ctx, MlirBlock loopBody,
mlirBlockAppendOwnedOperation(loopBody, add);
MlirOperationState storeState = mlirOperationStateGet(
- mlirStringRefCreateFromCString("memref.store"), location);
+ mlirStringRefCreateFromCString("std.store"), location);
MlirValue storeOperands[] = {mlirOperationGetResult(add, 0), funcArg0, iv};
mlirOperationStateAddOperands(&storeState, 3, storeOperands);
MlirOperation store = mlirOperationCreate(&storeState);
@@ -173,7 +173,7 @@ MlirModule makeAndDumpAdd(MlirContext ctx, MlirLocation location) {
// CHECK: %[[LHS:.*]] = load %[[ARG0]][%[[I]]] : memref<?xf32>
// CHECK: %[[RHS:.*]] = load %[[ARG1]][%[[I]]] : memref<?xf32>
// CHECK: %[[SUM:.*]] = addf %[[LHS]], %[[RHS]] : f32
- // CHECK: memref.store %[[SUM]], %[[ARG0]][%[[I]]] : memref<?xf32>
+ // CHECK: store %[[SUM]], %[[ARG0]][%[[I]]] : memref<?xf32>
// CHECK: }
// CHECK: return
// CHECK: }
@@ -345,7 +345,7 @@ static void printFirstOfEach(MlirContext ctx, MlirOperation operation) {
// CHECK: %[[LHS:.*]] = load %{{.*}}[%[[I]]] : memref<?xf32>
// CHECK: %[[RHS:.*]] = load %{{.*}}[%[[I]]] : memref<?xf32>
// CHECK: %[[SUM:.*]] = addf %[[LHS]], %[[RHS]] : f32
- // CHECK: memref.store %[[SUM]], %{{.*}}[%[[I]]] : memref<?xf32>
+ // CHECK: store %[[SUM]], %{{.*}}[%[[I]]] : memref<?xf32>
// CHECK: }
// CHECK: return
// CHECK: First operation: {{.*}} = constant 0 : index
diff --git a/mlir/test/Conversion/AffineToStandard/lower-affine-to-vector.mlir b/mlir/test/Conversion/AffineToStandard/lower-affine-to-vector.mlir
index ce87504e90d0..3df9bb33ece2 100644
--- a/mlir/test/Conversion/AffineToStandard/lower-affine-to-vector.mlir
+++ b/mlir/test/Conversion/AffineToStandard/lower-affine-to-vector.mlir
@@ -1,12 +1,13 @@
// RUN: mlir-opt -lower-affine --split-input-file %s | FileCheck %s
+
// CHECK-LABEL: func @affine_vector_load
func @affine_vector_load(%arg0 : index) {
- %0 = memref.alloc() : memref<100xf32>
+ %0 = alloc() : memref<100xf32>
affine.for %i0 = 0 to 16 {
%1 = affine.vector_load %0[%i0 + symbol(%arg0) + 7] : memref<100xf32>, vector<8xf32>
}
-// CHECK: %[[buf:.*]] = memref.alloc
+// CHECK: %[[buf:.*]] = alloc
// CHECK: %[[a:.*]] = addi %{{.*}}, %{{.*}} : index
// CHECK-NEXT: %[[c7:.*]] = constant 7 : index
// CHECK-NEXT: %[[b:.*]] = addi %[[a]], %[[c7]] : index
@@ -18,12 +19,12 @@ func @affine_vector_load(%arg0 : index) {
// CHECK-LABEL: func @affine_vector_store
func @affine_vector_store(%arg0 : index) {
- %0 = memref.alloc() : memref<100xf32>
+ %0 = alloc() : memref<100xf32>
%1 = constant dense<11.0> : vector<4xf32>
affine.for %i0 = 0 to 16 {
affine.vector_store %1, %0[%i0 - symbol(%arg0) + 7] : memref<100xf32>, vector<4xf32>
}
-// CHECK: %[[buf:.*]] = memref.alloc
+// CHECK: %[[buf:.*]] = alloc
// CHECK: %[[val:.*]] = constant dense
// CHECK: %[[c_1:.*]] = constant -1 : index
// CHECK-NEXT: %[[a:.*]] = muli %arg0, %[[c_1]] : index
@@ -38,11 +39,11 @@ func @affine_vector_store(%arg0 : index) {
// CHECK-LABEL: func @vector_load_2d
func @vector_load_2d() {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
affine.for %i0 = 0 to 16 step 2{
affine.for %i1 = 0 to 16 step 8 {
%1 = affine.vector_load %0[%i0, %i1] : memref<100x100xf32>, vector<2x8xf32>
-// CHECK: %[[buf:.*]] = memref.alloc
+// CHECK: %[[buf:.*]] = alloc
// CHECK: scf.for %[[i0:.*]] =
// CHECK: scf.for %[[i1:.*]] =
// CHECK-NEXT: vector.load %[[buf]][%[[i0]], %[[i1]]] : memref<100x100xf32>, vector<2x8xf32>
@@ -55,12 +56,12 @@ func @vector_load_2d() {
// CHECK-LABEL: func @vector_store_2d
func @vector_store_2d() {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
%1 = constant dense<11.0> : vector<2x8xf32>
affine.for %i0 = 0 to 16 step 2{
affine.for %i1 = 0 to 16 step 8 {
affine.vector_store %1, %0[%i0, %i1] : memref<100x100xf32>, vector<2x8xf32>
-// CHECK: %[[buf:.*]] = memref.alloc
+// CHECK: %[[buf:.*]] = alloc
// CHECK: %[[val:.*]] = constant dense
// CHECK: scf.for %[[i0:.*]] =
// CHECK: scf.for %[[i1:.*]] =
diff --git a/mlir/test/Conversion/AffineToStandard/lower-affine.mlir b/mlir/test/Conversion/AffineToStandard/lower-affine.mlir
index 9982401cecc5..cac7d17a8348 100644
--- a/mlir/test/Conversion/AffineToStandard/lower-affine.mlir
+++ b/mlir/test/Conversion/AffineToStandard/lower-affine.mlir
@@ -533,7 +533,7 @@ func @affine_apply_ceildiv(%arg0 : index) -> (index) {
// CHECK-LABEL: func @affine_load
func @affine_load(%arg0 : index) {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
affine.for %i0 = 0 to 10 {
%1 = affine.load %0[%i0 + symbol(%arg0) + 7] : memref<10xf32>
}
@@ -546,7 +546,7 @@ func @affine_load(%arg0 : index) {
// CHECK-LABEL: func @affine_store
func @affine_store(%arg0 : index) {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
%1 = constant 11.0 : f32
affine.for %i0 = 0 to 10 {
affine.store %1, %0[%i0 - symbol(%arg0) + 7] : memref<10xf32>
@@ -571,22 +571,22 @@ func @affine_load_store_zero_dim(%arg0 : memref<i32>, %arg1 : memref<i32>) {
// CHECK-LABEL: func @affine_prefetch
func @affine_prefetch(%arg0 : index) {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
affine.for %i0 = 0 to 10 {
affine.prefetch %0[%i0 + symbol(%arg0) + 7], read, locality<3>, data : memref<10xf32>
}
// CHECK: %[[a:.*]] = addi %{{.*}}, %{{.*}} : index
// CHECK-NEXT: %[[c7:.*]] = constant 7 : index
// CHECK-NEXT: %[[b:.*]] = addi %[[a]], %[[c7]] : index
-// CHECK-NEXT: memref.prefetch %[[v0:.*]][%[[b]]], read, locality<3>, data : memref<10xf32>
+// CHECK-NEXT: prefetch %[[v0:.*]][%[[b]]], read, locality<3>, data : memref<10xf32>
return
}
// CHECK-LABEL: func @affine_dma_start
func @affine_dma_start(%arg0 : index) {
- %0 = memref.alloc() : memref<100xf32>
- %1 = memref.alloc() : memref<100xf32, 2>
- %2 = memref.alloc() : memref<1xi32>
+ %0 = alloc() : memref<100xf32>
+ %1 = alloc() : memref<100xf32, 2>
+ %2 = alloc() : memref<1xi32>
%c0 = constant 0 : index
%c64 = constant 64 : index
affine.for %i0 = 0 to 10 {
@@ -603,7 +603,7 @@ func @affine_dma_start(%arg0 : index) {
// CHECK-LABEL: func @affine_dma_wait
func @affine_dma_wait(%arg0 : index) {
- %2 = memref.alloc() : memref<1xi32>
+ %2 = alloc() : memref<1xi32>
%c64 = constant 64 : index
affine.for %i0 = 0 to 10 {
affine.dma_wait %2[%i0 + %arg0 + 17], %c64 : memref<1xi32>
@@ -702,7 +702,7 @@ func @affine_parallel_tiled(%o: memref<100x100xf32>, %a: memref<100x100xf32>, %b
/////////////////////////////////////////////////////////////////////
func @affine_parallel_simple(%arg0: memref<3x3xf32>, %arg1: memref<3x3xf32>) -> (memref<3x3xf32>) {
- %O = memref.alloc() : memref<3x3xf32>
+ %O = alloc() : memref<3x3xf32>
affine.parallel (%kx, %ky) = (0, 0) to (2, 2) {
%1 = affine.load %arg0[%kx, %ky] : memref<3x3xf32>
%2 = affine.load %arg1[%kx, %ky] : memref<3x3xf32>
diff --git a/mlir/test/Conversion/AsyncToLLVM/convert-to-llvm.mlir b/mlir/test/Conversion/AsyncToLLVM/convert-to-llvm.mlir
index ba2a3914145c..3d444a5c2853 100644
--- a/mlir/test/Conversion/AsyncToLLVM/convert-to-llvm.mlir
+++ b/mlir/test/Conversion/AsyncToLLVM/convert-to-llvm.mlir
@@ -20,7 +20,7 @@ func @execute_no_async_args(%arg0: f32, %arg1: memref<1xf32>) {
// CHECK: %[[TOKEN:.*]] = call @async_execute_fn(%arg0, %arg1)
%token = async.execute {
%c0 = constant 0 : index
- memref.store %arg0, %arg1[%c0] : memref<1xf32>
+ store %arg0, %arg1[%c0] : memref<1xf32>
async.yield
}
// CHECK: call @mlirAsyncRuntimeAwaitToken(%[[TOKEN]])
@@ -51,7 +51,7 @@ func @execute_no_async_args(%arg0: f32, %arg1: memref<1xf32>) {
// Resume coroutine after suspension.
// CHECK: ^[[RESUME]]:
-// CHECK: memref.store %arg0, %arg1[%c0] : memref<1xf32>
+// CHECK: store %arg0, %arg1[%c0] : memref<1xf32>
// CHECK: call @mlirAsyncRuntimeEmplaceToken(%[[RET]])
// Delete coroutine.
@@ -74,12 +74,12 @@ func @nested_async_execute(%arg0: f32, %arg1: f32, %arg2: memref<1xf32>) {
%token1 = async.execute {
%c1 = constant 1: index
- memref.store %arg0, %arg2[%c0] : memref<1xf32>
+ store %arg0, %arg2[%c0] : memref<1xf32>
async.yield
}
async.await %token1 : !async.token
- memref.store %arg1, %arg2[%c0] : memref<1xf32>
+ store %arg1, %arg2[%c0] : memref<1xf32>
async.yield
}
// CHECK: call @mlirAsyncRuntimeAwaitToken(%[[TOKEN]])
@@ -95,7 +95,7 @@ func @nested_async_execute(%arg0: f32, %arg1: f32, %arg2: memref<1xf32>) {
// CHECK: %[[HDL_0:.*]] = llvm.intr.coro.begin
// CHECK: call @mlirAsyncRuntimeExecute
// CHECK: llvm.intr.coro.suspend
-// CHECK: memref.store %arg0, %arg1[%arg2] : memref<1xf32>
+// CHECK: store %arg0, %arg1[%arg2] : memref<1xf32>
// CHECK: call @mlirAsyncRuntimeEmplaceToken(%[[RET_0]])
// Function outlined from the outer async.execute operation.
@@ -115,7 +115,7 @@ func @nested_async_execute(%arg0: f32, %arg1: f32, %arg2: memref<1xf32>) {
// CHECK: llvm.intr.coro.suspend
// Emplace result token after second resumption.
-// CHECK: memref.store %arg2, %arg1[%c0] : memref<1xf32>
+// CHECK: store %arg2, %arg1[%c0] : memref<1xf32>
// CHECK: call @mlirAsyncRuntimeEmplaceToken(%[[RET_1]])
// -----
@@ -125,13 +125,13 @@ func @async_execute_token_dependency(%arg0: f32, %arg1: memref<1xf32>) {
// CHECK: %0 = call @async_execute_fn(%arg0, %arg1)
%token = async.execute {
%c0 = constant 0 : index
- memref.store %arg0, %arg1[%c0] : memref<1xf32>
+ store %arg0, %arg1[%c0] : memref<1xf32>
async.yield
}
// CHECK: %1 = call @async_execute_fn_0(%0, %arg0, %arg1)
%token_0 = async.execute [%token] {
%c0 = constant 0 : index
- memref.store %arg0, %arg1[%c0] : memref<1xf32>
+ store %arg0, %arg1[%c0] : memref<1xf32>
async.yield
}
return
@@ -144,7 +144,7 @@ func @async_execute_token_dependency(%arg0: f32, %arg1: memref<1xf32>) {
// CHECK: %[[HDL_0:.*]] = llvm.intr.coro.begin
// CHECK: call @mlirAsyncRuntimeExecute
// CHECK: llvm.intr.coro.suspend
-// CHECK: memref.store %arg0, %arg1[%c0] : memref<1xf32>
+// CHECK: store %arg0, %arg1[%c0] : memref<1xf32>
// CHECK: call @mlirAsyncRuntimeEmplaceToken(%[[RET_0]])
// Function outlined from the second async.execute operation with dependency.
@@ -163,7 +163,7 @@ func @async_execute_token_dependency(%arg0: f32, %arg1: memref<1xf32>) {
// CHECK: llvm.intr.coro.suspend
// Emplace result token after second resumption.
-// CHECK: memref.store %arg1, %arg2[%c0] : memref<1xf32>
+// CHECK: store %arg1, %arg2[%c0] : memref<1xf32>
// CHECK: call @mlirAsyncRuntimeEmplaceToken(%[[RET_1]])
// -----
diff --git a/mlir/test/Conversion/GPUCommon/memory-attrbution.mlir b/mlir/test/Conversion/GPUCommon/memory-attrbution.mlir
index ff8d16b8c6fd..7f9b8b5fd76d 100644
--- a/mlir/test/Conversion/GPUCommon/memory-attrbution.mlir
+++ b/mlir/test/Conversion/GPUCommon/memory-attrbution.mlir
@@ -42,7 +42,7 @@ gpu.module @kernel {
// ROCDL: llvm.getelementptr
// ROCDL: llvm.store
%c0 = constant 0 : index
- memref.store %arg0, %arg1[%c0] : memref<4xf32, 5>
+ store %arg0, %arg1[%c0] : memref<4xf32, 5>
"terminator"() : () -> ()
}
@@ -108,7 +108,7 @@ gpu.module @kernel {
// ROCDL: llvm.getelementptr
// ROCDL: llvm.store
%c0 = constant 0 : index
- memref.store %arg0, %arg1[%c0] : memref<4xf32, 3>
+ store %arg0, %arg1[%c0] : memref<4xf32, 3>
"terminator"() : () -> ()
}
@@ -178,7 +178,7 @@ gpu.module @kernel {
// ROCDL: %[[descr10:.*]] = llvm.insertvalue %[[c1]], %[[descr9]][4, 2]
%c0 = constant 0 : index
- memref.store %arg0, %arg1[%c0,%c0,%c0] : memref<4x2x6xf32, 3>
+ store %arg0, %arg1[%c0,%c0,%c0] : memref<4x2x6xf32, 3>
"terminator"() : () -> ()
}
}
@@ -222,10 +222,10 @@ gpu.module @kernel {
// ROCDL: llvm.alloca %[[c4]] x f32 : (i64) -> !llvm.ptr<f32, 5>
%c0 = constant 0 : index
- memref.store %arg0, %arg1[%c0] : memref<1xf32, 3>
- memref.store %arg0, %arg2[%c0] : memref<2xf32, 3>
- memref.store %arg0, %arg3[%c0] : memref<3xf32, 5>
- memref.store %arg0, %arg4[%c0] : memref<4xf32, 5>
+ store %arg0, %arg1[%c0] : memref<1xf32, 3>
+ store %arg0, %arg2[%c0] : memref<2xf32, 3>
+ store %arg0, %arg3[%c0] : memref<3xf32, 5>
+ store %arg0, %arg4[%c0] : memref<4xf32, 5>
"terminator"() : () -> ()
}
}
diff --git a/mlir/test/Conversion/GPUToSPIRV/load-store.mlir b/mlir/test/Conversion/GPUToSPIRV/load-store.mlir
index 66e39f84378c..40ce2d48c58f 100644
--- a/mlir/test/Conversion/GPUToSPIRV/load-store.mlir
+++ b/mlir/test/Conversion/GPUToSPIRV/load-store.mlir
@@ -17,7 +17,7 @@ module attributes {
%c1_2 = constant 1 : index
gpu.launch_func @kernels::@load_store_kernel
blocks in (%0, %c1_2, %c1_2) threads in (%1, %c1_2, %c1_2)
- args(%arg0 : memref<12x4xf32>, %arg1 : memref<12x4xf32>, %arg2 : memref<12x4xf32>,
+ args(%arg0 : memref<12x4xf32>, %arg1 : memref<12x4xf32>, %arg2 : memref<12x4xf32>,
%c0 : index, %c0_0 : index, %c1 : index, %c1_1 : index)
return
}
@@ -77,7 +77,7 @@ module attributes {
%16 = addf %14, %15 : f32
// CHECK: %[[PTR3:.*]] = spv.AccessChain %[[ARG2]]{{\[}}{{%.*}}, {{%.*}}{{\]}}
// CHECK-NEXT: spv.Store "StorageBuffer" %[[PTR3]], %[[VAL3]]
- memref.store %16, %arg2[%12, %13] : memref<12x4xf32>
+ store %16, %arg2[%12, %13] : memref<12x4xf32>
gpu.return
}
}
diff --git a/mlir/test/Conversion/GPUToVulkan/lower-gpu-launch-vulkan-launch.mlir b/mlir/test/Conversion/GPUToVulkan/lower-gpu-launch-vulkan-launch.mlir
index d370e721b71e..d99d28e0a864 100644
--- a/mlir/test/Conversion/GPUToVulkan/lower-gpu-launch-vulkan-launch.mlir
+++ b/mlir/test/Conversion/GPUToVulkan/lower-gpu-launch-vulkan-launch.mlir
@@ -1,6 +1,6 @@
// RUN: mlir-opt %s -convert-gpu-launch-to-vulkan-launch | FileCheck %s
-// CHECK: %[[resource:.*]] = memref.alloc() : memref<12xf32>
+// CHECK: %[[resource:.*]] = alloc() : memref<12xf32>
// CHECK: %[[index:.*]] = constant 1 : index
// CHECK: call @vulkanLaunch(%[[index]], %[[index]], %[[index]], %[[resource]]) {spirv_blob = "{{.*}}", spirv_entry_point = "kernel"}
@@ -24,7 +24,7 @@ module attributes {gpu.container_module} {
}
}
func @foo() {
- %0 = memref.alloc() : memref<12xf32>
+ %0 = alloc() : memref<12xf32>
%c1 = constant 1 : index
gpu.launch_func @kernels::@kernel
blocks in(%c1, %c1, %c1)
diff --git a/mlir/test/Conversion/LinalgToVector/linalg-to-vector.mlir b/mlir/test/Conversion/LinalgToVector/linalg-to-vector.mlir
index e661de007736..21aba6cdaf7b 100644
--- a/mlir/test/Conversion/LinalgToVector/linalg-to-vector.mlir
+++ b/mlir/test/Conversion/LinalgToVector/linalg-to-vector.mlir
@@ -21,12 +21,12 @@ func @conv_1d(%arg0: memref<?xf32>, %arg1: memref<?xf32>, %arg2: memref<?xf32>)
// CHECK: %[[v0:.*]] = dim %[[arg1]], %[[c0]] : memref<?xf32>
// CHECK: %[[v1:.*]] = dim %[[arg2]], %[[c0]] : memref<?xf32>
// CHECK: %[[v2:.*]] = dim %[[arg0]], %[[c0]] : memref<?xf32>
-// CHECK: %[[v3:.*]] = memref.alloc(%[[c12]]) : memref<?xi8>
-// CHECK: %[[v4:.*]] = memref.alloc(%[[c12]]) : memref<?xi8>
-// CHECK: %[[v5:.*]] = memref.alloc(%[[c4]]) : memref<?xi8>
-// CHECK: %[[v6:.*]] = memref.view %[[v3]][%[[c0]]][] : memref<?xi8> to memref<3xf32>
-// CHECK: %[[v7:.*]] = memref.view %[[v4]][%[[c0]]][] : memref<?xi8> to memref<3xf32>
-// CHECK: %[[v8:.*]] = memref.view %[[v5]][%[[c0]]][] : memref<?xi8> to memref<1xf32>
+// CHECK: %[[v3:.*]] = alloc(%[[c12]]) : memref<?xi8>
+// CHECK: %[[v4:.*]] = alloc(%[[c12]]) : memref<?xi8>
+// CHECK: %[[v5:.*]] = alloc(%[[c4]]) : memref<?xi8>
+// CHECK: %[[v6:.*]] = std.view %[[v3]][%[[c0]]][] : memref<?xi8> to memref<3xf32>
+// CHECK: %[[v7:.*]] = std.view %[[v4]][%[[c0]]][] : memref<?xi8> to memref<3xf32>
+// CHECK: %[[v8:.*]] = std.view %[[v5]][%[[c0]]][] : memref<?xi8> to memref<1xf32>
// CHECK: scf.for %[[arg3:.*]] = %[[c0]] to %[[v1]] step %[[c1]] {
// CHECK: %[[v9:.*]] = affine.min #[[$map0]](%[[arg3]])[%[[v1]]]
// CHECK: %[[v10:.*]] = subview %[[arg2]][%[[arg3]]] [%[[v9]]] [1] : memref<?xf32> to memref<?xf32, #[[$map1]]>
diff --git a/mlir/test/Conversion/SCFToGPU/no_blocks_no_threads.mlir b/mlir/test/Conversion/SCFToGPU/no_blocks_no_threads.mlir
index 60ba7adeae32..451fcbe173da 100644
--- a/mlir/test/Conversion/SCFToGPU/no_blocks_no_threads.mlir
+++ b/mlir/test/Conversion/SCFToGPU/no_blocks_no_threads.mlir
@@ -25,7 +25,7 @@ func @one_d_loop(%A : memref<?xf32>, %B : memref<?xf32>) {
// CHECK-BLOCKS-NEXT: %[[INDEX:.*]] = addi %{{.*}}, %[[B0]]
// CHECK-BLOCKS-NEXT: load %{{.*}}[%[[INDEX]]]
%0 = load %A[%i] : memref<?xf32>
- memref.store %0, %B[%i] : memref<?xf32>
+ store %0, %B[%i] : memref<?xf32>
// CHECK-THREADS: gpu.terminator
// CHECK-BLOCKS: gpu.terminator
}
diff --git a/mlir/test/Conversion/SCFToGPU/parallel_loop.mlir b/mlir/test/Conversion/SCFToGPU/parallel_loop.mlir
index 5d3df42ad382..e72aabe3bbdb 100644
--- a/mlir/test/Conversion/SCFToGPU/parallel_loop.mlir
+++ b/mlir/test/Conversion/SCFToGPU/parallel_loop.mlir
@@ -10,7 +10,7 @@ func @parallel_loop_bidy_bidx(%arg0 : index, %arg1 : index, %arg2 : index,
scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3)
step (%arg4, %step) {
%val = load %buf[%i0, %i1] : memref<?x?xf32>
- memref.store %val, %res[%i1, %i0] : memref<?x?xf32>
+ store %val, %res[%i1, %i0] : memref<?x?xf32>
} { mapping = [{processor = 1, map = affine_map<(d0) -> (d0)>, bound = affine_map<(d0) -> (d0)>}, {processor = 0, map = affine_map<(d0) -> (d0)>, bound = affine_map<(d0) -> (d0)>}] }
return
}
@@ -29,7 +29,7 @@ func @parallel_loop_bidy_bidx(%arg0 : index, %arg1 : index, %arg2 : index,
// CHECK: [[VAL_23:%.*]] = affine.apply #[[$MAP1]]([[VAL_12]]){{\[}}[[VAL_4]], [[VAL_0]]]
// CHECK: [[VAL_24:%.*]] = affine.apply #[[$MAP1]]([[VAL_11]]){{\[}}[[VAL_7]], [[VAL_1]]]
// CHECK: [[VAL_25:%.*]] = load [[VAL_5]]{{\[}}[[VAL_23]], [[VAL_24]]] : memref<?x?xf32>
-// CHECK: memref.store [[VAL_25]], [[VAL_6]]{{\[}}[[VAL_24]], [[VAL_23]]] : memref<?x?xf32>
+// CHECK: store [[VAL_25]], [[VAL_6]]{{\[}}[[VAL_24]], [[VAL_23]]] : memref<?x?xf32>
// CHECK: gpu.terminator
// CHECK: }
// CHECK: return
@@ -54,7 +54,7 @@ func @parallel_loop_tiled(%arg0 : index, %arg1 : index, %arg2 : index,
%idx0 = addi %i0, %si0 : index
%idx1 = addi %i1, %si1 : index
%val = load %buf[%idx0, %idx1] : memref<?x?xf32>
- memref.store %val, %res[%idx1, %idx0] : memref<?x?xf32>
+ store %val, %res[%idx1, %idx0] : memref<?x?xf32>
} { mapping = [
{processor = 4, map = affine_map<(d0) -> (d0)>, bound = affine_map<(d0) -> (d0)>},
{processor = 3, map = affine_map<(d0) -> (d0)>, bound = affine_map<(d0) -> (d0)>}
@@ -88,7 +88,7 @@ func @parallel_loop_tiled(%arg0 : index, %arg1 : index, %arg2 : index,
// CHECK: [[VAL_56:%.*]] = addi [[VAL_52]], [[VAL_54]] : index
// CHECK: [[VAL_57:%.*]] = addi [[VAL_53]], [[VAL_55]] : index
// CHECK: [[VAL_58:%.*]] = load [[VAL_30]]{{\[}}[[VAL_56]], [[VAL_57]]] : memref<?x?xf32>
-// CHECK: memref.store [[VAL_58]], [[VAL_31]]{{\[}}[[VAL_57]], [[VAL_56]]] : memref<?x?xf32>
+// CHECK: store [[VAL_58]], [[VAL_31]]{{\[}}[[VAL_57]], [[VAL_56]]] : memref<?x?xf32>
// CHECK: gpu.terminator
// CHECK: }
// CHECK: return
@@ -107,7 +107,7 @@ func @parallel_loop_bidy_seq(%arg0 : index, %arg1 : index, %arg2 : index,
scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3)
step (%arg4, %step) {
%val = load %buf[%i0, %i1] : memref<?x?xf32>
- memref.store %val, %res[%i1, %i0] : memref<?x?xf32>
+ store %val, %res[%i1, %i0] : memref<?x?xf32>
} { mapping = [
{processor = 1, map = affine_map<(d0) -> (d0)>, bound = affine_map<(d0) -> (d0)>},
{processor = 6, map = affine_map<(d0) -> (d0)>, bound = affine_map<(d0) -> (d0)>}
@@ -128,7 +128,7 @@ func @parallel_loop_bidy_seq(%arg0 : index, %arg1 : index, %arg2 : index,
// CHECK: [[VAL_81:%.*]] = affine.apply #[[$MAP1]]([[VAL_70]]){{\[}}[[VAL_63]], [[VAL_59]]]
// CHECK: scf.for [[VAL_82:%.*]] = [[VAL_60]] to [[VAL_62]] step [[VAL_66]] {
// CHECK: [[VAL_83:%.*]] = load [[VAL_64]]{{\[}}[[VAL_81]], [[VAL_82]]] : memref<?x?xf32>
-// CHECK: memref.store [[VAL_83]], [[VAL_65]]{{\[}}[[VAL_82]], [[VAL_81]]] : memref<?x?xf32>
+// CHECK: store [[VAL_83]], [[VAL_65]]{{\[}}[[VAL_82]], [[VAL_81]]] : memref<?x?xf32>
// CHECK: }
// CHECK: gpu.terminator
// CHECK: }
@@ -154,7 +154,7 @@ func @parallel_loop_tiled_seq(%arg0 : index, %arg1 : index, %arg2 : index,
%idx0 = addi %i0, %si0 : index
%idx1 = addi %i1, %si1 : index
%val = load %buf[%idx0, %idx1] : memref<?x?xf32>
- memref.store %val, %res[%idx1, %idx0] : memref<?x?xf32>
+ store %val, %res[%idx1, %idx0] : memref<?x?xf32>
} { mapping = [
{processor = 4, map = affine_map<(d0) -> (d0)>, bound = affine_map<(d0) -> (d0)>},
{processor = 6, map = affine_map<(d0) -> (d0)>, bound = affine_map<(d0) -> (d0)>}
@@ -186,7 +186,7 @@ func @parallel_loop_tiled_seq(%arg0 : index, %arg1 : index, %arg2 : index,
// CHECK: [[VAL_112:%.*]] = addi [[VAL_108]], [[VAL_110]] : index
// CHECK: [[VAL_113:%.*]] = addi [[VAL_109]], [[VAL_111]] : index
// CHECK: [[VAL_114:%.*]] = load [[VAL_88]]{{\[}}[[VAL_112]], [[VAL_113]]] : memref<?x?xf32>
-// CHECK: memref.store [[VAL_114]], [[VAL_89]]{{\[}}[[VAL_113]], [[VAL_112]]] : memref<?x?xf32>
+// CHECK: store [[VAL_114]], [[VAL_89]]{{\[}}[[VAL_113]], [[VAL_112]]] : memref<?x?xf32>
// CHECK: }
// CHECK: }
// CHECK: gpu.terminator
@@ -232,7 +232,7 @@ module {
%18 = load %11[%arg5, %arg6] : memref<?x?xf32, #map3>
%19 = load %16[%arg5, %arg6] : memref<?x?xf32, #map3>
%20 = addf %17, %18 : f32
- memref.store %20, %16[%arg5, %arg6] : memref<?x?xf32, #map3>
+ store %20, %16[%arg5, %arg6] : memref<?x?xf32, #map3>
scf.yield
} {mapping = [{bound = affine_map<(d0) -> (d0)>, map = affine_map<(d0) -> (d0)>, processor = 3 : i64}, {bound = affine_map<(d0) -> (d0)>, map = affine_map<(d0) -> (d0)>, processor = 4 : i64}]}
scf.yield
@@ -293,7 +293,7 @@ module {
// CHECK: [[VAL_50:%.*]] = load [[VAL_39]]{{\[}}[[VAL_45]], [[VAL_47]]] : memref<?x?xf32, #[[$MAP5]]>
// CHECK: [[VAL_51:%.*]] = load [[VAL_44]]{{\[}}[[VAL_45]], [[VAL_47]]] : memref<?x?xf32, #[[$MAP5]]>
// CHECK: [[VAL_52:%.*]] = addf [[VAL_49]], [[VAL_50]] : f32
-// CHECK: memref.store [[VAL_52]], [[VAL_44]]{{\[}}[[VAL_45]], [[VAL_47]]] : memref<?x?xf32, #[[$MAP5]]>
+// CHECK: store [[VAL_52]], [[VAL_44]]{{\[}}[[VAL_45]], [[VAL_47]]] : memref<?x?xf32, #[[$MAP5]]>
// CHECK: }
// CHECK: }
// CHECK: gpu.terminator
@@ -354,7 +354,7 @@ func @parallel_loop_loop_variant_bound(%arg0 : index, %arg1 : index, %arg2 : ind
%idx0 = addi %i0, %si0 : index
%idx1 = addi %i1, %si1 : index
%val = load %buf[%idx0, %idx1] : memref<?x?xf32>
- memref.store %val, %res[%idx1, %idx0] : memref<?x?xf32>
+ store %val, %res[%idx1, %idx0] : memref<?x?xf32>
} { mapping = [
{processor = 4, map = affine_map<(d0) -> (d0)>, bound = affine_map<(d0) -> (d0)>},
{processor = 6, map = affine_map<(d0) -> (d0)>, bound = affine_map<(d0) -> (d0)>}
diff --git a/mlir/test/Conversion/SCFToGPU/step_one.mlir b/mlir/test/Conversion/SCFToGPU/step_one.mlir
index 5eb4883cc2ed..631886a95403 100644
--- a/mlir/test/Conversion/SCFToGPU/step_one.mlir
+++ b/mlir/test/Conversion/SCFToGPU/step_one.mlir
@@ -67,9 +67,9 @@ func @step_1(%A : memref<?x?x?x?xf32>, %B : memref<?x?x?x?xf32>) {
// CHECK-11: {{.*}} = load %{{.*}}[%[[i]], %[[j]], %[[ii]], %[[jj]]] : memref<?x?x?x?xf32>
// CHECK-22: {{.*}} = load %{{.*}}[%[[i]], %[[j]], %[[ii]], %[[jj]]] : memref<?x?x?x?xf32>
%0 = load %A[%i, %j, %ii, %jj] : memref<?x?x?x?xf32>
- // CHECK-11-NEXT: memref.store {{.*}}, %{{.*}}[%[[i]], %[[j]], %[[ii]], %[[jj]]] : memref<?x?x?x?xf32>
- // CHECK-22-NEXT: memref.store {{.*}}, %{{.*}}[%[[i]], %[[j]], %[[ii]], %[[jj]]] : memref<?x?x?x?xf32>
- memref.store %0, %B[%i, %j, %ii, %jj] : memref<?x?x?x?xf32>
+ // CHECK-11-NEXT: store {{.*}}, %{{.*}}[%[[i]], %[[j]], %[[ii]], %[[jj]]] : memref<?x?x?x?xf32>
+ // CHECK-22-NEXT: store {{.*}}, %{{.*}}[%[[i]], %[[j]], %[[ii]], %[[jj]]] : memref<?x?x?x?xf32>
+ store %0, %B[%i, %j, %ii, %jj] : memref<?x?x?x?xf32>
// CHECK-11: gpu.terminator
// CHECK-22: gpu.terminator
diff --git a/mlir/test/Conversion/SCFToGPU/step_positive.mlir b/mlir/test/Conversion/SCFToGPU/step_positive.mlir
index 7e8f65f71c3a..850f87037351 100644
--- a/mlir/test/Conversion/SCFToGPU/step_positive.mlir
+++ b/mlir/test/Conversion/SCFToGPU/step_positive.mlir
@@ -20,8 +20,8 @@ func @step_var(%A : memref<?x?xf32>, %B : memref<?x?xf32>) {
// CHECK: {{.*}} = load %{{.*}}[%[[i]], %[[j]]] : memref<?x?xf32>
%0 = load %A[%i, %j] : memref<?x?xf32>
- // CHECK: memref.store {{.*}}, %{{.*}}[%[[i]], %[[j]]] : memref<?x?xf32>
- memref.store %0, %B[%i, %j] : memref<?x?xf32>
+ // CHECK: store {{.*}}, %{{.*}}[%[[i]], %[[j]]] : memref<?x?xf32>
+ store %0, %B[%i, %j] : memref<?x?xf32>
}
}
return
diff --git a/mlir/test/Conversion/SCFToSPIRV/for.mlir b/mlir/test/Conversion/SCFToSPIRV/for.mlir
index 40a100d89edd..3e4545b1b1b5 100644
--- a/mlir/test/Conversion/SCFToSPIRV/for.mlir
+++ b/mlir/test/Conversion/SCFToSPIRV/for.mlir
@@ -37,7 +37,7 @@ func @loop_kernel(%arg2 : memref<10xf32>, %arg3 : memref<10xf32>) {
// CHECK: }
scf.for %arg4 = %lb to %ub step %step {
%1 = load %arg2[%arg4] : memref<10xf32>
- memref.store %1, %arg3[%arg4] : memref<10xf32>
+ store %1, %arg3[%arg4] : memref<10xf32>
}
return
}
@@ -78,8 +78,8 @@ func @loop_yield(%arg2 : memref<10xf32>, %arg3 : memref<10xf32>) {
// CHECK-DAG: %[[OUT2:.*]] = spv.Load "Function" %[[VAR2]] : f32
// CHECK: spv.Store "StorageBuffer" {{%.*}}, %[[OUT1]] : f32
// CHECK: spv.Store "StorageBuffer" {{%.*}}, %[[OUT2]] : f32
- memref.store %result#0, %arg3[%lb] : memref<10xf32>
- memref.store %result#1, %arg3[%ub] : memref<10xf32>
+ store %result#0, %arg3[%lb] : memref<10xf32>
+ store %result#1, %arg3[%ub] : memref<10xf32>
return
}
diff --git a/mlir/test/Conversion/SCFToSPIRV/if.mlir b/mlir/test/Conversion/SCFToSPIRV/if.mlir
index 2d2bc528d3d1..d7c048f517ab 100644
--- a/mlir/test/Conversion/SCFToSPIRV/if.mlir
+++ b/mlir/test/Conversion/SCFToSPIRV/if.mlir
@@ -20,7 +20,7 @@ func @kernel_simple_selection(%arg2 : memref<10xf32>, %arg3 : i1) {
// CHECK-NEXT: spv.Return
scf.if %arg3 {
- memref.store %value, %arg2[%i] : memref<10xf32>
+ store %value, %arg2[%i] : memref<10xf32>
}
return
}
@@ -62,18 +62,18 @@ func @kernel_nested_selection(%arg3 : memref<10xf32>, %arg4 : memref<10xf32>, %a
scf.if %arg5 {
scf.if %arg6 {
%value = load %arg3[%i] : memref<10xf32>
- memref.store %value, %arg4[%i] : memref<10xf32>
+ store %value, %arg4[%i] : memref<10xf32>
} else {
%value = load %arg4[%i] : memref<10xf32>
- memref.store %value, %arg3[%i] : memref<10xf32>
+ store %value, %arg3[%i] : memref<10xf32>
}
} else {
scf.if %arg6 {
%value = load %arg3[%j] : memref<10xf32>
- memref.store %value, %arg4[%j] : memref<10xf32>
+ store %value, %arg4[%j] : memref<10xf32>
} else {
%value = load %arg4[%j] : memref<10xf32>
- memref.store %value, %arg3[%j] : memref<10xf32>
+ store %value, %arg3[%j] : memref<10xf32>
}
}
return
@@ -116,8 +116,8 @@ func @simple_if_yield(%arg2 : memref<10xf32>, %arg3 : i1) {
}
%i = constant 0 : index
%j = constant 1 : index
- memref.store %0#0, %arg2[%i] : memref<10xf32>
- memref.store %0#1, %arg2[%j] : memref<10xf32>
+ store %0#0, %arg2[%i] : memref<10xf32>
+ store %0#1, %arg2[%j] : memref<10xf32>
return
}
@@ -149,7 +149,7 @@ func @simple_if_yield_type_change(%arg2 : memref<10xf32>, %arg3 : memref<10xf32>
} else {
scf.yield %arg3 : memref<10xf32>
}
- memref.store %value, %0[%i] : memref<10xf32>
+ store %value, %0[%i] : memref<10xf32>
return
}
diff --git a/mlir/test/Conversion/SPIRVToLLVM/lower-host-to-llvm-calls.mlir b/mlir/test/Conversion/SPIRVToLLVM/lower-host-to-llvm-calls.mlir
index 687d78dc3baa..3e6eadd626b9 100644
--- a/mlir/test/Conversion/SPIRVToLLVM/lower-host-to-llvm-calls.mlir
+++ b/mlir/test/Conversion/SPIRVToLLVM/lower-host-to-llvm-calls.mlir
@@ -1,5 +1,5 @@
// RUN: mlir-opt --lower-host-to-llvm %s | FileCheck %s
-
+
module attributes {gpu.container_module, spv.target_env = #spv.target_env<#spv.vce<v1.0, [Shader], [SPV_KHR_variable_pointers]>, {max_compute_workgroup_invocations = 128 : i32, max_compute_workgroup_size = dense<[128, 128, 64]> : vector<3xi32>}>} {
// CHECK: llvm.mlir.global linkonce @__spv__foo_bar_arg_0_descriptor_set0_binding0() : !llvm.struct<(array<6 x i32>)>
@@ -8,7 +8,7 @@ module attributes {gpu.container_module, spv.target_env = #spv.target_env<#spv.v
// CHECK: spv.module @__spv__foo
// CHECK: spv.globalVariable @bar_arg_0 bind(0, 0) : !spv.ptr<!spv.struct<(!spv.array<6 x i32, stride=4> [0])>, StorageBuffer>
// CHECK: spv.func @__spv__foo_bar
-
+
// CHECK: spv.EntryPoint "GLCompute" @__spv__foo_bar
// CHECK: spv.ExecutionMode @__spv__foo_bar "LocalSize", 1, 1, 1
@@ -38,7 +38,7 @@ module attributes {gpu.container_module, spv.target_env = #spv.target_env<#spv.v
}
func @main() {
- %buffer = memref.alloc() : memref<6xi32>
+ %buffer = alloc() : memref<6xi32>
%one = constant 1 : index
gpu.launch_func @foo::@bar blocks in (%one, %one, %one)
threads in (%one, %one, %one) args(%buffer : memref<6xi32>)
diff --git a/mlir/test/Conversion/StandardToLLVM/calling-convention.mlir b/mlir/test/Conversion/StandardToLLVM/calling-convention.mlir
index a9e9f9079682..ae2ead8d95f8 100644
--- a/mlir/test/Conversion/StandardToLLVM/calling-convention.mlir
+++ b/mlir/test/Conversion/StandardToLLVM/calling-convention.mlir
@@ -151,7 +151,7 @@ func @return_var_memref(%arg0: memref<4x3xf32>) -> memref<*xf32> {
// CHECK: %[[DESC_0:.*]] = llvm.mlir.undef : !llvm.struct<(i64, ptr<i8>)>
// CHECK: %[[DESC_1:.*]] = llvm.insertvalue %{{.*}}, %[[DESC_0]][0]
// CHECK: %[[DESC_2:.*]] = llvm.insertvalue %[[MEMORY]], %[[DESC_1]][1]
- %0 = memref.cast %arg0: memref<4x3xf32> to memref<*xf32>
+ %0 = memref_cast %arg0: memref<4x3xf32> to memref<*xf32>
// CHECK: %[[ONE:.*]] = llvm.mlir.constant(1 : index)
// CHECK: %[[TWO:.*]] = llvm.mlir.constant(2 : index)
@@ -213,7 +213,7 @@ func @return_two_var_memref(%arg0: memref<4x3xf32>) -> (memref<*xf32>, memref<*x
// CHECK: %[[DESC_0:.*]] = llvm.mlir.undef : !llvm.struct<(i64, ptr<i8>)>
// CHECK: %[[DESC_1:.*]] = llvm.insertvalue %{{.*}}, %[[DESC_0]][0]
// CHECK: %[[DESC_2:.*]] = llvm.insertvalue %[[MEMORY]], %[[DESC_1]][1]
- %0 = memref.cast %arg0 : memref<4x3xf32> to memref<*xf32>
+ %0 = memref_cast %arg0 : memref<4x3xf32> to memref<*xf32>
// Only check that we allocate the memory for each operand of the "return"
// separately, even if both operands are the same value. The calling
diff --git a/mlir/test/Conversion/StandardToLLVM/convert-dynamic-memref-ops.mlir b/mlir/test/Conversion/StandardToLLVM/convert-dynamic-memref-ops.mlir
index 923125984870..9ea40718e260 100644
--- a/mlir/test/Conversion/StandardToLLVM/convert-dynamic-memref-ops.mlir
+++ b/mlir/test/Conversion/StandardToLLVM/convert-dynamic-memref-ops.mlir
@@ -48,7 +48,7 @@ func @mixed_alloc(%arg0: index, %arg1: index) -> memref<?x42x?xf32> {
// CHECK-NEXT: llvm.insertvalue %[[st0]], %{{.*}}[4, 0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
// CHECK-NEXT: llvm.insertvalue %[[N]], %{{.*}}[4, 1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
// CHECK-NEXT: llvm.insertvalue %[[one]], %{{.*}}[4, 2] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
- %0 = memref.alloc(%arg0, %arg1) : memref<?x42x?xf32>
+ %0 = alloc(%arg0, %arg1) : memref<?x42x?xf32>
// CHECK-NEXT: llvm.return %{{.*}} : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
return %0 : memref<?x42x?xf32>
}
@@ -58,7 +58,7 @@ func @mixed_dealloc(%arg0: memref<?x42x?xf32>) {
// CHECK: %[[ptr:.*]] = llvm.extractvalue %{{.*}}[0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
// CHECK-NEXT: %[[ptri8:.*]] = llvm.bitcast %[[ptr]] : !llvm.ptr<f32> to !llvm.ptr<i8>
// CHECK-NEXT: llvm.call @free(%[[ptri8]]) : (!llvm.ptr<i8>) -> ()
- memref.dealloc %arg0 : memref<?x42x?xf32>
+ dealloc %arg0 : memref<?x42x?xf32>
// CHECK-NEXT: llvm.return
return
}
@@ -82,7 +82,7 @@ func @dynamic_alloc(%arg0: index, %arg1: index) -> memref<?x?xf32> {
// CHECK-NEXT: llvm.insertvalue %[[N]], %{{.*}}[3, 1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK-NEXT: llvm.insertvalue %[[N]], %{{.*}}[4, 0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK-NEXT: llvm.insertvalue %[[one]], %{{.*}}[4, 1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
- %0 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
+ %0 = alloc(%arg0, %arg1) : memref<?x?xf32>
// CHECK-NEXT: llvm.return %{{.*}} : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
return %0 : memref<?x?xf32>
}
@@ -107,7 +107,7 @@ func @dynamic_alloca(%arg0: index, %arg1: index) -> memref<?x?xf32> {
// CHECK-NEXT: llvm.insertvalue %[[N]], %{{.*}}[3, 1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK-NEXT: llvm.insertvalue %[[N]], %{{.*}}[4, 0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK-NEXT: llvm.insertvalue %[[st1]], %{{.*}}[4, 1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
- %0 = memref.alloca(%arg0, %arg1) : memref<?x?xf32>
+ %0 = alloca(%arg0, %arg1) : memref<?x?xf32>
// Test with explicitly specified alignment. llvm.alloca takes care of the
// alignment. The same pointer is thus used for allocation and aligned
@@ -116,7 +116,7 @@ func @dynamic_alloca(%arg0: index, %arg1: index) -> memref<?x?xf32> {
// CHECK: %[[desc:.*]] = llvm.mlir.undef : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK: %[[desc1:.*]] = llvm.insertvalue %[[alloca_aligned]], %[[desc]][0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK: llvm.insertvalue %[[alloca_aligned]], %[[desc1]][1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
- memref.alloca(%arg0, %arg1) {alignment = 32} : memref<?x?xf32>
+ alloca(%arg0, %arg1) {alignment = 32} : memref<?x?xf32>
return %0 : memref<?x?xf32>
}
@@ -125,7 +125,7 @@ func @dynamic_dealloc(%arg0: memref<?x?xf32>) {
// CHECK: %[[ptr:.*]] = llvm.extractvalue %{{.*}}[0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK-NEXT: %[[ptri8:.*]] = llvm.bitcast %[[ptr]] : !llvm.ptr<f32> to !llvm.ptr<i8>
// CHECK-NEXT: llvm.call @free(%[[ptri8]]) : (!llvm.ptr<i8>) -> ()
- memref.dealloc %arg0 : memref<?x?xf32>
+ dealloc %arg0 : memref<?x?xf32>
return
}
@@ -142,23 +142,23 @@ func @stdlib_aligned_alloc(%N : index) -> memref<32x18xf32> {
// ALIGNED-ALLOC-NEXT: %[[alignment:.*]] = llvm.mlir.constant(32 : index) : i64
// ALIGNED-ALLOC-NEXT: %[[allocated:.*]] = llvm.call @aligned_alloc(%[[alignment]], %[[bytes]]) : (i64, i64) -> !llvm.ptr<i8>
// ALIGNED-ALLOC-NEXT: llvm.bitcast %[[allocated]] : !llvm.ptr<i8> to !llvm.ptr<f32>
- %0 = memref.alloc() {alignment = 32} : memref<32x18xf32>
+ %0 = alloc() {alignment = 32} : memref<32x18xf32>
// Do another alloc just to test that we have a unique declaration for
// aligned_alloc.
// ALIGNED-ALLOC: llvm.call @aligned_alloc
- %1 = memref.alloc() {alignment = 64} : memref<4096xf32>
+ %1 = alloc() {alignment = 64} : memref<4096xf32>
// Alignment is to element type boundaries (minimum 16 bytes).
// ALIGNED-ALLOC: %[[c32:.*]] = llvm.mlir.constant(32 : index) : i64
// ALIGNED-ALLOC-NEXT: llvm.call @aligned_alloc(%[[c32]]
- %2 = memref.alloc() : memref<4096xvector<8xf32>>
+ %2 = alloc() : memref<4096xvector<8xf32>>
// The minimum alignment is 16 bytes unless explicitly specified.
// ALIGNED-ALLOC: %[[c16:.*]] = llvm.mlir.constant(16 : index) : i64
// ALIGNED-ALLOC-NEXT: llvm.call @aligned_alloc(%[[c16]],
- %3 = memref.alloc() : memref<4096xvector<2xf32>>
+ %3 = alloc() : memref<4096xvector<2xf32>>
// ALIGNED-ALLOC: %[[c8:.*]] = llvm.mlir.constant(8 : index) : i64
// ALIGNED-ALLOC-NEXT: llvm.call @aligned_alloc(%[[c8]],
- %4 = memref.alloc() {alignment = 8} : memref<1024xvector<4xf32>>
+ %4 = alloc() {alignment = 8} : memref<1024xvector<4xf32>>
// Bump the memref allocation size if its size is not a multiple of alignment.
// ALIGNED-ALLOC: %[[c32:.*]] = llvm.mlir.constant(32 : index) : i64
// ALIGNED-ALLOC-NEXT: llvm.mlir.constant(1 : index) : i64
@@ -167,11 +167,11 @@ func @stdlib_aligned_alloc(%N : index) -> memref<32x18xf32> {
// ALIGNED-ALLOC-NEXT: llvm.urem
// ALIGNED-ALLOC-NEXT: %[[SIZE_ALIGNED:.*]] = llvm.sub
// ALIGNED-ALLOC-NEXT: llvm.call @aligned_alloc(%[[c32]], %[[SIZE_ALIGNED]])
- %5 = memref.alloc() {alignment = 32} : memref<100xf32>
+ %5 = alloc() {alignment = 32} : memref<100xf32>
// Bump alignment to the next power of two if it isn't.
// ALIGNED-ALLOC: %[[c128:.*]] = llvm.mlir.constant(128 : index) : i64
// ALIGNED-ALLOC: llvm.call @aligned_alloc(%[[c128]]
- %6 = memref.alloc(%N) : memref<?xvector<18xf32>>
+ %6 = alloc(%N) : memref<?xvector<18xf32>>
return %0 : memref<32x18xf32>
}
@@ -232,17 +232,17 @@ func @prefetch(%A : memref<?x?xf32>, %i : index, %j : index) {
// CHECK-NEXT: [[C3:%.*]] = llvm.mlir.constant(3 : i32) : i32
// CHECK-NEXT: [[C1_1:%.*]] = llvm.mlir.constant(1 : i32) : i32
// CHECK-NEXT: "llvm.intr.prefetch"(%[[addr]], [[C1]], [[C3]], [[C1_1]]) : (!llvm.ptr<f32>, i32, i32, i32) -> ()
- memref.prefetch %A[%i, %j], write, locality<3>, data : memref<?x?xf32>
+ prefetch %A[%i, %j], write, locality<3>, data : memref<?x?xf32>
// CHECK: [[C0:%.*]] = llvm.mlir.constant(0 : i32) : i32
// CHECK: [[C0_1:%.*]] = llvm.mlir.constant(0 : i32) : i32
// CHECK: [[C1_2:%.*]] = llvm.mlir.constant(1 : i32) : i32
// CHECK: "llvm.intr.prefetch"(%{{.*}}, [[C0]], [[C0_1]], [[C1_2]]) : (!llvm.ptr<f32>, i32, i32, i32) -> ()
- memref.prefetch %A[%i, %j], read, locality<0>, data : memref<?x?xf32>
+ prefetch %A[%i, %j], read, locality<0>, data : memref<?x?xf32>
// CHECK: [[C0_2:%.*]] = llvm.mlir.constant(0 : i32) : i32
// CHECK: [[C2:%.*]] = llvm.mlir.constant(2 : i32) : i32
// CHECK: [[C0_3:%.*]] = llvm.mlir.constant(0 : i32) : i32
// CHECK: "llvm.intr.prefetch"(%{{.*}}, [[C0_2]], [[C2]], [[C0_3]]) : (!llvm.ptr<f32>, i32, i32, i32) -> ()
- memref.prefetch %A[%i, %j], read, locality<2>, instr : memref<?x?xf32>
+ prefetch %A[%i, %j], read, locality<2>, instr : memref<?x?xf32>
return
}
@@ -263,7 +263,7 @@ func @dynamic_store(%dynamic : memref<?x?xf32>, %i : index, %j : index, %val : f
// CHECK-NEXT: %[[off1:.*]] = llvm.add %[[offI]], %[[J]] : i64
// CHECK-NEXT: %[[addr:.*]] = llvm.getelementptr %[[ptr]][%[[off1]]] : (!llvm.ptr<f32>, i64) -> !llvm.ptr<f32>
// CHECK-NEXT: llvm.store %{{.*}}, %[[addr]] : !llvm.ptr<f32>
- memref.store %val, %dynamic[%i, %j] : memref<?x?xf32>
+ store %val, %dynamic[%i, %j] : memref<?x?xf32>
return
}
@@ -284,56 +284,56 @@ func @mixed_store(%mixed : memref<42x?xf32>, %i : index, %j : index, %val : f32)
// CHECK-NEXT: %[[off1:.*]] = llvm.add %[[offI]], %[[J]] : i64
// CHECK-NEXT: %[[addr:.*]] = llvm.getelementptr %[[ptr]][%[[off1]]] : (!llvm.ptr<f32>, i64) -> !llvm.ptr<f32>
// CHECK-NEXT: llvm.store %{{.*}}, %[[addr]] : !llvm.ptr<f32>
- memref.store %val, %mixed[%i, %j] : memref<42x?xf32>
+ store %val, %mixed[%i, %j] : memref<42x?xf32>
return
}
// CHECK-LABEL: func @memref_cast_static_to_dynamic
func @memref_cast_static_to_dynamic(%static : memref<10x42xf32>) {
// CHECK-NOT: llvm.bitcast
- %0 = memref.cast %static : memref<10x42xf32> to memref<?x?xf32>
+ %0 = memref_cast %static : memref<10x42xf32> to memref<?x?xf32>
return
}
// CHECK-LABEL: func @memref_cast_static_to_mixed
func @memref_cast_static_to_mixed(%static : memref<10x42xf32>) {
// CHECK-NOT: llvm.bitcast
- %0 = memref.cast %static : memref<10x42xf32> to memref<?x42xf32>
+ %0 = memref_cast %static : memref<10x42xf32> to memref<?x42xf32>
return
}
// CHECK-LABEL: func @memref_cast_dynamic_to_static
func @memref_cast_dynamic_to_static(%dynamic : memref<?x?xf32>) {
// CHECK-NOT: llvm.bitcast
- %0 = memref.cast %dynamic : memref<?x?xf32> to memref<10x12xf32>
+ %0 = memref_cast %dynamic : memref<?x?xf32> to memref<10x12xf32>
return
}
// CHECK-LABEL: func @memref_cast_dynamic_to_mixed
func @memref_cast_dynamic_to_mixed(%dynamic : memref<?x?xf32>) {
// CHECK-NOT: llvm.bitcast
- %0 = memref.cast %dynamic : memref<?x?xf32> to memref<?x12xf32>
+ %0 = memref_cast %dynamic : memref<?x?xf32> to memref<?x12xf32>
return
}
// CHECK-LABEL: func @memref_cast_mixed_to_dynamic
func @memref_cast_mixed_to_dynamic(%mixed : memref<42x?xf32>) {
// CHECK-NOT: llvm.bitcast
- %0 = memref.cast %mixed : memref<42x?xf32> to memref<?x?xf32>
+ %0 = memref_cast %mixed : memref<42x?xf32> to memref<?x?xf32>
return
}
// CHECK-LABEL: func @memref_cast_mixed_to_static
func @memref_cast_mixed_to_static(%mixed : memref<42x?xf32>) {
// CHECK-NOT: llvm.bitcast
- %0 = memref.cast %mixed : memref<42x?xf32> to memref<42x1xf32>
+ %0 = memref_cast %mixed : memref<42x?xf32> to memref<42x1xf32>
return
}
// CHECK-LABEL: func @memref_cast_mixed_to_mixed
func @memref_cast_mixed_to_mixed(%mixed : memref<42x?xf32>) {
// CHECK-NOT: llvm.bitcast
- %0 = memref.cast %mixed : memref<42x?xf32> to memref<?x1xf32>
+ %0 = memref_cast %mixed : memref<42x?xf32> to memref<?x1xf32>
return
}
@@ -347,7 +347,7 @@ func @memref_cast_ranked_to_unranked(%arg : memref<42x2x?xf32>) {
// CHECK : llvm.mlir.undef : !llvm.struct<(i64, ptr<i8>)>
// CHECK-DAG: llvm.insertvalue %[[r]], %{{.*}}[0] : !llvm.struct<(i64, ptr<i8>)>
// CHECK-DAG: llvm.insertvalue %[[p2]], %{{.*}}[1] : !llvm.struct<(i64, ptr<i8>)>
- %0 = memref.cast %arg : memref<42x2x?xf32> to memref<*xf32>
+ %0 = memref_cast %arg : memref<42x2x?xf32> to memref<*xf32>
return
}
@@ -355,7 +355,7 @@ func @memref_cast_ranked_to_unranked(%arg : memref<42x2x?xf32>) {
func @memref_cast_unranked_to_ranked(%arg : memref<*xf32>) {
// CHECK: %[[p:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(i64, ptr<i8>)>
// CHECK-NEXT: llvm.bitcast %[[p]] : !llvm.ptr<i8> to !llvm.ptr<struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>>
- %0 = memref.cast %arg : memref<*xf32> to memref<?x?x10x2xf32>
+ %0 = memref_cast %arg : memref<*xf32> to memref<?x?x10x2xf32>
return
}
diff --git a/mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir b/mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir
index bd56e92329b3..f13da7ae48c5 100644
--- a/mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir
+++ b/mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir
@@ -93,7 +93,7 @@ func @zero_d_alloc() -> memref<f32> {
// BAREPTR-NEXT: llvm.insertvalue %[[ptr]], %{{.*}}[1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64)>
// BAREPTR-NEXT: %[[c0:.*]] = llvm.mlir.constant(0 : index) : i64
// BAREPTR-NEXT: llvm.insertvalue %[[c0]], %{{.*}}[2] : !llvm.struct<(ptr<f32>, ptr<f32>, i64)>
- %0 = memref.alloc() : memref<f32>
+ %0 = alloc() : memref<f32>
return %0 : memref<f32>
}
@@ -109,7 +109,7 @@ func @zero_d_dealloc(%arg0: memref<f32>) {
// BAREPTR: %[[ptr:.*]] = llvm.extractvalue %{{.*}}[0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64)>
// BAREPTR-NEXT: %[[bc:.*]] = llvm.bitcast %[[ptr]] : !llvm.ptr<f32> to !llvm.ptr<i8>
// BAREPTR-NEXT: llvm.call @free(%[[bc]]) : (!llvm.ptr<i8>) -> ()
- memref.dealloc %arg0 : memref<f32>
+ dealloc %arg0 : memref<f32>
return
}
@@ -161,7 +161,7 @@ func @aligned_1d_alloc() -> memref<42xf32> {
// BAREPTR-NEXT: llvm.insertvalue %[[alignedBitCast]], %{{.*}}[1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<1 x i64>, array<1 x i64>)>
// BAREPTR-NEXT: %[[c0:.*]] = llvm.mlir.constant(0 : index) : i64
// BAREPTR-NEXT: llvm.insertvalue %[[c0]], %{{.*}}[2] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<1 x i64>, array<1 x i64>)>
- %0 = memref.alloc() {alignment = 8} : memref<42xf32>
+ %0 = alloc() {alignment = 8} : memref<42xf32>
return %0 : memref<42xf32>
}
@@ -183,7 +183,7 @@ func @static_alloc() -> memref<32x18xf32> {
// BAREPTR-NEXT: %[[size_bytes:.*]] = llvm.ptrtoint %[[gep]] : !llvm.ptr<f32> to i64
// BAREPTR-NEXT: %[[allocated:.*]] = llvm.call @malloc(%[[size_bytes]]) : (i64) -> !llvm.ptr<i8>
// BAREPTR-NEXT: llvm.bitcast %[[allocated]] : !llvm.ptr<i8> to !llvm.ptr<f32>
- %0 = memref.alloc() : memref<32x18xf32>
+ %0 = alloc() : memref<32x18xf32>
return %0 : memref<32x18xf32>
}
@@ -199,7 +199,7 @@ func @static_alloca() -> memref<32x18xf32> {
// CHECK-NEXT: %[[gep:.*]] = llvm.getelementptr %[[null]][%[[num_elems]]] : (!llvm.ptr<f32>, i64) -> !llvm.ptr<f32>
// CHECK-NEXT: %[[size_bytes:.*]] = llvm.ptrtoint %[[gep]] : !llvm.ptr<f32> to i64
// CHECK-NEXT: %[[allocated:.*]] = llvm.alloca %[[size_bytes]] x f32 : (i64) -> !llvm.ptr<f32>
- %0 = memref.alloca() : memref<32x18xf32>
+ %0 = alloca() : memref<32x18xf32>
// Test with explicitly specified alignment. llvm.alloca takes care of the
// alignment. The same pointer is thus used for allocation and aligned
@@ -208,7 +208,7 @@ func @static_alloca() -> memref<32x18xf32> {
// CHECK: %[[desc:.*]] = llvm.mlir.undef : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK: %[[desc1:.*]] = llvm.insertvalue %[[alloca_aligned]], %[[desc]][0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK: llvm.insertvalue %[[alloca_aligned]], %[[desc1]][1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
- memref.alloca() {alignment = 32} : memref<32x18xf32>
+ alloca() {alignment = 32} : memref<32x18xf32>
return %0 : memref<32x18xf32>
}
@@ -224,7 +224,7 @@ func @static_dealloc(%static: memref<10x8xf32>) {
// BAREPTR: %[[ptr:.*]] = llvm.extractvalue %{{.*}}[0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
// BAREPTR-NEXT: %[[bc:.*]] = llvm.bitcast %[[ptr]] : !llvm.ptr<f32> to !llvm.ptr<i8>
// BAREPTR-NEXT: llvm.call @free(%[[bc]]) : (!llvm.ptr<i8>) -> ()
- memref.dealloc %static : memref<10x8xf32>
+ dealloc %static : memref<10x8xf32>
return
}
@@ -280,7 +280,7 @@ func @zero_d_store(%arg0: memref<f32>, %arg1: f32) {
// BAREPTR: %[[ptr:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64)>
// BAREPTR-NEXT: llvm.store %[[val]], %[[ptr]] : !llvm.ptr<f32>
- memref.store %arg1, %arg0[] : memref<f32>
+ store %arg1, %arg0[] : memref<f32>
return
}
@@ -314,7 +314,7 @@ func @static_store(%static : memref<10x42xf32>, %i : index, %j : index, %val : f
// BAREPTR-NEXT: %[[off1:.*]] = llvm.add %[[offI]], %[[J]] : i64
// BAREPTR-NEXT: %[[addr:.*]] = llvm.getelementptr %[[ptr]][%[[off1]]] : (!llvm.ptr<f32>, i64) -> !llvm.ptr<f32>
// BAREPTR-NEXT: llvm.store %{{.*}}, %[[addr]] : !llvm.ptr<f32>
- memref.store %val, %static[%i, %j] : memref<10x42xf32>
+ store %val, %static[%i, %j] : memref<10x42xf32>
return
}
diff --git a/mlir/test/Conversion/StandardToLLVM/convert-to-llvmir.mlir b/mlir/test/Conversion/StandardToLLVM/convert-to-llvmir.mlir
index e28f21d6cc99..2b38def9e6f2 100644
--- a/mlir/test/Conversion/StandardToLLVM/convert-to-llvmir.mlir
+++ b/mlir/test/Conversion/StandardToLLVM/convert-to-llvmir.mlir
@@ -786,7 +786,7 @@ func @splat(%a: vector<4xf32>, %b: f32) -> vector<4xf32> {
func @view(%arg0 : index, %arg1 : index, %arg2 : index) {
// CHECK: llvm.mlir.constant(2048 : index) : i64
// CHECK: llvm.mlir.undef : !llvm.struct<(ptr<i8>, ptr<i8>, i64, array<1 x i64>, array<1 x i64>)>
- %0 = memref.alloc() : memref<2048xi8>
+ %0 = alloc() : memref<2048xi8>
// Test two dynamic sizes.
// CHECK: llvm.mlir.undef : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
@@ -802,7 +802,7 @@ func @view(%arg0 : index, %arg1 : index, %arg2 : index) {
// CHECK: llvm.insertvalue %[[ARG0]], %{{.*}}[3, 0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK: llvm.mul %{{.*}}, %[[ARG1]]
// CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[4, 0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
- %1 = memref.view %0[%arg2][%arg0, %arg1] : memref<2048xi8> to memref<?x?xf32>
+ %1 = view %0[%arg2][%arg0, %arg1] : memref<2048xi8> to memref<?x?xf32>
// Test one dynamic size.
// CHECK: llvm.mlir.undef : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
@@ -819,7 +819,7 @@ func @view(%arg0 : index, %arg1 : index, %arg2 : index) {
// CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[3, 0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK: llvm.mul %{{.*}}, %[[ARG1]]
// CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[4, 0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
- %3 = memref.view %0[%arg2][%arg1] : memref<2048xi8> to memref<4x?xf32>
+ %3 = view %0[%arg2][%arg1] : memref<2048xi8> to memref<4x?xf32>
// Test static sizes.
// CHECK: llvm.mlir.undef : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
@@ -837,12 +837,12 @@ func @view(%arg0 : index, %arg1 : index, %arg2 : index) {
// CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[3, 0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK: llvm.mlir.constant(4 : index) : i64
// CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[4, 0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
- %5 = memref.view %0[%arg2][] : memref<2048xi8> to memref<64x4xf32>
+ %5 = view %0[%arg2][] : memref<2048xi8> to memref<64x4xf32>
// Test view memory space.
// CHECK: llvm.mlir.constant(2048 : index) : i64
// CHECK: llvm.mlir.undef : !llvm.struct<(ptr<i8, 4>, ptr<i8, 4>, i64, array<1 x i64>, array<1 x i64>)>
- %6 = memref.alloc() : memref<2048xi8, 4>
+ %6 = alloc() : memref<2048xi8, 4>
// CHECK: llvm.mlir.undef : !llvm.struct<(ptr<f32, 4>, ptr<f32, 4>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK: %[[BASE_PTR_4:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr<i8, 4>, ptr<i8, 4>, i64, array<1 x i64>, array<1 x i64>)>
@@ -859,7 +859,7 @@ func @view(%arg0 : index, %arg1 : index, %arg2 : index) {
// CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[3, 0] : !llvm.struct<(ptr<f32, 4>, ptr<f32, 4>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK: llvm.mlir.constant(4 : index) : i64
// CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[4, 0] : !llvm.struct<(ptr<f32, 4>, ptr<f32, 4>, i64, array<2 x i64>, array<2 x i64>)>
- %7 = memref.view %6[%arg2][] : memref<2048xi8, 4> to memref<64x4xf32, 4>
+ %7 = view %6[%arg2][] : memref<2048xi8, 4> to memref<64x4xf32, 4>
return
}
diff --git a/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir b/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir
index ebda01f2f469..f4eba23c9d38 100644
--- a/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir
+++ b/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir
@@ -3,7 +3,7 @@
// CHECK-LABEL: func @address_space(
// CHECK-SAME: !llvm.ptr<f32, 7>
func @address_space(%arg0 : memref<32xf32, affine_map<(d0) -> (d0)>, 7>) {
- %0 = memref.alloc() : memref<32xf32, affine_map<(d0) -> (d0)>, 5>
+ %0 = alloc() : memref<32xf32, affine_map<(d0) -> (d0)>, 5>
%1 = constant 7 : index
// CHECK: llvm.load %{{.*}} : !llvm.ptr<f32, 5>
%2 = load %0[%1] : memref<32xf32, affine_map<(d0) -> (d0)>, 5>
@@ -122,25 +122,25 @@ func @assert_test_function(%arg : i1) {
// CHECK: llvm.extractvalue {{.*}}[3, 2] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
// CHECK: llvm.insertvalue {{.*}}[3, 1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
func @transpose(%arg0: memref<?x?x?xf32, offset: ?, strides: [?, ?, 1]>) {
- %0 = memref.transpose %arg0 (i, j, k) -> (k, i, j) : memref<?x?x?xf32, offset: ?, strides: [?, ?, 1]> to memref<?x?x?xf32, affine_map<(d0, d1, d2)[s0, s1, s2] -> (d2 * s1 + s0 + d0 * s2 + d1)>>
+ %0 = transpose %arg0 (i, j, k) -> (k, i, j) : memref<?x?x?xf32, offset: ?, strides: [?, ?, 1]> to memref<?x?x?xf32, affine_map<(d0, d1, d2)[s0, s1, s2] -> (d2 * s1 + s0 + d0 * s2 + d1)>>
return
}
// -----
// CHECK: llvm.mlir.global external @gv0() : !llvm.array<2 x f32>
-memref.global @gv0 : memref<2xf32> = uninitialized
+global_memref @gv0 : memref<2xf32> = uninitialized
// CHECK: llvm.mlir.global private @gv1() : !llvm.array<2 x f32>
-memref.global "private" @gv1 : memref<2xf32>
+global_memref "private" @gv1 : memref<2xf32>
// CHECK: llvm.mlir.global external @gv2(dense<{{\[\[}}0.000000e+00, 1.000000e+00, 2.000000e+00], [3.000000e+00, 4.000000e+00, 5.000000e+00]]> : tensor<2x3xf32>) : !llvm.array<2 x array<3 x f32>>
-memref.global @gv2 : memref<2x3xf32> = dense<[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]]>
+global_memref @gv2 : memref<2x3xf32> = dense<[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]]>
// Test 1D memref.
// CHECK-LABEL: func @get_gv0_memref
func @get_gv0_memref() {
- %0 = memref.get_global @gv0 : memref<2xf32>
+ %0 = get_global_memref @gv0 : memref<2xf32>
// CHECK: %[[DIM:.*]] = llvm.mlir.constant(2 : index) : i64
// CHECK: %[[STRIDE:.*]] = llvm.mlir.constant(1 : index) : i64
// CHECK: %[[ADDR:.*]] = llvm.mlir.addressof @gv0 : !llvm.ptr<array<2 x f32>>
@@ -179,13 +179,13 @@ func @get_gv2_memref() {
// CHECK: llvm.insertvalue %[[DIM1]], {{.*}}[4, 0] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
// CHECK: llvm.insertvalue %[[STRIDE1]], {{.*}}[4, 1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<2 x i64>, array<2 x i64>)>
- %0 = memref.get_global @gv2 : memref<2x3xf32>
+ %0 = get_global_memref @gv2 : memref<2x3xf32>
return
}
// Test scalar memref.
// CHECK: llvm.mlir.global external @gv3(1.000000e+00 : f32) : f32
-memref.global @gv3 : memref<f32> = dense<1.0>
+global_memref @gv3 : memref<f32> = dense<1.0>
// CHECK-LABEL: func @get_gv3_memref
func @get_gv3_memref() {
@@ -199,7 +199,7 @@ func @get_gv3_memref() {
// CHECK: llvm.insertvalue %[[GEP]], {{.*}}[1] : !llvm.struct<(ptr<f32>, ptr<f32>, i64)>
// CHECK: %[[OFFSET:.*]] = llvm.mlir.constant(0 : index) : i64
// CHECK: llvm.insertvalue %[[OFFSET]], {{.*}}[2] : !llvm.struct<(ptr<f32>, ptr<f32>, i64)>
- %0 = memref.get_global @gv3 : memref<f32>
+ %0 = get_global_memref @gv3 : memref<f32>
return
}
diff --git a/mlir/test/Conversion/StandardToSPIRV/alloc.mlir b/mlir/test/Conversion/StandardToSPIRV/alloc.mlir
index a34a34e475d5..48c6df2f2263 100644
--- a/mlir/test/Conversion/StandardToSPIRV/alloc.mlir
+++ b/mlir/test/Conversion/StandardToSPIRV/alloc.mlir
@@ -10,22 +10,22 @@ module attributes {
}
{
func @alloc_dealloc_workgroup_mem(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<4x5xf32, 3>
+ %0 = alloc() : memref<4x5xf32, 3>
%1 = load %0[%arg0, %arg1] : memref<4x5xf32, 3>
- memref.store %1, %0[%arg0, %arg1] : memref<4x5xf32, 3>
- memref.dealloc %0 : memref<4x5xf32, 3>
+ store %1, %0[%arg0, %arg1] : memref<4x5xf32, 3>
+ dealloc %0 : memref<4x5xf32, 3>
return
}
}
// CHECK: spv.globalVariable @[[VAR:.+]] : !spv.ptr<!spv.struct<(!spv.array<20 x f32, stride=4>)>, Workgroup>
// CHECK: func @alloc_dealloc_workgroup_mem
-// CHECK-NOT: memref.alloc
+// CHECK-NOT: alloc
// CHECK: %[[PTR:.+]] = spv.mlir.addressof @[[VAR]]
// CHECK: %[[LOADPTR:.+]] = spv.AccessChain %[[PTR]]
// CHECK: %[[VAL:.+]] = spv.Load "Workgroup" %[[LOADPTR]] : f32
// CHECK: %[[STOREPTR:.+]] = spv.AccessChain %[[PTR]]
// CHECK: spv.Store "Workgroup" %[[STOREPTR]], %[[VAL]] : f32
-// CHECK-NOT: memref.dealloc
+// CHECK-NOT: dealloc
// CHECK: spv.Return
// -----
@@ -36,10 +36,10 @@ module attributes {
}
{
func @alloc_dealloc_workgroup_mem(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<4x5xi16, 3>
+ %0 = alloc() : memref<4x5xi16, 3>
%1 = load %0[%arg0, %arg1] : memref<4x5xi16, 3>
- memref.store %1, %0[%arg0, %arg1] : memref<4x5xi16, 3>
- memref.dealloc %0 : memref<4x5xi16, 3>
+ store %1, %0[%arg0, %arg1] : memref<4x5xi16, 3>
+ dealloc %0 : memref<4x5xi16, 3>
return
}
}
@@ -65,8 +65,8 @@ module attributes {
}
{
func @two_allocs() {
- %0 = memref.alloc() : memref<4x5xf32, 3>
- %1 = memref.alloc() : memref<2x3xi32, 3>
+ %0 = alloc() : memref<4x5xf32, 3>
+ %1 = alloc() : memref<2x3xi32, 3>
return
}
}
@@ -86,8 +86,8 @@ module attributes {
}
{
func @two_allocs_vector() {
- %0 = memref.alloc() : memref<4xvector<4xf32>, 3>
- %1 = memref.alloc() : memref<2xvector<2xi32>, 3>
+ %0 = alloc() : memref<4xvector<4xf32>, 3>
+ %1 = alloc() : memref<2xvector<2xi32>, 3>
return
}
}
@@ -109,8 +109,8 @@ module attributes {
{
func @alloc_dealloc_dynamic_workgroup_mem(%arg0 : index) {
// expected-error @+2 {{unhandled allocation type}}
- // expected-error @+1 {{'memref.alloc' op operand #0 must be index}}
- %0 = memref.alloc(%arg0) : memref<4x?xf32, 3>
+ // expected-error @+1 {{'std.alloc' op operand #0 must be index}}
+ %0 = alloc(%arg0) : memref<4x?xf32, 3>
return
}
}
@@ -124,7 +124,7 @@ module attributes {
{
func @alloc_dealloc_mem() {
// expected-error @+1 {{unhandled allocation type}}
- %0 = memref.alloc() : memref<4x5xf32>
+ %0 = alloc() : memref<4x5xf32>
return
}
}
@@ -139,8 +139,8 @@ module attributes {
{
func @alloc_dealloc_dynamic_workgroup_mem(%arg0 : memref<4x?xf32, 3>) {
// expected-error @+2 {{unhandled deallocation type}}
- // expected-error @+1 {{'memref.dealloc' op operand #0 must be memref of any type values}}
- memref.dealloc %arg0 : memref<4x?xf32, 3>
+ // expected-error @+1 {{'std.dealloc' op operand #0 must be memref of any type values}}
+ dealloc %arg0 : memref<4x?xf32, 3>
return
}
}
@@ -155,7 +155,7 @@ module attributes {
func @alloc_dealloc_mem(%arg0 : memref<4x5xf32>) {
// expected-error @+2 {{unhandled deallocation type}}
// expected-error @+1 {{op operand #0 must be memref of any type values}}
- memref.dealloc %arg0 : memref<4x5xf32>
+ dealloc %arg0 : memref<4x5xf32>
return
}
}
diff --git a/mlir/test/Conversion/StandardToSPIRV/legalization.mlir b/mlir/test/Conversion/StandardToSPIRV/legalization.mlir
index c37303e5e789..c5c59613b56e 100644
--- a/mlir/test/Conversion/StandardToSPIRV/legalization.mlir
+++ b/mlir/test/Conversion/StandardToSPIRV/legalization.mlir
@@ -41,10 +41,10 @@ func @fold_static_stride_subview_with_store(%arg0 : memref<12x32xf32>, %arg1 : i
// CHECK: [[INDEX1:%.*]] = addi [[ARG1]], [[STRIDE1]] : index
// CHECK: [[STRIDE2:%.*]] = muli [[ARG4]], [[C3]] : index
// CHECK: [[INDEX2:%.*]] = addi [[ARG2]], [[STRIDE2]] : index
- // CHECK: memref.store [[ARG5]], [[ARG0]]{{\[}}[[INDEX1]], [[INDEX2]]{{\]}}
+ // CHECK: store [[ARG5]], [[ARG0]]{{\[}}[[INDEX1]], [[INDEX2]]{{\]}}
%0 = subview %arg0[%arg1, %arg2][4, 4][2, 3] :
memref<12x32xf32> to memref<4x4xf32, offset:?, strides: [64, 3]>
- memref.store %arg5, %0[%arg3, %arg4] : memref<4x4xf32, offset:?, strides: [64, 3]>
+ store %arg5, %0[%arg3, %arg4] : memref<4x4xf32, offset:?, strides: [64, 3]>
return
}
@@ -56,10 +56,10 @@ func @fold_dynamic_stride_subview_with_store(%arg0 : memref<12x32xf32>, %arg1 :
// CHECK: [[INDEX1:%.*]] = addi [[ARG1]], [[STRIDE1]] : index
// CHECK: [[STRIDE2:%.*]] = muli [[ARG4]], [[ARG6]] : index
// CHECK: [[INDEX2:%.*]] = addi [[ARG2]], [[STRIDE2]] : index
- // CHECK: memref.store [[ARG7]], [[ARG0]]{{\[}}[[INDEX1]], [[INDEX2]]{{\]}}
+ // CHECK: store [[ARG7]], [[ARG0]]{{\[}}[[INDEX1]], [[INDEX2]]{{\]}}
%0 = subview %arg0[%arg1, %arg2][4, 4][%arg5, %arg6] :
memref<12x32xf32> to memref<4x4xf32, offset:?, strides: [?, ?]>
- memref.store %arg7, %0[%arg3, %arg4] : memref<4x4xf32, offset:?, strides: [?, ?]>
+ store %arg7, %0[%arg3, %arg4] : memref<4x4xf32, offset:?, strides: [?, ?]>
return
}
diff --git a/mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir b/mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir
index 002f333d647e..6bb6d78d56af 100644
--- a/mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir
+++ b/mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir
@@ -882,7 +882,7 @@ func @load_store_zero_rank_float(%arg0: memref<f32>, %arg1: memref<f32>) {
// CHECK-SAME: [[ZERO2]], [[ZERO2]]
// CHECK-SAME: ] :
// CHECK: spv.Store "StorageBuffer" %{{.*}} : f32
- memref.store %0, %arg1[] : memref<f32>
+ store %0, %arg1[] : memref<f32>
return
}
@@ -901,7 +901,7 @@ func @load_store_zero_rank_int(%arg0: memref<i32>, %arg1: memref<i32>) {
// CHECK-SAME: [[ZERO2]], [[ZERO2]]
// CHECK-SAME: ] :
// CHECK: spv.Store "StorageBuffer" %{{.*}} : i32
- memref.store %0, %arg1[] : memref<i32>
+ store %0, %arg1[] : memref<i32>
return
}
@@ -1000,7 +1000,7 @@ func @store_i8(%arg0: memref<i8>, %value: i8) {
// CHECK: %[[PTR:.+]] = spv.AccessChain %[[ARG0]][%[[ZERO]], %[[ACCESS_IDX]]]
// CHECK: spv.AtomicAnd "Device" "AcquireRelease" %[[PTR]], %[[MASK]]
// CHECK: spv.AtomicOr "Device" "AcquireRelease" %[[PTR]], %[[STORE_VAL]]
- memref.store %value, %arg0[] : memref<i8>
+ store %value, %arg0[] : memref<i8>
return
}
@@ -1026,7 +1026,7 @@ func @store_i16(%arg0: memref<10xi16>, %index: index, %value: i16) {
// CHECK: %[[PTR:.+]] = spv.AccessChain %[[ARG0]][%[[ZERO]], %[[ACCESS_IDX]]]
// CHECK: spv.AtomicAnd "Device" "AcquireRelease" %[[PTR]], %[[MASK]]
// CHECK: spv.AtomicOr "Device" "AcquireRelease" %[[PTR]], %[[STORE_VAL]]
- memref.store %value, %arg0[%index] : memref<10xi16>
+ store %value, %arg0[%index] : memref<10xi16>
return
}
@@ -1035,7 +1035,7 @@ func @store_i32(%arg0: memref<i32>, %value: i32) {
// CHECK: spv.Store
// CHECK-NOT: spv.AtomicAnd
// CHECK-NOT: spv.AtomicOr
- memref.store %value, %arg0[] : memref<i32>
+ store %value, %arg0[] : memref<i32>
return
}
@@ -1044,7 +1044,7 @@ func @store_f32(%arg0: memref<f32>, %value: f32) {
// CHECK: spv.Store
// CHECK-NOT: spv.AtomicAnd
// CHECK-NOT: spv.AtomicOr
- memref.store %value, %arg0[] : memref<f32>
+ store %value, %arg0[] : memref<f32>
return
}
@@ -1108,7 +1108,7 @@ func @store_i8(%arg0: memref<i8>, %value: i8) {
// CHECK: %[[PTR:.+]] = spv.AccessChain %[[ARG0]][%[[ZERO]], %[[ACCESS_IDX]]]
// CHECK: spv.AtomicAnd "Device" "AcquireRelease" %[[PTR]], %[[MASK]]
// CHECK: spv.AtomicOr "Device" "AcquireRelease" %[[PTR]], %[[STORE_VAL]]
- memref.store %value, %arg0[] : memref<i8>
+ store %value, %arg0[] : memref<i8>
return
}
@@ -1117,7 +1117,7 @@ func @store_i16(%arg0: memref<10xi16>, %index: index, %value: i16) {
// CHECK: spv.Store
// CHECK-NOT: spv.AtomicAnd
// CHECK-NOT: spv.AtomicOr
- memref.store %value, %arg0[%index] : memref<10xi16>
+ store %value, %arg0[%index] : memref<10xi16>
return
}
diff --git a/mlir/test/Conversion/StandardToSPIRV/subview-to-spirv.mlir b/mlir/test/Conversion/StandardToSPIRV/subview-to-spirv.mlir
index 351f1736d53b..44ccda4396aa 100644
--- a/mlir/test/Conversion/StandardToSPIRV/subview-to-spirv.mlir
+++ b/mlir/test/Conversion/StandardToSPIRV/subview-to-spirv.mlir
@@ -27,11 +27,11 @@ func @fold_static_stride_subview
// CHECK: %[[T7:.*]] = addi %[[ARG1]], %[[T6]]
// CHECK: %[[T8:.*]] = muli %[[ARG4]], %[[ARG2]]
// CHECK: %[[T9:.*]] = addi %[[T8]], %[[C2]]
- // CHECK: memref.store %[[STOREVAL]], %[[ARG0]][%[[T7]], %[[T9]]]
+ // CHECK: store %[[STOREVAL]], %[[ARG0]][%[[T7]], %[[T9]]]
%0 = subview %arg0[%arg1, 2][4, 4][3, %arg2] : memref<12x32xf32> to memref<4x4xf32, offset:?, strides: [96, ?]>
%1 = load %0[%arg3, %arg4] : memref<4x4xf32, offset:?, strides: [96, ?]>
%2 = math.sqrt %1 : f32
- memref.store %2, %0[%arg3, %arg4] : memref<4x4xf32, offset:?, strides: [96, ?]>
+ store %2, %0[%arg3, %arg4] : memref<4x4xf32, offset:?, strides: [96, ?]>
return
}
diff --git a/mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir b/mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir
index f337fba2cbce..7f69638d749b 100644
--- a/mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir
+++ b/mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir
@@ -4,7 +4,7 @@
// CHECK-LABEL: func @materialize_read_1d() {
func @materialize_read_1d() {
%f0 = constant 0.0: f32
- %A = memref.alloc () : memref<7x42xf32>
+ %A = alloc () : memref<7x42xf32>
affine.for %i0 = 0 to 7 step 4 {
affine.for %i1 = 0 to 42 step 4 {
%f1 = vector.transfer_read %A[%i0, %i1], %f0 {permutation_map = affine_map<(d0, d1) -> (d0)>} : memref<7x42xf32>, vector<4xf32>
@@ -35,7 +35,7 @@ func @materialize_read_1d() {
// CHECK-LABEL: func @materialize_read_1d_partially_specialized
func @materialize_read_1d_partially_specialized(%dyn1 : index, %dyn2 : index, %dyn4 : index) {
%f0 = constant 0.0: f32
- %A = memref.alloc (%dyn1, %dyn2, %dyn4) : memref<7x?x?x42x?xf32>
+ %A = alloc (%dyn1, %dyn2, %dyn4) : memref<7x?x?x42x?xf32>
affine.for %i0 = 0 to 7 {
affine.for %i1 = 0 to %dyn1 {
affine.for %i2 = 0 to %dyn2 {
@@ -52,7 +52,7 @@ func @materialize_read_1d_partially_specialized(%dyn1 : index, %dyn2 : index, %d
}
}
}
- // CHECK: %[[tensor:[0-9]+]] = memref.alloc
+ // CHECK: %[[tensor:[0-9]+]] = alloc
// CHECK-NOT: {{.*}} dim %[[tensor]], %c0
// CHECK-NOT: {{.*}} dim %[[tensor]], %c3
return
@@ -65,13 +65,13 @@ func @materialize_read_1d_partially_specialized(%dyn1 : index, %dyn2 : index, %d
// 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:.*]] = memref.alloca() : memref<5x4xvector<3xf32>>
+ // 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
// CHECK-DAG: %[[C4:.*]] = constant 4 : index
// CHECK-DAG: %[[C5:.*]] = constant 5 : index
- // CHECK: %{{.*}} = memref.alloc(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : memref<?x?x?x?xf32>
+ // CHECK: %{{.*}} = alloc(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : memref<?x?x?x?xf32>
// CHECK-NEXT: affine.for %[[I0:.*]] = 0 to %{{.*}} step 3 {
// CHECK-NEXT: affine.for %[[I1:.*]] = 0 to %{{.*}} {
// CHECK-NEXT: affine.for %[[I2:.*]] = 0 to %{{.*}} {
@@ -107,7 +107,7 @@ func @materialize_read(%M: index, %N: index, %O: index, %P: index) {
// Check that I0 + I4 (of size 3) read from first index load(L0, ...) and write into last index store(..., I4)
// Check that I3 + I6 (of size 5) read from last index load(..., L3) and write into first index store(I6, ...)
// Other dimensions are just accessed with I1, I2 resp.
- %A = memref.alloc (%M, %N, %O, %P) : memref<?x?x?x?xf32, 0>
+ %A = alloc (%M, %N, %O, %P) : memref<?x?x?x?xf32, 0>
affine.for %i0 = 0 to %M step 3 {
affine.for %i1 = 0 to %N {
affine.for %i2 = 0 to %O {
@@ -129,14 +129,14 @@ func @materialize_read(%M: index, %N: index, %O: index, %P: index) {
// CHECK-LABEL:func @materialize_write(%{{.*}}: index, %{{.*}}: index, %{{.*}}: index, %{{.*}}: index) {
func @materialize_write(%M: index, %N: index, %O: index, %P: index) {
- // CHECK-DAG: %[[ALLOC:.*]] = memref.alloca() : memref<5x4xvector<3xf32>>
+ // 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
// CHECK-DAG: %[[C3:.*]] = constant 3 : index
// CHECK-DAG: %[[C4:.*]] = constant 4 : index
// CHECK-DAG: %[[C5:.*]] = constant 5 : index
- // CHECK: %{{.*}} = memref.alloc(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : memref<?x?x?x?xf32>
+ // CHECK: %{{.*}} = alloc(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : memref<?x?x?x?xf32>
// CHECK-NEXT: affine.for %[[I0:.*]] = 0 to %{{.*}} step 3 {
// CHECK-NEXT: affine.for %[[I1:.*]] = 0 to %{{.*}} step 4 {
// CHECK-NEXT: affine.for %[[I2:.*]] = 0 to %{{.*}} {
@@ -169,7 +169,7 @@ func @materialize_write(%M: index, %N: index, %O: index, %P: index) {
// Check that I1 + I5 (of size 4) read from second index load(..., I5, ...) and write into second index store(..., S1, ...)
// Check that I3 + I6 (of size 5) read from first index load(I6, ...) and write into last index store(..., S3)
// Other dimension is just accessed with I2.
- %A = memref.alloc (%M, %N, %O, %P) : memref<?x?x?x?xf32, 0>
+ %A = alloc (%M, %N, %O, %P) : memref<?x?x?x?xf32, 0>
%f1 = constant dense<1.000000e+00> : vector<5x4x3xf32>
affine.for %i0 = 0 to %M step 3 {
affine.for %i1 = 0 to %N step 4 {
@@ -204,7 +204,7 @@ func @transfer_read_progressive(%A : memref<?x?xf32>, %base: index) -> vector<3x
%f7 = constant 7.0: f32
// CHECK-DAG: %[[splat:.*]] = constant dense<7.000000e+00> : vector<15xf32>
- // CHECK-DAG: %[[alloc:.*]] = memref.alloca() : memref<3xvector<15xf32>>
+ // CHECK-DAG: %[[alloc:.*]] = alloca() : memref<3xvector<15xf32>>
// CHECK-DAG: %[[C0:.*]] = constant 0 : index
// CHECK-DAG: %[[dim:.*]] = dim %[[A]], %[[C0]] : memref<?x?xf32>
// CHECK: affine.for %[[I:.*]] = 0 to 3 {
@@ -277,7 +277,7 @@ func @transfer_read_progressive(%A : memref<?x?xf32>, %base: index) -> vector<3x
// FULL-UNROLL-SAME: %[[vec:[a-zA-Z0-9]+]]: vector<3x15xf32>
func @transfer_write_progressive(%A : memref<?x?xf32>, %base: index, %vec: vector<3x15xf32>) {
// CHECK: %[[C0:.*]] = constant 0 : index
- // CHECK: %[[alloc:.*]] = memref.alloca() : memref<3xvector<15xf32>>
+ // CHECK: %[[alloc:.*]] = alloca() : memref<3xvector<15xf32>>
// CHECK: %[[vmemref:.*]] = vector.type_cast %[[alloc]] : memref<3xvector<15xf32>> to memref<vector<3x15xf32>>
// CHECK: store %[[vec]], %[[vmemref]][] : memref<vector<3x15xf32>>
// CHECK: %[[dim:.*]] = dim %[[A]], %[[C0]] : memref<?x?xf32>
@@ -331,7 +331,7 @@ func @transfer_write_progressive(%A : memref<?x?xf32>, %base: index, %vec: vecto
// FULL-UNROLL-SAME: %[[vec:[a-zA-Z0-9]+]]: vector<3x15xf32>
func @transfer_write_progressive_unmasked(%A : memref<?x?xf32>, %base: index, %vec: vector<3x15xf32>) {
// CHECK-NOT: scf.if
- // CHECK-NEXT: %[[alloc:.*]] = memref.alloca() : memref<3xvector<15xf32>>
+ // CHECK-NEXT: %[[alloc:.*]] = alloca() : memref<3xvector<15xf32>>
// CHECK-NEXT: %[[vmemref:.*]] = vector.type_cast %[[alloc]] : memref<3xvector<15xf32>> to memref<vector<3x15xf32>>
// CHECK-NEXT: store %[[vec]], %[[vmemref]][] : memref<vector<3x15xf32>>
// CHECK-NEXT: affine.for %[[I:.*]] = 0 to 3 {
@@ -384,7 +384,7 @@ func @transfer_read_minor_identity(%A : memref<?x?x?x?xf32>) -> vector<3x3xf32>
// CHECK: %[[cst:.*]] = constant 0.000000e+00 : f32
// CHECK: %[[c2:.*]] = constant 2 : index
// CHECK: %[[cst0:.*]] = constant dense<0.000000e+00> : vector<3xf32>
-// CHECK: %[[m:.*]] = memref.alloca() : memref<3xvector<3xf32>>
+// CHECK: %[[m:.*]] = alloca() : memref<3xvector<3xf32>>
// CHECK: %[[d:.*]] = dim %[[A]], %[[c2]] : memref<?x?x?x?xf32>
// CHECK: affine.for %[[arg1:.*]] = 0 to 3 {
// CHECK: %[[cmp:.*]] = cmpi slt, %[[arg1]], %[[d]] : index
@@ -413,7 +413,7 @@ func @transfer_write_minor_identity(%A : vector<3x3xf32>, %B : memref<?x?x?x?xf3
// CHECK-SAME: %[[B:.*]]: memref<?x?x?x?xf32>)
// CHECK: %[[c0:.*]] = constant 0 : index
// CHECK: %[[c2:.*]] = constant 2 : index
-// CHECK: %[[m:.*]] = memref.alloca() : memref<3xvector<3xf32>>
+// CHECK: %[[m:.*]] = alloca() : memref<3xvector<3xf32>>
// CHECK: %[[cast:.*]] = vector.type_cast %[[m]] : memref<3xvector<3xf32>> to memref<vector<3x3xf32>>
// CHECK: store %[[A]], %[[cast]][] : memref<vector<3x3xf32>>
// CHECK: %[[d:.*]] = dim %[[B]], %[[c2]] : memref<?x?x?x?xf32>
diff --git a/mlir/test/Dialect/Affine/SuperVectorize/vector_utils.mlir b/mlir/test/Dialect/Affine/SuperVectorize/vector_utils.mlir
index edbf37323cff..ef8e2831a848 100644
--- a/mlir/test/Dialect/Affine/SuperVectorize/vector_utils.mlir
+++ b/mlir/test/Dialect/Affine/SuperVectorize/vector_utils.mlir
@@ -4,12 +4,12 @@
func @vector_add_2d(%arg0: index, %arg1: index) -> f32 {
// Nothing should be matched in this first block.
- // CHECK-NOT:matched: {{.*}} = memref.alloc{{.*}}
+ // CHECK-NOT:matched: {{.*}} = alloc{{.*}}
// CHECK-NOT:matched: {{.*}} = constant 0{{.*}}
// CHECK-NOT:matched: {{.*}} = constant 1{{.*}}
- %0 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
- %1 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
- %2 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
+ %0 = alloc(%arg0, %arg1) : memref<?x?xf32>
+ %1 = alloc(%arg0, %arg1) : memref<?x?xf32>
+ %2 = alloc(%arg0, %arg1) : memref<?x?xf32>
%c0 = constant 0 : index
%cst = constant 1.000000e+00 : f32
diff --git a/mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir
index 2b937c93b330..86749e2c7bab 100644
--- a/mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir
+++ b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir
@@ -92,9 +92,9 @@ func @vec1d_3(%A : memref<?x?xf32>, %B : memref<?x?x?xf32>) {
// CHECK-LABEL: func @vector_add_2d
func @vector_add_2d(%M : index, %N : index) -> f32 {
- %A = memref.alloc (%M, %N) : memref<?x?xf32, 0>
- %B = memref.alloc (%M, %N) : memref<?x?xf32, 0>
- %C = memref.alloc (%M, %N) : memref<?x?xf32, 0>
+ %A = alloc (%M, %N) : memref<?x?xf32, 0>
+ %B = alloc (%M, %N) : memref<?x?xf32, 0>
+ %C = alloc (%M, %N) : memref<?x?xf32, 0>
%f1 = constant 1.0 : f32
%f2 = constant 2.0 : f32
affine.for %i0 = 0 to %M {
@@ -309,7 +309,7 @@ func @vec_rejected_7(%A : memref<?x?xf32>, %B : memref<?x?x?xf32>) {
// CHECK: affine.for %{{.*}}{{[0-9]*}} = 0 to %{{[0-9]*}} {
affine.for %i16 = 0 to %M { // not vectorized, can't vectorize a vector load
- %a16 = memref.alloc(%M) : memref<?xvector<2xf32>>
+ %a16 = alloc(%M) : memref<?xvector<2xf32>>
%l16 = affine.load %a16[%i16] : memref<?xvector<2xf32>>
}
return
diff --git a/mlir/test/Dialect/Affine/SuperVectorize/vectorize_2d.mlir b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_2d.mlir
index fe23c6e13562..86208ff24caf 100644
--- a/mlir/test/Dialect/Affine/SuperVectorize/vectorize_2d.mlir
+++ b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_2d.mlir
@@ -47,9 +47,9 @@ func @vec2d(%A : memref<?x?x?xf32>) {
}
func @vector_add_2d(%M : index, %N : index) -> f32 {
- %A = memref.alloc (%M, %N) : memref<?x?xf32, 0>
- %B = memref.alloc (%M, %N) : memref<?x?xf32, 0>
- %C = memref.alloc (%M, %N) : memref<?x?xf32, 0>
+ %A = alloc (%M, %N) : memref<?x?xf32, 0>
+ %B = alloc (%M, %N) : memref<?x?xf32, 0>
+ %C = alloc (%M, %N) : memref<?x?xf32, 0>
%f1 = constant 1.0 : f32
%f2 = constant 2.0 : f32
affine.for %i0 = 0 to %M {
diff --git a/mlir/test/Dialect/Affine/affine-data-copy.mlir b/mlir/test/Dialect/Affine/affine-data-copy.mlir
index 11288784a4e9..697196561b15 100644
--- a/mlir/test/Dialect/Affine/affine-data-copy.mlir
+++ b/mlir/test/Dialect/Affine/affine-data-copy.mlir
@@ -49,7 +49,7 @@ func @matmul(%A: memref<4096x4096xf32>, %B: memref<4096x4096xf32>, %C: memref<40
// CHECK: affine.for %[[I:.*]] = 0 to 4096 step 128 {
// CHECK: affine.for %[[J:.*]] = 0 to 4096 step 128 {
-// CHECK: [[BUFC:%[0-9]+]] = memref.alloc() : memref<128x128xf32>
+// CHECK: [[BUFC:%[0-9]+]] = alloc() : memref<128x128xf32>
// The result matrix's copy gets hoisted out.
// Result matrix copy-in.
// CHECK: affine.for %[[II:.*]] = #[[$MAP_IDENTITY]](%{{.*}}) to #[[$MAP_PLUS_128]](%{{.*}}) {
@@ -61,7 +61,7 @@ func @matmul(%A: memref<4096x4096xf32>, %B: memref<4096x4096xf32>, %C: memref<40
// LHS matrix copy-in.
// CHECK: affine.for %[[K:.*]] = 0 to 4096 step 128 {
-// CHECK: [[BUFA:%[0-9]+]] = memref.alloc() : memref<128x128xf32>
+// CHECK: [[BUFA:%[0-9]+]] = alloc() : memref<128x128xf32>
// CHECK: affine.for %[[II:.*]] = #[[$MAP_IDENTITY]](%{{.*}}) to #[[$MAP_PLUS_128]](%{{.*}}) {
// CHECK: affine.for %[[KK:.*]] = #[[$MAP_IDENTITY]](%{{.*}}) to #[[$MAP_PLUS_128]](%{{.*}}) {
// CHECK: affine.load %{{.*}}[%{{.*}}, %{{.*}}] : memref<4096x4096xf32>
@@ -70,7 +70,7 @@ func @matmul(%A: memref<4096x4096xf32>, %B: memref<4096x4096xf32>, %C: memref<40
// CHECK: }
// RHS matrix copy-in.
-// CHECK: [[BUFB:%[0-9]+]] = memref.alloc() : memref<128x128xf32>
+// CHECK: [[BUFB:%[0-9]+]] = alloc() : memref<128x128xf32>
// CHECK: affine.for %[[KK:.*]] = #[[$MAP_IDENTITY]](%{{.*}}) to #[[$MAP_PLUS_128]](%{{.*}}) {
// CHECK: affine.for %[[JJ:.*]] = #[[$MAP_IDENTITY]](%{{.*}}) to #[[$MAP_PLUS_128]](%{{.*}}) {
// CHECK: affine.load %{{.*}}[%{{.*}}, %{{.*}}] : memref<4096x4096xf32>
@@ -91,8 +91,8 @@ func @matmul(%A: memref<4096x4096xf32>, %B: memref<4096x4096xf32>, %C: memref<40
// CHECK: }
// CHECK: }
// CHECK: }
-// CHECK: memref.dealloc [[BUFB]] : memref<128x128xf32>
-// CHECK: memref.dealloc [[BUFA]] : memref<128x128xf32>
+// CHECK: dealloc [[BUFB]] : memref<128x128xf32>
+// CHECK: dealloc [[BUFA]] : memref<128x128xf32>
// CHECK: }
// Result matrix copy out.
@@ -102,15 +102,15 @@ func @matmul(%A: memref<4096x4096xf32>, %B: memref<4096x4096xf32>, %C: memref<40
// CHECK: store %{{.*}}, %{{.*}}[%{{.*}}, %{{.*}}] : memref<4096x4096xf32>
// CHECK: }
// CHECK: }
-// CHECK: memref.dealloc [[BUFC]] : memref<128x128xf32>
+// CHECK: dealloc [[BUFC]] : memref<128x128xf32>
// CHECK: }
// CHECK: }
// Check that only one memref is copied when memref filter is used.
// FILTER: affine.for %{{.*}} = 0 to 4096 step 128 {
-// FILTER: memref.alloc() : memref<128x4096xf32>
-// FILTER-NOT: memref.alloc()
+// FILTER: alloc() : memref<128x4096xf32>
+// FILTER-NOT: alloc()
// FILTER: affine.for
// FILTER: affine.for %{{.*}} = 0 to 4096 {
// FILTER: affine.for %{{.*}} = 0 to 4096 step 128 {
@@ -118,8 +118,8 @@ func @matmul(%A: memref<4096x4096xf32>, %B: memref<4096x4096xf32>, %C: memref<40
// FILTER-NEXT: affine.for %{{.*}} = #map{{.*}}(%{{.*}}) to #map{{.*}}(%{{.*}}) {
// FILTER-NEXT: affine.for %{{.*}} = #map{{.*}}(%{{.*}}) to #map{{.*}}(%{{.*}}) {
// FILTER-NEXT: affine.for %{{.*}} = #map{{.*}}(%{{.*}}) to #map{{.*}}(%{{.*}}) {
-// FILTER: memref.dealloc %{{.*}} : memref<128x4096xf32>
-// FILTER-NOT: memref.dealloc %{{.*}} : memref<128x4096xf32>
+// FILTER: dealloc %{{.*}} : memref<128x4096xf32>
+// FILTER-NOT: dealloc %{{.*}} : memref<128x4096xf32>
// -----
@@ -145,43 +145,43 @@ func @single_elt_buffers(%arg0: memref<1024x1024xf32>, %arg1: memref<1024x1024xf
}
// CHECK-SMALL: affine.for %arg{{.*}} = 0 to 1024 {
// CHECK-SMALL: affine.for %arg{{.*}} = 0 to 1024 {
-// CHECK-SMALL: memref.alloc() : memref<1x1xf32>
+// CHECK-SMALL: alloc() : memref<1x1xf32>
// CHECK-SMALL: affine.load %arg{{.*}}[%{{.*}}, %{{.*}}] : memref<1024x1024xf32>
// CHECK-SMALL: affine.store %{{.*}}, %{{.*}}[0, 0] : memref<1x1xf32>
// CHECK-SMALL: affine.for %arg{{.*}} = 0 to 1024 {
-// CHECK-SMALL: memref.alloc() : memref<1x1xf32>
+// CHECK-SMALL: alloc() : memref<1x1xf32>
// CHECK-SMALL: affine.load %arg{{.*}}[%{{.*}}, %{{.*}}] : memref<1024x1024xf32>
// CHECK-SMALL: affine.store %{{.*}}, %{{.*}}[0, 0] : memref<1x1xf32>
// CHECK-SMALL: affine.load %{{.*}}[0, 0] : memref<1x1xf32>
// CHECK-SMALL: affine.load %{{.*}}[0, 0] : memref<1x1xf32>
// CHECK-SMALL: addf %{{.*}}, %{{.*}} : f32
// CHECK-SMALL: affine.store %{{.*}}, %{{.*}}[0, 0] : memref<1x1xf32>
-// CHECK-SMALL: memref.dealloc %{{.*}} : memref<1x1xf32>
+// CHECK-SMALL: dealloc %{{.*}} : memref<1x1xf32>
// CHECK-SMALL: }
// CHECK-SMALL: affine.load %{{.*}}[0, 0] : memref<1x1xf32>
// CHECK-SMALL: affine.store %{{.*}}, %arg{{.*}}[%{{.*}}, %{{.*}}] : memref<1024x1024xf32>
-// CHECK-SMALL: memref.dealloc %{{.*}} : memref<1x1xf32>
+// CHECK-SMALL: dealloc %{{.*}} : memref<1x1xf32>
// CHECK-SMALL: }
// CHECK-SMALL: }
// CHECK-SMALL: return
// Check that only one memref is copied when memref filter is used.
-// FILTER: memref.alloc() : memref<1024x1024xf32>
-// FILTER-NOT: memref.alloc()
+// FILTER: alloc() : memref<1024x1024xf32>
+// FILTER-NOT: alloc()
// FILTER: affine.for %{{.*}} = 0 to 1024 {
// FILTER: affine.for %{{.*}} = 0 to 1024 {
// FILTER: affine.for %{{.*}} = 0 to 1024 {
// FILTER-NEXT: affine.for %{{.*}} = 0 to 1024 {
// FILTER-NEXT: affine.for %{{.*}} = 0 to 1024 {
-// FILTER: memref.dealloc %{{.*}} : memref<1024x1024xf32>
-// FILTER-NOT: memref.dealloc
+// FILTER: dealloc %{{.*}} : memref<1024x1024xf32>
+// FILTER-NOT: dealloc
// FILTER: return
// CHeck that only one memref is copied, because for-memref-region is enabled
// (and the first ever encountered load is analyzed).
-// MEMREF_REGION: memref.alloc() : memref<1024x1024xf32>
-// MEMREF_REGION-NOT: memref.alloc()
+// MEMREF_REGION: alloc() : memref<1024x1024xf32>
+// MEMREF_REGION-NOT: alloc()
// MEMREF_REGION: affine.for %{{.*}} = 0 to 1024 {
// MEMREF_REGION: affine.for %{{.*}} = 0 to 1024 {
// MEMREF_REGION: }
@@ -189,8 +189,8 @@ func @single_elt_buffers(%arg0: memref<1024x1024xf32>, %arg1: memref<1024x1024xf
// MEMREF_REGION-NEXT: affine.for %{{.*}} = 0 to 1024 {
// MEMREF_REGION-NEXT: affine.for %{{.*}} = 0 to 1024 {
// MEMREF_REGION-NEXT: affine.for %{{.*}} = 0 to 1024 {
-// MEMREF_REGION: memref.dealloc %{{.*}} : memref<1024x1024xf32>
-// MEMREF_REGION-NOT: memref.dealloc
+// MEMREF_REGION: dealloc %{{.*}} : memref<1024x1024xf32>
+// MEMREF_REGION-NOT: dealloc
// MEMREF_REGION-NEXT: return
// -----
@@ -216,7 +216,7 @@ func @min_upper_bound(%A: memref<4096xf32>) -> memref<4096xf32> {
return %A : memref<4096xf32>
}
// CHECK: affine.for %[[IV1:.*]] = 0 to 4096 step 100
-// CHECK: %[[BUF:.*]] = memref.alloc() : memref<100xf32>
+// CHECK: %[[BUF:.*]] = alloc() : memref<100xf32>
// CHECK-NEXT: affine.for %[[IV2:.*]] = #[[$MAP_IDENTITY]](%[[IV1]]) to min #[[$MAP_MIN_UB1]](%[[IV1]]) {
// CHECK-NEXT: affine.load %{{.*}}[%[[IV2]]] : memref<4096xf32>
// CHECK-NEXT: affine.store %{{.*}}, %[[BUF]][%[[IV2]] - %[[IV1]]] : memref<100xf32>
@@ -230,7 +230,7 @@ func @min_upper_bound(%A: memref<4096xf32>) -> memref<4096xf32> {
// CHECK-NEXT: affine.load %[[BUF]][%[[IV2]] - %[[IV1]]] : memref<100xf32>
// CHECK-NEXT: affine.store %{{.*}}, %{{.*}}[%[[IV2]]] : memref<4096xf32>
// CHECK-NEXT: }
-// CHECK-NEXT: memref.dealloc %[[BUF]] : memref<100xf32>
+// CHECK-NEXT: dealloc %[[BUF]] : memref<100xf32>
// CHECK-NEXT: }
// -----
@@ -257,7 +257,7 @@ func @max_lower_bound(%M: memref<2048x516xf64>, %i : index, %j : index) {
return
}
-// CHECK: %[[BUF:.*]] = memref.alloc() : memref<2048x6xf64>
+// CHECK: %[[BUF:.*]] = alloc() : memref<2048x6xf64>
// CHECK-NEXT: affine.for %[[ii:.*]] = 0 to 2048 {
// CHECK-NEXT: affine.for %[[jj:.*]] = max #[[$LB]]()[%[[i]], %[[j]]] to min #[[$UB]]()[%[[i]], %[[j]]] {
// CHECK-NEXT: affine.load %{{.*}}[%[[ii]], %[[jj]]] : memref<2048x516xf64>
@@ -269,4 +269,4 @@ func @max_lower_bound(%M: memref<2048x516xf64>, %i : index, %j : index) {
// CHECK-NEXT: affine.load %[[BUF]][%[[ii_]], %[[jj_]] - symbol(%[[j]]) * 6] : memref<2048x6xf64>
// CHECK-NEXT: }
// CHECK-NEXT: }
-// CHECK-NEXT: memref.dealloc %[[BUF]] : memref<2048x6xf64>
+// CHECK-NEXT: dealloc %[[BUF]] : memref<2048x6xf64>
diff --git a/mlir/test/Dialect/Affine/affine-loop-invariant-code-motion.mlir b/mlir/test/Dialect/Affine/affine-loop-invariant-code-motion.mlir
index 0b8c036bbc29..0c7a5fa06407 100644
--- a/mlir/test/Dialect/Affine/affine-loop-invariant-code-motion.mlir
+++ b/mlir/test/Dialect/Affine/affine-loop-invariant-code-motion.mlir
@@ -1,7 +1,7 @@
// RUN: mlir-opt %s -affine-loop-invariant-code-motion -split-input-file | FileCheck %s
func @nested_loops_both_having_invariant_code() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
%cf8 = constant 8.0 : f32
@@ -12,7 +12,7 @@ func @nested_loops_both_having_invariant_code() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 7.000000e+00 : f32
// CHECK-NEXT: %cst_0 = constant 8.000000e+00 : f32
// CHECK-NEXT: %1 = addf %cst, %cst_0 : f32
@@ -29,14 +29,14 @@ func @nested_loops_both_having_invariant_code() {
// CHECK-LABEL: func @store_affine_apply
func @store_affine_apply() -> memref<10xf32> {
%cf7 = constant 7.0 : f32
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
affine.for %arg0 = 0 to 10 {
%t0 = affine.apply affine_map<(d1) -> (d1 + 1)>(%arg0)
affine.store %cf7, %m[%t0] : memref<10xf32>
}
return %m : memref<10xf32>
// CHECK: %cst = constant 7.000000e+00 : f32
-// CHECK-NEXT: %0 = memref.alloc() : memref<10xf32>
+// CHECK-NEXT: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: %1 = affine.apply #map{{[0-9]*}}(%arg0)
// CHECK-NEXT: affine.store %cst, %0[%1] : memref<10xf32>
@@ -47,7 +47,7 @@ func @store_affine_apply() -> memref<10xf32> {
// -----
func @nested_loops_code_invariant_to_both() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
%cf8 = constant 8.0 : f32
@@ -57,7 +57,7 @@ func @nested_loops_code_invariant_to_both() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 7.000000e+00 : f32
// CHECK-NEXT: %cst_0 = constant 8.000000e+00 : f32
// CHECK-NEXT: %1 = addf %cst, %cst_0 : f32
@@ -68,8 +68,8 @@ func @nested_loops_code_invariant_to_both() {
// -----
func @single_loop_nothing_invariant() {
- %m1 = memref.alloc() : memref<10xf32>
- %m2 = memref.alloc() : memref<10xf32>
+ %m1 = alloc() : memref<10xf32>
+ %m2 = alloc() : memref<10xf32>
affine.for %arg0 = 0 to 10 {
%v0 = affine.load %m1[%arg0] : memref<10xf32>
%v1 = affine.load %m2[%arg0] : memref<10xf32>
@@ -77,8 +77,8 @@ func @single_loop_nothing_invariant() {
affine.store %v2, %m1[%arg0] : memref<10xf32>
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
- // CHECK-NEXT: %1 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
+ // CHECK-NEXT: %1 = alloc() : memref<10xf32>
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: %2 = affine.load %0[%arg0] : memref<10xf32>
// CHECK-NEXT: %3 = affine.load %1[%arg0] : memref<10xf32>
@@ -91,7 +91,7 @@ func @single_loop_nothing_invariant() {
// -----
func @invariant_code_inside_affine_if() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf8 = constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
@@ -103,7 +103,7 @@ func @invariant_code_inside_affine_if() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: %1 = affine.apply #map{{[0-9]*}}(%arg0)
@@ -119,7 +119,7 @@ func @invariant_code_inside_affine_if() {
// -----
func @dependent_stores() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
%cf8 = constant 8.0 : f32
@@ -132,7 +132,7 @@ func @dependent_stores() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 7.000000e+00 : f32
// CHECK-NEXT: %cst_0 = constant 8.000000e+00 : f32
// CHECK-NEXT: %1 = addf %cst, %cst_0 : f32
@@ -149,7 +149,7 @@ func @dependent_stores() {
// -----
func @independent_stores() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
%cf8 = constant 8.0 : f32
@@ -162,7 +162,7 @@ func @independent_stores() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 7.000000e+00 : f32
// CHECK-NEXT: %cst_0 = constant 8.000000e+00 : f32
// CHECK-NEXT: %1 = addf %cst, %cst_0 : f32
@@ -179,7 +179,7 @@ func @independent_stores() {
// -----
func @load_dependent_store() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
%cf8 = constant 8.0 : f32
@@ -192,7 +192,7 @@ func @load_dependent_store() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 7.000000e+00 : f32
// CHECK-NEXT: %cst_0 = constant 8.000000e+00 : f32
// CHECK-NEXT: %1 = addf %cst, %cst_0 : f32
@@ -208,7 +208,7 @@ func @load_dependent_store() {
// -----
func @load_after_load() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
%cf8 = constant 8.0 : f32
@@ -221,7 +221,7 @@ func @load_after_load() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 7.000000e+00 : f32
// CHECK-NEXT: %cst_0 = constant 8.000000e+00 : f32
// CHECK-NEXT: %1 = addf %cst, %cst_0 : f32
@@ -237,7 +237,7 @@ func @load_after_load() {
// -----
func @invariant_affine_if() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf8 = constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
affine.for %arg1 = 0 to 10 {
@@ -249,7 +249,7 @@ func @invariant_affine_if() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: affine.if #set(%arg0, %arg0) {
@@ -264,7 +264,7 @@ func @invariant_affine_if() {
// -----
func @invariant_affine_if2() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf8 = constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
affine.for %arg1 = 0 to 10 {
@@ -276,7 +276,7 @@ func @invariant_affine_if2() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: affine.for %arg1 = 0 to 10 {
@@ -293,7 +293,7 @@ func @invariant_affine_if2() {
// -----
func @invariant_affine_nested_if() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf8 = constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
affine.for %arg1 = 0 to 10 {
@@ -307,7 +307,7 @@ func @invariant_affine_nested_if() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: affine.for %arg1 = 0 to 10 {
@@ -327,7 +327,7 @@ func @invariant_affine_nested_if() {
// -----
func @invariant_affine_nested_if_else() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf8 = constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
affine.for %arg1 = 0 to 10 {
@@ -343,7 +343,7 @@ func @invariant_affine_nested_if_else() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: affine.for %arg1 = 0 to 10 {
@@ -365,8 +365,8 @@ func @invariant_affine_nested_if_else() {
// -----
func @invariant_affine_nested_if_else2() {
- %m = memref.alloc() : memref<10xf32>
- %m2 = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
+ %m2 = alloc() : memref<10xf32>
%cf8 = constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
affine.for %arg1 = 0 to 10 {
@@ -382,8 +382,8 @@ func @invariant_affine_nested_if_else2() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
- // CHECK-NEXT: %1 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
+ // CHECK-NEXT: %1 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: affine.if #set(%arg0, %arg0) {
@@ -403,7 +403,7 @@ func @invariant_affine_nested_if_else2() {
// -----
func @invariant_affine_nested_if2() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf8 = constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
affine.for %arg1 = 0 to 10 {
@@ -417,7 +417,7 @@ func @invariant_affine_nested_if2() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: affine.if #set(%arg0, %arg0) {
@@ -435,7 +435,7 @@ func @invariant_affine_nested_if2() {
// -----
func @invariant_affine_for_inside_affine_if() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf8 = constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
affine.for %arg1 = 0 to 10 {
@@ -449,7 +449,7 @@ func @invariant_affine_for_inside_affine_if() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: affine.for %arg1 = 0 to 10 {
@@ -469,16 +469,16 @@ func @invariant_affine_for_inside_affine_if() {
// -----
func @invariant_constant_and_load() {
- %m = memref.alloc() : memref<100xf32>
- %m2 = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
+ %m2 = alloc() : memref<100xf32>
affine.for %arg0 = 0 to 5 {
%c0 = constant 0 : index
%v = affine.load %m2[%c0] : memref<100xf32>
affine.store %v, %m[%arg0] : memref<100xf32>
}
- // CHECK: %0 = memref.alloc() : memref<100xf32>
- // CHECK-NEXT: %1 = memref.alloc() : memref<100xf32>
+ // CHECK: %0 = alloc() : memref<100xf32>
+ // CHECK-NEXT: %1 = alloc() : memref<100xf32>
// CHECK-NEXT: %c0 = constant 0 : index
// CHECK-NEXT: %2 = affine.load %1[%c0] : memref<100xf32>
// CHECK-NEXT: affine.for %arg0 = 0 to 5 {
@@ -491,7 +491,7 @@ func @invariant_constant_and_load() {
// -----
func @nested_load_store_same_memref() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cst = constant 8.0 : f32
%c0 = constant 0 : index
affine.for %arg0 = 0 to 10 {
@@ -501,7 +501,7 @@ func @nested_load_store_same_memref() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: %c0 = constant 0 : index
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
@@ -516,7 +516,7 @@ func @nested_load_store_same_memref() {
// -----
func @nested_load_store_same_memref2() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cst = constant 8.0 : f32
%c0 = constant 0 : index
affine.for %arg0 = 0 to 10 {
@@ -526,7 +526,7 @@ func @nested_load_store_same_memref2() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: %c0 = constant 0 : index
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
@@ -541,7 +541,7 @@ func @nested_load_store_same_memref2() {
// CHECK-LABEL: func @do_not_hoist_dependent_side_effect_free_op
func @do_not_hoist_dependent_side_effect_free_op(%arg0: memref<10x512xf32>) {
- %0 = memref.alloca() : memref<1xf32>
+ %0 = alloca() : memref<1xf32>
%cst = constant 8.0 : f32
affine.for %i = 0 to 512 {
affine.for %j = 0 to 10 {
@@ -571,8 +571,8 @@ func @do_not_hoist_dependent_side_effect_free_op(%arg0: memref<10x512xf32>) {
// CHECK-LABEL: func @vector_loop_nothing_invariant
func @vector_loop_nothing_invariant() {
- %m1 = memref.alloc() : memref<40xf32>
- %m2 = memref.alloc() : memref<40xf32>
+ %m1 = alloc() : memref<40xf32>
+ %m2 = alloc() : memref<40xf32>
affine.for %arg0 = 0 to 10 {
%v0 = affine.vector_load %m1[%arg0*4] : memref<40xf32>, vector<4xf32>
%v1 = affine.vector_load %m2[%arg0*4] : memref<40xf32>, vector<4xf32>
@@ -593,9 +593,9 @@ func @vector_loop_nothing_invariant() {
// CHECK-LABEL: func @vector_loop_all_invariant
func @vector_loop_all_invariant() {
- %m1 = memref.alloc() : memref<4xf32>
- %m2 = memref.alloc() : memref<4xf32>
- %m3 = memref.alloc() : memref<4xf32>
+ %m1 = alloc() : memref<4xf32>
+ %m2 = alloc() : memref<4xf32>
+ %m3 = alloc() : memref<4xf32>
affine.for %arg0 = 0 to 10 {
%v0 = affine.vector_load %m1[0] : memref<4xf32>, vector<4xf32>
%v1 = affine.vector_load %m2[0] : memref<4xf32>, vector<4xf32>
@@ -605,9 +605,9 @@ func @vector_loop_all_invariant() {
return
}
-// CHECK: memref.alloc()
-// CHECK-NEXT: memref.alloc()
-// CHECK-NEXT: memref.alloc()
+// CHECK: alloc()
+// CHECK-NEXT: alloc()
+// CHECK-NEXT: alloc()
// CHECK-NEXT: affine.vector_load
// CHECK-NEXT: affine.vector_load
// CHECK-NEXT: addf
diff --git a/mlir/test/Dialect/Affine/affine-loop-normalize.mlir b/mlir/test/Dialect/Affine/affine-loop-normalize.mlir
index 0a64ad525359..e8ad3ed6aae5 100644
--- a/mlir/test/Dialect/Affine/affine-loop-normalize.mlir
+++ b/mlir/test/Dialect/Affine/affine-loop-normalize.mlir
@@ -9,7 +9,7 @@
// CHECK-LABEL: func @normalize_parallel()
func @normalize_parallel() {
%cst = constant 1.0 : f32
- %0 = memref.alloc() : memref<2x4xf32>
+ %0 = alloc() : memref<2x4xf32>
// CHECK: affine.parallel (%[[i0:.*]], %[[j0:.*]]) = (0, 0) to (4, 2)
affine.parallel (%i, %j) = (0, 1) to (10, 5) step (3, 2) {
// CHECK: %[[i1:.*]] = affine.apply [[$MAP0]](%[[i0]])
diff --git a/mlir/test/Dialect/Affine/canonicalize.mlir b/mlir/test/Dialect/Affine/canonicalize.mlir
index c02730858ed9..352066adbbd8 100644
--- a/mlir/test/Dialect/Affine/canonicalize.mlir
+++ b/mlir/test/Dialect/Affine/canonicalize.mlir
@@ -7,7 +7,7 @@
// CHECK-LABEL: func @compose_affine_maps_1dto2d_no_symbols() {
func @compose_affine_maps_1dto2d_no_symbols() {
- %0 = memref.alloc() : memref<4x4xf32>
+ %0 = alloc() : memref<4x4xf32>
affine.for %i0 = 0 to 15 {
// Test load[%x, %x]
@@ -26,21 +26,21 @@ func @compose_affine_maps_1dto2d_no_symbols() {
%y1_1 = affine.apply affine_map<(d0, d1) -> (d1)> (%y0, %y0)
// CHECK-NEXT: %[[I1A:.*]] = affine.apply #[[$MAP1]](%{{.*}})
- // CHECK-NEXT: memref.store %[[V0]], %0[%[[I1A]], %[[I1A]]]
- memref.store %v0, %0[%y1_0, %y1_1] : memref<4x4xf32>
+ // CHECK-NEXT: store %[[V0]], %0[%[[I1A]], %[[I1A]]]
+ store %v0, %0[%y1_0, %y1_1] : memref<4x4xf32>
// Test store[%x, %y]
%xy_0 = affine.apply affine_map<(d0, d1) -> (d0)> (%x0, %y0)
%xy_1 = affine.apply affine_map<(d0, d1) -> (d1)> (%x0, %y0)
- // CHECK-NEXT: memref.store %[[V0]], %0[%[[I0A]], %[[I1A]]]
- memref.store %v0, %0[%xy_0, %xy_1] : memref<4x4xf32>
+ // CHECK-NEXT: store %[[V0]], %0[%[[I0A]], %[[I1A]]]
+ store %v0, %0[%xy_0, %xy_1] : memref<4x4xf32>
// Test store[%y, %x]
%yx_0 = affine.apply affine_map<(d0, d1) -> (d0)> (%y0, %x0)
%yx_1 = affine.apply affine_map<(d0, d1) -> (d1)> (%y0, %x0)
- // CHECK-NEXT: memref.store %[[V0]], %0[%[[I1A]], %[[I0A]]]
- memref.store %v0, %0[%yx_0, %yx_1] : memref<4x4xf32>
+ // CHECK-NEXT: store %[[V0]], %0[%[[I1A]], %[[I0A]]]
+ store %v0, %0[%yx_0, %yx_1] : memref<4x4xf32>
}
return
}
@@ -53,7 +53,7 @@ func @compose_affine_maps_1dto2d_no_symbols() {
// CHECK-LABEL: func @compose_affine_maps_1dto2d_with_symbols() {
func @compose_affine_maps_1dto2d_with_symbols() {
- %0 = memref.alloc() : memref<4x4xf32>
+ %0 = alloc() : memref<4x4xf32>
affine.for %i0 = 0 to 15 {
// Test load[%x0, %x0] with symbol %c4
@@ -68,22 +68,22 @@ func @compose_affine_maps_1dto2d_with_symbols() {
%x1 = affine.apply affine_map<(d0) -> (d0 + 1)> (%i0)
%y1 = affine.apply affine_map<(d0, d1) -> (d0+d1)> (%x0, %x1)
// CHECK-NEXT: %[[I1:.*]] = affine.apply #[[$MAP7]](%{{.*}})
- // CHECK-NEXT: memref.store %[[V0]], %{{.*}}[%[[I1]], %[[I1]]]
- memref.store %v0, %0[%y1, %y1] : memref<4x4xf32>
+ // CHECK-NEXT: store %[[V0]], %{{.*}}[%[[I1]], %[[I1]]]
+ store %v0, %0[%y1, %y1] : memref<4x4xf32>
// Test store[%x1, %x0] with symbol %c4 captured by '%x0' map.
%y2 = affine.apply affine_map<(d0, d1) -> (d0 + d1)> (%x1, %x0)
// CHECK-NEXT: %[[I2:.*]] = affine.apply #[[$MAP7]](%{{.*}})
- // CHECK-NEXT: memref.store %[[V0]], %{{.*}}[%[[I2]], %[[I2]]]
- memref.store %v0, %0[%y2, %y2] : memref<4x4xf32>
+ // CHECK-NEXT: store %[[V0]], %{{.*}}[%[[I2]], %[[I2]]]
+ store %v0, %0[%y2, %y2] : memref<4x4xf32>
// Test store[%x2, %x0] with symbol %c4 from '%x0' and %c5 from '%x2'
%c5 = constant 5 : index
%x2 = affine.apply affine_map<(d0)[s0] -> (d0 + s0)> (%i0)[%c5]
%y3 = affine.apply affine_map<(d0, d1) -> (d0 + d1)> (%x2, %x0)
// CHECK: %[[I3:.*]] = affine.apply #[[$MAP7a]](%{{.*}})
- // CHECK-NEXT: memref.store %[[V0]], %{{.*}}[%[[I3]], %[[I3]]]
- memref.store %v0, %0[%y3, %y3] : memref<4x4xf32>
+ // CHECK-NEXT: store %[[V0]], %{{.*}}[%[[I3]], %[[I3]]]
+ store %v0, %0[%y3, %y3] : memref<4x4xf32>
}
return
}
@@ -95,8 +95,8 @@ func @compose_affine_maps_1dto2d_with_symbols() {
// CHECK-LABEL: func @compose_affine_maps_2d_tile() {
func @compose_affine_maps_2d_tile() {
- %0 = memref.alloc() : memref<16x32xf32>
- %1 = memref.alloc() : memref<16x32xf32>
+ %0 = alloc() : memref<16x32xf32>
+ %1 = alloc() : memref<16x32xf32>
%c4 = constant 4 : index
%c8 = constant 8 : index
@@ -119,8 +119,8 @@ func @compose_affine_maps_2d_tile() {
// CHECK-NEXT: %[[L0:.*]] = load %{{.*}}[%[[I0]], %[[I1]]]
%v0 = load %0[%x40, %x41] : memref<16x32xf32>
- // CHECK-NEXT: memref.store %[[L0]], %{{.*}}[%[[I0]], %[[I1]]]
- memref.store %v0, %1[%x40, %x41] : memref<16x32xf32>
+ // CHECK-NEXT: store %[[L0]], %{{.*}}[%[[I0]], %[[I1]]]
+ store %v0, %1[%x40, %x41] : memref<16x32xf32>
}
}
}
@@ -138,8 +138,8 @@ func @compose_affine_maps_2d_tile() {
// CHECK-LABEL: func @compose_affine_maps_dependent_loads() {
func @compose_affine_maps_dependent_loads() {
- %0 = memref.alloc() : memref<16x32xf32>
- %1 = memref.alloc() : memref<16x32xf32>
+ %0 = alloc() : memref<16x32xf32>
+ %1 = alloc() : memref<16x32xf32>
affine.for %i0 = 0 to 3 {
affine.for %i1 = 0 to 3 {
@@ -160,12 +160,12 @@ func @compose_affine_maps_dependent_loads() {
// CHECK-NEXT: %[[V0:.*]] = load %{{.*}}[%[[I0]], %[[I1]]]
%v0 = load %0[%x00, %x01] : memref<16x32xf32>
- // CHECK-NEXT: memref.store %[[V0]], %{{.*}}[%[[I0]], %[[I2]]]
- memref.store %v0, %0[%x00, %x02] : memref<16x32xf32>
+ // CHECK-NEXT: store %[[V0]], %{{.*}}[%[[I0]], %[[I2]]]
+ store %v0, %0[%x00, %x02] : memref<16x32xf32>
// Swizzle %i0, %i1
- // CHECK-NEXT: memref.store %[[V0]], %{{.*}}[%[[I1]], %[[I0]]]
- memref.store %v0, %0[%x01, %x00] : memref<16x32xf32>
+ // CHECK-NEXT: store %[[V0]], %{{.*}}[%[[I1]], %[[I0]]]
+ store %v0, %0[%x01, %x00] : memref<16x32xf32>
// Swizzle %x00, %x01 and %c3, %c7
%x10 = affine.apply affine_map<(d0, d1)[s0, s1] -> (d0 * s1)>
@@ -175,8 +175,8 @@ func @compose_affine_maps_dependent_loads() {
// CHECK-NEXT: %[[I2A:.*]] = affine.apply #[[$MAP12]](%{{.*}})
// CHECK-NEXT: %[[I2B:.*]] = affine.apply #[[$MAP11]](%{{.*}})
- // CHECK-NEXT: memref.store %[[V0]], %{{.*}}[%[[I2A]], %[[I2B]]]
- memref.store %v0, %0[%x10, %x11] : memref<16x32xf32>
+ // CHECK-NEXT: store %[[V0]], %{{.*}}[%[[I2A]], %[[I2B]]]
+ store %v0, %0[%x10, %x11] : memref<16x32xf32>
}
}
}
@@ -198,8 +198,8 @@ func @compose_affine_maps_diamond_dependency(%arg0: f32, %arg1: memref<4x4xf32>)
%d1 = affine.apply affine_map<(d0, d1) -> (d1 floordiv 3)> (%b, %c)
// CHECK: %[[I0:.*]] = affine.apply #[[$MAP13A]](%{{.*}})
// CHECK: %[[I1:.*]] = affine.apply #[[$MAP13B]](%{{.*}})
- // CHECK-NEXT: memref.store %arg0, %arg1[%[[I0]], %[[I1]]]
- memref.store %arg0, %arg1[%d0, %d1] : memref<4x4xf32>
+ // CHECK-NEXT: store %arg0, %arg1[%[[I0]], %[[I1]]]
+ store %arg0, %arg1[%d0, %d1] : memref<4x4xf32>
}
return
@@ -223,16 +223,16 @@ func @compose_affine_maps_multiple_symbols(%arg0: index, %arg1: index) -> index
// CHECK-LABEL: func @arg_used_as_dim_and_symbol
func @arg_used_as_dim_and_symbol(%arg0: memref<100x100xf32>, %arg1: index, %arg2: f32) {
%c9 = constant 9 : index
- %1 = memref.alloc() : memref<100x100xf32, 1>
- %2 = memref.alloc() : memref<1xi32>
+ %1 = alloc() : memref<100x100xf32, 1>
+ %2 = alloc() : memref<1xi32>
affine.for %i0 = 0 to 100 {
affine.for %i1 = 0 to 100 {
%3 = affine.apply affine_map<(d0, d1)[s0, s1] -> (d1 + s0 + s1)>
(%i0, %i1)[%arg1, %c9]
%4 = affine.apply affine_map<(d0, d1, d3) -> (d3 - (d0 + d1))>
(%arg1, %c9, %3)
- // CHECK: memref.store %arg2, %{{.*}}[%{{.*}}, %{{.*}}]
- memref.store %arg2, %1[%4, %arg1] : memref<100x100xf32, 1>
+ // CHECK: store %arg2, %{{.*}}[%{{.*}}, %{{.*}}]
+ store %arg2, %1[%4, %arg1] : memref<100x100xf32, 1>
}
}
return
@@ -244,17 +244,17 @@ func @arg_used_as_dim_and_symbol(%arg0: memref<100x100xf32>, %arg1: index, %arg2
func @trivial_maps() {
// CHECK-NOT: affine.apply
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
%c0 = constant 0 : index
%cst = constant 0.000000e+00 : f32
affine.for %i1 = 0 to 10 {
%1 = affine.apply affine_map<()[s0] -> (s0)>()[%c0]
- memref.store %cst, %0[%1] : memref<10xf32>
+ store %cst, %0[%1] : memref<10xf32>
%2 = load %0[%c0] : memref<10xf32>
%3 = affine.apply affine_map<()[] -> (0)>()[]
- memref.store %cst, %0[%3] : memref<10xf32>
- memref.store %2, %0[%c0] : memref<10xf32>
+ store %cst, %0[%3] : memref<10xf32>
+ store %2, %0[%c0] : memref<10xf32>
}
return
}
@@ -422,7 +422,7 @@ func @symbolic_semi_affine(%M: index, %N: index, %A: memref<?xf32>) {
%1 = affine.apply affine_map<()[s0] -> (s0 + 1)> ()[%M]
%2 = affine.apply affine_map<(d0)[s0] -> (d0 floordiv s0)> (%i0)[%1]
// CHECK-DAG: {{.*}} = affine.apply #[[$symbolic_semi_affine]](%{{.*}})[%{{.*}}]
- memref.store %f1, %A[%2] : memref<?xf32>
+ store %f1, %A[%2] : memref<?xf32>
}
return
}
@@ -667,7 +667,7 @@ func @affine_parallel_const_bounds() {
%cst = constant 1.0 : f32
%c0 = constant 0 : index
%c4 = constant 4 : index
- %0 = memref.alloc() : memref<4xf32>
+ %0 = alloc() : memref<4xf32>
// CHECK: affine.parallel (%{{.*}}) = (0) to (4)
affine.parallel (%i) = (%c0) to (%c0 + %c4) {
%1 = affine.apply #map3(%i)
@@ -686,11 +686,11 @@ func @compose_affine_maps_div_symbol(%A : memref<i64>, %i0 : index, %i1 : index)
%1 = affine.apply affine_map<()[s0] -> (3 * s0)> ()[%i0]
%2 = affine.apply affine_map<(d0)[s0, s1] -> (d0 mod s1 + s0 * s1 + s0 * 4)> (%i1)[%0, %1]
%3 = index_cast %2: index to i64
- memref.store %3, %A[]: memref<i64>
+ store %3, %A[]: memref<i64>
affine.for %i2 = 0 to 3 {
%4 = affine.apply affine_map<(d0)[s0, s1] -> (d0 ceildiv s1 + s0 + s0 * 3)> (%i2)[%0, %1]
%5 = index_cast %4: index to i64
- memref.store %5, %A[]: memref<i64>
+ store %5, %A[]: memref<i64>
}
return
}
diff --git a/mlir/test/Dialect/Affine/dma-generate.mlir b/mlir/test/Dialect/Affine/dma-generate.mlir
index 184bed95f57a..19885b317a24 100644
--- a/mlir/test/Dialect/Affine/dma-generate.mlir
+++ b/mlir/test/Dialect/Affine/dma-generate.mlir
@@ -14,21 +14,21 @@
// CHECK-LABEL: func @loop_nest_1d() {
func @loop_nest_1d() {
- %A = memref.alloc() : memref<256 x f32>
- %B = memref.alloc() : memref<512 x f32>
- %F = memref.alloc() : memref<256 x f32, 2>
+ %A = alloc() : memref<256 x f32>
+ %B = alloc() : memref<512 x f32>
+ %F = alloc() : memref<256 x f32, 2>
// First DMA buffer.
- // CHECK: memref.alloc() : memref<256xf32>
- // CHECK: memref.alloc() : memref<256xf32, 2>
+ // CHECK: alloc() : memref<256xf32>
+ // CHECK: alloc() : memref<256xf32, 2>
// Tag for first DMA.
- // CHECK: memref.alloc() : memref<1xi32>
+ // CHECK: alloc() : memref<1xi32>
// First DMA transfer.
// CHECK: affine.dma_start %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}}], %{{.*}} : memref<256xf32>, memref<256xf32, 2>, memref<1xi32>
// CHECK: affine.dma_wait %{{.*}}[%{{.*}}], %{{.*}} : memref<1xi32>
// Second DMA buffer.
- // CHECK: memref.alloc() : memref<256xf32, 2>
+ // CHECK: alloc() : memref<256xf32, 2>
// Tag for second DMA.
- // CHECK: memref.alloc() : memref<1xi32>
+ // CHECK: alloc() : memref<1xi32>
// Second DMA transfer.
// CHECK: affine.dma_start %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}}], %{{.*}} : memref<512xf32>, memref<256xf32, 2>, memref<1xi32>
// CHECK-NEXT: affine.dma_wait %{{.*}}[%{{.*}}], %{{.*}} : memref<1xi32>
@@ -58,13 +58,13 @@ func @loop_nest_1d() {
// CHECK-LABEL: func @loop_nest_high_d
// CHECK: %{{.*}} = constant 16384 : index
-// CHECK-DAG: [[BUFB:%[0-9]+]] = memref.alloc() : memref<512x32xf32, 2>
-// CHECK-DAG: [[BUFA:%[0-9]+]] = memref.alloc() : memref<512x32xf32, 2>
-// CHECK-DAG: [[BUFC:%[0-9]+]] = memref.alloc() : memref<512x32xf32, 2>
-// CHECK-DAG: [[TAGB:%[0-9]+]] = memref.alloc() : memref<1xi32>
-// CHECK-DAG: [[TAGA:%[0-9]+]] = memref.alloc() : memref<1xi32>
-// CHECK-DAG: [[TAGC:%[0-9]+]] = memref.alloc() : memref<1xi32>
-// CHECK-DAG: [[TAGC_W:%[0-9]+]] = memref.alloc() : memref<1xi32>
+// CHECK-DAG: [[BUFB:%[0-9]+]] = alloc() : memref<512x32xf32, 2>
+// CHECK-DAG: [[BUFA:%[0-9]+]] = alloc() : memref<512x32xf32, 2>
+// CHECK-DAG: [[BUFC:%[0-9]+]] = alloc() : memref<512x32xf32, 2>
+// CHECK-DAG: [[TAGB:%[0-9]+]] = alloc() : memref<1xi32>
+// CHECK-DAG: [[TAGA:%[0-9]+]] = alloc() : memref<1xi32>
+// CHECK-DAG: [[TAGC:%[0-9]+]] = alloc() : memref<1xi32>
+// CHECK-DAG: [[TAGC_W:%[0-9]+]] = alloc() : memref<1xi32>
// INCOMING DMA for B
// CHECK-DAG: affine.dma_start %{{.*}}[%{{.*}}, %{{.*}}], [[BUFB]][%{{.*}}, %{{.*}}], [[TAGB]][%{{.*}}], %{{.*}} : memref<512x32xf32>, memref<512x32xf32, 2>, memref<1xi32>
// CHECK-DAG: affine.dma_wait [[TAGB]][%{{.*}}], %{{.*}} : memref<1xi32>
@@ -145,10 +145,10 @@ func @loop_nest_high_d(%A: memref<512 x 32 x f32>,
// region within a 256 x 8 memref.
//
// CHECK-LABEL: func @loop_nest_modulo() {
-// CHECK: memref.alloc() : memref<256x8xf32>
+// CHECK: alloc() : memref<256x8xf32>
// CHECK-NEXT: affine.for %{{.*}} = 0 to 32 step 4 {
-// CHECK: memref.alloc() : memref<1x2xf32, 2>
-// CHECK-NEXT: memref.alloc() : memref<1xi32>
+// CHECK: alloc() : memref<1x2xf32, 2>
+// CHECK-NEXT: alloc() : memref<1xi32>
// Composition of the affine map for '%{{.*}}' causes '%{{.*}}' to be added as a symbol.
// CHECK-NEXT: affine.dma_start %{{.*}}[%{{.*}}, 0], %{{.*}}[%{{.*}}, %{{.*}}], %{{.*}}[%{{.*}}], %{{.*}} : memref<256x8xf32>, memref<1x2xf32, 2>, memref<1xi32>
// CHECK-NEXT: affine.dma_wait %{{.*}}[%{{.*}}], %{{.*}} : memref<1xi32>
@@ -161,7 +161,7 @@ func @loop_nest_high_d(%A: memref<512 x 32 x f32>,
// CHECK-NEXT: }
// CHECK-NEXT: return
func @loop_nest_modulo() {
- %A = memref.alloc() : memref<256 x 8 x f32>
+ %A = alloc() : memref<256 x 8 x f32>
affine.for %i = 0 to 32 step 4 {
// DMAs will be performed at this level (%j is the first unit stride loop)
affine.for %j = 0 to 8 {
@@ -179,11 +179,11 @@ func @loop_nest_modulo() {
// dependent on outer loop IVs.
// CHECK-LABEL: func @loop_nest_tiled() -> memref<256x1024xf32> {
func @loop_nest_tiled() -> memref<256x1024xf32> {
- %0 = memref.alloc() : memref<256x1024xf32>
+ %0 = alloc() : memref<256x1024xf32>
affine.for %i0 = 0 to 256 step 32 {
affine.for %i1 = 0 to 1024 step 32 {
-// CHECK: memref.alloc() : memref<32x32xf32, 2>
-// CHECK-NEXT: memref.alloc() : memref<1xi32>
+// CHECK: alloc() : memref<32x32xf32, 2>
+// CHECK-NEXT: alloc() : memref<1xi32>
// Strided DMA here: 32 x 32 tile in a 256 x 1024 memref.
// CHECK-NEXT: affine.dma_start %{{.*}}[%{{.*}}, %{{.*}}], %{{.*}}[%{{.*}}, %{{.*}}], %{{.*}}[%{{.*}}], %{{.*}}, %{{.*}}, %{{.*}} : memref<256x1024xf32>, memref<32x32xf32, 2>, memref<1xi32>
// CHECK-NEXT: affine.dma_wait
@@ -206,8 +206,8 @@ func @loop_nest_tiled() -> memref<256x1024xf32> {
func @dma_constant_dim_access(%A : memref<100x100xf32>) {
%one = constant 1 : index
%N = constant 100 : index
- // CHECK: memref.alloc() : memref<1x100xf32, 2>
- // CHECK-NEXT: memref.alloc() : memref<1xi32>
+ // CHECK: alloc() : memref<1x100xf32, 2>
+ // CHECK-NEXT: alloc() : memref<1xi32>
// No strided DMA needed here.
// CHECK: affine.dma_start %{{.*}}[%{{.*}}, %{{.*}}], %{{.*}}[%{{.*}}, %{{.*}}], %{{.*}}[%{{.*}}], %{{.*}} : memref<100x100xf32>, memref<1x100xf32, 2>,
// CHECK-NEXT: affine.dma_wait %{{.*}}[%{{.*}}], %{{.*}} : memref<1xi32>
@@ -232,8 +232,8 @@ func @dma_with_symbolic_accesses(%A : memref<100x100xf32>, %M : index) {
}
}
return
-// CHECK: memref.alloc() : memref<100x100xf32, 2>
-// CHECK-NEXT: memref.alloc() : memref<1xi32>
+// CHECK: alloc() : memref<100x100xf32, 2>
+// CHECK-NEXT: alloc() : memref<1xi32>
// CHECK-NEXT: affine.dma_start %{{.*}}[0, symbol(%{{.*}}) + 9], %{{.*}}[%{{.*}}, %{{.*}}], %{{.*}}[%{{.*}}], %{{.*}}
// CHECK-NEXT: affine.dma_wait %{{.*}}[%{{.*}}], %{{.*}}
// CHECK-NEXT: affine.for %[[IV0:.*]] = 0 to 100 {
@@ -251,8 +251,8 @@ func @dma_with_symbolic_loop_bounds(%A : memref<100x100xf32>, %M : index, %N: in
%K = constant 9 : index
// The buffer size can't be bound by a constant smaller than the original
// memref size; so the DMA buffer is the entire 100x100.
-// CHECK: memref.alloc() : memref<100x100xf32, 2>
-// CHECK-NEXT: memref.alloc() : memref<1xi32>
+// CHECK: alloc() : memref<100x100xf32, 2>
+// CHECK-NEXT: alloc() : memref<1xi32>
// CHECK-NEXT: affine.dma_start %{{.*}}[%{{.*}}, %{{.*}}], %{{.*}}[%{{.*}}, %{{.*}}], %{{.*}}[%{{.*}}], %{{.*}} : memref<100x100xf32>, memref<100x100xf32, 2>, memref<1xi32>
// CHECK-NEXT: affine.dma_wait %{{.*}}[%{{.*}}], %{{.*}} : memref<1xi32>
affine.for %i = 0 to 100 {
@@ -315,7 +315,7 @@ func @dma_memref_3d(%arg0: memref<1024x1024x1024xf32>) {
// CHECK-LABEL: func @multi_load_store_union() {
func @multi_load_store_union() {
- %A = memref.alloc() : memref<512 x 512 x f32>
+ %A = alloc() : memref<512 x 512 x f32>
affine.for %i = 0 to 256 {
affine.for %j = 0 to 256 {
%idx = affine.apply affine_map<(d0) -> (d0 + 64)>(%i)
@@ -335,12 +335,12 @@ func @multi_load_store_union() {
}
return
}
-// CHECK: memref.alloc() : memref<512x512xf32>
-// CHECK-NEXT: memref.alloc() : memref<382x446xf32, 2>
-// CHECK-NEXT: memref.alloc() : memref<1xi32>
+// CHECK: alloc() : memref<512x512xf32>
+// CHECK-NEXT: alloc() : memref<382x446xf32, 2>
+// CHECK-NEXT: alloc() : memref<1xi32>
// CHECK-NEXT: affine.dma_start %{{.*}}[%{{.*}}, %{{.*}}], %{{.*}}[%{{.*}}, %{{.*}}], %{{.*}}[%{{.*}}], %{{.*}}, %{{.*}}, %{{.*}} : memref<512x512xf32>, memref<382x446xf32, 2>, memref<1xi32>
// CHECK-NEXT: affine.dma_wait %{{.*}}[%{{.*}}], %{{.*}} : memref<1xi32>
-// CHECK-NEXT: memref.alloc() : memref<1xi32>
+// CHECK-NEXT: alloc() : memref<1xi32>
// CHECK-NEXT: affine.for %{{.*}} = 0 to 256 {
// CHECK-NEXT: affine.for %{{.*}} = 0 to 256 {
// CHECK: affine.load %{{.*}}[%{{.*}}, %{{.*}} + 126] : memref<382x446xf32, 2>
@@ -363,7 +363,7 @@ func @multi_load_store_union() {
func @dma_loop_straightline_interspersed() {
%c0 = constant 0 : index
%c255 = constant 255 : index
- %A = memref.alloc() : memref<256 x f32>
+ %A = alloc() : memref<256 x f32>
%v = affine.load %A[%c0] : memref<256 x f32>
affine.for %i = 1 to 255 {
affine.load %A[%i] : memref<256 x f32>
@@ -374,16 +374,16 @@ func @dma_loop_straightline_interspersed() {
}
// There are three regions here - the 'load' preceding the loop, the loop
// itself, and the operations appearing after the scf.
-// CHECK: memref.alloc() : memref<256xf32>
-// CHECK-NEXT: memref.alloc() : memref<1xf32, 2>
-// CHECK-NEXT: memref.alloc() : memref<1xi32>
+// CHECK: alloc() : memref<256xf32>
+// CHECK-NEXT: alloc() : memref<1xf32, 2>
+// CHECK-NEXT: alloc() : memref<1xi32>
// CHECK-NEXT: affine.dma_start %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}}], %{{.*}} : memref<256xf32>, memref<1xf32, 2>, memref<1xi32>
// CHECK-NEXT: affine.dma_wait %{{.*}}[%{{.*}}], %{{.*}} : memref<1xi32>
// CHECK-NEXT: affine.load %{{.*}}[0] : memref<1xf32, 2>
// CHECK-NEXT: dealloc %{{.*}} : memref<1xi32>
// CHECK-NEXT: dealloc %{{.*}} : memref<1xf32, 2>
-// CHECK-NEXT: memref.alloc() : memref<254xf32, 2>
-// CHECK-NEXT: memref.alloc() : memref<1xi32>
+// CHECK-NEXT: alloc() : memref<254xf32, 2>
+// CHECK-NEXT: alloc() : memref<1xi32>
// CHECK-NEXT: affine.dma_start %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}}], %{{.*}} : memref<256xf32>, memref<254xf32, 2>, memref<1xi32>
// CHECK-NEXT: affine.dma_wait %{{.*}}[%{{.*}}], %{{.*}} : memref<1xi32>
// CHECK-NEXT: affine.for %{{.*}} = 1 to 255 {
@@ -391,11 +391,11 @@ func @dma_loop_straightline_interspersed() {
// CHECK-NEXT: }
// CHECK-NEXT: dealloc %{{.*}} : memref<1xi32>
// CHECK-NEXT: dealloc %{{.*}} : memref<254xf32, 2>
-// CHECK-NEXT: memref.alloc() : memref<256xf32, 2>
-// CHECK-NEXT: memref.alloc() : memref<1xi32>
+// CHECK-NEXT: alloc() : memref<256xf32, 2>
+// CHECK-NEXT: alloc() : memref<1xi32>
// CHECK-NEXT: affine.dma_start %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}}], %{{.*}} : memref<256xf32>, memref<256xf32, 2>, memref<1xi32>
// CHECK-NEXT: affine.dma_wait %{{.*}}[%{{.*}}], %{{.*}} : memref<1xi32>
-// CHECK-NEXT: memref.alloc() : memref<1xi32>
+// CHECK-NEXT: alloc() : memref<1xi32>
// CHECK-NEXT: affine.load %{{.*}}[255] : memref<256xf32, 2>
// CHECK-NEXT: affine.store %{{.*}}, %{{.*}}[0] : memref<256xf32, 2>
// CHECK-NEXT: affine.dma_start %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}}], %{{.*}} : memref<256xf32, 2>, memref<256xf32>, memref<1xi32>
@@ -410,7 +410,7 @@ func @dma_loop_straightline_interspersed() {
// CHECK-LABEL: func @dma_mixed_loop_blocks() {
func @dma_mixed_loop_blocks() {
%c0 = constant 0 : index
- %A = memref.alloc() : memref<256 x 256 x vector<8 x f32>>
+ %A = alloc() : memref<256 x 256 x vector<8 x f32>>
affine.for %i = 0 to 256 {
%v = affine.load %A[%c0, %c0] : memref<256 x 256 x vector<8 x f32>>
"foo"(%v) : (vector<8 x f32>) -> ()
@@ -421,9 +421,9 @@ func @dma_mixed_loop_blocks() {
}
return
}
-// CHECK-DAG: [[MEM:%[0-9]+]] = memref.alloc() : memref<256x256xvector<8xf32>>
-// CHECK-DAG: [[BUF:%[0-9]+]] = memref.alloc() : memref<256x256xvector<8xf32>, 2>
-// CHECK-DAG: [[TAG:%[0-9]+]] = memref.alloc() : memref<1xi32>
+// CHECK-DAG: [[MEM:%[0-9]+]] = alloc() : memref<256x256xvector<8xf32>>
+// CHECK-DAG: [[BUF:%[0-9]+]] = alloc() : memref<256x256xvector<8xf32>, 2>
+// CHECK-DAG: [[TAG:%[0-9]+]] = alloc() : memref<1xi32>
// CHECK: affine.dma_start [[MEM]][%{{.*}}, %{{.*}}], [[BUF]][%{{.*}}, %{{.*}}], [[TAG]][%{{.*}}], %{{.*}} : memref<256x256xvector<8xf32>>, memref<256x256xvector<8xf32>, 2>, memref<1xi32>
// CHECK-NEXT: affine.dma_wait [[TAG]][%{{.*}}], %{{.*}} : memref<1xi32>
// CHECK-NEXT: affine.for %{{.*}} = 0 to 256 {
@@ -443,8 +443,8 @@ func @relative_loop_bounds(%arg0: memref<1027xf32>) {
}
return
}
-// CHECK: [[BUF:%[0-9]+]] = memref.alloc() : memref<1027xf32, 2>
-// CHECK-NEXT: [[MEM:%[0-9]+]] = memref.alloc() : memref<1xi32>
+// CHECK: [[BUF:%[0-9]+]] = alloc() : memref<1027xf32, 2>
+// CHECK-NEXT: [[MEM:%[0-9]+]] = alloc() : memref<1xi32>
// CHECK-NEXT: affine.for %{{.*}} = 0 to 1024 {
// CHECK-NEXT: affine.for %[[I2:.*]] = {{#map[0-9]+}}(%{{.*}}) to {{#map[0-9]+}}(%{{.*}}) {
// CHECK: affine.store %{{.*}}, [[BUF]][%[[I2]]] : memref<1027xf32, 2>
@@ -456,7 +456,7 @@ func @relative_loop_bounds(%arg0: memref<1027xf32>) {
// -----
func @test_read_write_region_union() {
- %0 = memref.alloc() : memref<256xf32>
+ %0 = alloc() : memref<256xf32>
affine.for %i0 = 0 to 10 {
// memref dims: [0, 256)
// read region: [100, 110)
@@ -470,12 +470,12 @@ func @test_read_write_region_union() {
return
}
-// CHECK: memref.alloc() : memref<256xf32>
-// CHECK-NEXT: memref.alloc() : memref<85xf32, 2>
-// CHECK-NEXT: memref.alloc() : memref<1xi32>
+// CHECK: alloc() : memref<256xf32>
+// CHECK-NEXT: alloc() : memref<85xf32, 2>
+// CHECK-NEXT: alloc() : memref<1xi32>
// CHECK-NEXT: affine.dma_start %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}}], %{{.*}} : memref<256xf32>, memref<85xf32, 2>, memref<1xi32>
// CHECK-NEXT: affine.dma_wait %{{.*}}[%{{.*}}], %{{.*}} : memref<1xi32>
-// CHECK-NEXT: memref.alloc() : memref<1xi32>
+// CHECK-NEXT: alloc() : memref<1xi32>
// CHECK-NEXT: affine.for %{{.*}} = 0 to 10 {
// CHECK: affine.load %{{.*}}[%{{.*}} + 75] : memref<85xf32, 2>
// CHECK-NEXT: affine.store %{{.*}}, %{{.*}}[%{{.*}}] : memref<85xf32, 2>
@@ -493,8 +493,8 @@ func @test_read_write_region_union() {
// CHECK-LABEL: func @test_analysis_util
func @test_analysis_util(%arg0: memref<4x4x16x1xf32>, %arg1: memref<144x9xf32>, %arg2: memref<2xf32>) -> (memref<144x9xf32>, memref<2xf32>) {
%c0 = constant 0 : index
- %0 = memref.alloc() : memref<64x1xf32>
- %1 = memref.alloc() : memref<144x4xf32>
+ %0 = alloc() : memref<64x1xf32>
+ %1 = alloc() : memref<144x4xf32>
%2 = constant 0.0 : f32
affine.for %i8 = 0 to 9 step 3 {
affine.for %i9 = #map_lb(%i8) to #map_ub(%i8) {
@@ -510,7 +510,7 @@ func @test_analysis_util(%arg0: memref<4x4x16x1xf32>, %arg1: memref<144x9xf32>,
return %arg1, %arg2 : memref<144x9xf32>, memref<2xf32>
}
// CHECK: affine.for %{{.*}} = 0 to 9 step 3 {
-// CHECK: [[BUF:%[0-9]+]] = memref.alloc() : memref<2xf32, 2>
+// CHECK: [[BUF:%[0-9]+]] = alloc() : memref<2xf32, 2>
// CHECK: affine.dma_start %{{.*}}[%{{.*}} floordiv 8], [[BUF]]
// CHECK: affine.dma_wait %{{.*}}[%{{.*}}], %{{.*}} : memref<1xi32>
// CHECK: affine.for %{{.*}} =
@@ -539,8 +539,8 @@ func @test_memref_bounds(%arg0: memref<4x4x16x1xvector<8x128xf32>>, %arg1: memre
return %arg1, %arg2 : memref<144x9xvector<8x128xf32>>, memref<2xvector<8x128xf32>>
}
-// CHECK: memref.alloc() : memref<4x4x16x1xvector<8x128xf32>, 2>
-// CHECK-NEXT: memref.alloc() : memref<1xi32>
+// CHECK: alloc() : memref<4x4x16x1xvector<8x128xf32>, 2>
+// CHECK-NEXT: alloc() : memref<1xi32>
// CHECK-NEXT: affine.dma_start %{{.*}}[%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}], %{{.*}}[%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}], %{{.*}}[%{{.*}}], %{{.*}} : memref<4x4x16x1xvector<8x128xf32>>, memref<4x4x16x1xvector<8x128xf32>, 2>, memref<1xi32>
// CHECK-NEXT: affine.dma_wait %{{.*}}[%{{.*}}], %{{.*}} : memref<1xi32>
@@ -553,7 +553,7 @@ func @test_memref_bounds(%arg0: memref<4x4x16x1xvector<8x128xf32>>, %arg1: memre
func @load_store_same_memref(%arg0: memref<256x1024xf32>) {
// FAST-MEM-16KB: affine.for %{{.*}} = 0 to 256 step 4
affine.for %i0 = 0 to 256 step 4 {
- // FAST-MEM-16KB: [[BUF:%[0-9]+]] = memref.alloc() : memref<4x1024xf32, 2>
+ // FAST-MEM-16KB: [[BUF:%[0-9]+]] = alloc() : memref<4x1024xf32, 2>
// FAST-MEM-16KB: affine.dma_start %{{.*}}
// FAST-MEM-16KB-NEXT: affine.dma_wait
// FAST-MEM-16KB: affine.for %{{.*}}
diff --git a/mlir/test/Dialect/Affine/dma.mlir b/mlir/test/Dialect/Affine/dma.mlir
index 3ac1d03e0f82..6feb267596a1 100644
--- a/mlir/test/Dialect/Affine/dma.mlir
+++ b/mlir/test/Dialect/Affine/dma.mlir
@@ -4,9 +4,9 @@
// Test with loop IVs.
func @test0(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<100x100xf32>
- %1 = memref.alloc() : memref<100x100xf32, affine_map<(d0, d1) -> (d0, d1)>, 2>
- %2 = memref.alloc() : memref<1xi32>
+ %0 = alloc() : memref<100x100xf32>
+ %1 = alloc() : memref<100x100xf32, affine_map<(d0, d1) -> (d0, d1)>, 2>
+ %2 = alloc() : memref<1xi32>
%c0 = constant 0 : index
%c64 = constant 64 : index
affine.for %i0 = 0 to 10 {
@@ -25,9 +25,9 @@ func @test0(%arg0 : index, %arg1 : index) {
// Test with loop IVs and optional stride arguments.
func @test1(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<100x100xf32>
- %1 = memref.alloc() : memref<100x100xf32, affine_map<(d0, d1) -> (d0, d1)>, 2>
- %2 = memref.alloc() : memref<1xi32>
+ %0 = alloc() : memref<100x100xf32>
+ %1 = alloc() : memref<100x100xf32, affine_map<(d0, d1) -> (d0, d1)>, 2>
+ %2 = alloc() : memref<1xi32>
%c0 = constant 0 : index
%c64 = constant 64 : index
%c128 = constant 128 : index
@@ -48,9 +48,9 @@ func @test1(%arg0 : index, %arg1 : index) {
// Test with loop IVs and symbols (without symbol keyword).
func @test2(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<100x100xf32>
- %1 = memref.alloc() : memref<100x100xf32, affine_map<(d0, d1) -> (d0, d1)>, 2>
- %2 = memref.alloc() : memref<1xi32>
+ %0 = alloc() : memref<100x100xf32>
+ %1 = alloc() : memref<100x100xf32, affine_map<(d0, d1) -> (d0, d1)>, 2>
+ %2 = alloc() : memref<1xi32>
%c0 = constant 0 : index
%c64 = constant 64 : index
affine.for %i0 = 0 to 10 {
@@ -70,9 +70,9 @@ func @test2(%arg0 : index, %arg1 : index) {
// Test with loop IVs and symbols (with symbol keyword).
func @test3(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<100x100xf32>
- %1 = memref.alloc() : memref<100x100xf32, affine_map<(d0, d1) -> (d0, d1)>, 2>
- %2 = memref.alloc() : memref<1xi32>
+ %0 = alloc() : memref<100x100xf32>
+ %1 = alloc() : memref<100x100xf32, affine_map<(d0, d1) -> (d0, d1)>, 2>
+ %2 = alloc() : memref<1xi32>
%c0 = constant 0 : index
%c64 = constant 64 : index
affine.for %i0 = 0 to 10 {
@@ -93,9 +93,9 @@ func @test3(%arg0 : index, %arg1 : index) {
// Test with loop IVs, symbols and constants in nested affine expressions.
func @test4(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<100x100xf32>
- %1 = memref.alloc() : memref<100x100xf32, 2>
- %2 = memref.alloc() : memref<1xi32>
+ %0 = alloc() : memref<100x100xf32>
+ %1 = alloc() : memref<100x100xf32, 2>
+ %2 = alloc() : memref<1xi32>
%c64 = constant 64 : index
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 10 {
diff --git a/mlir/test/Dialect/Affine/invalid.mlir b/mlir/test/Dialect/Affine/invalid.mlir
index 29da7bbc3dd7..56562481aad8 100644
--- a/mlir/test/Dialect/Affine/invalid.mlir
+++ b/mlir/test/Dialect/Affine/invalid.mlir
@@ -121,7 +121,7 @@ func @affine_if_invalid_sym() {
func @affine_if_invalid_dimop_dim(%arg0: index, %arg1: index, %arg2: index, %arg3: index) {
affine.for %n0 = 0 to 7 {
- %0 = memref.alloc(%arg0, %arg1, %arg2, %arg3) : memref<?x?x?x?xf32>
+ %0 = alloc(%arg0, %arg1, %arg2, %arg3) : memref<?x?x?x?xf32>
%c0 = constant 0 : index
%dim = dim %0, %c0 : memref<?x?x?x?xf32>
@@ -253,7 +253,7 @@ func @affine_parallel(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @affine_parallel(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
// expected-error at +1 {{reduction must be specified for each output}}
%1 = affine.parallel (%i, %j) = (0, 0) to (100, 100) step (10, 10) -> (f32) {
%2 = affine.load %0[%i, %j] : memref<100x100xf32>
@@ -265,7 +265,7 @@ func @affine_parallel(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @affine_parallel(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
// expected-error at +1 {{invalid reduction value: "bad"}}
%1 = affine.parallel (%i, %j) = (0, 0) to (100, 100) step (10, 10) reduce ("bad") -> (f32) {
%2 = affine.load %0[%i, %j] : memref<100x100xf32>
@@ -277,7 +277,7 @@ func @affine_parallel(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @affine_parallel(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<100x100xi32>
+ %0 = alloc() : memref<100x100xi32>
%1 = affine.parallel (%i, %j) = (0, 0) to (100, 100) step (10, 10) reduce ("minf") -> (f32) {
%2 = affine.load %0[%i, %j] : memref<100x100xi32>
// expected-error at +1 {{types mismatch between yield op and its parent}}
@@ -289,7 +289,7 @@ func @affine_parallel(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @vector_load_invalid_vector_type() {
- %0 = memref.alloc() : memref<100xf32>
+ %0 = alloc() : memref<100xf32>
affine.for %i0 = 0 to 16 step 8 {
// expected-error at +1 {{requires memref and vector types of the same elemental type}}
%1 = affine.vector_load %0[%i0] : memref<100xf32>, vector<8xf64>
@@ -300,7 +300,7 @@ func @vector_load_invalid_vector_type() {
// -----
func @vector_store_invalid_vector_type() {
- %0 = memref.alloc() : memref<100xf32>
+ %0 = alloc() : memref<100xf32>
%1 = constant dense<7.0> : vector<8xf64>
affine.for %i0 = 0 to 16 step 8 {
// expected-error at +1 {{requires memref and vector types of the same elemental type}}
@@ -312,7 +312,7 @@ func @vector_store_invalid_vector_type() {
// -----
func @vector_load_vector_memref() {
- %0 = memref.alloc() : memref<100xvector<8xf32>>
+ %0 = alloc() : memref<100xvector<8xf32>>
affine.for %i0 = 0 to 4 {
// expected-error at +1 {{requires memref and vector types of the same elemental type}}
%1 = affine.vector_load %0[%i0] : memref<100xvector<8xf32>>, vector<8xf32>
@@ -323,7 +323,7 @@ func @vector_load_vector_memref() {
// -----
func @vector_store_vector_memref() {
- %0 = memref.alloc() : memref<100xvector<8xf32>>
+ %0 = alloc() : memref<100xvector<8xf32>>
%1 = constant dense<7.0> : vector<8xf32>
affine.for %i0 = 0 to 4 {
// expected-error at +1 {{requires memref and vector types of the same elemental type}}
diff --git a/mlir/test/Dialect/Affine/load-store-invalid.mlir b/mlir/test/Dialect/Affine/load-store-invalid.mlir
index 4c2948afc2cf..5bc31a2184f3 100644
--- a/mlir/test/Dialect/Affine/load-store-invalid.mlir
+++ b/mlir/test/Dialect/Affine/load-store-invalid.mlir
@@ -63,7 +63,7 @@ func @store_too_few_subscripts_map(%arg0: memref<?x?xf32>, %arg1: index, %val: f
// -----
func @load_non_affine_index(%arg0 : index) {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
affine.for %i0 = 0 to 10 {
%1 = muli %i0, %arg0 : index
// expected-error at +1 {{op index must be a dimension or symbol identifier}}
@@ -75,7 +75,7 @@ func @load_non_affine_index(%arg0 : index) {
// -----
func @store_non_affine_index(%arg0 : index) {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
%1 = constant 11.0 : f32
affine.for %i0 = 0 to 10 {
%2 = muli %i0, %arg0 : index
@@ -88,7 +88,7 @@ func @store_non_affine_index(%arg0 : index) {
// -----
func @invalid_prefetch_rw(%i : index) {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
// expected-error at +1 {{rw specifier has to be 'read' or 'write'}}
affine.prefetch %0[%i], rw, locality<0>, data : memref<10xf32>
return
@@ -97,7 +97,7 @@ func @invalid_prefetch_rw(%i : index) {
// -----
func @invalid_prefetch_cache_type(%i : index) {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
// expected-error at +1 {{cache type has to be 'data' or 'instr'}}
affine.prefetch %0[%i], read, locality<0>, false : memref<10xf32>
return
@@ -106,9 +106,9 @@ func @invalid_prefetch_cache_type(%i : index) {
// -----
func @dma_start_non_affine_src_index(%arg0 : index) {
- %0 = memref.alloc() : memref<100xf32>
- %1 = memref.alloc() : memref<100xf32, 2>
- %2 = memref.alloc() : memref<1xi32, 4>
+ %0 = alloc() : memref<100xf32>
+ %1 = alloc() : memref<100xf32, 2>
+ %2 = alloc() : memref<1xi32, 4>
%c0 = constant 0 : index
%c64 = constant 64 : index
affine.for %i0 = 0 to 10 {
@@ -123,9 +123,9 @@ func @dma_start_non_affine_src_index(%arg0 : index) {
// -----
func @dma_start_non_affine_dst_index(%arg0 : index) {
- %0 = memref.alloc() : memref<100xf32>
- %1 = memref.alloc() : memref<100xf32, 2>
- %2 = memref.alloc() : memref<1xi32, 4>
+ %0 = alloc() : memref<100xf32>
+ %1 = alloc() : memref<100xf32, 2>
+ %2 = alloc() : memref<1xi32, 4>
%c0 = constant 0 : index
%c64 = constant 64 : index
affine.for %i0 = 0 to 10 {
@@ -140,9 +140,9 @@ func @dma_start_non_affine_dst_index(%arg0 : index) {
// -----
func @dma_start_non_affine_tag_index(%arg0 : index) {
- %0 = memref.alloc() : memref<100xf32>
- %1 = memref.alloc() : memref<100xf32, 2>
- %2 = memref.alloc() : memref<1xi32, 4>
+ %0 = alloc() : memref<100xf32>
+ %1 = alloc() : memref<100xf32, 2>
+ %2 = alloc() : memref<1xi32, 4>
%c0 = constant 0 : index
%c64 = constant 64 : index
affine.for %i0 = 0 to 10 {
@@ -157,9 +157,9 @@ func @dma_start_non_affine_tag_index(%arg0 : index) {
// -----
func @dma_wait_non_affine_tag_index(%arg0 : index) {
- %0 = memref.alloc() : memref<100xf32>
- %1 = memref.alloc() : memref<100xf32, 2>
- %2 = memref.alloc() : memref<1xi32, 4>
+ %0 = alloc() : memref<100xf32>
+ %1 = alloc() : memref<100xf32, 2>
+ %2 = alloc() : memref<1xi32, 4>
%c0 = constant 0 : index
%c64 = constant 64 : index
affine.for %i0 = 0 to 10 {
diff --git a/mlir/test/Dialect/Affine/load-store.mlir b/mlir/test/Dialect/Affine/load-store.mlir
index fa667f5f36a1..84613f436a1e 100644
--- a/mlir/test/Dialect/Affine/load-store.mlir
+++ b/mlir/test/Dialect/Affine/load-store.mlir
@@ -4,7 +4,7 @@
// Test with just loop IVs.
func @test0(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 10 {
%1 = affine.load %0[%i0, %i1] : memref<100x100xf32>
@@ -18,7 +18,7 @@ func @test0(%arg0 : index, %arg1 : index) {
// Test with loop IVs and constants.
func @test1(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 10 {
%1 = affine.load %0[%i0 + 3, %i1 + 7] : memref<100x100xf32>
@@ -35,7 +35,7 @@ func @test1(%arg0 : index, %arg1 : index) {
// Test with loop IVs and function args without 'symbol' keyword (should
// be parsed as dim identifiers).
func @test2(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 10 {
%1 = affine.load %0[%i0 + %arg0, %i1 + %arg1] : memref<100x100xf32>
@@ -52,7 +52,7 @@ func @test2(%arg0 : index, %arg1 : index) {
// Test with loop IVs and function args with 'symbol' keyword (should
// be parsed as symbol identifiers).
func @test3(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 10 {
%1 = affine.load %0[%i0 + symbol(%arg0), %i1 + symbol(%arg1)]
@@ -70,7 +70,7 @@ func @test3(%arg0 : index, %arg1 : index) {
// Test with loop IVs, symbols and constants in nested affine expressions.
func @test4(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 10 {
%1 = affine.load %0[(%i0 + symbol(%arg0)) floordiv 3 + 11,
@@ -88,7 +88,7 @@ func @test4(%arg0 : index, %arg1 : index) {
// Test with swizzled loop IVs.
func @test5(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<10x10x10xf32>
+ %0 = alloc() : memref<10x10x10xf32>
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 10 {
affine.for %i2 = 0 to 10 {
@@ -108,7 +108,7 @@ func @test5(%arg0 : index, %arg1 : index) {
// Dim identifiers are assigned in parse order:
// d0 = %i2, d1 = %arg0, d2 = %i0, d3 = %i1, d4 = %arg1
func @test6(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<10x10x10xf32>
+ %0 = alloc() : memref<10x10x10xf32>
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 10 {
affine.for %i2 = 0 to 10 {
@@ -131,7 +131,7 @@ func @test6(%arg0 : index, %arg1 : index) {
// d0 = %i2, d1 = %i0, d2 = %i1
// s0 = %arg0, s1 = %arg1
func @test6(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<10x10x10xf32>
+ %0 = alloc() : memref<10x10x10xf32>
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 10 {
affine.for %i2 = 0 to 10 {
@@ -157,7 +157,7 @@ func @test6(%arg0 : index, %arg1 : index) {
// Test with operands without special SSA name.
func @test7() {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
affine.for %i0 = 0 to 10 {
%1 = affine.apply affine_map<(d1) -> (d1 + 1)>(%i0)
%2 = affine.load %0[%1] : memref<10xf32>
@@ -183,7 +183,7 @@ func @zero_dim(%arg0 : memref<i32>, %arg1 : memref<i32>) {
// Test with loop IVs and constants.
func @test_prefetch(%arg0 : index, %arg1 : index) {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 10 {
%1 = affine.load %0[%i0 + 3, %i1 + 7] : memref<100x100xf32>
@@ -200,12 +200,12 @@ func @test_prefetch(%arg0 : index, %arg1 : index) {
// Test with just loop IVs.
func @vector_load_vector_store_iv() {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
affine.for %i0 = 0 to 16 {
affine.for %i1 = 0 to 16 step 8 {
%1 = affine.vector_load %0[%i0, %i1] : memref<100x100xf32>, vector<8xf32>
affine.vector_store %1, %0[%i0, %i1] : memref<100x100xf32>, vector<8xf32>
-// CHECK: %[[buf:.*]] = memref.alloc
+// CHECK: %[[buf:.*]] = alloc
// CHECK-NEXT: affine.for %[[i0:.*]] = 0
// CHECK-NEXT: affine.for %[[i1:.*]] = 0
// CHECK-NEXT: %[[val:.*]] = affine.vector_load %[[buf]][%[[i0]], %[[i1]]] : memref<100x100xf32>, vector<8xf32>
@@ -219,12 +219,12 @@ func @vector_load_vector_store_iv() {
// Test with loop IVs and constants.
func @vector_load_vector_store_iv_constant() {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 16 step 4 {
%1 = affine.vector_load %0[%i0 + 3, %i1 + 7] : memref<100x100xf32>, vector<4xf32>
affine.vector_store %1, %0[%i0 + 3, %i1 + 7] : memref<100x100xf32>, vector<4xf32>
-// CHECK: %[[buf:.*]] = memref.alloc
+// CHECK: %[[buf:.*]] = alloc
// CHECK-NEXT: affine.for %[[i0:.*]] = 0
// CHECK-NEXT: affine.for %[[i1:.*]] = 0
// CHECK-NEXT: %[[val:.*]] = affine.vector_load %{{.*}}[%{{.*}} + 3, %{{.*}} + 7] : memref<100x100xf32>, vector<4xf32>
@@ -237,12 +237,12 @@ func @vector_load_vector_store_iv_constant() {
// -----
func @vector_load_vector_store_2d() {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
affine.for %i0 = 0 to 16 step 2{
affine.for %i1 = 0 to 16 step 8 {
%1 = affine.vector_load %0[%i0, %i1] : memref<100x100xf32>, vector<2x8xf32>
affine.vector_store %1, %0[%i0, %i1] : memref<100x100xf32>, vector<2x8xf32>
-// CHECK: %[[buf:.*]] = memref.alloc
+// CHECK: %[[buf:.*]] = alloc
// CHECK-NEXT: affine.for %[[i0:.*]] = 0
// CHECK-NEXT: affine.for %[[i1:.*]] = 0
// CHECK-NEXT: %[[val:.*]] = affine.vector_load %[[buf]][%[[i0]], %[[i1]]] : memref<100x100xf32>, vector<2x8xf32>
diff --git a/mlir/test/Dialect/Affine/loop-tiling-validity.mlir b/mlir/test/Dialect/Affine/loop-tiling-validity.mlir
index 786313bacdc1..6468d7ed3dc0 100644
--- a/mlir/test/Dialect/Affine/loop-tiling-validity.mlir
+++ b/mlir/test/Dialect/Affine/loop-tiling-validity.mlir
@@ -9,7 +9,7 @@
// CHECK-LABEL: func @legal_loop()
func @legal_loop() {
- %0 = memref.alloc() : memref<64xf32>
+ %0 = alloc() : memref<64xf32>
affine.for %i = 0 to 64 {
%1 = affine.load %0[%i] : memref<64xf32>
@@ -32,7 +32,7 @@ func @legal_loop() {
// CHECK-LABEL: func @illegal_loop_with_diag_dependence
func @illegal_loop_with_diag_dependence() {
- %A = memref.alloc() : memref<64x64xf32>
+ %A = alloc() : memref<64x64xf32>
affine.for %i = 0 to 64 {
// expected-remark at above {{tiled code is illegal due to dependences}}
diff --git a/mlir/test/Dialect/Affine/memref-stride-calculation.mlir b/mlir/test/Dialect/Affine/memref-stride-calculation.mlir
index d410e9d825bc..a52de3d858d8 100644
--- a/mlir/test/Dialect/Affine/memref-stride-calculation.mlir
+++ b/mlir/test/Dialect/Affine/memref-stride-calculation.mlir
@@ -2,79 +2,79 @@
func @f(%0: index) {
// CHECK-LABEL: Testing: f
- %1 = memref.alloc() : memref<3x4x5xf32>
+ %1 = alloc() : memref<3x4x5xf32>
// CHECK: MemRefType offset: 0 strides: 20, 5, 1
- %2 = memref.alloc(%0) : memref<3x4x?xf32>
+ %2 = alloc(%0) : memref<3x4x?xf32>
// CHECK: MemRefType offset: 0 strides: ?, ?, 1
- %3 = memref.alloc(%0) : memref<3x?x5xf32>
+ %3 = alloc(%0) : memref<3x?x5xf32>
// CHECK: MemRefType offset: 0 strides: ?, 5, 1
- %4 = memref.alloc(%0) : memref<?x4x5xf32>
+ %4 = alloc(%0) : memref<?x4x5xf32>
// CHECK: MemRefType offset: 0 strides: 20, 5, 1
- %5 = memref.alloc(%0, %0) : memref<?x4x?xf32>
+ %5 = alloc(%0, %0) : memref<?x4x?xf32>
// CHECK: MemRefType offset: 0 strides: ?, ?, 1
- %6 = memref.alloc(%0, %0, %0) : memref<?x?x?xf32>
+ %6 = alloc(%0, %0, %0) : memref<?x?x?xf32>
// CHECK: MemRefType offset: 0 strides: ?, ?, 1
- %11 = memref.alloc() : memref<3x4x5xf32, affine_map<(i, j, k)->(i, j, k)>>
+ %11 = alloc() : memref<3x4x5xf32, affine_map<(i, j, k)->(i, j, k)>>
// CHECK: MemRefType offset: 0 strides: 20, 5, 1
- %b11 = memref.alloc() : memref<3x4x5xf32, offset: 0, strides: [20, 5, 1]>
+ %b11 = alloc() : memref<3x4x5xf32, offset: 0, strides: [20, 5, 1]>
// CHECK: MemRefType offset: 0 strides: 20, 5, 1
- %12 = memref.alloc(%0) : memref<3x4x?xf32, affine_map<(i, j, k)->(i, j, k)>>
+ %12 = alloc(%0) : memref<3x4x?xf32, affine_map<(i, j, k)->(i, j, k)>>
// CHECK: MemRefType offset: 0 strides: ?, ?, 1
- %13 = memref.alloc(%0) : memref<3x?x5xf32, affine_map<(i, j, k)->(i, j, k)>>
+ %13 = alloc(%0) : memref<3x?x5xf32, affine_map<(i, j, k)->(i, j, k)>>
// CHECK: MemRefType offset: 0 strides: ?, 5, 1
- %14 = memref.alloc(%0) : memref<?x4x5xf32, affine_map<(i, j, k)->(i, j, k)>>
+ %14 = alloc(%0) : memref<?x4x5xf32, affine_map<(i, j, k)->(i, j, k)>>
// CHECK: MemRefType offset: 0 strides: 20, 5, 1
- %15 = memref.alloc(%0, %0) : memref<?x4x?xf32, affine_map<(i, j, k)->(i, j, k)>>
+ %15 = alloc(%0, %0) : memref<?x4x?xf32, affine_map<(i, j, k)->(i, j, k)>>
// CHECK: MemRefType offset: 0 strides: ?, ?, 1
- %16 = memref.alloc(%0, %0, %0) : memref<?x?x?xf32, affine_map<(i, j, k)->(i, j, k)>>
+ %16 = alloc(%0, %0, %0) : memref<?x?x?xf32, affine_map<(i, j, k)->(i, j, k)>>
// CHECK: MemRefType offset: 0 strides: ?, ?, 1
- %21 = memref.alloc()[%0] : memref<3x4x5xf32, affine_map<(i, j, k)[M]->(32 * i + 16 * j + M * k + 1)>>
+ %21 = alloc()[%0] : memref<3x4x5xf32, affine_map<(i, j, k)[M]->(32 * i + 16 * j + M * k + 1)>>
// CHECK: MemRefType offset: 1 strides: 32, 16, ?
- %22 = memref.alloc()[%0] : memref<3x4x5xf32, affine_map<(i, j, k)[M]->(32 * i + M * j + 16 * k + 3)>>
+ %22 = alloc()[%0] : memref<3x4x5xf32, affine_map<(i, j, k)[M]->(32 * i + M * j + 16 * k + 3)>>
// CHECK: MemRefType offset: 3 strides: 32, ?, 16
- %b22 = memref.alloc(%0)[%0, %0] : memref<3x4x?xf32, offset: 0, strides: [?, ?, 1]>
+ %b22 = alloc(%0)[%0, %0] : memref<3x4x?xf32, offset: 0, strides: [?, ?, 1]>
// CHECK: MemRefType offset: 0 strides: ?, ?, 1
- %23 = memref.alloc(%0)[%0] : memref<3x?x5xf32, affine_map<(i, j, k)[M]->(M * i + 32 * j + 16 * k + 7)>>
+ %23 = alloc(%0)[%0] : memref<3x?x5xf32, affine_map<(i, j, k)[M]->(M * i + 32 * j + 16 * k + 7)>>
// CHECK: MemRefType offset: 7 strides: ?, 32, 16
- %b23 = memref.alloc(%0)[%0] : memref<3x?x5xf32, offset: 0, strides: [?, 5, 1]>
+ %b23 = alloc(%0)[%0] : memref<3x?x5xf32, offset: 0, strides: [?, 5, 1]>
// CHECK: MemRefType offset: 0 strides: ?, 5, 1
- %24 = memref.alloc(%0)[%0] : memref<3x?x5xf32, affine_map<(i, j, k)[M]->(M * i + 32 * j + 16 * k + M)>>
+ %24 = alloc(%0)[%0] : memref<3x?x5xf32, affine_map<(i, j, k)[M]->(M * i + 32 * j + 16 * k + M)>>
// CHECK: MemRefType offset: ? strides: ?, 32, 16
- %b24 = memref.alloc(%0)[%0, %0] : memref<3x?x5xf32, offset: ?, strides: [?, 32, 16]>
+ %b24 = alloc(%0)[%0, %0] : memref<3x?x5xf32, offset: ?, strides: [?, 32, 16]>
// CHECK: MemRefType offset: ? strides: ?, 32, 16
- %25 = memref.alloc(%0, %0)[%0, %0] : memref<?x?x16xf32, affine_map<(i, j, k)[M, N]->(M * i + N * j + k + 1)>>
+ %25 = alloc(%0, %0)[%0, %0] : memref<?x?x16xf32, affine_map<(i, j, k)[M, N]->(M * i + N * j + k + 1)>>
// CHECK: MemRefType offset: 1 strides: ?, ?, 1
- %b25 = memref.alloc(%0, %0)[%0, %0] : memref<?x?x16xf32, offset: 1, strides: [?, ?, 1]>
+ %b25 = alloc(%0, %0)[%0, %0] : memref<?x?x16xf32, offset: 1, strides: [?, ?, 1]>
// CHECK: MemRefType offset: 1 strides: ?, ?, 1
- %26 = memref.alloc(%0)[] : memref<?xf32, affine_map<(i)[M]->(i)>>
+ %26 = alloc(%0)[] : memref<?xf32, affine_map<(i)[M]->(i)>>
// CHECK: MemRefType offset: 0 strides: 1
- %27 = memref.alloc()[%0] : memref<5xf32, affine_map<(i)[M]->(M)>>
+ %27 = alloc()[%0] : memref<5xf32, affine_map<(i)[M]->(M)>>
// CHECK: MemRefType memref<5xf32, affine_map<(d0)[s0] -> (s0)>> cannot be converted to strided form
- %28 = memref.alloc()[%0] : memref<5xf32, affine_map<(i)[M]->(123)>>
+ %28 = alloc()[%0] : memref<5xf32, affine_map<(i)[M]->(123)>>
// CHECK: MemRefType memref<5xf32, affine_map<(d0)[s0] -> (123)>> cannot be converted to strided form
- %29 = memref.alloc()[%0] : memref<f32, affine_map<()[M]->(M)>>
+ %29 = alloc()[%0] : memref<f32, affine_map<()[M]->(M)>>
// CHECK: MemRefType offset: ? strides:
- %30 = memref.alloc()[%0] : memref<f32, affine_map<()[M]->(123)>>
+ %30 = alloc()[%0] : memref<f32, affine_map<()[M]->(123)>>
// CHECK: MemRefType offset: 123 strides:
- %100 = memref.alloc(%0, %0)[%0, %0] : memref<?x?x16xf32, affine_map<(i, j, k)[M, N]->(i + j, j, k)>, affine_map<(i, j, k)[M, N]->(M * i + N * j + k + 1)>>
+ %100 = alloc(%0, %0)[%0, %0] : memref<?x?x16xf32, affine_map<(i, j, k)[M, N]->(i + j, j, k)>, affine_map<(i, j, k)[M, N]->(M * i + N * j + k + 1)>>
// CHECK: MemRefType memref<?x?x16xf32, affine_map<(d0, d1, d2)[s0, s1] -> (d0 + d1, d1, d2)>, affine_map<(d0, d1, d2)[s0, s1] -> (d0 * s0 + d1 * s1 + d2 + 1)>> cannot be converted to strided form
- %101 = memref.alloc() : memref<3x4x5xf32, affine_map<(i, j, k)->(i floordiv 4 + j + k)>>
+ %101 = alloc() : memref<3x4x5xf32, affine_map<(i, j, k)->(i floordiv 4 + j + k)>>
// CHECK: MemRefType memref<3x4x5xf32, affine_map<(d0, d1, d2) -> (d0 floordiv 4 + d1 + d2)>> cannot be converted to strided form
- %102 = memref.alloc() : memref<3x4x5xf32, affine_map<(i, j, k)->(i ceildiv 4 + j + k)>>
+ %102 = alloc() : memref<3x4x5xf32, affine_map<(i, j, k)->(i ceildiv 4 + j + k)>>
// CHECK: MemRefType memref<3x4x5xf32, affine_map<(d0, d1, d2) -> (d0 ceildiv 4 + d1 + d2)>> cannot be converted to strided form
- %103 = memref.alloc() : memref<3x4x5xf32, affine_map<(i, j, k)->(i mod 4 + j + k)>>
+ %103 = alloc() : memref<3x4x5xf32, affine_map<(i, j, k)->(i mod 4 + j + k)>>
// CHECK: MemRefType memref<3x4x5xf32, affine_map<(d0, d1, d2) -> (d0 mod 4 + d1 + d2)>> cannot be converted to strided form
- %200 = memref.alloc()[%0, %0, %0] : memref<3x4x5xf32, affine_map<(i, j, k)[M, N, K]->(M * i + N * i + N * j + K * k - (M + N - 20)* i)>>
+ %200 = alloc()[%0, %0, %0] : memref<3x4x5xf32, affine_map<(i, j, k)[M, N, K]->(M * i + N * i + N * j + K * k - (M + N - 20)* i)>>
// CHECK: MemRefType offset: 0 strides: 20, ?, ?
- %201 = memref.alloc()[%0, %0, %0] : memref<3x4x5xf32, affine_map<(i, j, k)[M, N, K]->(M * i + N * i + N * K * j + K * K * k - (M + N - 20) * (i + 1))>>
+ %201 = alloc()[%0, %0, %0] : memref<3x4x5xf32, affine_map<(i, j, k)[M, N, K]->(M * i + N * i + N * K * j + K * K * k - (M + N - 20) * (i + 1))>>
// CHECK: MemRefType offset: ? strides: 20, ?, ?
- %202 = memref.alloc()[%0, %0, %0] : memref<3x4x5xf32, affine_map<(i, j, k)[M, N, K]->(M * (i + 1) + j + k - M)>>
+ %202 = alloc()[%0, %0, %0] : memref<3x4x5xf32, affine_map<(i, j, k)[M, N, K]->(M * (i + 1) + j + k - M)>>
// CHECK: MemRefType offset: 0 strides: ?, 1, 1
- %203 = memref.alloc()[%0, %0, %0] : memref<3x4x5xf32, affine_map<(i, j, k)[M, N, K]->(M + M * (i + N * (j + K * k)))>>
+ %203 = alloc()[%0, %0, %0] : memref<3x4x5xf32, affine_map<(i, j, k)[M, N, K]->(M + M * (i + N * (j + K * k)))>>
// CHECK: MemRefType offset: ? strides: ?, ?, ?
return
diff --git a/mlir/test/Dialect/Affine/ops.mlir b/mlir/test/Dialect/Affine/ops.mlir
index 88895975b396..ad2fb5fd6a59 100644
--- a/mlir/test/Dialect/Affine/ops.mlir
+++ b/mlir/test/Dialect/Affine/ops.mlir
@@ -97,7 +97,7 @@ func @affine_max(%arg0 : index, %arg1 : index, %arg2 : index) {
func @valid_symbols(%arg0: index, %arg1: index, %arg2: index) {
%c1 = constant 1 : index
%c0 = constant 0 : index
- %0 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
+ %0 = alloc(%arg0, %arg1) : memref<?x?xf32>
affine.for %arg3 = 0 to %arg2 step 768 {
%13 = dim %0, %c1 : memref<?x?xf32>
affine.for %arg4 = 0 to %13 step 264 {
diff --git a/mlir/test/Dialect/Affine/parallelize.mlir b/mlir/test/Dialect/Affine/parallelize.mlir
index f0185f2d2cc4..3f7a79daf91d 100644
--- a/mlir/test/Dialect/Affine/parallelize.mlir
+++ b/mlir/test/Dialect/Affine/parallelize.mlir
@@ -4,8 +4,8 @@
// CHECK-LABEL: func @reduce_window_max() {
func @reduce_window_max() {
%cst = constant 0.000000e+00 : f32
- %0 = memref.alloc() : memref<1x8x8x64xf32>
- %1 = memref.alloc() : memref<1x18x18x64xf32>
+ %0 = alloc() : memref<1x8x8x64xf32>
+ %1 = alloc() : memref<1x18x18x64xf32>
affine.for %arg0 = 0 to 1 {
affine.for %arg1 = 0 to 8 {
affine.for %arg2 = 0 to 8 {
@@ -40,8 +40,8 @@ func @reduce_window_max() {
}
// CHECK: %[[cst:.*]] = constant 0.000000e+00 : f32
-// CHECK: %[[v0:.*]] = memref.alloc() : memref<1x8x8x64xf32>
-// CHECK: %[[v1:.*]] = memref.alloc() : memref<1x18x18x64xf32>
+// CHECK: %[[v0:.*]] = alloc() : memref<1x8x8x64xf32>
+// CHECK: %[[v1:.*]] = alloc() : memref<1x18x18x64xf32>
// CHECK: affine.parallel (%[[arg0:.*]]) = (0) to (1) {
// CHECK: affine.parallel (%[[arg1:.*]]) = (0) to (8) {
// CHECK: affine.parallel (%[[arg2:.*]]) = (0) to (8) {
@@ -75,9 +75,9 @@ func @reduce_window_max() {
// CHECK: }
func @loop_nest_3d_outer_two_parallel(%N : index) {
- %0 = memref.alloc() : memref<1024 x 1024 x vector<64xf32>>
- %1 = memref.alloc() : memref<1024 x 1024 x vector<64xf32>>
- %2 = memref.alloc() : memref<1024 x 1024 x vector<64xf32>>
+ %0 = alloc() : memref<1024 x 1024 x vector<64xf32>>
+ %1 = alloc() : memref<1024 x 1024 x vector<64xf32>>
+ %2 = alloc() : memref<1024 x 1024 x vector<64xf32>>
affine.for %i = 0 to %N {
affine.for %j = 0 to %N {
%7 = affine.load %2[%i, %j] : memref<1024x1024xvector<64xf32>>
@@ -108,7 +108,7 @@ func @unknown_op_conservative() {
// CHECK-LABEL: non_affine_load
func @non_affine_load() {
- %0 = memref.alloc() : memref<100 x f32>
+ %0 = alloc() : memref<100 x f32>
affine.for %i = 0 to 100 {
// CHECK: affine.for %{{.*}} = 0 to 100 {
load %0[%i] : memref<100 x f32>
diff --git a/mlir/test/Dialect/Affine/slicing-utils.mlir b/mlir/test/Dialect/Affine/slicing-utils.mlir
index 9ce5cb1fdd72..e11a66b0d0eb 100644
--- a/mlir/test/Dialect/Affine/slicing-utils.mlir
+++ b/mlir/test/Dialect/Affine/slicing-utils.mlir
@@ -17,7 +17,7 @@
// FWDBWD-LABEL: slicing_test
func @slicing_test() {
// Fake 0 to align on 1 and match ASCII art.
- %0 = memref.alloc() : memref<1xi32>
+ %0 = alloc() : memref<1xi32>
// FWD: matched: %[[v1:.*]] {{.*}} forward static slice:
// FWD-NEXT: %[[v5:.*]] {{.*}} -> i5
diff --git a/mlir/test/Dialect/Affine/unroll.mlir b/mlir/test/Dialect/Affine/unroll.mlir
index f829588508b6..67fa20e4716a 100644
--- a/mlir/test/Dialect/Affine/unroll.mlir
+++ b/mlir/test/Dialect/Affine/unroll.mlir
@@ -265,9 +265,9 @@ func @loop_nest_outer_unroll() {
// count threshold set to 2.
// SHORT-LABEL: func @loop_nest_seq_long() -> i32 {
func @loop_nest_seq_long() -> i32 {
- %A = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2>
- %B = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2>
- %C = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2>
+ %A = alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2>
+ %B = alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2>
+ %C = alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2>
%zero = constant 0 : i32
%one = constant 1 : i32
@@ -279,9 +279,9 @@ func @loop_nest_seq_long() -> i32 {
affine.for %n0 = 0 to 512 {
// CHECK: affine.for %arg1 = 0 to 8
affine.for %n1 = 0 to 8 {
- memref.store %one, %A[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2>
- memref.store %two, %B[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2>
- memref.store %zero, %C[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2>
+ store %one, %A[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2>
+ store %two, %B[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2>
+ store %zero, %C[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2>
}
}
@@ -306,7 +306,7 @@ func @loop_nest_seq_long() -> i32 {
%c2 = "affine.apply" (%x, %k2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index
%s1 = load %C[%j1, %c2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2>
%s2 = "addi32"(%s0, %s1) : (i32, i32) -> i32
- memref.store %s2, %C[%j1, %c2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2>
+ store %s2, %C[%j1, %c2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2>
}
}
"op4"() : () -> ()
diff --git a/mlir/test/Dialect/Async/async-parallel-for.mlir b/mlir/test/Dialect/Async/async-parallel-for.mlir
index d498fe80906b..ad21650ab0ee 100644
--- a/mlir/test/Dialect/Async/async-parallel-for.mlir
+++ b/mlir/test/Dialect/Async/async-parallel-for.mlir
@@ -6,14 +6,14 @@ func @loop_1d(%arg0: index, %arg1: index, %arg2: index, %arg3: memref<?xf32>) {
// CHECK: scf.for
// CHECK: %[[TOKEN:.*]] = async.execute {
// CHECK: scf.for
- // CHECK: memref.store
+ // CHECK: store
// CHECK: async.yield
// CHECK: }
// CHECK: async.add_to_group %[[TOKEN]], %[[GROUP]]
// CHECK: async.await_all %[[GROUP]]
scf.parallel (%i) = (%arg0) to (%arg1) step (%arg2) {
%one = constant 1.0 : f32
- memref.store %one, %arg3[%i] : memref<?xf32>
+ store %one, %arg3[%i] : memref<?xf32>
}
return
@@ -29,7 +29,7 @@ func @loop_2d(%arg0: index, %arg1: index, %arg2: index, // lb, ub, step
// CHECK: %[[TOKEN:.*]] = async.execute {
// CHECK: scf.for
// CHECK: scf.for
- // CHECK: memref.store
+ // CHECK: store
// CHECK: async.yield
// CHECK: }
// CHECK: async.add_to_group %[[TOKEN]], %[[GROUP]]
@@ -37,7 +37,7 @@ func @loop_2d(%arg0: index, %arg1: index, %arg2: index, // lb, ub, step
scf.parallel (%i0, %i1) = (%arg0, %arg3) to (%arg1, %arg4)
step (%arg2, %arg5) {
%one = constant 1.0 : f32
- memref.store %one, %arg6[%i0, %i1] : memref<?x?xf32>
+ store %one, %arg6[%i0, %i1] : memref<?x?xf32>
}
return
diff --git a/mlir/test/Dialect/Async/async-to-async-runtime.mlir b/mlir/test/Dialect/Async/async-to-async-runtime.mlir
index a57c283b3de2..7d4d05538629 100644
--- a/mlir/test/Dialect/Async/async-to-async-runtime.mlir
+++ b/mlir/test/Dialect/Async/async-to-async-runtime.mlir
@@ -4,7 +4,7 @@
func @execute_no_async_args(%arg0: f32, %arg1: memref<1xf32>) {
%token = async.execute {
%c0 = constant 0 : index
- memref.store %arg0, %arg1[%c0] : memref<1xf32>
+ store %arg0, %arg1[%c0] : memref<1xf32>
async.yield
}
async.await %token : !async.token
@@ -28,7 +28,7 @@ func @execute_no_async_args(%arg0: f32, %arg1: memref<1xf32>) {
// Resume coroutine after suspension.
// CHECK: ^[[RESUME]]:
-// CHECK: memref.store
+// CHECK: store
// CHECK: async.runtime.set_available %[[TOKEN]]
// Delete coroutine.
@@ -50,12 +50,12 @@ func @nested_async_execute(%arg0: f32, %arg1: f32, %arg2: memref<1xf32>) {
%token1 = async.execute {
%c1 = constant 1: index
- memref.store %arg0, %arg2[%c0] : memref<1xf32>
+ store %arg0, %arg2[%c0] : memref<1xf32>
async.yield
}
async.await %token1 : !async.token
- memref.store %arg1, %arg2[%c0] : memref<1xf32>
+ store %arg1, %arg2[%c0] : memref<1xf32>
async.yield
}
// CHECK: async.runtime.await %[[TOKEN]]
@@ -77,7 +77,7 @@ func @nested_async_execute(%arg0: f32, %arg1: f32, %arg2: memref<1xf32>) {
// CHECK-SAME: ^[[SUSPEND:.*]], ^[[RESUME:.*]], ^[[CLEANUP:.*]]
// CHECK: ^[[RESUME]]:
-// CHECK: memref.store
+// CHECK: store
// CHECK: async.runtime.set_available %[[TOKEN]]
// Function outlined from the outer async.execute operation.
@@ -103,7 +103,7 @@ func @nested_async_execute(%arg0: f32, %arg1: f32, %arg2: memref<1xf32>) {
// Set token available after second resumption.
// CHECK: ^[[RESUME_1]]:
-// CHECK: memref.store
+// CHECK: store
// CHECK: async.runtime.set_available %[[TOKEN]]
// CHECK: ^[[CLEANUP]]:
@@ -116,13 +116,13 @@ func @async_execute_token_dependency(%arg0: f32, %arg1: memref<1xf32>) {
// CHECK: %[[TOKEN:.*]] = call @async_execute_fn
%token = async.execute {
%c0 = constant 0 : index
- memref.store %arg0, %arg1[%c0] : memref<1xf32>
+ store %arg0, %arg1[%c0] : memref<1xf32>
async.yield
}
// CHECK: call @async_execute_fn_0(%[[TOKEN]], %arg0, %arg1)
%token_0 = async.execute [%token] {
%c0 = constant 0 : index
- memref.store %arg0, %arg1[%c0] : memref<1xf32>
+ store %arg0, %arg1[%c0] : memref<1xf32>
async.yield
}
return
@@ -157,7 +157,7 @@ func @async_execute_token_dependency(%arg0: f32, %arg1: memref<1xf32>) {
// Emplace result token after second resumption.
// CHECK: ^[[RESUME_1]]:
-// CHECK: memref.store
+// CHECK: store
// CHECK: async.runtime.set_available %[[TOKEN]]
// CHECK: ^[[CLEANUP]]:
diff --git a/mlir/test/Dialect/GPU/multiple-all-reduce.mlir b/mlir/test/Dialect/GPU/multiple-all-reduce.mlir
index c01562e760bd..497adb50c142 100644
--- a/mlir/test/Dialect/GPU/multiple-all-reduce.mlir
+++ b/mlir/test/Dialect/GPU/multiple-all-reduce.mlir
@@ -1,9 +1,9 @@
// RUN: mlir-opt --gpu-kernel-outlining --convert-gpu-to-nvvm %s | FileCheck %s
func @main() {
- %data = memref.alloc() : memref<2x6xf32>
- %sum = memref.alloc() : memref<2xf32>
- %mul = memref.alloc() : memref<2xf32>
+ %data = alloc() : memref<2x6xf32>
+ %sum = alloc() : memref<2xf32>
+ %mul = alloc() : memref<2xf32>
%c1 = constant 1 : index
// ADD + MUL
@@ -11,9 +11,9 @@ func @main() {
threads(%tx, %ty, %tz) in (%block_x = %c1, %block_y = %c1, %block_z = %c1) {
%val = load %data[%bx, %tx] : memref<2x6xf32>
%reduced0 = "gpu.all_reduce"(%val) ({}) { op = "add" } : (f32) -> (f32)
- memref.store %reduced0, %sum[%bx] : memref<2xf32>
+ store %reduced0, %sum[%bx] : memref<2xf32>
%reduced1 = "gpu.all_reduce"(%val) ({}) { op = "mul" } : (f32) -> (f32)
- memref.store %reduced1, %mul[%bx] : memref<2xf32>
+ store %reduced1, %mul[%bx] : memref<2xf32>
gpu.terminator
}
diff --git a/mlir/test/Dialect/Linalg/affine.mlir b/mlir/test/Dialect/Linalg/affine.mlir
index 5042cb908540..0df7db06e4c4 100644
--- a/mlir/test/Dialect/Linalg/affine.mlir
+++ b/mlir/test/Dialect/Linalg/affine.mlir
@@ -12,9 +12,9 @@
func @matmul(%arg0: memref<?xi8>, %M: index, %N: index, %K: index) {
%c0 = constant 0 : index
%c1 = constant 1 : index
- %A = memref.view %arg0[%c0][%M, %K] : memref<?xi8> to memref<?x?xf32>
- %B = memref.view %arg0[%c0][%K, %N] : memref<?xi8> to memref<?x?xf32>
- %C = memref.view %arg0[%c0][%M, %N] : memref<?xi8> to memref<?x?xf32>
+ %A = view %arg0[%c0][%M, %K] : memref<?xi8> to memref<?x?xf32>
+ %B = view %arg0[%c0][%K, %N] : memref<?xi8> to memref<?x?xf32>
+ %C = view %arg0[%c0][%M, %N] : memref<?xi8> to memref<?x?xf32>
linalg.matmul ins(%A, %B: memref<?x?xf32>, memref<?x?xf32>)
outs(%C: memref<?x?xf32>)
return
@@ -24,9 +24,9 @@ func @matmul(%arg0: memref<?xi8>, %M: index, %N: index, %K: index) {
// CHECK-SAME: [[M:arg[0-9]+]]: index
// CHECK-SAME: [[N:arg[0-9]+]]: index
// CHECK-SAME: [[K:arg[0-9]+]]: index
-// CHECK: %[[A:.*]] = memref.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
-// CHECK: %[[B:.*]] = memref.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
-// CHECK: %[[C:.*]] = memref.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECK: %[[A:.*]] = std.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECK: %[[B:.*]] = std.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECK: %[[C:.*]] = std.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
// CHECK: affine.for %{{.*}} = 0 to %{{.*}} {
// CHECK: affine.for %{{.*}} = 0 to %{{.*}} {
// CHECK: affine.for %{{.*}} = 0 to %{{.*}} {
diff --git a/mlir/test/Dialect/Linalg/bufferize.mlir b/mlir/test/Dialect/Linalg/bufferize.mlir
index 9479a08bbcf5..1b5b047b9bdd 100644
--- a/mlir/test/Dialect/Linalg/bufferize.mlir
+++ b/mlir/test/Dialect/Linalg/bufferize.mlir
@@ -12,7 +12,7 @@
// CHECK-LABEL: func @basic(
// CHECK-SAME: %[[TENSOR:.*]]: tensor<4xf32>) -> tensor<4xf32> {
// CHECK: %[[MEMREF:.*]] = tensor_to_memref %[[TENSOR]] : memref<4xf32>
-// CHECK: %[[RESULT_MEMREF:.*]] = memref.alloc() : memref<4xf32>
+// CHECK: %[[RESULT_MEMREF:.*]] = alloc() : memref<4xf32>
// CHECK: linalg.generic {indexing_maps = [#map, #map], iterator_types = ["parallel"]}
// CHECK-SAME: ins(%[[MEMREF]] : memref<4xf32>)
// CHECK-SAME: outs(%[[RESULT_MEMREF]] : memref<4xf32>) {
@@ -45,7 +45,7 @@ func @basic(%arg0: tensor<4xf32>) -> tensor<4xf32> {
// CHECK: #map = affine_map<(d0) -> (d0)>
// CHECK-LABEL: func @init_tensor(
// CHECK-SAME: %[[IN:.*]]: tensor<?xf32>, %[[SIZE:.*]]: index)
-// CHECK: %[[OUT_BUF:.*]] = memref.alloc(%[[SIZE]]) : memref<?xf32>
+// CHECK: %[[OUT_BUF:.*]] = alloc(%[[SIZE]]) : memref<?xf32>
// CHECK: %[[MEMREF:.*]] = tensor_to_memref %[[IN]] : memref<?xf32>
// CHECK: linalg.generic
// CHECK-SAME: ins(%[[MEMREF]] : memref<?xf32>)
@@ -70,8 +70,8 @@ func @init_tensor(%in : tensor<?xf32>, %size: index) -> tensor<?xf32> {
#map0 = affine_map<(d0) -> (d0)>
// CHECK-LABEL: func @multiple_results
-// CHECK: %[[RESULT0:.*]] = memref.alloc() : memref<4xf32>
-// CHECK: %[[RESULT1:.*]] = memref.alloc() : memref<4xf32>
+// CHECK: %[[RESULT0:.*]] = alloc() : memref<4xf32>
+// CHECK: %[[RESULT1:.*]] = alloc() : memref<4xf32>
// CHECK: linalg.generic
// CHECK-SAME: ins(%{{.*}} : memref<4xf32>)
// CHECK-SAME: outs(%[[RESULT0]], %[[RESULT1]] : memref<4xf32>, memref<4xf32>)
@@ -94,8 +94,8 @@ func @multiple_results(%arg0: tensor<4xf32>) -> (tensor<4xf32>, tensor<4xf32>) {
#map0 = affine_map<(d0) -> (d0)>
// CHECK-LABEL: func @multiple_results_indexed
-// CHECK: %[[RESULT0:.*]] = memref.alloc() : memref<4xi32>
-// CHECK: %[[RESULT1:.*]] = memref.alloc() : memref<4xi32>
+// CHECK: %[[RESULT0:.*]] = alloc() : memref<4xi32>
+// CHECK: %[[RESULT1:.*]] = alloc() : memref<4xi32>
// CHECK: linalg.indexed_generic
// CHECK-SAME: ins(%{{.*}} : memref<4xi32>)
// CHECK-SAME: outs(%[[RESULT0]], %[[RESULT1]] : memref<4xi32>, memref<4xi32>)
@@ -129,8 +129,8 @@ func @multiple_results_indexed(%arg0: tensor<4xi32>)
// CHECK: %[[MEMREF_ARG:.*]] = tensor_to_memref %[[ARG]] : memref<?x?xf32>
// CHECK: %[[DIM0:.*]] = dim %[[ARG]], %[[C0]] : tensor<?x?xf32>
// CHECK: %[[DIM1:.*]] = dim %[[ARG]], %[[C1]] : tensor<?x?xf32>
-// CHECK: %[[RESULT0:.*]] = memref.alloc(%[[DIM0]], %[[DIM1]]) : memref<?x?xf32>
-// CHECK: %[[RESULT1:.*]] = memref.alloc(%[[DIM0]], %[[DIM1]]) : memref<?x?xf32>
+// CHECK: %[[RESULT0:.*]] = alloc(%[[DIM0]], %[[DIM1]]) : memref<?x?xf32>
+// CHECK: %[[RESULT1:.*]] = alloc(%[[DIM0]], %[[DIM1]]) : memref<?x?xf32>
// CHECK: linalg.generic
// CHECK-SAME: ins(%[[MEMREF_ARG]] : memref<?x?xf32>)
// CHECK-SAME: outs(%[[RESULT0]], %[[RESULT1]] : memref<?x?xf32>, memref<?x?xf32>)
@@ -167,7 +167,7 @@ func @dynamic_results(%arg0: tensor<?x?xf32>)
// CHECK-SAME: %[[ARG1_TENSOR:.*]]: tensor<3x2xf32>) -> tensor<3x2xf32> {
// CHECK: %[[ARG0_MEMREF:.*]] = tensor_to_memref %[[ARG0_TENSOR]] : memref<2x3x4xvector<3x4xi4>>
// CHECK: %[[ARG1_MEMREF:.*]] = tensor_to_memref %[[ARG1_TENSOR]] : memref<3x2xf32>
-// CHECK: %[[INIT_BUFFER:.*]] = memref.alloc() : memref<3x2xf32>
+// CHECK: %[[INIT_BUFFER:.*]] = alloc() : memref<3x2xf32>
// CHECK: linalg.copy(%[[ARG1_MEMREF]], %[[INIT_BUFFER]]) : memref<3x2xf32>, memref<3x2xf32>
// CHECK: linalg.generic
// CHECK-SAME: ins(%[[ARG0_MEMREF]] : memref<2x3x4xvector<3x4xi4>>)
@@ -199,7 +199,7 @@ func @bufferize_subtensor(%t : tensor<?x?xf32>) -> (tensor<2x3xf32>, tensor<2x?x
%i0 = call @make_index() : () -> index
// CHECK: %[[M0:.*]] = tensor_to_memref %[[T]] : memref<?x?xf32>
- // CHECK-NEXT: %[[A0:.*]] = memref.alloc() : memref<2x3xf32>
+ // CHECK-NEXT: %[[A0:.*]] = alloc() : memref<2x3xf32>
// CHECK-NEXT: %[[SM0:.*]] = subview %[[M0]][0, 0] [2, 3] [1, 1]
// CHECK-SAME: memref<?x?xf32> to memref<2x3xf32, #[[$MAP0]]>
// CHECK-NEXT: linalg.copy(%[[SM0]], %[[A0]]) : memref<2x3xf32, #[[$MAP0]]>, memref<2x3xf32>
@@ -207,7 +207,7 @@ func @bufferize_subtensor(%t : tensor<?x?xf32>) -> (tensor<2x3xf32>, tensor<2x?x
%st0 = subtensor %t[0, 0][2, 3][1, 1] : tensor<?x?xf32> to tensor<2x3xf32>
// CHECK: %[[M1:.*]] = tensor_to_memref %[[T]] : memref<?x?xf32>
- // CHECK-NEXT: %[[A1:.*]] = memref.alloc(%[[IDX]]) : memref<2x?xf32>
+ // CHECK-NEXT: %[[A1:.*]] = alloc(%[[IDX]]) : memref<2x?xf32>
// CHECK-NEXT: %[[SM1:.*]] = subview %[[M1]][0, %[[IDX]]] [2, %[[IDX]]] [1, 2]
// CHECK-SAME: memref<?x?xf32> to memref<2x?xf32, #[[$MAP1]]>
// CHECK-NEXT: linalg.copy(%[[SM1]], %[[A1]]) : memref<2x?xf32, #[[$MAP1]]>, memref<2x?xf32>
@@ -243,7 +243,7 @@ func @bufferize_subtensor_insert(%t : tensor<?x?xf32>, %st0 : tensor<2x3xf32>, %
// CHECK-DAG: %[[SM0:.*]] = tensor_to_memref %[[ST0]] : memref<2x3xf32>
// CHECK-NEXT: %[[DIM0:.*]] = dim %[[T]], %[[C0]] : tensor<?x?xf32>
// CHECK-NEXT: %[[DIM1:.*]] = dim %[[T]], %[[C1]] : tensor<?x?xf32>
- // CHECK-NEXT: %[[M0_COPY:.*]] = memref.alloc(%[[DIM0]], %[[DIM1]]) : memref<?x?xf32>
+ // CHECK-NEXT: %[[M0_COPY:.*]] = alloc(%[[DIM0]], %[[DIM1]]) : memref<?x?xf32>
// CHECK-NEXT: linalg.copy(%[[M0]], %[[M0_COPY]]) : memref<?x?xf32>, memref<?x?xf32>
// CHECK-NEXT: %[[SUBVIEW0:.*]] = subview %[[M0_COPY]][0, 0] [2, 3] [1, 1]
// CHECK-SAME: memref<?x?xf32> to memref<2x3xf32, #[[$MAP0]]>
@@ -253,7 +253,7 @@ func @bufferize_subtensor_insert(%t : tensor<?x?xf32>, %st0 : tensor<2x3xf32>, %
// CHECK-DAG: %[[M1:.*]] = tensor_to_memref %[[T]] : memref<?x?xf32>
// CHECK-DAG: %[[SM1:.*]] = tensor_to_memref %[[ST1]] : memref<2x?xf32>
- // CHECK-NEXT: %[[M1_COPY:.*]] = memref.alloc(%[[DIM0]], %[[DIM1]]) : memref<?x?xf32>
+ // CHECK-NEXT: %[[M1_COPY:.*]] = alloc(%[[DIM0]], %[[DIM1]]) : memref<?x?xf32>
// CHECK-NEXT: linalg.copy(%[[M1]], %[[M1_COPY]]) : memref<?x?xf32>, memref<?x?xf32>
// CHECK-NEXT: %[[SUBVIEW1:.*]] = subview %[[M1_COPY]][0, %[[IDX]]] [2, %[[IDX]]] [1, 2]
// CHECK-SAME: memref<?x?xf32> to memref<2x?xf32, #[[$MAP1]]>
diff --git a/mlir/test/Dialect/Linalg/canonicalize.mlir b/mlir/test/Dialect/Linalg/canonicalize.mlir
index b65b1480726e..2fb5eb3086e6 100644
--- a/mlir/test/Dialect/Linalg/canonicalize.mlir
+++ b/mlir/test/Dialect/Linalg/canonicalize.mlir
@@ -6,9 +6,9 @@ func @memref_cast(%a: index, %b: index) -> memref<?x?xf32> {
%c1 = constant 1 : index
%c8 = constant 8 : index
%c16 = constant 16 : index
- %1 = memref.alloc (%b) : memref<?xi8>
- %2 = memref.view %1[%c0][] : memref<?xi8> to memref<16x16xf32>
- %3 = memref.cast %2 : memref<16x16xf32> to memref<?x?xf32>
+ %1 = alloc (%b) : memref<?xi8>
+ %2 = view %1[%c0][] : memref<?xi8> to memref<16x16xf32>
+ %3 = memref_cast %2 : memref<16x16xf32> to memref<?x?xf32>
// CHECK: linalg.matmul ins({{.*}}memref<16x16xf32>, memref<16x16xf32>) outs({{.*}}memref<16x16xf32>)
linalg.matmul ins(%3, %3: memref<?x?xf32>, memref<?x?xf32>)
diff --git a/mlir/test/Dialect/Linalg/fold-affine-min-scf.mlir b/mlir/test/Dialect/Linalg/fold-affine-min-scf.mlir
index 200ed8475950..72d76b3d1869 100644
--- a/mlir/test/Dialect/Linalg/fold-affine-min-scf.mlir
+++ b/mlir/test/Dialect/Linalg/fold-affine-min-scf.mlir
@@ -13,21 +13,21 @@ func @scf_for(%A : memref<i64>, %step : index) {
// CHECK: scf.for
// CHECK-NEXT: %[[C2:.*]] = constant 2 : index
// CHECK-NEXT: %[[C2I64:.*]] = index_cast %[[C2:.*]]
- // CHECK-NEXT: memref.store %[[C2I64]], %{{.*}}[] : memref<i64>
+ // CHECK-NEXT: store %[[C2I64]], %{{.*}}[] : memref<i64>
scf.for %i = %c0 to %c4 step %c2 {
%1 = affine.min affine_map<(d0, d1)[] -> (2, d1 - d0)> (%i, %c4)
%2 = index_cast %1: index to i64
- memref.store %2, %A[]: memref<i64>
+ store %2, %A[]: memref<i64>
}
// CHECK: scf.for
// CHECK-NEXT: %[[C2:.*]] = constant 2 : index
// CHECK-NEXT: %[[C2I64:.*]] = index_cast %[[C2:.*]]
- // CHECK-NEXT: memref.store %[[C2I64]], %{{.*}}[] : memref<i64>
+ // CHECK-NEXT: store %[[C2I64]], %{{.*}}[] : memref<i64>
scf.for %i = %c1 to %c7 step %c2 {
%1 = affine.min affine_map<(d0)[s0] -> (s0 - d0, 2)> (%i)[%c7]
%2 = index_cast %1: index to i64
- memref.store %2, %A[]: memref<i64>
+ store %2, %A[]: memref<i64>
}
// This should not canonicalize because: 4 - %i may take the value 1 < 2.
@@ -37,7 +37,7 @@ func @scf_for(%A : memref<i64>, %step : index) {
scf.for %i = %c1 to %c4 step %c2 {
%1 = affine.min affine_map<(d0)[s0] -> (2, s0 - d0)> (%i)[%c4]
%2 = index_cast %1: index to i64
- memref.store %2, %A[]: memref<i64>
+ store %2, %A[]: memref<i64>
}
// This should not canonicalize because: 16 - %i may take the value 15 < 1024.
@@ -47,7 +47,7 @@ func @scf_for(%A : memref<i64>, %step : index) {
scf.for %i = %c1 to %c16 step %c1024 {
%1 = affine.min affine_map<(d0) -> (1024, 16 - d0)> (%i)
%2 = index_cast %1: index to i64
- memref.store %2, %A[]: memref<i64>
+ store %2, %A[]: memref<i64>
}
// This example should simplify but affine_map is currently missing
@@ -62,7 +62,7 @@ func @scf_for(%A : memref<i64>, %step : index) {
scf.for %i = %c0 to %ub step %step {
%1 = affine.min affine_map<(d0, d1, d2) -> (d0, d1 - d2)> (%step, %ub, %i)
%2 = index_cast %1: index to i64
- memref.store %2, %A[]: memref<i64>
+ store %2, %A[]: memref<i64>
}
// This example should simplify but affine_map is currently missing
@@ -79,7 +79,7 @@ func @scf_for(%A : memref<i64>, %step : index) {
scf.for %i = %c0 to %ub2 step %step {
%1 = affine.min affine_map<(d0, d1, d2) -> (d0, d2 - d1)> (%step, %i, %ub2)
%2 = index_cast %1: index to i64
- memref.store %2, %A[]: memref<i64>
+ store %2, %A[]: memref<i64>
}
return
@@ -96,21 +96,21 @@ func @scf_parallel(%A : memref<i64>, %step : index) {
// CHECK: scf.parallel
// CHECK-NEXT: %[[C2:.*]] = constant 2 : index
// CHECK-NEXT: %[[C2I64:.*]] = index_cast %[[C2:.*]]
- // CHECK-NEXT: memref.store %[[C2I64]], %{{.*}}[] : memref<i64>
+ // CHECK-NEXT: store %[[C2I64]], %{{.*}}[] : memref<i64>
scf.parallel (%i) = (%c0) to (%c4) step (%c2) {
%1 = affine.min affine_map<(d0, d1)[] -> (2, d1 - d0)> (%i, %c4)
%2 = index_cast %1: index to i64
- memref.store %2, %A[]: memref<i64>
+ store %2, %A[]: memref<i64>
}
// CHECK: scf.parallel
// CHECK-NEXT: %[[C2:.*]] = constant 2 : index
// CHECK-NEXT: %[[C2I64:.*]] = index_cast %[[C2:.*]]
- // CHECK-NEXT: memref.store %[[C2I64]], %{{.*}}[] : memref<i64>
+ // CHECK-NEXT: store %[[C2I64]], %{{.*}}[] : memref<i64>
scf.parallel (%i) = (%c1) to (%c7) step (%c2) {
%1 = affine.min affine_map<(d0)[s0] -> (2, s0 - d0)> (%i)[%c7]
%2 = index_cast %1: index to i64
- memref.store %2, %A[]: memref<i64>
+ store %2, %A[]: memref<i64>
}
// This example should simplify but affine_map is currently missing
@@ -125,7 +125,7 @@ func @scf_parallel(%A : memref<i64>, %step : index) {
scf.parallel (%i) = (%c0) to (%ub) step (%step) {
%1 = affine.min affine_map<(d0, d1, d2) -> (d0, d2 - d1)> (%step, %i, %ub)
%2 = index_cast %1: index to i64
- memref.store %2, %A[]: memref<i64>
+ store %2, %A[]: memref<i64>
}
// This example should simplify but affine_map is currently missing
@@ -140,7 +140,7 @@ func @scf_parallel(%A : memref<i64>, %step : index) {
scf.parallel (%i) = (%c0) to (%ub2) step (%step) {
%1 = affine.min affine_map<(d0, d1, d2) -> (d0, d2 - d1)> (%step, %i, %ub2)
%2 = index_cast %1: index to i64
- memref.store %2, %A[]: memref<i64>
+ store %2, %A[]: memref<i64>
}
return
diff --git a/mlir/test/Dialect/Linalg/forward-vector-transfers.mlir b/mlir/test/Dialect/Linalg/forward-vector-transfers.mlir
index f12b95df1a2c..35e9b7f13a7e 100644
--- a/mlir/test/Dialect/Linalg/forward-vector-transfers.mlir
+++ b/mlir/test/Dialect/Linalg/forward-vector-transfers.mlir
@@ -4,17 +4,17 @@
// CHECK-SAME: %[[ARG0:[0-9a-zA-Z]*]]: memref
// CHECK-NOT: linalg.fill
// CHECK-NOT: linalg.copy
-// CHECK: %[[ALLOC:.*]] = memref.alloc
+// CHECK: %[[ALLOC:.*]] = alloc
// CHECK: vector.transfer_read %[[ARG0]]
// CHECK-NOT: masked
func @testAllocRead(%in: memref<? x f32>) -> vector<32 x f32> {
%c0 = constant 0: index
%f0 = constant 0.0: f32
- %alloc = memref.alloc() : memref<32 x f32>
+ %alloc = alloc() : memref<32 x f32>
%subview = subview %alloc[0][16][1] : memref<32 x f32> to memref<16 x f32>
linalg.copy(%in, %subview): memref<? x f32>, memref<16 x f32>
%0 = vector.transfer_read %alloc[%c0], %f0 {masked = [false]} : memref<32 x f32>, vector<32 x f32>
- memref.dealloc %alloc : memref<32 x f32>
+ dealloc %alloc : memref<32 x f32>
return %0: vector<32 x f32>
}
@@ -22,18 +22,18 @@ func @testAllocRead(%in: memref<? x f32>) -> vector<32 x f32> {
// CHECK-SAME: %[[ARG0:[0-9a-zA-Z]*]]: memref
// CHECK-NOT: linalg.fill
// CHECK-NOT: linalg.copy
-// CHECK: %[[ALLOC:.*]] = memref.alloc
+// CHECK: %[[ALLOC:.*]] = alloc
// CHECK: vector.transfer_read %[[ARG0]]
// CHECK-NOT: masked
func @testAllocFillRead(%in: memref<? x f32>) -> vector<32 x f32> {
%c0 = constant 0: index
%f0 = constant 0.0: f32
- %alloc = memref.alloc() : memref<32 x f32>
+ %alloc = alloc() : memref<32 x f32>
linalg.fill(%alloc, %f0): memref<32 x f32>, f32
%subview = subview %alloc[0][16][1] : memref<32 x f32> to memref<16 x f32>
linalg.copy(%in, %subview): memref<? x f32>, memref<16 x f32>
%0 = vector.transfer_read %alloc[%c0], %f0 {masked = [false]} : memref<32 x f32>, vector<32 x f32>
- memref.dealloc %alloc : memref<32 x f32>
+ dealloc %alloc : memref<32 x f32>
return %0: vector<32 x f32>
}
@@ -41,18 +41,18 @@ func @testAllocFillRead(%in: memref<? x f32>) -> vector<32 x f32> {
// CHECK-SAME: %[[ARG0:[0-9a-zA-Z]*]]: memref
// CHECK-NOT: linalg.fill
// CHECK-NOT: linalg.copy
-// CHECK: %[[ALLOC:.*]] = memref.alloc
+// CHECK: %[[ALLOC:.*]] = alloc
// CHECK: vector.transfer_read %[[ARG0]]
// CHECK-NOT: masked
func @testViewRead(%in: memref<? x f32>) -> vector<32 x f32> {
%c0 = constant 0: index
%f0 = constant 0.0: f32
- %alloc = memref.alloc() : memref<128 x i8>
- %view = memref.view %alloc[%c0][] : memref<128 x i8> to memref<32 x f32>
+ %alloc = alloc() : memref<128 x i8>
+ %view = view %alloc[%c0][] : memref<128 x i8> to memref<32 x f32>
%subview = subview %view[0][16][1] : memref<32 x f32> to memref<16 x f32>
linalg.copy(%in, %subview): memref<? x f32>, memref<16 x f32>
%0 = vector.transfer_read %view[%c0], %f0 {masked = [false]} : memref<32 x f32>, vector<32 x f32>
- memref.dealloc %alloc : memref<128 x i8>
+ dealloc %alloc : memref<128 x i8>
return %0: vector<32 x f32>
}
@@ -60,19 +60,19 @@ func @testViewRead(%in: memref<? x f32>) -> vector<32 x f32> {
// CHECK-SAME: %[[ARG0:[0-9a-zA-Z]*]]: memref
// CHECK-NOT: linalg.fill
// CHECK-NOT: linalg.copy
-// CHECK: %[[ALLOC:.*]] = memref.alloc
+// CHECK: %[[ALLOC:.*]] = alloc
// CHECK: vector.transfer_read %[[ARG0]]
// CHECK-NOT: masked
func @testViewFillRead(%in: memref<? x f32>) -> vector<32 x f32> {
%c0 = constant 0: index
%f0 = constant 0.0: f32
- %alloc = memref.alloc() : memref<128 x i8>
- %view = memref.view %alloc[%c0][] : memref<128 x i8> to memref<32 x f32>
+ %alloc = alloc() : memref<128 x i8>
+ %view = view %alloc[%c0][] : memref<128 x i8> to memref<32 x f32>
%subview = subview %view[0][16][1] : memref<32 x f32> to memref<16 x f32>
linalg.fill(%view, %f0): memref<32 x f32>, f32
linalg.copy(%in, %subview): memref<? x f32>, memref<16 x f32>
%0 = vector.transfer_read %view[%c0], %f0 {masked = [false]} : memref<32 x f32>, vector<32 x f32>
- memref.dealloc %alloc : memref<128 x i8>
+ dealloc %alloc : memref<128 x i8>
return %0: vector<32 x f32>
}
@@ -80,17 +80,17 @@ func @testViewFillRead(%in: memref<? x f32>) -> vector<32 x f32> {
// CHECK-SAME: %[[ARG0:[0-9a-zA-Z]*]]: vector
// CHECK-SAME: %[[ARG1:[0-9a-zA-Z]*]]: memref
// CHECK-NOT: linalg.copy
-// CHECK: %[[ALLOC:.*]] = memref.alloc
+// CHECK: %[[ALLOC:.*]] = alloc
// CHECK: vector.transfer_write %[[ARG0]], %[[ARG1]]
// CHECK-NOT: masked
func @testAllocWrite(%vec: vector<32 x f32>, %out: memref<? x f32>) {
%c0 = constant 0: index
%f0 = constant 0.0: f32
- %alloc = memref.alloc() : memref<32 x f32>
+ %alloc = alloc() : memref<32 x f32>
%subview = subview %alloc[0][16][1] : memref<32 x f32> to memref<16 x f32>
vector.transfer_write %vec, %alloc[%c0] {masked = [false]} : vector<32 x f32>, memref<32 x f32>
linalg.copy(%subview, %out): memref<16 x f32>, memref<? x f32>
- memref.dealloc %alloc : memref<32 x f32>
+ dealloc %alloc : memref<32 x f32>
return
}
@@ -98,18 +98,18 @@ func @testAllocWrite(%vec: vector<32 x f32>, %out: memref<? x f32>) {
// CHECK-SAME: %[[ARG0:[0-9a-zA-Z]*]]: vector
// CHECK-SAME: %[[ARG1:[0-9a-zA-Z]*]]: memref
// CHECK-NOT: linalg.copy
-// CHECK: %[[ALLOC:.*]] = memref.alloc
+// CHECK: %[[ALLOC:.*]] = alloc
// CHECK: vector.transfer_write %[[ARG0]], %[[ARG1]]
// CHECK-NOT: masked
func @testViewWrite(%vec: vector<32 x f32>, %out: memref<? x f32>) {
%c0 = constant 0: index
%f0 = constant 0.0: f32
- %alloc = memref.alloc() : memref<128 x i8>
- %view = memref.view %alloc[%c0][] : memref<128 x i8> to memref<32 x f32>
+ %alloc = alloc() : memref<128 x i8>
+ %view = view %alloc[%c0][] : memref<128 x i8> to memref<32 x f32>
%subview = subview %view[0][16][1] : memref<32 x f32> to memref<16 x f32>
vector.transfer_write %vec, %view[%c0] {masked = [false]} : vector<32 x f32>, memref<32 x f32>
linalg.copy(%subview, %out): memref<16 x f32>, memref<? x f32>
- memref.dealloc %alloc : memref<128 x i8>
+ dealloc %alloc : memref<128 x i8>
return
}
@@ -121,20 +121,20 @@ func @testViewWrite(%vec: vector<32 x f32>, %out: memref<? x f32>) {
// CHECK-LABEL: failAllocFillRead
// CHECK-SAME: %[[ARG0:[0-9a-zA-Z]*]]: memref
// CHECK-NOT: vector.transfer_read %[[ARG0]]
-// CHECK: %[[ALLOC:.*]] = memref.alloc
+// CHECK: %[[ALLOC:.*]] = alloc
// CHECK: linalg.copy
// CHECK: vector.transfer_read %[[ALLOC]]
func @failAllocFillRead(%in: memref<? x f32>) -> vector<32 x f32> {
%c0 = constant 0: index
%f0 = constant 0.0: f32
%f1 = constant 1.0: f32
- %alloc = memref.alloc() : memref<32 x f32>
+ %alloc = alloc() : memref<32 x f32>
linalg.fill(%alloc, %f0): memref<32 x f32>, f32
%subview = subview %alloc[0][16][1] : memref<32 x f32> to memref<16 x f32>
linalg.copy(%in, %subview): memref<? x f32>, memref<16 x f32>
"some_interleaved_use"(%subview) : (memref<16 x f32>) -> ()
%0 = vector.transfer_read %alloc[%c0], %f1: memref<32 x f32>, vector<32 x f32>
- memref.dealloc %alloc : memref<32 x f32>
+ dealloc %alloc : memref<32 x f32>
return %0: vector<32 x f32>
}
@@ -143,17 +143,17 @@ func @failAllocFillRead(%in: memref<? x f32>) -> vector<32 x f32> {
// CHECK-SAME: %[[ARG0:[0-9a-zA-Z]*]]: vector
// CHECK-SAME: %[[ARG1:[0-9a-zA-Z]*]]: memref
// CHECK-NOT: vector.transfer_write %[[ARG0]], %[[ARG1]]
-// CHECK: %[[ALLOC:.*]] = memref.alloc
+// CHECK: %[[ALLOC:.*]] = alloc
// CHECK: vector.transfer_write %[[ARG0]], %[[ALLOC]]
// CHECK: linalg.copy
func @failAllocWrite(%vec: vector<32 x f32>, %out: memref<? x f32>) {
%c0 = constant 0: index
%f0 = constant 0.0: f32
- %alloc = memref.alloc() : memref<32 x f32>
+ %alloc = alloc() : memref<32 x f32>
%subview = subview %alloc[0][16][1] : memref<32 x f32> to memref<16 x f32>
vector.transfer_write %vec, %alloc[%c0] : vector<32 x f32>, memref<32 x f32>
"some_interleaved_use"(%subview) : (memref<16 x f32>) -> ()
linalg.copy(%subview, %out): memref<16 x f32>, memref<? x f32>
- memref.dealloc %alloc : memref<32 x f32>
+ dealloc %alloc : memref<32 x f32>
return
}
diff --git a/mlir/test/Dialect/Linalg/fusion-pattern.mlir b/mlir/test/Dialect/Linalg/fusion-pattern.mlir
index 79b91886b354..ca30a32e75b1 100644
--- a/mlir/test/Dialect/Linalg/fusion-pattern.mlir
+++ b/mlir/test/Dialect/Linalg/fusion-pattern.mlir
@@ -318,7 +318,7 @@ module {
%c1 = constant 1 : index
%0 = dim %arg2, %c0 : memref<?x?xf32>
%1 = dim %arg2, %c1 : memref<?x?xf32>
- %2 = memref.alloc(%0, %1) : memref<?x?xf32>
+ %2 = alloc(%0, %1) : memref<?x?xf32>
linalg.matmul ins(%arg0, %arg1 : memref<?x?xf32>, memref<?x?xf32>)
outs(%2 : memref<?x?xf32>)
linalg.generic
@@ -340,7 +340,7 @@ module {
// CHECK-SAME: %[[ARG0:[a-zA-Z0-9_]+]]: memref<?x?xf32>
// CHECK-SAME: %[[ARG1:[a-zA-Z0-9_]+]]: memref<?x?xf32>
// CHECK-SAME: %[[ARG2:[a-zA-Z0-9_]+]]: memref<?x?xf32>
-// CHECK: %[[T2:.+]] = memref.alloc(%{{.*}}, %{{.*}}) : memref<?x?xf32>
+// CHECK: %[[T2:.+]] = alloc(%{{.*}}, %{{.*}}) : memref<?x?xf32>
// CHECK: linalg.matmul
// CHECK-SAME: after_transpose_fusion_original
// CHECK: scf.parallel (%[[ARG3:[a-zA-Z0-9_]+]], %[[ARG4:.[a-zA-Z0-9_]+]])
@@ -368,7 +368,7 @@ module {
%c1 = constant 1 : index
%0 = dim %arg2, %c0 : memref<?x?xf32>
%1 = dim %arg2, %c1 : memref<?x?xf32>
- %2 = memref.alloc(%0, %1) : memref<?x?xf32>
+ %2 = alloc(%0, %1) : memref<?x?xf32>
linalg.matmul ins(%arg0, %arg1 : memref<?x?xf32>, memref<?x?xf32>)
outs(%2 : memref<?x?xf32>)
linalg.generic
diff --git a/mlir/test/Dialect/Linalg/fusion-sequence.mlir b/mlir/test/Dialect/Linalg/fusion-sequence.mlir
index e45d3430f11e..97d81378701e 100644
--- a/mlir/test/Dialect/Linalg/fusion-sequence.mlir
+++ b/mlir/test/Dialect/Linalg/fusion-sequence.mlir
@@ -8,7 +8,7 @@ module {
%c1 = constant 1 : index
%d0 = dim %arg0, %c0 : memref<?x?xf32>
%d1 = dim %arg1, %c1 : memref<?x?xf32>
- %0 = memref.alloc(%d0, %d1) : memref<?x?xf32>
+ %0 = alloc(%d0, %d1) : memref<?x?xf32>
linalg.fill(%0, %cst) : memref<?x?xf32>, f32
linalg.matmul ins(%arg0, %arg1 : memref<?x?xf32>, memref<?x?xf32>)
outs(%0 : memref<?x?xf32>)
@@ -34,7 +34,7 @@ module {
// CHECK-SAME: %[[ARG1:[a-zA-Z0-9_]+]]: memref<?x?xf32>
// CHECK-SAME: %[[ARG2:[a-zA-Z0-9_]+]]: memref<?xf32>
// CHECK-SAME: %[[ARG3:[a-zA-Z0-9_]+]]: memref<?x?xf32>
-// CHECK: %[[TEMP:.+]] = memref.alloc(%{{.*}}, %{{.*}}) : memref<?x?xf32>
+// CHECK: %[[TEMP:.+]] = alloc(%{{.*}}, %{{.*}}) : memref<?x?xf32>
// CHECK: scf.parallel (%[[IV0:.+]], %[[IV1:.+]]) = {{.*}} {
// CHECK-DAG: %[[SV_TEMP:.+]] = subview %[[TEMP]][%[[IV0]], %[[IV1]]]
// CHECK-DAG: %[[SV_ARG2:.+]] = subview %[[ARG2]][%[[IV1]]]
@@ -66,8 +66,8 @@ module {
%n1 = dim %arg1, %c1 : memref<?x?xf32>
%n2 = dim %arg2, %c1 : memref<?x?xf32>
%n3 = dim %arg3, %c1 : memref<?x?xf32>
- %0 = memref.alloc(%m, %n1) : memref<?x?xf32>
- %1 = memref.alloc(%m, %n2) : memref<?x?xf32>
+ %0 = alloc(%m, %n1) : memref<?x?xf32>
+ %1 = alloc(%m, %n2) : memref<?x?xf32>
linalg.fill(%0, %cst) : memref<?x?xf32>, f32
linalg.matmul ins(%arg0, %arg1 : memref<?x?xf32>, memref<?x?xf32>)
outs(%0 : memref<?x?xf32>)
@@ -95,8 +95,8 @@ module {
// CHECK-DAG: %[[M:.+]] = dim %[[ARG0]], %[[C0]]
// CHECK-DAG: %[[N1:.+]] = dim %[[ARG1]], %[[C1]]
// CHECK-DAG: %[[N2:.+]] = dim %[[ARG2]], %[[C1]]
-// CHECK: %[[ALLOC1:.+]] = memref.alloc(%[[M]], %[[N1]])
-// CHECK: %[[ALLOC2:.+]] = memref.alloc(%[[M]], %[[N2]])
+// CHECK: %[[ALLOC1:.+]] = alloc(%[[M]], %[[N1]])
+// CHECK: %[[ALLOC2:.+]] = alloc(%[[M]], %[[N2]])
// CHECK: scf.parallel (%[[IV0:.+]]) = (%[[C0]]) to (%[[M]])
// CHECK-SAME: step (%[[C16]]) {
// CHECK: %[[TILE_M:.+]] = affine.min #[[MAP0]](%[[IV0]])[%[[M]]]
diff --git a/mlir/test/Dialect/Linalg/fusion.mlir b/mlir/test/Dialect/Linalg/fusion.mlir
index ec07e85f68ca..026807dcebd3 100644
--- a/mlir/test/Dialect/Linalg/fusion.mlir
+++ b/mlir/test/Dialect/Linalg/fusion.mlir
@@ -543,11 +543,11 @@ func @pointwise_no_view(%M: index, %N: index) {
%c0 = constant 0 : index
%c3 = constant 3 : index
%c2 = constant 2 : index
- %A = memref.alloc (%M, %N): memref<?x?xf32>
- %B = memref.alloc (%M, %N): memref<?x?xf32>
- %C = memref.alloc (%M, %N): memref<?x?xf32>
- %D = memref.alloc (%M, %N): memref<?x?xf32>
- %E = memref.alloc (%M, %N): memref<?x?xf32>
+ %A = alloc (%M, %N): memref<?x?xf32>
+ %B = alloc (%M, %N): memref<?x?xf32>
+ %C = alloc (%M, %N): memref<?x?xf32>
+ %D = alloc (%M, %N): memref<?x?xf32>
+ %E = alloc (%M, %N): memref<?x?xf32>
linalg.generic #pointwise_2d_trait
ins(%A, %A : memref<?x?xf32>, memref<?x?xf32>)
outs(%B : memref<?x?xf32>) {
@@ -601,7 +601,7 @@ func @fusion_of_three(%arg0: memref<100x10xf32>,
%arg2: memref<100x10xf32>) {
%c0 = constant 0 : index
%c1 = constant 1 : index
- %0 = memref.alloc() {temp = true} : memref<100x10xf32>
+ %0 = alloc() {temp = true} : memref<100x10xf32>
linalg.generic {
indexing_maps = [#map0, #map1],
iterator_types = ["parallel", "parallel"]}
@@ -610,7 +610,7 @@ func @fusion_of_three(%arg0: memref<100x10xf32>,
^bb0(%arg3: f32, %arg4: f32): // no predecessors
linalg.yield %arg3 : f32
}
- %1 = memref.alloc() {temp = true} : memref<100x10xf32>
+ %1 = alloc() {temp = true} : memref<100x10xf32>
linalg.generic {
indexing_maps = [#map1, #map1, #map1],
iterator_types = ["parallel", "parallel"]}
@@ -620,7 +620,7 @@ func @fusion_of_three(%arg0: memref<100x10xf32>,
%2 = subf %arg3, %arg4 : f32
linalg.yield %2 : f32
}
- memref.dealloc %0 : memref<100x10xf32>
+ dealloc %0 : memref<100x10xf32>
%2 = dim %1, %c0 : memref<100x10xf32>
%3 = dim %1, %c1 : memref<100x10xf32>
%4 = dim %arg2, %c0 : memref<100x10xf32>
@@ -642,7 +642,7 @@ func @fusion_of_three(%arg0: memref<100x10xf32>,
}
}
}
- memref.dealloc %1 : memref<100x10xf32>
+ dealloc %1 : memref<100x10xf32>
return
}
// CHECK-LABEL: func @fusion
@@ -719,9 +719,9 @@ func @accept_
diff erent_alloc_ops(%dim: index, %s0 : index, %s1: index) {
%c3 = constant 3 : index
%c4 = constant 4 : index
- %A = memref.alloca(%dim, %dim)[%s0, %s1] : memref<?x?xf32, offset: 0, strides: [?, ?]>
- %B = memref.alloca(%dim, %dim)[%s0, %s1] : memref<?x?xf32, offset: 0, strides: [?, ?]>
- %C = memref.alloc(%dim, %dim)[%s0, %s1] : memref<?x?xf32, offset: 0, strides: [?, ?]>
+ %A = alloca(%dim, %dim)[%s0, %s1] : memref<?x?xf32, offset: 0, strides: [?, ?]>
+ %B = alloca(%dim, %dim)[%s0, %s1] : memref<?x?xf32, offset: 0, strides: [?, ?]>
+ %C = alloc(%dim, %dim)[%s0, %s1] : memref<?x?xf32, offset: 0, strides: [?, ?]>
linalg.matmul ins(%A, %B : memref<?x?xf32, offset: 0, strides: [?, ?]>,
memref<?x?xf32, offset: 0, strides: [?, ?]>)
diff --git a/mlir/test/Dialect/Linalg/hoisting.mlir b/mlir/test/Dialect/Linalg/hoisting.mlir
index 98ed0239791e..540d1734dd63 100644
--- a/mlir/test/Dialect/Linalg/hoisting.mlir
+++ b/mlir/test/Dialect/Linalg/hoisting.mlir
@@ -10,77 +10,77 @@
// CHECK-SAME: %[[STEP:[a-zA-Z0-9]*]]: index,
// CHECK-SAME: %[[CMP:[a-zA-Z0-9]*]]: i1
func @hoist_allocs(%val: index, %lb : index, %ub : index, %step: index, %cmp: i1) {
-// CHECK-DAG: memref.alloca(%[[VAL]]) : memref<?xi8>
-// CHECK-DAG: %[[A0:.*]] = memref.alloc(%[[VAL]]) : memref<?xi8>
+// CHECK-DAG: alloca(%[[VAL]]) : memref<?xi8>
+// CHECK-DAG: %[[A0:.*]] = alloc(%[[VAL]]) : memref<?xi8>
// CHECK: scf.for %[[I:.*]] = %[[LB]] to %[[UB]] step %[[STEP]] {
-// CHECK: memref.alloca(%[[I]]) : memref<?xi8>
-// CHECK: %[[A1:.*]] = memref.alloc(%[[I]]) : memref<?xi8>
+// CHECK: alloca(%[[I]]) : memref<?xi8>
+// CHECK: %[[A1:.*]] = alloc(%[[I]]) : memref<?xi8>
// CHECK: scf.for %[[J:.*]] = %[[LB]] to %[[UB]] step %[[STEP]] {
-// CHECK-DAG: memref.alloca(%[[J]]) : memref<?xi8>
-// CHECK-DAG: %[[A2:.*]] = memref.alloc(%[[J]]) : memref<?xi8>
+// CHECK-DAG: alloca(%[[J]]) : memref<?xi8>
+// CHECK-DAG: %[[A2:.*]] = alloc(%[[J]]) : memref<?xi8>
// CHECK: scf.for %[[K:.*]] = %[[LB]] to %[[UB]] step %[[STEP]] {
scf.for %i = %lb to %ub step %step {
scf.for %j = %lb to %ub step %step {
scf.for %k = %lb to %ub step %step {
// Hoist allocs / deallocs outermost, keep view/subview below k.
- %sa0 = memref.alloca(%val) : memref<? x i8>
- %a0 = memref.alloc(%val) : memref<? x i8>
-// CHECK: memref.view %[[A0]][%[[LB]]][] : memref<?xi8> to memref<16xf32>
+ %sa0 = alloca(%val) : memref<? x i8>
+ %a0 = alloc(%val) : memref<? x i8>
+// CHECK: std.view %[[A0]][%[[LB]]][] : memref<?xi8> to memref<16xf32>
// CHECK: subview %[[A0]][0] [42] [1] : memref<?xi8> to memref<42xi8>
- %v0 = memref.view %a0[%lb][] : memref<? x i8> to memref<16 x f32>
+ %v0 = view %a0[%lb][] : memref<? x i8> to memref<16 x f32>
%sv0 = subview %a0[0][42][1] : memref<? x i8> to memref<42 x i8>
- memref.dealloc %a0 : memref<? x i8>
+ dealloc %a0 : memref<? x i8>
// Hoist below i.
- %sa1 = memref.alloca(%i) : memref<? x i8>
- %a1 = memref.alloc(%i) : memref<? x i8>
- memref.dealloc %a1 : memref<? x i8>
+ %sa1 = alloca(%i) : memref<? x i8>
+ %a1 = alloc(%i) : memref<? x i8>
+ dealloc %a1 : memref<? x i8>
// Hoist below j.
- %sa2 = memref.alloca(%j) : memref<? x i8>
- %a2 = memref.alloc(%j) : memref<? x i8>
- memref.dealloc %a2 : memref<? x i8>
+ %sa2 = alloca(%j) : memref<? x i8>
+ %a2 = alloc(%j) : memref<? x i8>
+ dealloc %a2 : memref<? x i8>
// Don't hoist since k innermost.
-// CHECK: memref.alloca(%[[K]]) : memref<?xi8>
-// CHECK: %[[A3:.*]] = memref.alloc(%[[K]]) : memref<?xi8>
-// CHECK: memref.dealloc %[[A3]] : memref<?xi8>
- %sa3 = memref.alloca(%k) : memref<? x i8>
- %a3 = memref.alloc(%k) : memref<? x i8>
- memref.dealloc %a3 : memref<? x i8>
+// CHECK: alloca(%[[K]]) : memref<?xi8>
+// CHECK: %[[A3:.*]] = alloc(%[[K]]) : memref<?xi8>
+// CHECK: dealloc %[[A3]] : memref<?xi8>
+ %sa3 = alloca(%k) : memref<? x i8>
+ %a3 = alloc(%k) : memref<? x i8>
+ dealloc %a3 : memref<? x i8>
// No hoisting due to control flow.
// CHECK: scf.if %[[CMP]] {
-// CHECK: memref.alloca(%[[VAL]]) : memref<?xi8>
-// CHECK: %[[A4:.*]] = memref.alloc(%[[VAL]]) : memref<?xi8>
-// CHECK: memref.dealloc %[[A4]] : memref<?xi8>
+// CHECK: alloca(%[[VAL]]) : memref<?xi8>
+// CHECK: %[[A4:.*]] = alloc(%[[VAL]]) : memref<?xi8>
+// CHECK: dealloc %[[A4]] : memref<?xi8>
scf.if %cmp {
- %sa4 = memref.alloca(%val) : memref<? x i8>
- %a4 = memref.alloc(%val) : memref<? x i8>
- memref.dealloc %a4 : memref<? x i8>
+ %sa4 = alloca(%val) : memref<? x i8>
+ %a4 = alloc(%val) : memref<? x i8>
+ dealloc %a4 : memref<? x i8>
}
// No hoisting due to load/store.
-// CHECK: %[[SA5:.*]] = memref.alloca(%[[VAL]]) : memref<?xi8>
-// CHECK: %[[A5:.*]] = memref.alloc(%[[VAL]]) : memref<?xi8>
+// CHECK: %[[SA5:.*]] = alloca(%[[VAL]]) : memref<?xi8>
+// CHECK: %[[A5:.*]] = alloc(%[[VAL]]) : memref<?xi8>
// CHECK: load %[[A5]][%[[LB]]] : memref<?xi8>
-// CHECK: memref.store %{{.*}}, %[[SA5]][%[[LB]]] : memref<?xi8>
-// CHECK: memref.dealloc %[[A5]] : memref<?xi8>
- %sa5 = memref.alloca(%val) : memref<? x i8>
- %a5 = memref.alloc(%val) : memref<? x i8>
+// CHECK: store %{{.*}}, %[[SA5]][%[[LB]]] : memref<?xi8>
+// CHECK: dealloc %[[A5]] : memref<?xi8>
+ %sa5 = alloca(%val) : memref<? x i8>
+ %a5 = alloc(%val) : memref<? x i8>
%v5 = load %a5[%lb] : memref<? x i8>
- memref.store %v5, %sa5[%lb] : memref<? x i8>
- memref.dealloc %a5 : memref<? x i8>
+ store %v5, %sa5[%lb] : memref<? x i8>
+ dealloc %a5 : memref<? x i8>
}
}
}
// CHECK: }
-// CHECK: memref.dealloc %[[A2]] : memref<?xi8>
+// CHECK: dealloc %[[A2]] : memref<?xi8>
// CHECK: }
-// CHECK: memref.dealloc %[[A1]] : memref<?xi8>
+// CHECK: dealloc %[[A1]] : memref<?xi8>
// CHECK: }
-// CHECK: memref.dealloc %[[A0]] : memref<?xi8>
+// CHECK: dealloc %[[A0]] : memref<?xi8>
return
}
diff --git a/mlir/test/Dialect/Linalg/invalid.mlir b/mlir/test/Dialect/Linalg/invalid.mlir
index 6c2607b86996..084fd4abcf2a 100644
--- a/mlir/test/Dialect/Linalg/invalid.mlir
+++ b/mlir/test/Dialect/Linalg/invalid.mlir
@@ -12,7 +12,7 @@ func @store_number_of_indices(%v : memref<f32>) {
// expected-error @+3 {{store index operand count not equal to memref rank}}
%c0 = constant 0 : index
%f0 = constant 0.0 : f32
- memref.store %f0, %v[%c0] : memref<f32>
+ store %f0, %v[%c0] : memref<f32>
}
// -----
diff --git a/mlir/test/Dialect/Linalg/loops.mlir b/mlir/test/Dialect/Linalg/loops.mlir
index f9d72115dd2c..71fd7c7cf15a 100644
--- a/mlir/test/Dialect/Linalg/loops.mlir
+++ b/mlir/test/Dialect/Linalg/loops.mlir
@@ -34,9 +34,9 @@
func @matmul(%arg0: memref<?xi8>, %M: index, %N: index, %K: index) {
%c0 = constant 0 : index
%c1 = constant 1 : index
- %A = memref.view %arg0[%c0][%M, %K] : memref<?xi8> to memref<?x?xf32>
- %B = memref.view %arg0[%c0][%K, %N] : memref<?xi8> to memref<?x?xf32>
- %C = memref.view %arg0[%c0][%M, %N] : memref<?xi8> to memref<?x?xf32>
+ %A = view %arg0[%c0][%M, %K] : memref<?xi8> to memref<?x?xf32>
+ %B = view %arg0[%c0][%K, %N] : memref<?xi8> to memref<?x?xf32>
+ %C = view %arg0[%c0][%M, %N] : memref<?xi8> to memref<?x?xf32>
linalg.matmul ins(%A, %B: memref<?x?xf32>, memref<?x?xf32>)
outs(%C: memref<?x?xf32>)
return
@@ -45,9 +45,9 @@ func @matmul(%arg0: memref<?xi8>, %M: index, %N: index, %K: index) {
// CHECKLOOP-SAME: [[M:arg[0-9]+]]: index
// CHECKLOOP-SAME: [[N:arg[0-9]+]]: index
// CHECKLOOP-SAME: [[K:arg[0-9]+]]: index
-// CHECKLOOP: %[[A:.*]] = memref.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
-// CHECKLOOP: %[[B:.*]] = memref.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
-// CHECKLOOP: %[[C:.*]] = memref.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECKLOOP: %[[A:.*]] = std.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECKLOOP: %[[B:.*]] = std.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECKLOOP: %[[C:.*]] = std.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
// CHECKLOOP: scf.for %{{.*}} = %{{.*}} to %[[M]] step %{{.*}} {
// CHECKLOOP: scf.for %{{.*}} = %{{.*}} to %[[N]] step %{{.*}} {
// CHECKLOOP: scf.for %{{.*}} = %{{.*}} to %[[K]] step %{{.*}} {
@@ -62,9 +62,9 @@ func @matmul(%arg0: memref<?xi8>, %M: index, %N: index, %K: index) {
// CHECKPARALLEL-SAME: [[M:arg[0-9]+]]: index
// CHECKPARALLEL-SAME: [[N:arg[0-9]+]]: index
// CHECKPARALLEL-SAME: [[K:arg[0-9]+]]: index
-// CHECKPARALLEL: %[[A:.*]] = memref.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
-// CHECKPARALLEL: %[[B:.*]] = memref.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
-// CHECKPARALLEL: %[[C:.*]] = memref.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECKPARALLEL: %[[A:.*]] = std.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECKPARALLEL: %[[B:.*]] = std.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECKPARALLEL: %[[C:.*]] = std.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
// CHECKPARALLEL: scf.parallel (%{{.*}}, %{{.*}}) = (%{{.*}}, %{{.*}}) to (%[[M]], %[[N]]) step (%{{.*}}, %{{.*}} {
// CHECKPARALLEL: scf.for %{{.*}} = %{{.*}} to %[[K]] step %{{.*}} {
// CHECKPARALLEL-DAG: %[[a:.*]] = load %[[A]][%{{.*}}, %{{.*}}] : memref<?x?xf32>
@@ -79,9 +79,9 @@ func @matmul(%arg0: memref<?xi8>, %M: index, %N: index, %K: index) {
func @matvec(%arg0: memref<?xi8>, %M: index, %N: index) {
%c0 = constant 0 : index
%c1 = constant 1 : index
- %2 = memref.view %arg0[%c0][%M, %N] : memref<?xi8> to memref<?x?xf32>
- %3 = memref.view %arg0[%c0][%M] : memref<?xi8> to memref<?xf32>
- %4 = memref.view %arg0[%c0][%N] : memref<?xi8> to memref<?xf32>
+ %2 = view %arg0[%c0][%M, %N] : memref<?xi8> to memref<?x?xf32>
+ %3 = view %arg0[%c0][%M] : memref<?xi8> to memref<?xf32>
+ %4 = view %arg0[%c0][%N] : memref<?xi8> to memref<?xf32>
linalg.matvec ins(%2, %3: memref<?x?xf32>, memref<?xf32>)
outs(%4 : memref<?xf32>)
return
@@ -89,9 +89,9 @@ func @matvec(%arg0: memref<?xi8>, %M: index, %N: index) {
// CHECKLOOP-LABEL: func @matvec(%{{.*}}: memref<?xi8>,
// CHECKLOOP-SAME: [[M:arg[0-9]+]]: index
// CHECKLOOP-SAME: [[K:arg[0-9]+]]: index
-// CHECKLOOP: %[[A:.*]] = memref.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
-// CHECKLOOP: %[[B:.*]] = memref.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?xf32>
-// CHECKLOOP: %[[C:.*]] = memref.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?xf32>
+// CHECKLOOP: %[[A:.*]] = std.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECKLOOP: %[[B:.*]] = std.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?xf32>
+// CHECKLOOP: %[[C:.*]] = std.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?xf32>
// CHECKLOOP: scf.for %{{.*}} = %{{.*}} to %[[M]] step %{{.*}} {
// CHECKLOOP: scf.for %{{.*}} = %{{.*}} to %[[K]] step %{{.*}} {
// CHECKLOOP-DAG: %[[a:.*]] = load %[[A]][%{{.*}}, %{{.*}}] : memref<?x?xf32>
@@ -104,9 +104,9 @@ func @matvec(%arg0: memref<?xi8>, %M: index, %N: index) {
// CHECKPARALLEL-LABEL: func @matvec(%{{.*}}: memref<?xi8>,
// CHECKPARALLEL-SAME: [[M:arg[0-9]+]]: index
// CHECKPARALLEL-SAME: [[K:arg[0-9]+]]: index
-// CHECKPARALLEL: %[[A:.*]] = memref.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
-// CHECKPARALLEL: %[[B:.*]] = memref.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?xf32>
-// CHECKPARALLEL: %[[C:.*]] = memref.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?xf32>
+// CHECKPARALLEL: %[[A:.*]] = std.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECKPARALLEL: %[[B:.*]] = std.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?xf32>
+// CHECKPARALLEL: %[[C:.*]] = std.view %{{.*}}[{{.*}}] : memref<?xi8> to memref<?xf32>
// CHECKPARALLEL: scf.parallel (%{{.*}}) = (%{{.*}}) to (%[[M]]) step (%{{.*}}) {
// CHECKPARALLEL: scf.for %{{.*}} = %{{.*}} to %[[K]] step %{{.*}} {
// CHECKPARALLEL-DAG: %[[a:.*]] = load %[[A]][%{{.*}}, %{{.*}}] : memref<?x?xf32>
@@ -120,18 +120,18 @@ func @matvec(%arg0: memref<?xi8>, %M: index, %N: index) {
func @dot(%arg0: memref<?xi8>, %M: index) {
%c0 = constant 0 : index
%c1 = constant 1 : index
- %1 = memref.view %arg0[%c0][%M] : memref<?xi8> to memref<?xf32>
- %2 = memref.view %arg0[%c0][%M] : memref<?xi8> to memref<?xf32>
- %3 = memref.view %arg0[%c0][] : memref<?xi8> to memref<f32>
+ %1 = view %arg0[%c0][%M] : memref<?xi8> to memref<?xf32>
+ %2 = view %arg0[%c0][%M] : memref<?xi8> to memref<?xf32>
+ %3 = view %arg0[%c0][] : memref<?xi8> to memref<f32>
linalg.dot ins(%1, %2 : memref<?xf32>, memref<?xf32>)
outs(%3 : memref<f32>)
return
}
// CHECKLOOP-LABEL: func @dot(%{{.*}}: memref<?xi8>,
// CHECKLOOP-SAME: [[K:arg[0-9]+]]: index
-// CHECKLOOP: %[[A:.*]] = memref.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?xf32>
-// CHECKLOOP: %[[B:.*]] = memref.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?xf32>
-// CHECKLOOP: %[[C:.*]] = memref.view %{{.*}}[{{.*}}][] : memref<?xi8> to memref<f32>
+// CHECKLOOP: %[[A:.*]] = std.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?xf32>
+// CHECKLOOP: %[[B:.*]] = std.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?xf32>
+// CHECKLOOP: %[[C:.*]] = std.view %{{.*}}[{{.*}}][] : memref<?xi8> to memref<f32>
// CHECKLOOP: scf.for %{{.*}} = %{{.*}} to %[[K]] step %{{.*}} {
// CHECKLOOP-DAG: %[[a:.*]] = load %[[A]][%{{.*}}] : memref<?xf32>
// CHECKLOOP-DAG: %[[b:.*]] = load %[[B]][%{{.*}}] : memref<?xf32>
@@ -142,9 +142,9 @@ func @dot(%arg0: memref<?xi8>, %M: index) {
// CHECKPARALLEL-LABEL: func @dot(%{{.*}}: memref<?xi8>,
// CHECKPARALLEL-SAME: [[K:arg[0-9]+]]: index
-// CHECKPARALLEL: %[[A:.*]] = memref.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?xf32>
-// CHECKPARALLEL: %[[B:.*]] = memref.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?xf32>
-// CHECKPARALLEL: %[[C:.*]] = memref.view %{{.*}}[{{.*}}][] : memref<?xi8> to memref<f32>
+// CHECKPARALLEL: %[[A:.*]] = std.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?xf32>
+// CHECKPARALLEL: %[[B:.*]] = std.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?xf32>
+// CHECKPARALLEL: %[[C:.*]] = std.view %{{.*}}[{{.*}}][] : memref<?xi8> to memref<f32>
// CHECKPARALLEL: scf.for %{{.*}} = %{{.*}} to %[[K]] step %{{.*}} {
// CHECKPARALLEL-DAG: %[[a:.*]] = load %[[A]][%{{.*}}] : memref<?xf32>
// CHECKPARALLEL-DAG: %[[b:.*]] = load %[[B]][%{{.*}}] : memref<?xf32>
diff --git a/mlir/test/Dialect/Linalg/promote.mlir b/mlir/test/Dialect/Linalg/promote.mlir
index 14c478f85bbe..838699301639 100644
--- a/mlir/test/Dialect/Linalg/promote.mlir
+++ b/mlir/test/Dialect/Linalg/promote.mlir
@@ -14,9 +14,9 @@ func @matmul_f32(%A: memref<?xi8>, %M: index, %N: index, %K: index) {
%c2 = constant 2 : index
%c0 = constant 0 : index
%c1 = constant 1 : index
- %3 = memref.view %A[%c0][%M, %K] : memref<?xi8> to memref<?x?xf32>
- %4 = memref.view %A[%c0][%K, %N] : memref<?xi8> to memref<?x?xf32>
- %5 = memref.view %A[%c0][%M, %N] : memref<?xi8> to memref<?x?xf32>
+ %3 = view %A[%c0][%M, %K] : memref<?xi8> to memref<?x?xf32>
+ %4 = view %A[%c0][%K, %N] : memref<?xi8> to memref<?x?xf32>
+ %5 = view %A[%c0][%M, %N] : memref<?xi8> to memref<?x?xf32>
%6 = dim %3, %c0 : memref<?x?xf32>
%7 = dim %3, %c1 : memref<?x?xf32>
%8 = dim %4, %c1 : memref<?x?xf32>
@@ -44,22 +44,22 @@ func @matmul_f32(%A: memref<?xi8>, %M: index, %N: index, %K: index) {
// CHECK: %[[vB:.*]] = subview {{.*}} : memref<?x?xf32>
// CHECK: %[[vC:.*]] = subview {{.*}} : memref<?x?xf32>
///
-// CHECK: %[[tmpA:.*]] = memref.alloc() : memref<32xi8>
-// ALLOCA: %[[tmpA:.*]] = memref.alloca() : memref<32xi8>
-// CHECK: %[[fullA:.*]] = memref.view %[[tmpA]][{{.*}}][{{.*}}] : memref<32xi8> to memref<?x?xf32>
-// DYNAMIC: memref.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECK: %[[tmpA:.*]] = alloc() : memref<32xi8>
+// ALLOCA: %[[tmpA:.*]] = alloca() : memref<32xi8>
+// CHECK: %[[fullA:.*]] = std.view %[[tmpA]][{{.*}}][{{.*}}] : memref<32xi8> to memref<?x?xf32>
+// DYNAMIC: std.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?x?xf32>
// CHECK: %[[partialA:.*]] = subview %[[fullA]]{{.*}} : memref<?x?xf32> to memref<?x?xf32, #[[$strided2D]]>
///
-// CHECK: %[[tmpB:.*]] = memref.alloc() : memref<48xi8>
-// ALLOCA: %[[tmpB:.*]] = memref.alloca() : memref<48xi8>
-// CHECK: %[[fullB:.*]] = memref.view %[[tmpB]][{{.*}}][{{.*}}] : memref<48xi8> to memref<?x?xf32>
-// DYNAMIC: memref.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECK: %[[tmpB:.*]] = alloc() : memref<48xi8>
+// ALLOCA: %[[tmpB:.*]] = alloca() : memref<48xi8>
+// CHECK: %[[fullB:.*]] = std.view %[[tmpB]][{{.*}}][{{.*}}] : memref<48xi8> to memref<?x?xf32>
+// DYNAMIC: std.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?x?xf32>
// CHECK: %[[partialB:.*]] = subview %[[fullB]]{{.*}} : memref<?x?xf32> to memref<?x?xf32, #[[$strided2D]]>
///
-// CHECK: %[[tmpC:.*]] = memref.alloc() : memref<24xi8>
-// ALLOCA: %[[tmpC:.*]] = memref.alloca() : memref<24xi8>
-// CHECK: %[[fullC:.*]] = memref.view %[[tmpC]][{{.*}}][{{.*}}] : memref<24xi8> to memref<?x?xf32>
-// DYNAMIC: memref.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECK: %[[tmpC:.*]] = alloc() : memref<24xi8>
+// ALLOCA: %[[tmpC:.*]] = alloca() : memref<24xi8>
+// CHECK: %[[fullC:.*]] = std.view %[[tmpC]][{{.*}}][{{.*}}] : memref<24xi8> to memref<?x?xf32>
+// DYNAMIC: std.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?x?xf32>
// CHECK: %[[partialC:.*]] = subview %[[fullC]]{{.*}} : memref<?x?xf32> to memref<?x?xf32, #[[$strided2D]]>
// CHECK: linalg.copy(%[[vA]], %[[partialA]]) : memref<?x?xf32, #[[$strided2D]]>, memref<?x?xf32, #[[$strided2D]]>
@@ -72,12 +72,12 @@ func @matmul_f32(%A: memref<?xi8>, %M: index, %N: index, %K: index) {
// CHECK: memref<?x?xf32, #[[$strided2D]]>,
// CHECK: memref<?x?xf32, #[[$strided2D]]>
//
-// CHECK: memref.dealloc %[[tmpA]] : memref<32xi8>
-// CHECK: memref.dealloc %[[tmpB]] : memref<48xi8>
-// CHECK: memref.dealloc %[[tmpC]] : memref<24xi8>
-// ALLOCA-NOT: memref.dealloc %[[tmpA]] : memref<32xi8>
-// ALLOCA-NOT: memref.dealloc %[[tmpB]] : memref<48xi8>
-// ALLOCA-NOT: memref.dealloc %[[tmpC]] : memref<24xi8>
+// CHECK: dealloc %[[tmpA]] : memref<32xi8>
+// CHECK: dealloc %[[tmpB]] : memref<48xi8>
+// CHECK: dealloc %[[tmpC]] : memref<24xi8>
+// ALLOCA-NOT: dealloc %[[tmpA]] : memref<32xi8>
+// ALLOCA-NOT: dealloc %[[tmpB]] : memref<48xi8>
+// ALLOCA-NOT: dealloc %[[tmpC]] : memref<24xi8>
// -----
@@ -87,9 +87,9 @@ func @matmul_f64(%A: memref<?xi8>, %M: index, %N: index, %K: index) {
%c2 = constant 2 : index
%c0 = constant 0 : index
%c1 = constant 1 : index
- %3 = memref.view %A[%c0][%M, %K] : memref<?xi8> to memref<?x?xf64>
- %4 = memref.view %A[%c0][%K, %N] : memref<?xi8> to memref<?x?xf64>
- %5 = memref.view %A[%c0][%M, %N] : memref<?xi8> to memref<?x?xf64>
+ %3 = view %A[%c0][%M, %K] : memref<?xi8> to memref<?x?xf64>
+ %4 = view %A[%c0][%K, %N] : memref<?xi8> to memref<?x?xf64>
+ %5 = view %A[%c0][%M, %N] : memref<?xi8> to memref<?x?xf64>
%6 = dim %3, %c0 : memref<?x?xf64>
%7 = dim %3, %c1 : memref<?x?xf64>
%8 = dim %4, %c1 : memref<?x?xf64>
@@ -117,19 +117,19 @@ func @matmul_f64(%A: memref<?xi8>, %M: index, %N: index, %K: index) {
// CHECK: %[[vB_f64:.*]] = subview {{.*}} : memref<?x?xf64>
// CHECK: %[[vC_f64:.*]] = subview {{.*}} : memref<?x?xf64>
///
-// CHECK: %[[tmpA_f64:.*]] = memref.alloc() : memref<64xi8>
-// CHECK: %[[fullA_f64:.*]] = memref.view %[[tmpA_f64]][{{.*}}][{{.*}}] : memref<64xi8> to memref<?x?xf64>
-// DYNAMIC: memref.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?x?xf64>
+// CHECK: %[[tmpA_f64:.*]] = alloc() : memref<64xi8>
+// CHECK: %[[fullA_f64:.*]] = std.view %[[tmpA_f64]][{{.*}}][{{.*}}] : memref<64xi8> to memref<?x?xf64>
+// DYNAMIC: std.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?x?xf64>
// CHECK: %[[partialA_f64:.*]] = subview %[[fullA_f64]][0, 0] [%{{.*}}, %{{.*}}] [1, 1] : memref<?x?xf64> to memref<?x?xf64, #[[$strided2D]]>
///
-// CHECK: %[[tmpB_f64:.*]] = memref.alloc() : memref<96xi8>
-// CHECK: %[[fullB_f64:.*]] = memref.view %[[tmpB_f64]][{{.*}}][{{.*}}] : memref<96xi8> to memref<?x?xf64>
-// DYNAMIC: memref.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?x?xf64>
+// CHECK: %[[tmpB_f64:.*]] = alloc() : memref<96xi8>
+// CHECK: %[[fullB_f64:.*]] = std.view %[[tmpB_f64]][{{.*}}][{{.*}}] : memref<96xi8> to memref<?x?xf64>
+// DYNAMIC: std.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?x?xf64>
// CHECK: %[[partialB_f64:.*]] = subview %[[fullB_f64]][0, 0] [%{{.*}}, %{{.*}}] [1, 1] : memref<?x?xf64> to memref<?x?xf64, #[[$strided2D]]>
///
-// CHECK: %[[tmpC_f64:.*]] = memref.alloc() : memref<48xi8>
-// CHECK: %[[fullC_f64:.*]] = memref.view %[[tmpC_f64]][{{.*}}][{{.*}}] : memref<48xi8> to memref<?x?xf64>
-// DYNAMIC: memref.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?x?xf64>
+// CHECK: %[[tmpC_f64:.*]] = alloc() : memref<48xi8>
+// CHECK: %[[fullC_f64:.*]] = std.view %[[tmpC_f64]][{{.*}}][{{.*}}] : memref<48xi8> to memref<?x?xf64>
+// DYNAMIC: std.view %{{.*}}[{{.*}}][{{.*}}] : memref<?xi8> to memref<?x?xf64>
// CHECK: %[[partialC_f64:.*]] = subview %[[fullC_f64]][0, 0] [%{{.*}}, %{{.*}}] [1, 1] : memref<?x?xf64> to memref<?x?xf64, #[[$strided2D]]>
// CHECK: linalg.copy(%[[vA_f64]], %[[partialA_f64]]) : memref<?x?xf64, #[[$strided2D]]>, memref<?x?xf64, #[[$strided2D]]>
@@ -142,6 +142,6 @@ func @matmul_f64(%A: memref<?xi8>, %M: index, %N: index, %K: index) {
// CHECK: memref<?x?xf64, #[[$strided2D]]>,
// CHECK: memref<?x?xf64, #[[$strided2D]]>
//
-// CHECK: memref.dealloc %[[tmpA_f64]] : memref<64xi8>
-// CHECK: memref.dealloc %[[tmpB_f64]] : memref<96xi8>
-// CHECK: memref.dealloc %[[tmpC_f64]] : memref<48xi8>
+// CHECK: dealloc %[[tmpA_f64]] : memref<64xi8>
+// CHECK: dealloc %[[tmpB_f64]] : memref<96xi8>
+// CHECK: dealloc %[[tmpC_f64]] : memref<48xi8>
diff --git a/mlir/test/Dialect/Linalg/promotion_options.mlir b/mlir/test/Dialect/Linalg/promotion_options.mlir
index 9608ebe61f70..0f38c904eb5a 100644
--- a/mlir/test/Dialect/Linalg/promotion_options.mlir
+++ b/mlir/test/Dialect/Linalg/promotion_options.mlir
@@ -19,9 +19,9 @@ func @gemm(%a : memref<?x?xf32>, %b : memref<?x?xf32>, %c : memref<?x?xf32>)
// CHECK: %[[T7:.+]] = subview %[[ARG0]]
// CHECK: %[[T12:.+]] = subview %[[ARG1]]
// CHECK: %[[T17:.+]] = subview %[[ARG2]]
-// CHECK: %[[T18:.+]] = memref.alloc(%{{.*}}, %{{.*}}) : memref<?x?xf32, 3>
+// CHECK: %[[T18:.+]] = alloc(%{{.*}}, %{{.*}}) : memref<?x?xf32, 3>
// CHECK: %[[T19:.+]] = subview %[[T18]]
-// CHECK: %[[T20:.+]] = memref.alloc(%{{.*}}, %{{.*}}) : memref<?x?xf32, 3>
+// CHECK: %[[T20:.+]] = alloc(%{{.*}}, %{{.*}}) : memref<?x?xf32, 3>
// CHECK: %[[T21:.+]] = subview %[[T20]]
// CHECK: linalg.fill(%[[T19]], %[[C42]])
// CHECK: linalg.copy(%[[T7]], %[[T19]])
@@ -30,5 +30,5 @@ func @gemm(%a : memref<?x?xf32>, %b : memref<?x?xf32>, %c : memref<?x?xf32>)
// CHECK: linalg.matmul ins(%[[T19]], %[[T12]]{{.*}} outs(%[[T21]]
// CHECK-NOT: linalg.fill
// CHECK: linalg.copy(%[[T21]], %[[T17]])
-// CHECK: memref.dealloc %[[T18]]
-// CHECK: memref.dealloc %[[T20]]
+// CHECK: dealloc %[[T18]]
+// CHECK: dealloc %[[T20]]
diff --git a/mlir/test/Dialect/Linalg/roundtrip.mlir b/mlir/test/Dialect/Linalg/roundtrip.mlir
index 8cc027c4dffd..32ea93bc3c2c 100644
--- a/mlir/test/Dialect/Linalg/roundtrip.mlir
+++ b/mlir/test/Dialect/Linalg/roundtrip.mlir
@@ -88,22 +88,22 @@ func @range(%arg0: index, %arg1: index, %arg2: index) {
func @views(%arg0: index, %arg1: index, %arg2: index, %arg3: index, %arg4: index) {
%c0 = constant 0 : index
%0 = muli %arg0, %arg0 : index
- %1 = memref.alloc (%0) : memref<?xi8>
+ %1 = alloc (%0) : memref<?xi8>
%2 = linalg.range %arg0:%arg1:%arg2 : !linalg.range
- %3 = memref.view %1[%c0][%arg0, %arg0] : memref<?xi8> to memref<?x?xf32>
- %4 = memref.view %1[%c0][%arg0, %arg0] : memref<?xi8> to memref<?x?xvector<4x4xf32>>
- memref.dealloc %1 : memref<?xi8>
+ %3 = view %1[%c0][%arg0, %arg0] : memref<?xi8> to memref<?x?xf32>
+ %4 = view %1[%c0][%arg0, %arg0] : memref<?xi8> to memref<?x?xvector<4x4xf32>>
+ dealloc %1 : memref<?xi8>
return
}
// CHECK-LABEL: func @views
// CHECK: muli %{{.*}}, %{{.*}} : index
-// CHECK-NEXT: memref.alloc(%{{.*}}) : memref<?xi8>
+// CHECK-NEXT: alloc(%{{.*}}) : memref<?xi8>
// CHECK-NEXT: range
-// CHECK-NEXT: memref.view %{{.*}}[%{{.*}}][%{{.*}}] :
+// CHECK-NEXT: std.view %{{.*}}[%{{.*}}][%{{.*}}] :
// CHECK-SAME: memref<?xi8> to memref<?x?xf32>
-// CHECK-NEXT: memref.view %{{.*}}[%{{.*}}][%{{.*}}] :
+// CHECK-NEXT: view %{{.*}}[%{{.*}}][%{{.*}}] :
// CHECK-SAME: memref<?xi8> to memref<?x?xvector<4x4xf32>>
-// CHECK-NEXT: memref.dealloc %{{.*}} : memref<?xi8>
+// CHECK-NEXT: dealloc %{{.*}} : memref<?xi8>
// -----
@@ -157,7 +157,7 @@ func @fill_view(%arg0: memref<?xf32, offset: ?, strides: [1]>, %arg1: f32) {
// CHECK-DAG: #[[$strided3DT:.*]] = affine_map<(d0, d1, d2)[s0, s1, s2] -> (d2 * s1 + s0 + d1 * s2 + d0)>
func @transpose(%arg0: memref<?x?x?xf32, offset: ?, strides: [?, ?, 1]>) {
- %0 = memref.transpose %arg0 (i, j, k) -> (k, j, i) : memref<?x?x?xf32, offset: ?, strides: [?, ?, 1]> to memref<?x?x?xf32, affine_map<(d0, d1, d2)[s0, s1, s2] -> (d2 * s1 + s0 + d1 * s2 + d0)>>
+ %0 = transpose %arg0 (i, j, k) -> (k, j, i) : memref<?x?x?xf32, offset: ?, strides: [?, ?, 1]> to memref<?x?x?xf32, affine_map<(d0, d1, d2)[s0, s1, s2] -> (d2 * s1 + s0 + d1 * s2 + d0)>>
return
}
// CHECK-LABEL: func @transpose
diff --git a/mlir/test/Dialect/Linalg/sparse_1d.mlir b/mlir/test/Dialect/Linalg/sparse_1d.mlir
index 80a7bf2e2a14..5730b89d9a1c 100644
--- a/mlir/test/Dialect/Linalg/sparse_1d.mlir
+++ b/mlir/test/Dialect/Linalg/sparse_1d.mlir
@@ -23,7 +23,7 @@
// CHECK: %[[VAL_5:.*]] = constant 1 : index
// CHECK: %[[VAL_6:.*]] = tensor_to_memref %[[VAL_0]] : memref<32xf32>
// CHECK: %[[VAL_7:.*]] = tensor_to_memref %[[VAL_2]] : memref<32xf32>
-// CHECK: %[[VAL_8:.*]] = memref.alloc() : memref<32xf32>
+// CHECK: %[[VAL_8:.*]] = alloc() : memref<32xf32>
// CHECK: linalg.copy(%[[VAL_7]], %[[VAL_8]]) : memref<32xf32>, memref<32xf32>
// CHECK: scf.for %[[VAL_9:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] {
// CHECK: %[[VAL_10:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_9]]] : memref<32xf32>
@@ -53,7 +53,7 @@ func @add_d(%arga: tensor<32xf32>, %argb: f32, %argx: tensor<32xf32>) -> tensor<
// CHECK: %[[VAL_5:.*]] = constant 1 : index
// CHECK: %[[VAL_6:.*]] = tensor_to_memref %[[VAL_0]] : memref<32xf32>
// CHECK: %[[VAL_7:.*]] = tensor_to_memref %[[VAL_2]] : memref<32xf32>
-// CHECK: %[[VAL_8:.*]] = memref.alloc() : memref<32xf32>
+// CHECK: %[[VAL_8:.*]] = alloc() : memref<32xf32>
// CHECK: linalg.copy(%[[VAL_7]], %[[VAL_8]]) : memref<32xf32>, memref<32xf32>
// CHECK: scf.for %[[VAL_9:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] {
// CHECK: %[[VAL_10:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_9]]] : memref<32xf32>
@@ -99,7 +99,7 @@ func @mul_d(%arga: tensor<32xf32>, %argb: f32, %argx: tensor<32xf32>) -> tensor<
// CHECK: %[[VAL_8:.*]] = linalg.sparse_indices %[[VAL_0]], %[[VAL_4]] : tensor<32xf32> to memref<?xindex>
// CHECK: %[[VAL_9:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32xf32> to memref<?xf32>
// CHECK: %[[VAL_10:.*]] = tensor_to_memref %[[VAL_2]] : memref<32xf32>
-// CHECK: %[[VAL_11:.*]] = memref.alloc() : memref<32xf32>
+// CHECK: %[[VAL_11:.*]] = alloc() : memref<32xf32>
// CHECK: linalg.copy(%[[VAL_10]], %[[VAL_11]]) : memref<32xf32>, memref<32xf32>
// CHECK: %[[VAL_12:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_4]]] : memref<?xindex>
// CHECK: %[[VAL_13:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_6]]] : memref<?xindex>
@@ -152,7 +152,7 @@ func @add_s(%arga: tensor<32xf32>, %argb: f32, %argx: tensor<32xf32>) -> tensor<
// CHECK: %[[VAL_5:.*]] = linalg.sparse_indices %[[VAL_0]], %[[VAL_2]] : tensor<32xf32> to memref<?xindex>
// CHECK: %[[VAL_6:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32xf32> to memref<?xf32>
// CHECK: %[[VAL_7:.*]] = tensor_to_memref %[[VAL_1]] : memref<32xf32>
-// CHECK: %[[VAL_8:.*]] = memref.alloc() : memref<32xf32>
+// CHECK: %[[VAL_8:.*]] = alloc() : memref<32xf32>
// CHECK: linalg.copy(%[[VAL_7]], %[[VAL_8]]) : memref<32xf32>, memref<32xf32>
// CHECK: %[[VAL_9:.*]] = load %[[VAL_4]]{{\[}}%[[VAL_2]]] : memref<?xindex>
// CHECK: %[[VAL_10:.*]] = load %[[VAL_4]]{{\[}}%[[VAL_3]]] : memref<?xindex>
@@ -193,7 +193,7 @@ func @repeated_add_s(%arga: tensor<32xf32>, %argx: tensor<32xf32>) -> tensor<32x
// CHECK: %[[VAL_6:.*]] = linalg.sparse_indices %[[VAL_0]], %[[VAL_3]] : tensor<32xf32> to memref<?xindex>
// CHECK: %[[VAL_7:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32xf32> to memref<?xf32>
// CHECK: %[[VAL_8:.*]] = tensor_to_memref %[[VAL_2]] : memref<32xf32>
-// CHECK: %[[VAL_9:.*]] = memref.alloc() : memref<32xf32>
+// CHECK: %[[VAL_9:.*]] = alloc() : memref<32xf32>
// CHECK: linalg.copy(%[[VAL_8]], %[[VAL_9]]) : memref<32xf32>, memref<32xf32>
// CHECK: %[[VAL_10:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex>
// CHECK: %[[VAL_11:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex>
@@ -242,7 +242,7 @@ func @mul_s(%arga: tensor<32xf32>, %argb: f32, %argx: tensor<32xf32>) -> tensor<
// CHECK: %[[VAL_6:.*]] = tensor_to_memref %[[VAL_0]] : memref<32xf32>
// CHECK: %[[VAL_7:.*]] = tensor_to_memref %[[VAL_1]] : memref<32xf32>
// CHECK: %[[VAL_8:.*]] = tensor_to_memref %[[VAL_2]] : memref<32xf32>
-// CHECK: %[[VAL_9:.*]] = memref.alloc() : memref<32xf32>
+// CHECK: %[[VAL_9:.*]] = alloc() : memref<32xf32>
// CHECK: linalg.copy(%[[VAL_8]], %[[VAL_9]]) : memref<32xf32>, memref<32xf32>
// CHECK: scf.for %[[VAL_10:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] {
// CHECK: %[[VAL_11:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_10]]] : memref<32xf32>
@@ -274,7 +274,7 @@ func @add_dd(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>
// CHECK: %[[VAL_6:.*]] = tensor_to_memref %[[VAL_0]] : memref<32xf32>
// CHECK: %[[VAL_7:.*]] = tensor_to_memref %[[VAL_1]] : memref<32xf32>
// CHECK: %[[VAL_8:.*]] = tensor_to_memref %[[VAL_2]] : memref<32xf32>
-// CHECK: %[[VAL_9:.*]] = memref.alloc() : memref<32xf32>
+// CHECK: %[[VAL_9:.*]] = alloc() : memref<32xf32>
// CHECK: linalg.copy(%[[VAL_8]], %[[VAL_9]]) : memref<32xf32>, memref<32xf32>
// CHECK: scf.for %[[VAL_10:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] {
// CHECK: %[[VAL_11:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_10]]] : memref<32xf32>
@@ -324,7 +324,7 @@ func @mul_dd(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>
// CHECK: %[[VAL_9:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_4]] : tensor<32xf32> to memref<?xindex>
// CHECK: %[[VAL_10:.*]] = linalg.sparse_values %[[VAL_1]] : tensor<32xf32> to memref<?xf32>
// CHECK: %[[VAL_11:.*]] = tensor_to_memref %[[VAL_2]] : memref<32xf32>
-// CHECK: %[[VAL_12:.*]] = memref.alloc() : memref<32xf32>
+// CHECK: %[[VAL_12:.*]] = alloc() : memref<32xf32>
// CHECK: linalg.copy(%[[VAL_11]], %[[VAL_12]]) : memref<32xf32>, memref<32xf32>
// CHECK: %[[VAL_13:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_4]]] : memref<?xindex>
// CHECK: %[[VAL_14:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_6]]] : memref<?xindex>
@@ -382,7 +382,7 @@ func @add_ds(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>
// CHECK: %[[VAL_7:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_3]] : tensor<32xf32> to memref<?xindex>
// CHECK: %[[VAL_8:.*]] = linalg.sparse_values %[[VAL_1]] : tensor<32xf32> to memref<?xf32>
// CHECK: %[[VAL_9:.*]] = tensor_to_memref %[[VAL_2]] : memref<32xf32>
-// CHECK: %[[VAL_10:.*]] = memref.alloc() : memref<32xf32>
+// CHECK: %[[VAL_10:.*]] = alloc() : memref<32xf32>
// CHECK: linalg.copy(%[[VAL_9]], %[[VAL_10]]) : memref<32xf32>, memref<32xf32>
// CHECK: %[[VAL_11:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_3]]] : memref<?xindex>
// CHECK: %[[VAL_12:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref<?xindex>
@@ -435,7 +435,7 @@ func @mul_ds(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>
// CHECK: %[[VAL_9:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32xf32> to memref<?xf32>
// CHECK: %[[VAL_10:.*]] = tensor_to_memref %[[VAL_1]] : memref<32xf32>
// CHECK: %[[VAL_11:.*]] = tensor_to_memref %[[VAL_2]] : memref<32xf32>
-// CHECK: %[[VAL_12:.*]] = memref.alloc() : memref<32xf32>
+// CHECK: %[[VAL_12:.*]] = alloc() : memref<32xf32>
// CHECK: linalg.copy(%[[VAL_11]], %[[VAL_12]]) : memref<32xf32>, memref<32xf32>
// CHECK: %[[VAL_13:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_4]]] : memref<?xindex>
// CHECK: %[[VAL_14:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_6]]] : memref<?xindex>
@@ -493,7 +493,7 @@ func @add_sd(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>
// CHECK: %[[VAL_7:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32xf32> to memref<?xf32>
// CHECK: %[[VAL_8:.*]] = tensor_to_memref %[[VAL_1]] : memref<32xf32>
// CHECK: %[[VAL_9:.*]] = tensor_to_memref %[[VAL_2]] : memref<32xf32>
-// CHECK: %[[VAL_10:.*]] = memref.alloc() : memref<32xf32>
+// CHECK: %[[VAL_10:.*]] = alloc() : memref<32xf32>
// CHECK: linalg.copy(%[[VAL_9]], %[[VAL_10]]) : memref<32xf32>, memref<32xf32>
// CHECK: %[[VAL_11:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex>
// CHECK: %[[VAL_12:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex>
@@ -546,7 +546,7 @@ func @mul_sd(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>
// CHECK: %[[VAL_9:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_3]] : tensor<32xf32> to memref<?xindex>
// CHECK: %[[VAL_10:.*]] = linalg.sparse_values %[[VAL_1]] : tensor<32xf32> to memref<?xf32>
// CHECK: %[[VAL_11:.*]] = tensor_to_memref %[[VAL_2]] : memref<32xf32>
-// CHECK: %[[VAL_12:.*]] = memref.alloc() : memref<32xf32>
+// CHECK: %[[VAL_12:.*]] = alloc() : memref<32xf32>
// CHECK: linalg.copy(%[[VAL_11]], %[[VAL_12]]) : memref<32xf32>, memref<32xf32>
// CHECK: %[[VAL_13:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex>
// CHECK: %[[VAL_14:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex>
@@ -630,7 +630,7 @@ func @add_ss(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>
// CHECK: %[[VAL_9:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_3]] : tensor<32xf32> to memref<?xindex>
// CHECK: %[[VAL_10:.*]] = linalg.sparse_values %[[VAL_1]] : tensor<32xf32> to memref<?xf32>
// CHECK: %[[VAL_11:.*]] = tensor_to_memref %[[VAL_2]] : memref<32xf32>
-// CHECK: %[[VAL_12:.*]] = memref.alloc() : memref<32xf32>
+// CHECK: %[[VAL_12:.*]] = alloc() : memref<32xf32>
// CHECK: linalg.copy(%[[VAL_11]], %[[VAL_12]]) : memref<32xf32>, memref<32xf32>
// CHECK: %[[VAL_13:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex>
// CHECK: %[[VAL_14:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex>
@@ -708,7 +708,7 @@ func @mul_ss(%arga: tensor<32xf32>, %argb: tensor<32xf32>, %argx: tensor<32xf32>
// CHECK: %[[VAL_10:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_4]] : tensor<16xf32> to memref<?xindex>
// CHECK: %[[VAL_11:.*]] = linalg.sparse_values %[[VAL_1]] : tensor<16xf32> to memref<?xf32>
// CHECK: %[[VAL_12:.*]] = tensor_to_memref %[[VAL_3]] : memref<16xf32>
-// CHECK: %[[VAL_13:.*]] = memref.alloc() : memref<16xf32>
+// CHECK: %[[VAL_13:.*]] = alloc() : memref<16xf32>
// CHECK: linalg.copy(%[[VAL_12]], %[[VAL_13]]) : memref<16xf32>, memref<16xf32>
// CHECK: %[[VAL_14:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref<?xindex>
// CHECK: %[[VAL_15:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref<?xindex>
@@ -799,7 +799,7 @@ func @two_way_inv(%arga: tensor<16xf32>, %argb: tensor<16xf32>, %argc: f32, %arg
// CHECK: %[[VAL_10:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_4]] : tensor<16xf32> to memref<?xindex>
// CHECK: %[[VAL_11:.*]] = linalg.sparse_values %[[VAL_1]] : tensor<16xf32> to memref<?xf32>
// CHECK: %[[VAL_12:.*]] = tensor_to_memref %[[VAL_3]] : memref<16xf32>
-// CHECK: %[[VAL_13:.*]] = memref.alloc() : memref<16xf32>
+// CHECK: %[[VAL_13:.*]] = alloc() : memref<16xf32>
// CHECK: linalg.copy(%[[VAL_12]], %[[VAL_13]]) : memref<16xf32>, memref<16xf32>
// CHECK: %[[VAL_14:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref<?xindex>
// CHECK: %[[VAL_15:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref<?xindex>
@@ -897,7 +897,7 @@ func @two_way_inv_alt(%arga: tensor<16xf32>,
// CHECK: %[[VAL_4:.*]] = linalg.sparse_pointers %[[VAL_0]], %[[VAL_2]] : tensor<?xf32> to memref<?xindex>
// CHECK: %[[VAL_5:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<?xf32> to memref<?xf32>
// CHECK: %[[VAL_6:.*]] = tensor_to_memref %[[VAL_1]] : memref<f32>
-// CHECK: %[[VAL_7:.*]] = memref.alloc() : memref<f32>
+// CHECK: %[[VAL_7:.*]] = alloc() : memref<f32>
// CHECK: linalg.copy(%[[VAL_6]], %[[VAL_7]]) : memref<f32>, memref<f32>
// CHECK: %[[VAL_8:.*]] = load %[[VAL_4]]{{\[}}%[[VAL_2]]] : memref<?xindex>
// CHECK: %[[VAL_9:.*]] = load %[[VAL_4]]{{\[}}%[[VAL_3]]] : memref<?xindex>
@@ -950,7 +950,7 @@ func @sum_reduction(%arga: tensor<?xf32>, %argx: tensor<f32>) -> tensor<f32> {
// CHECK: %[[VAL_9:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_3]] : tensor<16xf32> to memref<?xindex>
// CHECK: %[[VAL_10:.*]] = linalg.sparse_values %[[VAL_1]] : tensor<16xf32> to memref<?xf32>
// CHECK: %[[VAL_11:.*]] = tensor_to_memref %[[VAL_2]] : memref<f32>
-// CHECK: %[[VAL_12:.*]] = memref.alloc() : memref<f32>
+// CHECK: %[[VAL_12:.*]] = alloc() : memref<f32>
// CHECK: linalg.copy(%[[VAL_11]], %[[VAL_12]]) : memref<f32>, memref<f32>
// CHECK: %[[VAL_13:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex>
// CHECK: %[[VAL_14:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex>
@@ -1065,7 +1065,7 @@ func @sum_reduction_ss(%arga: tensor<16xf32>,
// CHECK: %[[VAL_11:.*]] = linalg.sparse_indices %[[VAL_2]], %[[VAL_4]] : tensor<16xf32> to memref<?xindex>
// CHECK: %[[VAL_12:.*]] = linalg.sparse_values %[[VAL_2]] : tensor<16xf32> to memref<?xf32>
// CHECK: %[[VAL_13:.*]] = tensor_to_memref %[[VAL_3]] : memref<f32>
-// CHECK: %[[VAL_14:.*]] = memref.alloc() : memref<f32>
+// CHECK: %[[VAL_14:.*]] = alloc() : memref<f32>
// CHECK: linalg.copy(%[[VAL_13]], %[[VAL_14]]) : memref<f32>, memref<f32>
// CHECK: %[[VAL_15:.*]] = load %[[VAL_9]][] : memref<f32>
// CHECK: %[[VAL_16:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref<?xindex>
diff --git a/mlir/test/Dialect/Linalg/sparse_2d.mlir b/mlir/test/Dialect/Linalg/sparse_2d.mlir
index 2ad11270fd60..55beeeba7bbb 100644
--- a/mlir/test/Dialect/Linalg/sparse_2d.mlir
+++ b/mlir/test/Dialect/Linalg/sparse_2d.mlir
@@ -27,7 +27,7 @@
// CHECK: %[[VAL_7:.*]] = tensor_to_memref %[[VAL_0]] : memref<32x16xf32>
// CHECK: %[[VAL_8:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16xf32>
// CHECK: %[[VAL_9:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16xf32>
-// CHECK: %[[VAL_10:.*]] = memref.alloc() : memref<32x16xf32>
+// CHECK: %[[VAL_10:.*]] = alloc() : memref<32x16xf32>
// CHECK: linalg.copy(%[[VAL_9]], %[[VAL_10]]) : memref<32x16xf32>, memref<32x16xf32>
// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_5]] to %[[VAL_3]] step %[[VAL_6]] {
// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_5]] to %[[VAL_4]] step %[[VAL_6]] {
@@ -62,7 +62,7 @@ func @add_dd(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<3
// CHECK: %[[VAL_7:.*]] = tensor_to_memref %[[VAL_0]] : memref<32x16xf32>
// CHECK: %[[VAL_8:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16xf32>
// CHECK: %[[VAL_9:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16xf32>
-// CHECK: %[[VAL_10:.*]] = memref.alloc() : memref<32x16xf32>
+// CHECK: %[[VAL_10:.*]] = alloc() : memref<32x16xf32>
// CHECK: linalg.copy(%[[VAL_9]], %[[VAL_10]]) : memref<32x16xf32>, memref<32x16xf32>
// CHECK: scf.for %[[VAL_11:.*]] = %[[VAL_5]] to %[[VAL_3]] step %[[VAL_6]] {
// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_5]] to %[[VAL_4]] step %[[VAL_6]] {
@@ -115,7 +115,7 @@ func @mul_dd(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<3
// CHECK: %[[VAL_10:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16xf32> to memref<?xf32>
// CHECK: %[[VAL_11:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16xf32>
// CHECK: %[[VAL_12:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16xf32>
-// CHECK: %[[VAL_13:.*]] = memref.alloc() : memref<32x16xf32>
+// CHECK: %[[VAL_13:.*]] = alloc() : memref<32x16xf32>
// CHECK: linalg.copy(%[[VAL_12]], %[[VAL_13]]) : memref<32x16xf32>, memref<32x16xf32>
// CHECK: scf.for %[[VAL_14:.*]] = %[[VAL_5]] to %[[VAL_3]] step %[[VAL_7]] {
// CHECK: %[[VAL_15:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_14]]] : memref<?xindex>
@@ -177,7 +177,7 @@ func @add_ds(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<3
// CHECK: %[[VAL_8:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16xf32> to memref<?xf32>
// CHECK: %[[VAL_9:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16xf32>
// CHECK: %[[VAL_10:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16xf32>
-// CHECK: %[[VAL_11:.*]] = memref.alloc() : memref<32x16xf32>
+// CHECK: %[[VAL_11:.*]] = alloc() : memref<32x16xf32>
// CHECK: linalg.copy(%[[VAL_10]], %[[VAL_11]]) : memref<32x16xf32>, memref<32x16xf32>
// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] {
// CHECK: %[[VAL_13:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_12]]] : memref<?xindex>
@@ -234,7 +234,7 @@ func @mul_ds(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<3
// CHECK: %[[VAL_10:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16xf32> to memref<?xf32>
// CHECK: %[[VAL_11:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16xf32>
// CHECK: %[[VAL_12:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16xf32>
-// CHECK: %[[VAL_13:.*]] = memref.alloc() : memref<32x16xf32>
+// CHECK: %[[VAL_13:.*]] = alloc() : memref<32x16xf32>
// CHECK: linalg.copy(%[[VAL_12]], %[[VAL_13]]) : memref<32x16xf32>, memref<32x16xf32>
// CHECK: %[[VAL_14:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_6]]] : memref<?xindex>
// CHECK: %[[VAL_15:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_7]]] : memref<?xindex>
@@ -301,7 +301,7 @@ func @add_sd(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<3
// CHECK: %[[VAL_8:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16xf32> to memref<?xf32>
// CHECK: %[[VAL_9:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16xf32>
// CHECK: %[[VAL_10:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16xf32>
-// CHECK: %[[VAL_11:.*]] = memref.alloc() : memref<32x16xf32>
+// CHECK: %[[VAL_11:.*]] = alloc() : memref<32x16xf32>
// CHECK: linalg.copy(%[[VAL_10]], %[[VAL_11]]) : memref<32x16xf32>, memref<32x16xf32>
// CHECK: %[[VAL_12:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref<?xindex>
// CHECK: %[[VAL_13:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref<?xindex>
@@ -361,7 +361,7 @@ func @mul_sd(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<3
// CHECK: %[[VAL_12:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16xf32> to memref<?xf32>
// CHECK: %[[VAL_13:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16xf32>
// CHECK: %[[VAL_14:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16xf32>
-// CHECK: %[[VAL_15:.*]] = memref.alloc() : memref<32x16xf32>
+// CHECK: %[[VAL_15:.*]] = alloc() : memref<32x16xf32>
// CHECK: linalg.copy(%[[VAL_14]], %[[VAL_15]]) : memref<32x16xf32>, memref<32x16xf32>
// CHECK: %[[VAL_16:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_6]]] : memref<?xindex>
// CHECK: %[[VAL_17:.*]] = load %[[VAL_8]]{{\[}}%[[VAL_7]]] : memref<?xindex>
@@ -453,7 +453,7 @@ func @add_ss(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<3
// CHECK: %[[VAL_9:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16xf32> to memref<?xf32>
// CHECK: %[[VAL_10:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16xf32>
// CHECK: %[[VAL_11:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16xf32>
-// CHECK: %[[VAL_12:.*]] = memref.alloc() : memref<32x16xf32>
+// CHECK: %[[VAL_12:.*]] = alloc() : memref<32x16xf32>
// CHECK: linalg.copy(%[[VAL_11]], %[[VAL_12]]) : memref<32x16xf32>, memref<32x16xf32>
// CHECK: %[[VAL_13:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex>
// CHECK: %[[VAL_14:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex>
@@ -516,7 +516,7 @@ func @mul_ss(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tensor<3
// CHECK: %[[VAL_13:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_4]] : tensor<32x16xf32> to memref<?xindex>
// CHECK: %[[VAL_14:.*]] = linalg.sparse_values %[[VAL_1]] : tensor<32x16xf32> to memref<?xf32>
// CHECK: %[[VAL_15:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16xf32>
-// CHECK: %[[VAL_16:.*]] = memref.alloc() : memref<32x16xf32>
+// CHECK: %[[VAL_16:.*]] = alloc() : memref<32x16xf32>
// CHECK: linalg.copy(%[[VAL_15]], %[[VAL_16]]) : memref<32x16xf32>, memref<32x16xf32>
// CHECK: %[[VAL_17:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex>
// CHECK: %[[VAL_18:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex>
@@ -681,7 +681,7 @@ func @add_ss_ss(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tenso
// CHECK: %[[VAL_13:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_4]] : tensor<32x16xf32> to memref<?xindex>
// CHECK: %[[VAL_14:.*]] = linalg.sparse_values %[[VAL_1]] : tensor<32x16xf32> to memref<?xf32>
// CHECK: %[[VAL_15:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16xf32>
-// CHECK: %[[VAL_16:.*]] = memref.alloc() : memref<32x16xf32>
+// CHECK: %[[VAL_16:.*]] = alloc() : memref<32x16xf32>
// CHECK: linalg.copy(%[[VAL_15]], %[[VAL_16]]) : memref<32x16xf32>, memref<32x16xf32>
// CHECK: %[[VAL_17:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex>
// CHECK: %[[VAL_18:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex>
@@ -793,7 +793,7 @@ func @mul_ss_ss(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tenso
// CHECK: %[[VAL_13:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_4]] : tensor<32x16xf32> to memref<?xindex>
// CHECK: %[[VAL_14:.*]] = linalg.sparse_values %[[VAL_1]] : tensor<32x16xf32> to memref<?xf32>
// CHECK: %[[VAL_15:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16xf32>
-// CHECK: %[[VAL_16:.*]] = memref.alloc() : memref<32x16xf32>
+// CHECK: %[[VAL_16:.*]] = alloc() : memref<32x16xf32>
// CHECK: linalg.copy(%[[VAL_15]], %[[VAL_16]]) : memref<32x16xf32>, memref<32x16xf32>
// CHECK: %[[VAL_17:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex>
// CHECK: %[[VAL_18:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex>
@@ -958,7 +958,7 @@ func @add_sd_ds(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tenso
// CHECK: %[[VAL_13:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_4]] : tensor<32x16xf32> to memref<?xindex>
// CHECK: %[[VAL_14:.*]] = linalg.sparse_values %[[VAL_1]] : tensor<32x16xf32> to memref<?xf32>
// CHECK: %[[VAL_15:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16xf32>
-// CHECK: %[[VAL_16:.*]] = memref.alloc() : memref<32x16xf32>
+// CHECK: %[[VAL_16:.*]] = alloc() : memref<32x16xf32>
// CHECK: linalg.copy(%[[VAL_15]], %[[VAL_16]]) : memref<32x16xf32>, memref<32x16xf32>
// CHECK: %[[VAL_17:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex>
// CHECK: %[[VAL_18:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex>
@@ -1065,7 +1065,7 @@ func @mul_sd_ds(%arga: tensor<32x16xf32>, %argb: tensor<32x16xf32>, %argx: tenso
// CHECK: %[[VAL_8:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<16x32xf32> to memref<?xf32>
// CHECK: %[[VAL_9:.*]] = tensor_to_memref %[[VAL_1]] : memref<32xf32>
// CHECK: %[[VAL_10:.*]] = tensor_to_memref %[[VAL_2]] : memref<16xf32>
-// CHECK: %[[VAL_11:.*]] = memref.alloc() : memref<16xf32>
+// CHECK: %[[VAL_11:.*]] = alloc() : memref<16xf32>
// CHECK: linalg.copy(%[[VAL_10]], %[[VAL_11]]) : memref<16xf32>, memref<16xf32>
// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] {
// CHECK: %[[VAL_13:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_12]]] : memref<?xindex>
@@ -1119,7 +1119,7 @@ func @matvec(%argA: tensor<16x32xf32>, %argb: tensor<32xf32>, %argx: tensor<16xf
// CHECK: %[[VAL_5:.*]] = linalg.sparse_pointers %[[VAL_0]], %[[VAL_4]] : tensor<10x20xf32> to memref<?xindex>
// CHECK: %[[VAL_6:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<10x20xf32> to memref<?xf32>
// CHECK: %[[VAL_7:.*]] = tensor_to_memref %[[VAL_1]] : memref<f32>
-// CHECK: %[[VAL_8:.*]] = memref.alloc() : memref<f32>
+// CHECK: %[[VAL_8:.*]] = alloc() : memref<f32>
// CHECK: linalg.copy(%[[VAL_7]], %[[VAL_8]]) : memref<f32>, memref<f32>
// CHECK: scf.for %[[VAL_9:.*]] = %[[VAL_3]] to %[[VAL_2]] step %[[VAL_4]] {
// CHECK: %[[VAL_10:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_9]]] : memref<?xindex>
@@ -1172,7 +1172,7 @@ func @sum_reduction(%arga: tensor<10x20xf32>, %argx: tensor<f32>) -> tensor<f32>
// CHECK: %[[VAL_8:.*]] = dim %[[VAL_1]], %[[VAL_3]] : tensor<?x?xf64>
// CHECK: %[[VAL_9:.*]] = dim %[[VAL_1]], %[[VAL_4]] : tensor<?x?xf64>
// CHECK: %[[VAL_10:.*]] = tensor_to_memref %[[VAL_1]] : memref<?x?xf64>
-// CHECK: %[[VAL_11:.*]] = memref.alloc(%[[VAL_8]], %[[VAL_9]]) : memref<?x?xf64>
+// CHECK: %[[VAL_11:.*]] = alloc(%[[VAL_8]], %[[VAL_9]]) : memref<?x?xf64>
// CHECK: linalg.copy(%[[VAL_10]], %[[VAL_11]]) : memref<?x?xf64>, memref<?x?xf64>
// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_3]] to %[[VAL_8]] step %[[VAL_4]] {
// CHECK: %[[VAL_13:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_12]]] : memref<?xindex>
@@ -1235,7 +1235,7 @@ func @scale(%arga: tensor<?x?xf64>, %argx: tensor<?x?xf64>) -> tensor<?x?xf64> {
// CHECK: %[[VAL_14:.*]] = dim %[[VAL_3]], %[[VAL_4]] : tensor<?x?xf32>
// CHECK: %[[VAL_15:.*]] = dim %[[VAL_3]], %[[VAL_5]] : tensor<?x?xf32>
// CHECK: %[[VAL_16:.*]] = tensor_to_memref %[[VAL_3]] : memref<?x?xf32>
-// CHECK: %[[VAL_17:.*]] = memref.alloc(%[[VAL_14]], %[[VAL_15]]) : memref<?x?xf32>
+// CHECK: %[[VAL_17:.*]] = alloc(%[[VAL_14]], %[[VAL_15]]) : memref<?x?xf32>
// CHECK: linalg.copy(%[[VAL_16]], %[[VAL_17]]) : memref<?x?xf32>, memref<?x?xf32>
// CHECK: %[[VAL_18:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref<?xindex>
// CHECK: %[[VAL_19:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref<?xindex>
@@ -1323,7 +1323,7 @@ func @sampled_dense_dense(%args: tensor<?x?xf32>,
// CHECK: %[[VAL_21:.*]] = tensor_to_memref %[[VAL_4]] : memref<f32>
// CHECK: %[[VAL_22:.*]] = dim %[[VAL_5]], %[[VAL_6]] : tensor<?xf32>
// CHECK: %[[VAL_23:.*]] = tensor_to_memref %[[VAL_5]] : memref<?xf32>
-// CHECK: %[[VAL_24:.*]] = memref.alloc(%[[VAL_22]]) : memref<?xf32>
+// CHECK: %[[VAL_24:.*]] = alloc(%[[VAL_22]]) : memref<?xf32>
// CHECK: linalg.copy(%[[VAL_23]], %[[VAL_24]]) : memref<?xf32>, memref<?xf32>
// CHECK: %[[VAL_25:.*]] = load %[[VAL_21]][] : memref<f32>
// CHECK: %[[VAL_26:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_6]]] : memref<?xindex>
diff --git a/mlir/test/Dialect/Linalg/sparse_3d.mlir b/mlir/test/Dialect/Linalg/sparse_3d.mlir
index 434634586fe1..d0148199a606 100644
--- a/mlir/test/Dialect/Linalg/sparse_3d.mlir
+++ b/mlir/test/Dialect/Linalg/sparse_3d.mlir
@@ -28,7 +28,7 @@
// CHECK: %[[VAL_8:.*]] = tensor_to_memref %[[VAL_0]] : memref<32x16x8xf32>
// CHECK: %[[VAL_9:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_10:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_11:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_11:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_10]], %[[VAL_11]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_6]] to %[[VAL_3]] step %[[VAL_7]] {
// CHECK: scf.for %[[VAL_13:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_7]] {
@@ -66,7 +66,7 @@ func @add_ddd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_8:.*]] = tensor_to_memref %[[VAL_0]] : memref<32x16x8xf32>
// CHECK: %[[VAL_9:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_10:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_11:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_11:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_10]], %[[VAL_11]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: scf.for %[[VAL_12:.*]] = %[[VAL_6]] to %[[VAL_3]] step %[[VAL_7]] {
// CHECK: scf.for %[[VAL_13:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_7]] {
@@ -123,7 +123,7 @@ func @mul_ddd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_12:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16x8xf32> to memref<?xf32>
// CHECK: %[[VAL_13:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_14:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_15:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_15:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_14]], %[[VAL_15]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: scf.for %[[VAL_16:.*]] = %[[VAL_7]] to %[[VAL_4]] step %[[VAL_9]] {
// CHECK: scf.for %[[VAL_17:.*]] = %[[VAL_7]] to %[[VAL_5]] step %[[VAL_9]] {
@@ -191,7 +191,7 @@ func @add_dds(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_10:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16x8xf32> to memref<?xf32>
// CHECK: %[[VAL_11:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_12:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_13:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_13:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_12]], %[[VAL_13]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: scf.for %[[VAL_14:.*]] = %[[VAL_6]] to %[[VAL_4]] step %[[VAL_7]] {
// CHECK: scf.for %[[VAL_15:.*]] = %[[VAL_6]] to %[[VAL_5]] step %[[VAL_7]] {
@@ -253,7 +253,7 @@ func @mul_dds(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_11:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16x8xf32> to memref<?xf32>
// CHECK: %[[VAL_12:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_13:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_14:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_14:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_13]], %[[VAL_14]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: scf.for %[[VAL_15:.*]] = %[[VAL_7]] to %[[VAL_3]] step %[[VAL_8]] {
// CHECK: %[[VAL_16:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_15]]] : memref<?xindex>
@@ -324,7 +324,7 @@ func @add_dsd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_9:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16x8xf32> to memref<?xf32>
// CHECK: %[[VAL_10:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_11:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_12:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_12:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_11]], %[[VAL_12]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: scf.for %[[VAL_13:.*]] = %[[VAL_5]] to %[[VAL_3]] step %[[VAL_6]] {
// CHECK: %[[VAL_14:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_13]]] : memref<?xindex>
@@ -389,7 +389,7 @@ func @mul_dsd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_14:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16x8xf32> to memref<?xf32>
// CHECK: %[[VAL_15:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_16:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_17:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_17:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_16]], %[[VAL_17]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: scf.for %[[VAL_18:.*]] = %[[VAL_8]] to %[[VAL_4]] step %[[VAL_9]] {
// CHECK: %[[VAL_19:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_18]]] : memref<?xindex>
@@ -486,7 +486,7 @@ func @add_dss(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_11:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16x8xf32> to memref<?xf32>
// CHECK: %[[VAL_12:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_13:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_14:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_14:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_13]], %[[VAL_14]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: scf.for %[[VAL_15:.*]] = %[[VAL_5]] to %[[VAL_4]] step %[[VAL_6]] {
// CHECK: %[[VAL_16:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_15]]] : memref<?xindex>
@@ -550,7 +550,7 @@ func @mul_dss(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_11:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16x8xf32> to memref<?xf32>
// CHECK: %[[VAL_12:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_13:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_14:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_14:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_13]], %[[VAL_14]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: %[[VAL_15:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_7]]] : memref<?xindex>
// CHECK: %[[VAL_16:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_8]]] : memref<?xindex>
@@ -626,7 +626,7 @@ func @add_sdd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_9:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16x8xf32> to memref<?xf32>
// CHECK: %[[VAL_10:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_11:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_12:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_12:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_11]], %[[VAL_12]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: %[[VAL_13:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_5]]] : memref<?xindex>
// CHECK: %[[VAL_14:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_6]]] : memref<?xindex>
@@ -692,7 +692,7 @@ func @mul_sdd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_14:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16x8xf32> to memref<?xf32>
// CHECK: %[[VAL_15:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_16:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_17:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_17:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_16]], %[[VAL_17]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: %[[VAL_18:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_8]]] : memref<?xindex>
// CHECK: %[[VAL_19:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_9]]] : memref<?xindex>
@@ -794,7 +794,7 @@ func @add_sds(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_11:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16x8xf32> to memref<?xf32>
// CHECK: %[[VAL_12:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_13:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_14:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_14:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_13]], %[[VAL_14]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: %[[VAL_15:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_5]]] : memref<?xindex>
// CHECK: %[[VAL_16:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_6]]] : memref<?xindex>
@@ -861,7 +861,7 @@ func @mul_sds(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_13:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16x8xf32> to memref<?xf32>
// CHECK: %[[VAL_14:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_15:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_16:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_16:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_15]], %[[VAL_16]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: %[[VAL_17:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_7]]] : memref<?xindex>
// CHECK: %[[VAL_18:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_8]]] : memref<?xindex>
@@ -966,7 +966,7 @@ func @add_ssd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_10:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16x8xf32> to memref<?xf32>
// CHECK: %[[VAL_11:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_12:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_13:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_13:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_12]], %[[VAL_13]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: %[[VAL_14:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref<?xindex>
// CHECK: %[[VAL_15:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref<?xindex>
@@ -1036,7 +1036,7 @@ func @mul_ssd(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_16:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16x8xf32> to memref<?xf32>
// CHECK: %[[VAL_17:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_18:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_19:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_19:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_18]], %[[VAL_19]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: %[[VAL_20:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_8]]] : memref<?xindex>
// CHECK: %[[VAL_21:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_9]]] : memref<?xindex>
@@ -1167,7 +1167,7 @@ func @add_sss(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_12:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<32x16x8xf32> to memref<?xf32>
// CHECK: %[[VAL_13:.*]] = tensor_to_memref %[[VAL_1]] : memref<32x16x8xf32>
// CHECK: %[[VAL_14:.*]] = tensor_to_memref %[[VAL_2]] : memref<32x16x8xf32>
-// CHECK: %[[VAL_15:.*]] = memref.alloc() : memref<32x16x8xf32>
+// CHECK: %[[VAL_15:.*]] = alloc() : memref<32x16x8xf32>
// CHECK: linalg.copy(%[[VAL_14]], %[[VAL_15]]) : memref<32x16x8xf32>, memref<32x16x8xf32>
// CHECK: %[[VAL_16:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_4]]] : memref<?xindex>
// CHECK: %[[VAL_17:.*]] = load %[[VAL_6]]{{\[}}%[[VAL_5]]] : memref<?xindex>
@@ -1238,7 +1238,7 @@ func @mul_sss(%arga: tensor<32x16x8xf32>, %argb: tensor<32x16x8xf32>, %argx: ten
// CHECK: %[[VAL_13:.*]] = dim %[[VAL_0]], %[[VAL_5]] : tensor<?x?xf32>
// CHECK: %[[VAL_14:.*]] = dim %[[VAL_0]], %[[VAL_6]] : tensor<?x?xf32>
// CHECK: %[[VAL_15:.*]] = tensor_to_memref %[[VAL_0]] : memref<?x?xf32>
-// CHECK: %[[VAL_16:.*]] = memref.alloc(%[[VAL_13]], %[[VAL_14]]) : memref<?x?xf32>
+// CHECK: %[[VAL_16:.*]] = alloc(%[[VAL_13]], %[[VAL_14]]) : memref<?x?xf32>
// CHECK: linalg.copy(%[[VAL_15]], %[[VAL_16]]) : memref<?x?xf32>, memref<?x?xf32>
// CHECK: scf.for %[[VAL_17:.*]] = %[[VAL_5]] to %[[VAL_13]] step %[[VAL_6]] {
// CHECK: scf.for %[[VAL_18:.*]] = %[[VAL_5]] to %[[VAL_10]] step %[[VAL_6]] {
@@ -1305,7 +1305,7 @@ func @kernel_3d(%arga: tensor<?x?xf32>,
// CHECK: %[[VAL_7:.*]] = linalg.sparse_pointers %[[VAL_0]], %[[VAL_2]] : tensor<10x20x30xf32> to memref<?xindex>
// CHECK: %[[VAL_8:.*]] = linalg.sparse_values %[[VAL_0]] : tensor<10x20x30xf32> to memref<?xf32>
// CHECK: %[[VAL_9:.*]] = tensor_to_memref %[[VAL_1]] : memref<f32>
-// CHECK: %[[VAL_10:.*]] = memref.alloc() : memref<f32>
+// CHECK: %[[VAL_10:.*]] = alloc() : memref<f32>
// CHECK: linalg.copy(%[[VAL_9]], %[[VAL_10]]) : memref<f32>, memref<f32>
// CHECK: %[[VAL_11:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_3]]] : memref<?xindex>
// CHECK: %[[VAL_12:.*]] = load %[[VAL_5]]{{\[}}%[[VAL_4]]] : memref<?xindex>
@@ -1368,7 +1368,7 @@ func @sum_reduction(%arga: tensor<10x20x30xf32>, %argx: tensor<f32>) -> tensor<f
// CHECK: %[[VAL_9:.*]] = dim %[[VAL_1]], %[[VAL_4]] : tensor<?xf32>
// CHECK: %[[VAL_10:.*]] = tensor_to_memref %[[VAL_1]] : memref<?xf32>
// CHECK: %[[VAL_11:.*]] = tensor_to_memref %[[VAL_2]] : memref<f32>
-// CHECK: %[[VAL_12:.*]] = memref.alloc() : memref<f32>
+// CHECK: %[[VAL_12:.*]] = alloc() : memref<f32>
// CHECK: linalg.copy(%[[VAL_11]], %[[VAL_12]]) : memref<f32>, memref<f32>
// CHECK: scf.for %[[VAL_13:.*]] = %[[VAL_4]] to %[[VAL_9]] step %[[VAL_5]] {
// CHECK: %[[VAL_14:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_13]]] : memref<?xf32>
@@ -1431,7 +1431,7 @@ func @sum_reduction_inv(%arga: tensor<?x?x?xf32>,
// CHECK: %[[VAL_10:.*]] = tensor_to_memref %[[VAL_1]] : memref<20xf32>
// CHECK: %[[VAL_11:.*]] = tensor_to_memref %[[VAL_2]] : memref<30xf32>
// CHECK: %[[VAL_12:.*]] = tensor_to_memref %[[VAL_3]] : memref<10x20x30xf32>
-// CHECK: %[[VAL_13:.*]] = memref.alloc() : memref<10x20x30xf32>
+// CHECK: %[[VAL_13:.*]] = alloc() : memref<10x20x30xf32>
// CHECK: linalg.copy(%[[VAL_12]], %[[VAL_13]]) : memref<10x20x30xf32>, memref<10x20x30xf32>
// CHECK: scf.for %[[VAL_14:.*]] = %[[VAL_7]] to %[[VAL_4]] step %[[VAL_8]] {
// CHECK: %[[VAL_15:.*]] = load %[[VAL_9]]{{\[}}%[[VAL_14]]] : memref<10xf32>
diff --git a/mlir/test/Dialect/Linalg/sparse_lower.mlir b/mlir/test/Dialect/Linalg/sparse_lower.mlir
index 5eaaa4ca728e..26888d979126 100644
--- a/mlir/test/Dialect/Linalg/sparse_lower.mlir
+++ b/mlir/test/Dialect/Linalg/sparse_lower.mlir
@@ -47,7 +47,7 @@
// CHECK-HIR: %[[VAL_9:.*]] = linalg.sparse_values %[[VAL_6]] : tensor<64x64xf64> to memref<?xf64>
// CHECK-HIR: %[[VAL_10:.*]] = tensor_to_memref %[[VAL_1]] : memref<64xf64>
// CHECK-HIR: %[[VAL_11:.*]] = tensor_to_memref %[[VAL_2]] : memref<64xf64>
-// CHECK-HIR: %[[VAL_12:.*]] = memref.alloc() : memref<64xf64>
+// CHECK-HIR: %[[VAL_12:.*]] = alloc() : memref<64xf64>
// CHECK-HIR: linalg.copy(%[[VAL_11]], %[[VAL_12]]) : memref<64xf64>, memref<64xf64>
// CHECK-HIR: scf.for %[[VAL_13:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] {
// CHECK-HIR: %[[VAL_14:.*]] = load %[[VAL_7]]{{\[}}%[[VAL_13]]] : memref<?xindex>
@@ -80,7 +80,7 @@
// CHECK-MIR: %[[VAL_8:.*]] = call @sparseValuesF64(%[[VAL_0]]) : (!llvm.ptr<i8>) -> memref<?xf64>
// CHECK-MIR: %[[VAL_9:.*]] = tensor_to_memref %[[VAL_1]] : memref<64xf64>
// CHECK-MIR: %[[VAL_10:.*]] = tensor_to_memref %[[VAL_2]] : memref<64xf64>
-// CHECK-MIR: %[[VAL_11:.*]] = memref.alloc() : memref<64xf64>
+// CHECK-MIR: %[[VAL_11:.*]] = alloc() : memref<64xf64>
// CHECK-MIR: scf.for %[[VAL_12:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] {
// CHECK-MIR: %[[VAL_13:.*]] = load %[[VAL_10]]{{\[}}%[[VAL_12]]] : memref<64xf64>
// CHECK-MIR: store %[[VAL_13]], %[[VAL_11]]{{\[}}%[[VAL_12]]] : memref<64xf64>
@@ -114,7 +114,7 @@
// CHECK-LIR: %[[VAL_6:.*]] = call @sparsePointers64(%[[VAL_0]], %[[VAL_5]]) : (!llvm.ptr<i8>, index) -> memref<?xindex>
// CHECK-LIR: %[[VAL_7:.*]] = call @sparseIndices64(%[[VAL_0]], %[[VAL_5]]) : (!llvm.ptr<i8>, index) -> memref<?xindex>
// CHECK-LIR: %[[VAL_8:.*]] = call @sparseValuesF64(%[[VAL_0]]) : (!llvm.ptr<i8>) -> memref<?xf64>
-// CHECK-LIR: %[[VAL_9:.*]] = memref.alloc() : memref<64xf64>
+// CHECK-LIR: %[[VAL_9:.*]] = alloc() : memref<64xf64>
// CHECK-LIR: scf.for %[[VAL_10:.*]] = %[[VAL_4]] to %[[VAL_3]] step %[[VAL_5]] {
// CHECK-LIR: %[[VAL_11:.*]] = load %[[VAL_2]]{{\[}}%[[VAL_10]]] : memref<64xf64>
// CHECK-LIR: store %[[VAL_11]], %[[VAL_9]]{{\[}}%[[VAL_10]]] : memref<64xf64>
diff --git a/mlir/test/Dialect/Linalg/sparse_nd.mlir b/mlir/test/Dialect/Linalg/sparse_nd.mlir
index d31afd124c99..62f3c5e4dded 100644
--- a/mlir/test/Dialect/Linalg/sparse_nd.mlir
+++ b/mlir/test/Dialect/Linalg/sparse_nd.mlir
@@ -40,7 +40,7 @@
// CHECK: %[[VAL_17:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_4]] : tensor<10x20x30x40x50x60x70x80xf32> to memref<?xindex>
// CHECK: %[[VAL_18:.*]] = linalg.sparse_values %[[VAL_1]] : tensor<10x20x30x40x50x60x70x80xf32> to memref<?xf32>
// CHECK: %[[VAL_19:.*]] = tensor_to_memref %[[VAL_2]] : memref<10x20x30x40x50x60x70x80xf32>
-// CHECK: %[[VAL_20:.*]] = memref.alloc() : memref<10x20x30x40x50x60x70x80xf32>
+// CHECK: %[[VAL_20:.*]] = alloc() : memref<10x20x30x40x50x60x70x80xf32>
// CHECK: linalg.copy(%[[VAL_19]], %[[VAL_20]]) : memref<10x20x30x40x50x60x70x80xf32>, memref<10x20x30x40x50x60x70x80xf32>
// CHECK: scf.for %[[VAL_21:.*]] = %[[VAL_11]] to %[[VAL_10]] step %[[VAL_12]] {
// CHECK: scf.for %[[VAL_22:.*]] = %[[VAL_11]] to %[[VAL_9]] step %[[VAL_12]] {
@@ -71,7 +71,7 @@
// CHECK: %[[VAL_47:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_44]], %[[VAL_41]], %[[VAL_38]], %[[VAL_37]], %[[VAL_32]], %[[VAL_25]], %[[VAL_22]], %[[VAL_21]]] : memref<10x20x30x40x50x60x70x80xf32>
// CHECK: %[[VAL_48:.*]] = load %[[VAL_18]]{{\[}}%[[VAL_46]]] : memref<?xf32>
// CHECK: %[[VAL_49:.*]] = mulf %[[VAL_47]], %[[VAL_48]] : f32
-// CHECK: memref.store %[[VAL_49]], %[[VAL_20]]{{\[}}%[[VAL_44]], %[[VAL_41]], %[[VAL_38]], %[[VAL_37]], %[[VAL_32]], %[[VAL_25]], %[[VAL_22]], %[[VAL_21]]] : memref<10x20x30x40x50x60x70x80xf32>
+// CHECK: store %[[VAL_49]], %[[VAL_20]]{{\[}}%[[VAL_44]], %[[VAL_41]], %[[VAL_38]], %[[VAL_37]], %[[VAL_32]], %[[VAL_25]], %[[VAL_22]], %[[VAL_21]]] : memref<10x20x30x40x50x60x70x80xf32>
// CHECK: }
// CHECK: }
// CHECK: }
diff --git a/mlir/test/Dialect/Linalg/standard.mlir b/mlir/test/Dialect/Linalg/standard.mlir
index 949b79810dff..15cfca2ea679 100644
--- a/mlir/test/Dialect/Linalg/standard.mlir
+++ b/mlir/test/Dialect/Linalg/standard.mlir
@@ -20,11 +20,11 @@ func @dot(%arg0: memref<?xf32, offset: ?, strides: [1]>,
// CHECK-SAME: %[[arg0:[a-zA-z0-9]*]]: memref<?xf32, #[[$map0]]>,
// CHECK-SAME: %[[arg1:[a-zA-z0-9]*]]: memref<?xf32, #[[$map0]]>,
// CHECK-SAME: %[[arg2:[a-zA-z0-9]*]]: memref<f32>) {
-// CHECK: %[[o0:.*]] = memref.cast %[[arg0]] :
+// CHECK: %[[o0:.*]] = memref_cast %[[arg0]] :
// CHECK-SAME: memref<?xf32, #[[$map0]]> to memref<?xf32, #[[$map6]]>
-// CHECK: %[[o1:.*]] = memref.cast %[[arg1]] :
+// CHECK: %[[o1:.*]] = memref_cast %[[arg1]] :
// CHECK-SAME: memref<?xf32, #[[$map0]]> to memref<?xf32, #[[$map6]]>
-// CHECK: %[[o2:.*]] = memref.cast %[[arg2]] :
+// CHECK: %[[o2:.*]] = memref_cast %[[arg2]] :
// CHECK-SAME: memref<f32> to memref<f32, #[[$map7]]>
// CHECK: call @linalg_dot_viewsxf32_viewsxf32_viewf32(
// CHECK-SAME: %[[o0]], %[[o1]], %[[o2]]) :
@@ -37,9 +37,9 @@ func @copy(%arg0: memref<?x?x?xf32, offset: ?, strides: [?, ?, 1]>, %arg1: memre
// CHECK-LABEL: func @copy(
// CHECK-SAME: %[[arg0:[a-zA-z0-9]*]]: memref<?x?x?xf32, #[[$map1]]>,
// CHECK-SAME: %[[arg1:[a-zA-z0-9]*]]: memref<?x?x?xf32, #[[$map1]]>) {
-// CHECK: %[[o0:.*]] = memref.cast %[[arg0]] :
+// CHECK: %[[o0:.*]] = memref_cast %[[arg0]] :
// CHECK-SAME: memref<?x?x?xf32, #[[$map1]]> to memref<?x?x?xf32, #[[$map8]]>
-// CHECK: %[[o1:.*]] = memref.cast %[[arg1]] :
+// CHECK: %[[o1:.*]] = memref_cast %[[arg1]] :
// CHECK-SAME: memref<?x?x?xf32, #[[$map1]]> to memref<?x?x?xf32, #[[$map8]]>
// CHECK: call @linalg_copy_viewsxsxsxf32_viewsxsxsxf32(%[[o0]], %[[o1]]) :
// CHECK-SAME: memref<?x?x?xf32, #[[$map8]]>, memref<?x?x?xf32, #[[$map8]]>
@@ -57,9 +57,9 @@ func @copy_transpose(%arg0: memref<?x?x?xf32, offset: ?, strides: [?, ?, 1]>, %a
// CHECK-SAME: (d0, d1, d2) -> (d0, d2, d1) : memref<?x?x?xf32, #[[$map1]]>
// CHECK: %[[t1:.*]] = transpose %[[arg1]]
// CHECK-SAME: (d0, d1, d2) -> (d2, d1, d0) : memref<?x?x?xf32, #[[$map1]]>
-// CHECK: %[[o0:.*]] = memref.cast %[[t0]] :
+// CHECK: %[[o0:.*]] = memref_cast %[[t0]] :
// CHECK-SAME: memref<?x?x?xf32, #[[$map2]]> to memref<?x?x?xf32, #[[$map8]]>
-// CHECK: %[[o1:.*]] = memref.cast %[[t1]] :
+// CHECK: %[[o1:.*]] = memref_cast %[[t1]] :
// CHECK-SAME: memref<?x?x?xf32, #[[$map4]]> to memref<?x?x?xf32, #[[$map8]]>
// CHECK: call @linalg_copy_viewsxsxsxf32_viewsxsxsxf32(%[[o0]], %[[o1]]) :
// CHECK-SAME: memref<?x?x?xf32, #[[$map8]]>, memref<?x?x?xf32, #[[$map8]]>
diff --git a/mlir/test/Dialect/Linalg/transform-patterns.mlir b/mlir/test/Dialect/Linalg/transform-patterns.mlir
index a43e2b29f1ad..32d2e01a9731 100644
--- a/mlir/test/Dialect/Linalg/transform-patterns.mlir
+++ b/mlir/test/Dialect/Linalg/transform-patterns.mlir
@@ -248,16 +248,16 @@ func @promote_subview_matmul(%arg0: memref<?x?xf32, offset: ?, strides: [?, 1]>,
// CHECK: %[[s0:.*]] = subview {{%.*}}[{{%.*}}, {{%.*}}] [{{%.*}}, {{%.*}}] [{{%.*}}, {{%.*}}] : memref<?x?xf32, #map{{.*}}> to memref<?x?xf32, #map{{.*}}>
// CHECK: %[[s1:.*]] = subview {{%.*}}[{{%.*}}, {{%.*}}] [{{%.*}}, {{%.*}}] [{{%.*}}, {{%.*}}] : memref<?x?xf32, #map{{.*}}> to memref<?x?xf32, #map{{.*}}>
// CHECK: %[[s2:.*]] = subview {{%.*}}[{{%.*}}, {{%.*}}] [{{%.*}}, {{%.*}}] [{{%.*}}, {{%.*}}] : memref<?x?xf32, #map{{.*}}> to memref<?x?xf32, #map{{.*}}>
-// CHECK: %[[a0:.*]] = memref.alloc({{%.*}}) : memref<?xi8>
-// CHECK: %[[v0:.*]] = memref.view %[[a0]][{{.*}}][{{%.*}}, {{%.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECK: %[[a0:.*]] = alloc({{%.*}}) : memref<?xi8>
+// CHECK: %[[v0:.*]] = std.view %[[a0]][{{.*}}][{{%.*}}, {{%.*}}] : memref<?xi8> to memref<?x?xf32>
// CHECK: %[[l0:.*]] = subview %[[v0]][0, 0] [%{{.*}}, %{{.*}}] [1, 1]
// CHECK-SAME: memref<?x?xf32> to memref<?x?xf32, #[[$STRIDED_2D_u_1]]>
-// CHECK: %[[a1:.*]] = memref.alloc({{%.*}}) : memref<?xi8>
-// CHECK: %[[v1:.*]] = memref.view %[[a1]][{{.*}}][{{%.*}}, {{%.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECK: %[[a1:.*]] = alloc({{%.*}}) : memref<?xi8>
+// CHECK: %[[v1:.*]] = std.view %[[a1]][{{.*}}][{{%.*}}, {{%.*}}] : memref<?xi8> to memref<?x?xf32>
// CHECK: %[[l1:.*]] = subview %[[v1]][0, 0] [%{{.*}}, %{{.*}}] [1, 1]
// CHECK-SAME: memref<?x?xf32> to memref<?x?xf32, #[[$STRIDED_2D_u_1]]>
-// CHECK: %[[a2:.*]] = memref.alloc({{%.*}}) : memref<?xi8>
-// CHECK: %[[v2:.*]] = memref.view %[[a2]][{{.*}}][{{%.*}}, {{%.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECK: %[[a2:.*]] = alloc({{%.*}}) : memref<?xi8>
+// CHECK: %[[v2:.*]] = std.view %[[a2]][{{.*}}][{{%.*}}, {{%.*}}] : memref<?xi8> to memref<?x?xf32>
// CHECK: %[[l2:.*]] = subview %[[v2]][0, 0] [%{{.*}}, %{{.*}}] [1, 1]
// CHECK-SAME: memref<?x?xf32> to memref<?x?xf32, #[[$STRIDED_2D_u_1]]>
// CHECK: linalg.copy(%[[s0]], %[[l0]]) : memref<?x?xf32, #map{{.*}}>, memref<?x?xf32, #map{{.*}}>
@@ -307,14 +307,14 @@ func @promote_first_subview_matmul(%arg0: memref<?x?xf32, offset: ?, strides: [?
// CHECK: %[[s0:.*]] = subview {{%.*}}[{{%.*}}, {{%.*}}] [{{%.*}}, {{%.*}}] [{{%.*}}, {{%.*}}] : memref<?x?xf32, #map{{.*}}> to memref<?x?xf32, #map{{.*}}>
// CHECK: %[[s1:.*]] = subview {{%.*}}[{{%.*}}, {{%.*}}] [{{%.*}}, {{%.*}}] [{{%.*}}, {{%.*}}] : memref<?x?xf32, #map{{.*}}> to memref<?x?xf32, #map{{.*}}>
// CHECK: %[[s2:.*]] = subview {{%.*}}[{{%.*}}, {{%.*}}] [{{%.*}}, {{%.*}}] [{{%.*}}, {{%.*}}] : memref<?x?xf32, #map{{.*}}> to memref<?x?xf32, #map{{.*}}>
-// CHECK: %[[a0:.*]] = memref.alloc({{%.*}}) : memref<?xi8>
-// CHECK: %[[v0:.*]] = memref.view %[[a0]][{{.*}}][{{%.*}}, {{%.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECK: %[[a0:.*]] = alloc({{%.*}}) : memref<?xi8>
+// CHECK: %[[v0:.*]] = std.view %[[a0]][{{.*}}][{{%.*}}, {{%.*}}] : memref<?xi8> to memref<?x?xf32>
// CHECK: %[[l0:.*]] = subview %[[v0]][0, 0] [%{{.*}}, %{{.*}}] [1, 1] : memref<?x?xf32> to memref<?x?xf32, #[[$STRIDED_2D_u_1]]>
-// CHECK-NOT: %[[a1:.*]] = memref.alloc({{%.*}}) : memref<?xi8>
-// CHECK-NOT: %[[v1:.*]] = memref.view %[[a1]][{{.*}}][{{%.*}}, {{%.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECK-NOT: %[[a1:.*]] = alloc({{%.*}}) : memref<?xi8>
+// CHECK-NOT: %[[v1:.*]] = std.view %[[a1]][{{.*}}][{{%.*}}, {{%.*}}] : memref<?xi8> to memref<?x?xf32>
// CHECK-NOT: %[[l0:.*]] = subview %[[v1]][0, 0] [%{{.*}}, %{{.*}}] [1, 1] : memref<?x?xf32> to memref<?x?xf32, #[[$STRIDED_2D_u_1]]>
-// CHECK-NOT: %[[a2:.*]] = memref.alloc({{%.*}}) : memref<?xi8>
-// CHECK-NOT: %[[v2:.*]] = memref.view %[[a2]][{{.*}}][{{%.*}}, {{%.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECK-NOT: %[[a2:.*]] = alloc({{%.*}}) : memref<?xi8>
+// CHECK-NOT: %[[v2:.*]] = std.view %[[a2]][{{.*}}][{{%.*}}, {{%.*}}] : memref<?xi8> to memref<?x?xf32>
// CHECK-NOT: %[[l0:.*]] = subview %[[v2]][0, 0] [%{{.*}}, %{{.*}}] [1, 1] : memref<?x?xf32> to memref<?x?xf32, #[[$STRIDED_2D_u_1]]>
// CHECK: linalg.copy(%[[s0]], %[[l0]]) : memref<?x?xf32, #map{{.*}}>, memref<?x?xf32, #map{{.*}}>
// CHECK-NOT: linalg.copy(%[[s1]], %[[l1]]) : memref<?x?xf32, #map{{.*}}>, memref<?x?xf32, #map{{.*}}>
@@ -338,8 +338,8 @@ func @aligned_promote_fill(%arg0: memref<?x?xf32, offset: ?, strides: [?, 1]>) {
// CHECK-LABEL: func @aligned_promote_fill
// CHECK: %[[cf:.*]] = constant {{.*}} : f32
// CHECK: %[[s0:.*]] = subview {{%.*}}[{{%.*}}, {{%.*}}] [{{%.*}}, {{%.*}}] [{{%.*}}, {{%.*}}] : memref<?x?xf32, #map{{.*}}> to memref<?x?xf32, #map{{.*}}>
-// CHECK: %[[a0:.*]] = memref.alloc({{%.*}}) {alignment = 32 : i64} : memref<?xi8>
-// CHECK: %[[v0:.*]] = memref.view %[[a0]][{{.*}}][{{%.*}}, {{%.*}}] : memref<?xi8> to memref<?x?xf32>
+// CHECK: %[[a0:.*]] = alloc({{%.*}}) {alignment = 32 : i64} : memref<?xi8>
+// CHECK: %[[v0:.*]] = std.view %[[a0]][{{.*}}][{{%.*}}, {{%.*}}] : memref<?xi8> to memref<?x?xf32>
// CHECK: %[[l0:.*]] = subview %[[v0]][0, 0] [%{{.*}}, %{{.*}}] [1, 1] : memref<?x?xf32> to memref<?x?xf32, #[[$STRIDED_2D_u_1]]>
// CHECK: linalg.fill(%[[v0]], {{%.*}}) : memref<?x?xf32>, f32
// CHECK: linalg.copy(%[[s0]], %[[l0]]) : memref<?x?xf32, #map{{.*}}>, memref<?x?xf32, #map{{.*}}>
diff --git a/mlir/test/Dialect/OpenACC/invalid.mlir b/mlir/test/Dialect/OpenACC/invalid.mlir
index 9d2afb7d3a08..df52b0cd9a60 100644
--- a/mlir/test/Dialect/OpenACC/invalid.mlir
+++ b/mlir/test/Dialect/OpenACC/invalid.mlir
@@ -82,21 +82,21 @@ acc.update
// -----
%cst = constant 1 : index
-%value = memref.alloc() : memref<10xf32>
+%value = alloc() : memref<10xf32>
// expected-error at +1 {{wait_devnum cannot appear without waitOperands}}
acc.update wait_devnum(%cst: index) host(%value: memref<10xf32>)
// -----
%cst = constant 1 : index
-%value = memref.alloc() : memref<10xf32>
+%value = alloc() : memref<10xf32>
// expected-error at +1 {{async attribute cannot appear with asyncOperand}}
acc.update async(%cst: index) host(%value: memref<10xf32>) attributes {async}
// -----
%cst = constant 1 : index
-%value = memref.alloc() : memref<10xf32>
+%value = alloc() : memref<10xf32>
// expected-error at +1 {{wait attribute cannot appear with waitOperands}}
acc.update wait(%cst: index) host(%value: memref<10xf32>) attributes {wait}
@@ -162,14 +162,14 @@ acc.exit_data attributes {async}
// -----
%cst = constant 1 : index
-%value = memref.alloc() : memref<10xf32>
+%value = alloc() : memref<10xf32>
// expected-error at +1 {{async attribute cannot appear with asyncOperand}}
acc.exit_data async(%cst: index) delete(%value : memref<10xf32>) attributes {async}
// -----
%cst = constant 1 : index
-%value = memref.alloc() : memref<10xf32>
+%value = alloc() : memref<10xf32>
// expected-error at +1 {{wait_devnum cannot appear without waitOperands}}
acc.exit_data wait_devnum(%cst: index) delete(%value : memref<10xf32>)
@@ -181,20 +181,20 @@ acc.enter_data attributes {async}
// -----
%cst = constant 1 : index
-%value = memref.alloc() : memref<10xf32>
+%value = alloc() : memref<10xf32>
// expected-error at +1 {{async attribute cannot appear with asyncOperand}}
acc.enter_data async(%cst: index) create(%value : memref<10xf32>) attributes {async}
// -----
%cst = constant 1 : index
-%value = memref.alloc() : memref<10xf32>
+%value = alloc() : memref<10xf32>
// expected-error at +1 {{wait attribute cannot appear with waitOperands}}
acc.enter_data wait(%cst: index) create(%value : memref<10xf32>) attributes {wait}
// -----
%cst = constant 1 : index
-%value = memref.alloc() : memref<10xf32>
+%value = alloc() : memref<10xf32>
// expected-error at +1 {{wait_devnum cannot appear without waitOperands}}
acc.enter_data wait_devnum(%cst: index) create(%value : memref<10xf32>)
diff --git a/mlir/test/Dialect/OpenACC/ops.mlir b/mlir/test/Dialect/OpenACC/ops.mlir
index bceaf25a79f7..6e5336727a65 100644
--- a/mlir/test/Dialect/OpenACC/ops.mlir
+++ b/mlir/test/Dialect/OpenACC/ops.mlir
@@ -20,7 +20,7 @@ func @compute1(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x10xf3
%cij = load %C[%arg3, %arg4] : memref<10x10xf32>
%p = mulf %a, %b : f32
%co = addf %cij, %p : f32
- memref.store %co, %C[%arg3, %arg4] : memref<10x10xf32>
+ store %co, %C[%arg3, %arg4] : memref<10x10xf32>
}
}
}
@@ -47,7 +47,7 @@ func @compute1(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x10xf3
// CHECK-NEXT: %{{.*}} = load %{{.*}}[%{{.*}}, %{{.*}}] : memref<10x10xf32>
// CHECK-NEXT: %{{.*}} = mulf %{{.*}}, %{{.*}} : f32
// CHECK-NEXT: %{{.*}} = addf %{{.*}}, %{{.*}} : f32
-// CHECK-NEXT: memref.store %{{.*}}, %{{.*}}[%{{.*}}, %{{.*}}] : memref<10x10xf32>
+// CHECK-NEXT: store %{{.*}}, %{{.*}}[%{{.*}}, %{{.*}}] : memref<10x10xf32>
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: }
@@ -75,7 +75,7 @@ func @compute2(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x10xf3
%cij = load %C[%arg3, %arg4] : memref<10x10xf32>
%p = mulf %a, %b : f32
%co = addf %cij, %p : f32
- memref.store %co, %C[%arg3, %arg4] : memref<10x10xf32>
+ store %co, %C[%arg3, %arg4] : memref<10x10xf32>
}
}
}
@@ -101,7 +101,7 @@ func @compute2(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x10xf3
// CHECK-NEXT: %{{.*}} = load %{{.*}}[%{{.*}}, %{{.*}}] : memref<10x10xf32>
// CHECK-NEXT: %{{.*}} = mulf %{{.*}}, %{{.*}} : f32
// CHECK-NEXT: %{{.*}} = addf %{{.*}}, %{{.*}} : f32
-// CHECK-NEXT: memref.store %{{.*}}, %{{.*}}[%{{.*}}, %{{.*}}] : memref<10x10xf32>
+// CHECK-NEXT: store %{{.*}}, %{{.*}}[%{{.*}}, %{{.*}}] : memref<10x10xf32>
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: }
@@ -130,7 +130,7 @@ func @compute3(%a: memref<10x10xf32>, %b: memref<10x10xf32>, %c: memref<10xf32>,
%axy = load %a[%x, %y] : memref<10x10xf32>
%bxy = load %b[%x, %y] : memref<10x10xf32>
%tmp = addf %axy, %bxy : f32
- memref.store %tmp, %c[%y] : memref<10xf32>
+ store %tmp, %c[%y] : memref<10xf32>
}
acc.yield
}
@@ -142,7 +142,7 @@ func @compute3(%a: memref<10x10xf32>, %b: memref<10x10xf32>, %c: memref<10xf32>,
%ci = load %c[%i] : memref<10xf32>
%dx = load %d[%x] : memref<10xf32>
%z = addf %ci, %dx : f32
- memref.store %z, %d[%x] : memref<10xf32>
+ store %z, %d[%x] : memref<10xf32>
}
acc.yield
} attributes {seq}
@@ -172,7 +172,7 @@ func @compute3(%a: memref<10x10xf32>, %b: memref<10x10xf32>, %c: memref<10xf32>,
// CHECK-NEXT: %{{.*}} = load %{{.*}}[%{{.*}}, %{{.*}}] : memref<10x10xf32>
// CHECK-NEXT: %{{.*}} = load %{{.*}}[%{{.*}}, %{{.*}}] : memref<10x10xf32>
// CHECK-NEXT: %{{.*}} = addf %{{.*}}, %{{.*}} : f32
-// CHECK-NEXT: memref.store %{{.*}}, %{{.*}}[%{{.*}}] : memref<10xf32>
+// CHECK-NEXT: store %{{.*}}, %{{.*}}[%{{.*}}] : memref<10xf32>
// CHECK-NEXT: }
// CHECK-NEXT: acc.yield
// CHECK-NEXT: }
@@ -181,7 +181,7 @@ func @compute3(%a: memref<10x10xf32>, %b: memref<10x10xf32>, %c: memref<10xf32>,
// CHECK-NEXT: %{{.*}} = load %{{.*}}[%{{.*}}] : memref<10xf32>
// CHECK-NEXT: %{{.*}} = load %{{.*}}[%{{.*}}] : memref<10xf32>
// CHECK-NEXT: %{{.*}} = addf %{{.*}}, %{{.*}} : f32
-// CHECK-NEXT: memref.store %{{.*}}, %{{.*}}[%{{.*}}] : memref<10xf32>
+// CHECK-NEXT: store %{{.*}}, %{{.*}}[%{{.*}}] : memref<10xf32>
// CHECK-NEXT: }
// CHECK-NEXT: acc.yield
// CHECK-NEXT: } attributes {seq}
diff --git a/mlir/test/Dialect/SCF/canonicalize.mlir b/mlir/test/Dialect/SCF/canonicalize.mlir
index fa36deb9dd2c..f0638d16105b 100644
--- a/mlir/test/Dialect/SCF/canonicalize.mlir
+++ b/mlir/test/Dialect/SCF/canonicalize.mlir
@@ -10,7 +10,7 @@ func @single_iteration(%A: memref<?x?x?xi32>) {
%c10 = constant 10 : index
scf.parallel (%i0, %i1, %i2) = (%c0, %c3, %c7) to (%c1, %c6, %c10) step (%c1, %c2, %c3) {
%c42 = constant 42 : i32
- memref.store %c42, %A[%i0, %i1, %i2] : memref<?x?x?xi32>
+ store %c42, %A[%i0, %i1, %i2] : memref<?x?x?xi32>
scf.yield
}
return
@@ -25,7 +25,7 @@ func @single_iteration(%A: memref<?x?x?xi32>) {
// CHECK: [[C7:%.*]] = constant 7 : index
// CHECK: [[C42:%.*]] = constant 42 : i32
// CHECK: scf.parallel ([[V0:%.*]]) = ([[C3]]) to ([[C6]]) step ([[C2]]) {
-// CHECK: memref.store [[C42]], [[ARG0]]{{\[}}[[C0]], [[V0]], [[C7]]] : memref<?x?x?xi32>
+// CHECK: store [[C42]], [[ARG0]]{{\[}}[[C0]], [[V0]], [[C7]]] : memref<?x?x?xi32>
// CHECK: scf.yield
// CHECK: }
// CHECK: return
diff --git a/mlir/test/Dialect/SCF/for-loop-specialization.mlir b/mlir/test/Dialect/SCF/for-loop-specialization.mlir
index 7b209f552961..473b8232e351 100644
--- a/mlir/test/Dialect/SCF/for-loop-specialization.mlir
+++ b/mlir/test/Dialect/SCF/for-loop-specialization.mlir
@@ -13,7 +13,7 @@ func @for(%outer: index, %A: memref<?xf32>, %B: memref<?xf32>,
%B_elem = load %B[%i0] : memref<?xf32>
%C_elem = load %C[%i0] : memref<?xf32>
%sum_elem = addf %B_elem, %C_elem : f32
- memref.store %sum_elem, %result[%i0] : memref<?xf32>
+ store %sum_elem, %result[%i0] : memref<?xf32>
}
return
}
@@ -28,11 +28,11 @@ func @for(%outer: index, %A: memref<?xf32>, %B: memref<?xf32>,
// CHECK: [[PRED:%.*]] = cmpi eq, [[MIN]], [[CST_1024]] : index
// CHECK: scf.if [[PRED]] {
// CHECK: scf.for [[IDX0:%.*]] = [[CST_0]] to [[CST_1024]] step [[CST_1]] {
-// CHECK: memref.store
+// CHECK: store
// CHECK: }
// CHECK: } else {
// CHECK: scf.for [[IDX0:%.*]] = [[CST_0]] to [[MIN]] step [[CST_1]] {
-// CHECK: memref.store
+// CHECK: store
// CHECK: }
// CHECK: }
// CHECK: return
diff --git a/mlir/test/Dialect/SCF/loop-unroll.mlir b/mlir/test/Dialect/SCF/loop-unroll.mlir
index a824a7df51ce..0b6e178ed0aa 100644
--- a/mlir/test/Dialect/SCF/loop-unroll.mlir
+++ b/mlir/test/Dialect/SCF/loop-unroll.mlir
@@ -8,7 +8,7 @@ func @dynamic_loop_unroll(%arg0 : index, %arg1 : index, %arg2 : index,
%arg3: memref<?xf32>) {
%0 = constant 7.0 : f32
scf.for %i0 = %arg0 to %arg1 step %arg2 {
- memref.store %0, %arg3[%i0] : memref<?xf32>
+ store %0, %arg3[%i0] : memref<?xf32>
}
return
}
@@ -34,14 +34,14 @@ func @dynamic_loop_unroll(%arg0 : index, %arg1 : index, %arg2 : index,
// Compute step of unrolled loop in V8.
// UNROLL-BY-2-DAG: %[[V8:.*]] = muli %[[STEP]], %[[C2]] : index
// UNROLL-BY-2: scf.for %[[IV:.*]] = %[[LB]] to %[[V7]] step %[[V8]] {
-// UNROLL-BY-2-NEXT: memref.store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
+// UNROLL-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
// UNROLL-BY-2-NEXT: %[[C1_IV:.*]] = constant 1 : index
// UNROLL-BY-2-NEXT: %[[V9:.*]] = muli %[[STEP]], %[[C1_IV]] : index
// UNROLL-BY-2-NEXT: %[[V10:.*]] = addi %[[IV]], %[[V9]] : index
-// UNROLL-BY-2-NEXT: memref.store %{{.*}}, %[[MEM]][%[[V10]]] : memref<?xf32>
+// UNROLL-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[V10]]] : memref<?xf32>
// UNROLL-BY-2-NEXT: }
// UNROLL-BY-2-NEXT: scf.for %[[IV:.*]] = %[[V7]] to %[[UB]] step %[[STEP]] {
-// UNROLL-BY-2-NEXT: memref.store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
+// UNROLL-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
// UNROLL-BY-2-NEXT: }
// UNROLL-BY-2-NEXT: return
@@ -67,18 +67,18 @@ func @dynamic_loop_unroll(%arg0 : index, %arg1 : index, %arg2 : index,
// Compute step of unrolled loop in V8.
// UNROLL-BY-3-DAG: %[[V8:.*]] = muli %[[STEP]], %[[C3]] : index
// UNROLL-BY-3: scf.for %[[IV:.*]] = %[[LB]] to %[[V7]] step %[[V8]] {
-// UNROLL-BY-3-NEXT: memref.store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
+// UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
// UNROLL-BY-3-NEXT: %[[C1_IV:.*]] = constant 1 : index
// UNROLL-BY-3-NEXT: %[[V9:.*]] = muli %[[STEP]], %[[C1_IV]] : index
// UNROLL-BY-3-NEXT: %[[V10:.*]] = addi %[[IV]], %[[V9]] : index
-// UNROLL-BY-3-NEXT: memref.store %{{.*}}, %[[MEM]][%[[V10]]] : memref<?xf32>
+// UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[V10]]] : memref<?xf32>
// UNROLL-BY-3-NEXT: %[[C2_IV:.*]] = constant 2 : index
// UNROLL-BY-3-NEXT: %[[V11:.*]] = muli %[[STEP]], %[[C2_IV]] : index
// UNROLL-BY-3-NEXT: %[[V12:.*]] = addi %[[IV]], %[[V11]] : index
-// UNROLL-BY-3-NEXT: memref.store %{{.*}}, %[[MEM]][%[[V12]]] : memref<?xf32>
+// UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[V12]]] : memref<?xf32>
// UNROLL-BY-3-NEXT: }
// UNROLL-BY-3-NEXT: scf.for %[[IV:.*]] = %[[V7]] to %[[UB]] step %[[STEP]] {
-// UNROLL-BY-3-NEXT: memref.store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
+// UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
// UNROLL-BY-3-NEXT: }
// UNROLL-BY-3-NEXT: return
@@ -88,7 +88,7 @@ func @dynamic_loop_unroll_outer_by_2(
%0 = constant 7.0 : f32
scf.for %i0 = %arg0 to %arg1 step %arg2 {
scf.for %i1 = %arg3 to %arg4 step %arg5 {
- memref.store %0, %arg6[%i1] : memref<?xf32>
+ store %0, %arg6[%i1] : memref<?xf32>
}
}
return
@@ -104,15 +104,15 @@ func @dynamic_loop_unroll_outer_by_2(
//
// UNROLL-OUTER-BY-2: scf.for %[[IV0:.*]] = %[[LB0]] to %{{.*}} step %{{.*}} {
// UNROLL-OUTER-BY-2-NEXT: scf.for %[[IV1:.*]] = %[[LB1]] to %[[UB1]] step %[[STEP1]] {
-// UNROLL-OUTER-BY-2-NEXT: memref.store %{{.*}}, %[[MEM]][%[[IV1]]] : memref<?xf32>
+// UNROLL-OUTER-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV1]]] : memref<?xf32>
// UNROLL-OUTER-BY-2-NEXT: }
// UNROLL-OUTER-BY-2-NEXT: scf.for %[[IV1:.*]] = %[[LB1]] to %[[UB1]] step %[[STEP1]] {
-// UNROLL-OUTER-BY-2-NEXT: memref.store %{{.*}}, %[[MEM]][%[[IV1]]] : memref<?xf32>
+// UNROLL-OUTER-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV1]]] : memref<?xf32>
// UNROLL-OUTER-BY-2-NEXT: }
// UNROLL-OUTER-BY-2-NEXT: }
// UNROLL-OUTER-BY-2-NEXT: scf.for %[[IV0:.*]] = %{{.*}} to %[[UB0]] step %[[STEP0]] {
// UNROLL-OUTER-BY-2-NEXT: scf.for %[[IV1:.*]] = %[[LB1]] to %[[UB1]] step %[[STEP1]] {
-// UNROLL-OUTER-BY-2-NEXT: memref.store %{{.*}}, %[[MEM]][%[[IV1]]] : memref<?xf32>
+// UNROLL-OUTER-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV1]]] : memref<?xf32>
// UNROLL-OUTER-BY-2-NEXT: }
// UNROLL-OUTER-BY-2-NEXT: }
// UNROLL-OUTER-BY-2-NEXT: return
@@ -123,7 +123,7 @@ func @dynamic_loop_unroll_inner_by_2(
%0 = constant 7.0 : f32
scf.for %i0 = %arg0 to %arg1 step %arg2 {
scf.for %i1 = %arg3 to %arg4 step %arg5 {
- memref.store %0, %arg6[%i1] : memref<?xf32>
+ store %0, %arg6[%i1] : memref<?xf32>
}
}
return
@@ -139,14 +139,14 @@ func @dynamic_loop_unroll_inner_by_2(
//
// UNROLL-INNER-BY-2: scf.for %[[IV0:.*]] = %[[LB0]] to %[[UB0]] step %[[STEP0]] {
// UNROLL-INNER-BY-2: scf.for %[[IV1:.*]] = %[[LB1]] to %{{.*}} step %{{.*}} {
-// UNROLL-INNER-BY-2-NEXT: memref.store %{{.*}}, %[[MEM]][%[[IV1]]] : memref<?xf32>
+// UNROLL-INNER-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV1]]] : memref<?xf32>
// UNROLL-INNER-BY-2-NEXT: %[[C1_IV:.*]] = constant 1 : index
// UNROLL-INNER-BY-2-NEXT: %[[V0:.*]] = muli %[[STEP1]], %[[C1_IV]] : index
// UNROLL-INNER-BY-2-NEXT: %[[V1:.*]] = addi %[[IV1]], %[[V0]] : index
-// UNROLL-INNER-BY-2-NEXT: memref.store %{{.*}}, %[[MEM]][%[[V1]]] : memref<?xf32>
+// UNROLL-INNER-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[V1]]] : memref<?xf32>
// UNROLL-INNER-BY-2-NEXT: }
// UNROLL-INNER-BY-2-NEXT: scf.for %[[IV1:.*]] = %{{.*}} to %[[UB1]] step %[[STEP1]] {
-// UNROLL-INNER-BY-2-NEXT: memref.store %{{.*}}, %[[MEM]][%[[IV1]]] : memref<?xf32>
+// UNROLL-INNER-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV1]]] : memref<?xf32>
// UNROLL-INNER-BY-2-NEXT: }
// UNROLL-INNER-BY-2-NEXT: }
// UNROLL-INNER-BY-2-NEXT: return
@@ -159,7 +159,7 @@ func @static_loop_unroll_by_2(%arg0 : memref<?xf32>) {
%ub = constant 20 : index
%step = constant 1 : index
scf.for %i0 = %lb to %ub step %step {
- memref.store %0, %arg0[%i0] : memref<?xf32>
+ store %0, %arg0[%i0] : memref<?xf32>
}
return
}
@@ -171,11 +171,11 @@ func @static_loop_unroll_by_2(%arg0 : memref<?xf32>) {
// UNROLL-BY-2-DAG: %[[C20:.*]] = constant 20 : index
// UNROLL-BY-2-DAG: %[[C2:.*]] = constant 2 : index
// UNROLL-BY-2: scf.for %[[IV:.*]] = %[[C0]] to %[[C20]] step %[[C2]] {
-// UNROLL-BY-2-NEXT: memref.store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
+// UNROLL-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
// UNROLL-BY-2-NEXT: %[[C1_IV:.*]] = constant 1 : index
// UNROLL-BY-2-NEXT: %[[V0:.*]] = muli %[[C1]], %[[C1_IV]] : index
// UNROLL-BY-2-NEXT: %[[V1:.*]] = addi %[[IV]], %[[V0]] : index
-// UNROLL-BY-2-NEXT: memref.store %{{.*}}, %[[MEM]][%[[V1]]] : memref<?xf32>
+// UNROLL-BY-2-NEXT: store %{{.*}}, %[[MEM]][%[[V1]]] : memref<?xf32>
// UNROLL-BY-2-NEXT: }
// UNROLL-BY-2-NEXT: return
@@ -187,7 +187,7 @@ func @static_loop_unroll_by_3(%arg0 : memref<?xf32>) {
%ub = constant 20 : index
%step = constant 1 : index
scf.for %i0 = %lb to %ub step %step {
- memref.store %0, %arg0[%i0] : memref<?xf32>
+ store %0, %arg0[%i0] : memref<?xf32>
}
return
}
@@ -201,18 +201,18 @@ func @static_loop_unroll_by_3(%arg0 : memref<?xf32>) {
// UNROLL-BY-3-DAG: %[[C18:.*]] = constant 18 : index
// UNROLL-BY-3-DAG: %[[C3:.*]] = constant 3 : index
// UNROLL-BY-3: scf.for %[[IV:.*]] = %[[C0]] to %[[C18]] step %[[C3]] {
-// UNROLL-BY-3-NEXT: memref.store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
+// UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
// UNROLL-BY-3-NEXT: %[[C1_IV:.*]] = constant 1 : index
// UNROLL-BY-3-NEXT: %[[V0:.*]] = muli %[[C1]], %[[C1_IV]] : index
// UNROLL-BY-3-NEXT: %[[V1:.*]] = addi %[[IV]], %[[V0]] : index
-// UNROLL-BY-3-NEXT: memref.store %{{.*}}, %[[MEM]][%[[V1]]] : memref<?xf32>
+// UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[V1]]] : memref<?xf32>
// UNROLL-BY-3-NEXT: %[[C2_IV:.*]] = constant 2 : index
// UNROLL-BY-3-NEXT: %[[V2:.*]] = muli %[[C1]], %[[C2_IV]] : index
// UNROLL-BY-3-NEXT: %[[V3:.*]] = addi %[[IV]], %[[V2]] : index
-// UNROLL-BY-3-NEXT: memref.store %{{.*}}, %[[MEM]][%[[V3]]] : memref<?xf32>
+// UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[V3]]] : memref<?xf32>
// UNROLL-BY-3-NEXT: }
// UNROLL-BY-3-NEXT: scf.for %[[IV:.*]] = %[[C18]] to %[[C20]] step %[[C1]] {
-// UNROLL-BY-3-NEXT: memref.store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
+// UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
// UNROLL-BY-3-NEXT: }
// UNROLL-BY-3-NEXT: return
@@ -224,7 +224,7 @@ func @static_loop_unroll_by_3_promote_epilogue(%arg0 : memref<?xf32>) {
%ub = constant 10 : index
%step = constant 1 : index
scf.for %i0 = %lb to %ub step %step {
- memref.store %0, %arg0[%i0] : memref<?xf32>
+ store %0, %arg0[%i0] : memref<?xf32>
}
return
}
@@ -237,17 +237,17 @@ func @static_loop_unroll_by_3_promote_epilogue(%arg0 : memref<?xf32>) {
// UNROLL-BY-3-DAG: %[[C9:.*]] = constant 9 : index
// UNROLL-BY-3-DAG: %[[C3:.*]] = constant 3 : index
// UNROLL-BY-3: scf.for %[[IV:.*]] = %[[C0]] to %[[C9]] step %[[C3]] {
-// UNROLL-BY-3-NEXT: memref.store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
+// UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[IV]]] : memref<?xf32>
// UNROLL-BY-3-NEXT: %[[C1_IV:.*]] = constant 1 : index
// UNROLL-BY-3-NEXT: %[[V0:.*]] = muli %[[C1]], %[[C1_IV]] : index
// UNROLL-BY-3-NEXT: %[[V1:.*]] = addi %[[IV]], %[[V0]] : index
-// UNROLL-BY-3-NEXT: memref.store %{{.*}}, %[[MEM]][%[[V1]]] : memref<?xf32>
+// UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[V1]]] : memref<?xf32>
// UNROLL-BY-3-NEXT: %[[C2_IV:.*]] = constant 2 : index
// UNROLL-BY-3-NEXT: %[[V2:.*]] = muli %[[C1]], %[[C2_IV]] : index
// UNROLL-BY-3-NEXT: %[[V3:.*]] = addi %[[IV]], %[[V2]] : index
-// UNROLL-BY-3-NEXT: memref.store %{{.*}}, %[[MEM]][%[[V3]]] : memref<?xf32>
+// UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[V3]]] : memref<?xf32>
// UNROLL-BY-3-NEXT: }
-// UNROLL-BY-3-NEXT: memref.store %{{.*}}, %[[MEM]][%[[C9]]] : memref<?xf32>
+// UNROLL-BY-3-NEXT: store %{{.*}}, %[[MEM]][%[[C9]]] : memref<?xf32>
// UNROLL-BY-3-NEXT: return
// Test unroll-up-to functionality.
diff --git a/mlir/test/Dialect/SCF/parallel-loop-fusion.mlir b/mlir/test/Dialect/SCF/parallel-loop-fusion.mlir
index e70864188ec6..971e1c8041b8 100644
--- a/mlir/test/Dialect/SCF/parallel-loop-fusion.mlir
+++ b/mlir/test/Dialect/SCF/parallel-loop-fusion.mlir
@@ -29,22 +29,22 @@ func @fuse_two(%A: memref<2x2xf32>, %B: memref<2x2xf32>,
%c2 = constant 2 : index
%c0 = constant 0 : index
%c1 = constant 1 : index
- %sum = memref.alloc() : memref<2x2xf32>
+ %sum = alloc() : memref<2x2xf32>
scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) {
%B_elem = load %B[%i, %j] : memref<2x2xf32>
%C_elem = load %C[%i, %j] : memref<2x2xf32>
%sum_elem = addf %B_elem, %C_elem : f32
- memref.store %sum_elem, %sum[%i, %j] : memref<2x2xf32>
+ store %sum_elem, %sum[%i, %j] : memref<2x2xf32>
scf.yield
}
scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) {
%sum_elem = load %sum[%i, %j] : memref<2x2xf32>
%A_elem = load %A[%i, %j] : memref<2x2xf32>
%product_elem = mulf %sum_elem, %A_elem : f32
- memref.store %product_elem, %result[%i, %j] : memref<2x2xf32>
+ store %product_elem, %result[%i, %j] : memref<2x2xf32>
scf.yield
}
- memref.dealloc %sum : memref<2x2xf32>
+ dealloc %sum : memref<2x2xf32>
return
}
// CHECK-LABEL: func @fuse_two
@@ -53,20 +53,20 @@ func @fuse_two(%A: memref<2x2xf32>, %B: memref<2x2xf32>,
// CHECK: [[C2:%.*]] = constant 2 : index
// CHECK: [[C0:%.*]] = constant 0 : index
// CHECK: [[C1:%.*]] = constant 1 : index
-// CHECK: [[SUM:%.*]] = memref.alloc()
+// CHECK: [[SUM:%.*]] = alloc()
// CHECK: scf.parallel ([[I:%.*]], [[J:%.*]]) = ([[C0]], [[C0]])
// CHECK-SAME: to ([[C2]], [[C2]]) step ([[C1]], [[C1]]) {
// CHECK: [[B_ELEM:%.*]] = load [[B]]{{\[}}[[I]], [[J]]]
// CHECK: [[C_ELEM:%.*]] = load [[C]]{{\[}}[[I]], [[J]]]
// CHECK: [[SUM_ELEM:%.*]] = addf [[B_ELEM]], [[C_ELEM]]
-// CHECK: memref.store [[SUM_ELEM]], [[SUM]]{{\[}}[[I]], [[J]]]
+// CHECK: store [[SUM_ELEM]], [[SUM]]{{\[}}[[I]], [[J]]]
// CHECK: [[SUM_ELEM_:%.*]] = load [[SUM]]{{\[}}[[I]], [[J]]]
// CHECK: [[A_ELEM:%.*]] = load [[A]]{{\[}}[[I]], [[J]]]
// CHECK: [[PRODUCT_ELEM:%.*]] = mulf [[SUM_ELEM_]], [[A_ELEM]]
-// CHECK: memref.store [[PRODUCT_ELEM]], [[RESULT]]{{\[}}[[I]], [[J]]]
+// CHECK: store [[PRODUCT_ELEM]], [[RESULT]]{{\[}}[[I]], [[J]]]
// CHECK: scf.yield
// CHECK: }
-// CHECK: memref.dealloc [[SUM]]
+// CHECK: dealloc [[SUM]]
// -----
@@ -76,28 +76,28 @@ func @fuse_three(%lhs: memref<100x10xf32>, %rhs: memref<100xf32>,
%c10 = constant 10 : index
%c0 = constant 0 : index
%c1 = constant 1 : index
- %broadcast_rhs = memref.alloc() : memref<100x10xf32>
- %
diff = memref.alloc() : memref<100x10xf32>
+ %broadcast_rhs = alloc() : memref<100x10xf32>
+ %
diff = alloc() : memref<100x10xf32>
scf.parallel (%i, %j) = (%c0, %c0) to (%c100, %c10) step (%c1, %c1) {
%rhs_elem = load %rhs[%i] : memref<100xf32>
- memref.store %rhs_elem, %broadcast_rhs[%i, %j] : memref<100x10xf32>
+ store %rhs_elem, %broadcast_rhs[%i, %j] : memref<100x10xf32>
scf.yield
}
scf.parallel (%i, %j) = (%c0, %c0) to (%c100, %c10) step (%c1, %c1) {
%lhs_elem = load %lhs[%i, %j] : memref<100x10xf32>
%broadcast_rhs_elem = load %broadcast_rhs[%i, %j] : memref<100x10xf32>
%
diff _elem = subf %lhs_elem, %broadcast_rhs_elem : f32
- memref.store %
diff _elem, %
diff [%i, %j] : memref<100x10xf32>
+ store %
diff _elem, %
diff [%i, %j] : memref<100x10xf32>
scf.yield
}
scf.parallel (%i, %j) = (%c0, %c0) to (%c100, %c10) step (%c1, %c1) {
%
diff _elem = load %
diff [%i, %j] : memref<100x10xf32>
%exp_elem = math.exp %
diff _elem : f32
- memref.store %exp_elem, %result[%i, %j] : memref<100x10xf32>
+ store %exp_elem, %result[%i, %j] : memref<100x10xf32>
scf.yield
}
- memref.dealloc %broadcast_rhs : memref<100x10xf32>
- memref.dealloc %
diff : memref<100x10xf32>
+ dealloc %broadcast_rhs : memref<100x10xf32>
+ dealloc %
diff : memref<100x10xf32>
return
}
// CHECK-LABEL: func @fuse_three
@@ -107,23 +107,23 @@ func @fuse_three(%lhs: memref<100x10xf32>, %rhs: memref<100xf32>,
// CHECK: [[C10:%.*]] = constant 10 : index
// CHECK: [[C0:%.*]] = constant 0 : index
// CHECK: [[C1:%.*]] = constant 1 : index
-// CHECK: [[BROADCAST_RHS:%.*]] = memref.alloc()
-// CHECK: [[DIFF:%.*]] = memref.alloc()
+// CHECK: [[BROADCAST_RHS:%.*]] = alloc()
+// CHECK: [[DIFF:%.*]] = alloc()
// CHECK: scf.parallel ([[I:%.*]], [[J:%.*]]) = ([[C0]], [[C0]])
// CHECK-SAME: to ([[C100]], [[C10]]) step ([[C1]], [[C1]]) {
// CHECK: [[RHS_ELEM:%.*]] = load [[RHS]]{{\[}}[[I]]]
-// CHECK: memref.store [[RHS_ELEM]], [[BROADCAST_RHS]]{{\[}}[[I]], [[J]]]
+// CHECK: store [[RHS_ELEM]], [[BROADCAST_RHS]]{{\[}}[[I]], [[J]]]
// CHECK: [[LHS_ELEM:%.*]] = load [[LHS]]{{\[}}[[I]], [[J]]]
// CHECK: [[BROADCAST_RHS_ELEM:%.*]] = load [[BROADCAST_RHS]]
// CHECK: [[DIFF_ELEM:%.*]] = subf [[LHS_ELEM]], [[BROADCAST_RHS_ELEM]]
-// CHECK: memref.store [[DIFF_ELEM]], [[DIFF]]{{\[}}[[I]], [[J]]]
+// CHECK: store [[DIFF_ELEM]], [[DIFF]]{{\[}}[[I]], [[J]]]
// CHECK: [[DIFF_ELEM_:%.*]] = load [[DIFF]]{{\[}}[[I]], [[J]]]
// CHECK: [[EXP_ELEM:%.*]] = math.exp [[DIFF_ELEM_]]
-// CHECK: memref.store [[EXP_ELEM]], [[RESULT]]{{\[}}[[I]], [[J]]]
+// CHECK: store [[EXP_ELEM]], [[RESULT]]{{\[}}[[I]], [[J]]]
// CHECK: scf.yield
// CHECK: }
-// CHECK: memref.dealloc [[BROADCAST_RHS]]
-// CHECK: memref.dealloc [[DIFF]]
+// CHECK: dealloc [[BROADCAST_RHS]]
+// CHECK: dealloc [[DIFF]]
// -----
@@ -196,7 +196,7 @@ func @do_not_fuse_loops_with_side_effecting_ops_in_between() {
scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) {
scf.yield
}
- %buffer = memref.alloc() : memref<2x2xf32>
+ %buffer = alloc() : memref<2x2xf32>
scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) {
scf.yield
}
@@ -233,12 +233,12 @@ func @do_not_fuse_unmatching_write_read_patterns(
%c2 = constant 2 : index
%c0 = constant 0 : index
%c1 = constant 1 : index
- %common_buf = memref.alloc() : memref<2x2xf32>
+ %common_buf = alloc() : memref<2x2xf32>
scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) {
%B_elem = load %B[%i, %j] : memref<2x2xf32>
%C_elem = load %C[%i, %j] : memref<2x2xf32>
%sum_elem = addf %B_elem, %C_elem : f32
- memref.store %sum_elem, %common_buf[%i, %j] : memref<2x2xf32>
+ store %sum_elem, %common_buf[%i, %j] : memref<2x2xf32>
scf.yield
}
scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) {
@@ -246,10 +246,10 @@ func @do_not_fuse_unmatching_write_read_patterns(
%sum_elem = load %common_buf[%k, %j] : memref<2x2xf32>
%A_elem = load %A[%i, %j] : memref<2x2xf32>
%product_elem = mulf %sum_elem, %A_elem : f32
- memref.store %product_elem, %result[%i, %j] : memref<2x2xf32>
+ store %product_elem, %result[%i, %j] : memref<2x2xf32>
scf.yield
}
- memref.dealloc %common_buf : memref<2x2xf32>
+ dealloc %common_buf : memref<2x2xf32>
return
}
// CHECK-LABEL: func @do_not_fuse_unmatching_write_read_patterns
@@ -263,12 +263,12 @@ func @do_not_fuse_unmatching_read_write_patterns(
%c2 = constant 2 : index
%c0 = constant 0 : index
%c1 = constant 1 : index
- %sum = memref.alloc() : memref<2x2xf32>
+ %sum = alloc() : memref<2x2xf32>
scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) {
%B_elem = load %B[%i, %j] : memref<2x2xf32>
%C_elem = load %common_buf[%i, %j] : memref<2x2xf32>
%sum_elem = addf %B_elem, %C_elem : f32
- memref.store %sum_elem, %sum[%i, %j] : memref<2x2xf32>
+ store %sum_elem, %sum[%i, %j] : memref<2x2xf32>
scf.yield
}
scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) {
@@ -276,10 +276,10 @@ func @do_not_fuse_unmatching_read_write_patterns(
%sum_elem = load %sum[%k, %j] : memref<2x2xf32>
%A_elem = load %A[%i, %j] : memref<2x2xf32>
%product_elem = mulf %sum_elem, %A_elem : f32
- memref.store %product_elem, %common_buf[%j, %i] : memref<2x2xf32>
+ store %product_elem, %common_buf[%j, %i] : memref<2x2xf32>
scf.yield
}
- memref.dealloc %sum : memref<2x2xf32>
+ dealloc %sum : memref<2x2xf32>
return
}
// CHECK-LABEL: func @do_not_fuse_unmatching_read_write_patterns
@@ -292,7 +292,7 @@ func @do_not_fuse_loops_with_memref_defined_in_loop_bodies() {
%c2 = constant 2 : index
%c0 = constant 0 : index
%c1 = constant 1 : index
- %buffer = memref.alloc() : memref<2x2xf32>
+ %buffer = alloc() : memref<2x2xf32>
scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) {
scf.yield
}
@@ -315,24 +315,24 @@ func @nested_fuse(%A: memref<2x2xf32>, %B: memref<2x2xf32>,
%c2 = constant 2 : index
%c0 = constant 0 : index
%c1 = constant 1 : index
- %sum = memref.alloc() : memref<2x2xf32>
+ %sum = alloc() : memref<2x2xf32>
scf.parallel (%k) = (%c0) to (%c2) step (%c1) {
scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) {
%B_elem = load %B[%i, %j] : memref<2x2xf32>
%C_elem = load %C[%i, %j] : memref<2x2xf32>
%sum_elem = addf %B_elem, %C_elem : f32
- memref.store %sum_elem, %sum[%i, %j] : memref<2x2xf32>
+ store %sum_elem, %sum[%i, %j] : memref<2x2xf32>
scf.yield
}
scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) {
%sum_elem = load %sum[%i, %j] : memref<2x2xf32>
%A_elem = load %A[%i, %j] : memref<2x2xf32>
%product_elem = mulf %sum_elem, %A_elem : f32
- memref.store %product_elem, %result[%i, %j] : memref<2x2xf32>
+ store %product_elem, %result[%i, %j] : memref<2x2xf32>
scf.yield
}
}
- memref.dealloc %sum : memref<2x2xf32>
+ dealloc %sum : memref<2x2xf32>
return
}
// CHECK-LABEL: func @nested_fuse
@@ -341,19 +341,19 @@ func @nested_fuse(%A: memref<2x2xf32>, %B: memref<2x2xf32>,
// CHECK: [[C2:%.*]] = constant 2 : index
// CHECK: [[C0:%.*]] = constant 0 : index
// CHECK: [[C1:%.*]] = constant 1 : index
-// CHECK: [[SUM:%.*]] = memref.alloc()
+// CHECK: [[SUM:%.*]] = alloc()
// CHECK: scf.parallel
// CHECK: scf.parallel ([[I:%.*]], [[J:%.*]]) = ([[C0]], [[C0]])
// CHECK-SAME: to ([[C2]], [[C2]]) step ([[C1]], [[C1]]) {
// CHECK: [[B_ELEM:%.*]] = load [[B]]{{\[}}[[I]], [[J]]]
// CHECK: [[C_ELEM:%.*]] = load [[C]]{{\[}}[[I]], [[J]]]
// CHECK: [[SUM_ELEM:%.*]] = addf [[B_ELEM]], [[C_ELEM]]
-// CHECK: memref.store [[SUM_ELEM]], [[SUM]]{{\[}}[[I]], [[J]]]
+// CHECK: store [[SUM_ELEM]], [[SUM]]{{\[}}[[I]], [[J]]]
// CHECK: [[SUM_ELEM_:%.*]] = load [[SUM]]{{\[}}[[I]], [[J]]]
// CHECK: [[A_ELEM:%.*]] = load [[A]]{{\[}}[[I]], [[J]]]
// CHECK: [[PRODUCT_ELEM:%.*]] = mulf [[SUM_ELEM_]], [[A_ELEM]]
-// CHECK: memref.store [[PRODUCT_ELEM]], [[RESULT]]{{\[}}[[I]], [[J]]]
+// CHECK: store [[PRODUCT_ELEM]], [[RESULT]]{{\[}}[[I]], [[J]]]
// CHECK: scf.yield
// CHECK: }
// CHECK: }
-// CHECK: memref.dealloc [[SUM]]
+// CHECK: dealloc [[SUM]]
diff --git a/mlir/test/Dialect/SCF/parallel-loop-specialization.mlir b/mlir/test/Dialect/SCF/parallel-loop-specialization.mlir
index 3261c26df565..959b2f8dabc1 100644
--- a/mlir/test/Dialect/SCF/parallel-loop-specialization.mlir
+++ b/mlir/test/Dialect/SCF/parallel-loop-specialization.mlir
@@ -15,7 +15,7 @@ func @parallel_loop(%outer_i0: index, %outer_i1: index, %A: memref<?x?xf32>, %B:
%B_elem = load %B[%i0, %i1] : memref<?x?xf32>
%C_elem = load %C[%i0, %i1] : memref<?x?xf32>
%sum_elem = addf %B_elem, %C_elem : f32
- memref.store %sum_elem, %result[%i0, %i1] : memref<?x?xf32>
+ store %sum_elem, %result[%i0, %i1] : memref<?x?xf32>
}
return
}
@@ -35,11 +35,11 @@ func @parallel_loop(%outer_i0: index, %outer_i1: index, %A: memref<?x?xf32>, %B:
// CHECK: [[VAL_16:%.*]] = and [[VAL_13]], [[VAL_15]] : i1
// CHECK: scf.if [[VAL_16]] {
// CHECK: scf.parallel ([[VAL_17:%.*]], [[VAL_18:%.*]]) = ([[VAL_6]], [[VAL_6]]) to ([[VAL_12]], [[VAL_14]]) step ([[VAL_7]], [[VAL_7]]) {
-// CHECK: memref.store
+// CHECK: store
// CHECK: }
// CHECK: } else {
// CHECK: scf.parallel ([[VAL_22:%.*]], [[VAL_23:%.*]]) = ([[VAL_6]], [[VAL_6]]) to ([[VAL_10]], [[VAL_11]]) step ([[VAL_7]], [[VAL_7]]) {
-// CHECK: memref.store
+// CHECK: store
// CHECK: }
// CHECK: }
// CHECK: return
diff --git a/mlir/test/Dialect/SCF/parallel-loop-tiling.mlir b/mlir/test/Dialect/SCF/parallel-loop-tiling.mlir
index 9b7950e633bc..5d3a676f58ab 100644
--- a/mlir/test/Dialect/SCF/parallel-loop-tiling.mlir
+++ b/mlir/test/Dialect/SCF/parallel-loop-tiling.mlir
@@ -8,7 +8,7 @@ func @parallel_loop(%arg0 : index, %arg1 : index, %arg2 : index,
%B_elem = load %B[%i0, %i1] : memref<?x?xf32>
%C_elem = load %C[%i0, %i1] : memref<?x?xf32>
%sum_elem = addf %B_elem, %C_elem : f32
- memref.store %sum_elem, %result[%i0, %i1] : memref<?x?xf32>
+ store %sum_elem, %result[%i0, %i1] : memref<?x?xf32>
}
return
}
@@ -30,7 +30,7 @@ func @parallel_loop(%arg0 : index, %arg1 : index, %arg2 : index,
// CHECK: [[V11:%.*]] = load [[ARG8]]{{\[}}[[V9]], [[V10]]] : memref<?x?xf32>
// CHECK: [[V12:%.*]] = load [[ARG9]]{{\[}}[[V9]], [[V10]]] : memref<?x?xf32>
// CHECK: [[V13:%.*]] = addf [[V11]], [[V12]] : f32
-// CHECK: memref.store [[V13]], [[ARG10]]{{\[}}[[V9]], [[V10]]] : memref<?x?xf32>
+// CHECK: store [[V13]], [[ARG10]]{{\[}}[[V9]], [[V10]]] : memref<?x?xf32>
// CHECK: }
// CHECK: }
// CHECK: return
diff --git a/mlir/test/Dialect/Standard/canonicalize.mlir b/mlir/test/Dialect/Standard/canonicalize.mlir
index 79f36fafbfdc..c864af8f5747 100644
--- a/mlir/test/Dialect/Standard/canonicalize.mlir
+++ b/mlir/test/Dialect/Standard/canonicalize.mlir
@@ -102,7 +102,7 @@ func @cmpi_equal_operands(%arg0: i64)
// CHECK-SAME: %[[SHP:[0-9a-z]+]]: memref<?xindex>
// CHECK-NEXT: %[[IDX:.*]] = constant 3
// CHECK-NEXT: %[[DIM:.*]] = load %[[SHP]][%[[IDX]]]
-// CHECK-NEXT: memref.store
+// CHECK-NEXT: store
// CHECK-NOT: dim
// CHECK: return %[[DIM]] : index
func @dim_of_memref_reshape(%arg0: memref<*xf32>, %arg1: memref<?xindex>)
@@ -111,7 +111,7 @@ func @dim_of_memref_reshape(%arg0: memref<*xf32>, %arg1: memref<?xindex>)
%0 = memref_reshape %arg0(%arg1)
: (memref<*xf32>, memref<?xindex>) -> memref<*xf32>
// Update the shape to test that he load ends up in the right place.
- memref.store %c3, %arg1[%c3] : memref<?xindex>
+ store %c3, %arg1[%c3] : memref<?xindex>
%1 = dim %0, %c3 : memref<*xf32>
return %1 : index
}
@@ -135,7 +135,7 @@ func @fold_dim_of_tensor.cast(%arg0 : tensor<4x?xf32>) -> (index, index) {
// CHECK-LABEL: func @tensor_cast_to_memref
// CHECK-SAME: %[[ARG0:.+]]: tensor<4x6x16x32xi8>
// CHECK: %[[M:.+]] = tensor_to_memref %[[ARG0]] : memref<4x6x16x32xi8>
-// CHECK: %[[M1:.+]] = memref.cast %[[M]] : memref<4x6x16x32xi8> to memref<?x?x16x32xi8>
+// CHECK: %[[M1:.+]] = memref_cast %[[M]] : memref<4x6x16x32xi8> to memref<?x?x16x32xi8>
// CHECK: return %[[M1]] : memref<?x?x16x32xi8>
func @tensor_cast_to_memref(%arg0 : tensor<4x6x16x32xi8>) ->
memref<?x?x16x32xi8> {
@@ -147,11 +147,11 @@ func @tensor_cast_to_memref(%arg0 : tensor<4x6x16x32xi8>) ->
// CHECK-LABEL: func @subview_of_memcast
// CHECK-SAME: %[[ARG0:.[a-z0-9A-Z_]+]]: memref<4x6x16x32xi8>
// CHECK: %[[S:.+]] = subview %arg0[0, 1, 0, 0] [1, 1, 16, 32] [1, 1, 1, 1] : memref<4x6x16x32xi8> to memref<16x32xi8, #{{.*}}>
-// CHECK: %[[M:.+]] = memref.cast %[[S]] : memref<16x32xi8, #{{.*}}> to memref<16x32xi8, #{{.*}}>
+// CHECK: %[[M:.+]] = memref_cast %[[S]] : memref<16x32xi8, #{{.*}}> to memref<16x32xi8, #{{.*}}>
// CHECK: return %[[M]] : memref<16x32xi8, #{{.*}}>
func @subview_of_memcast(%arg : memref<4x6x16x32xi8>) ->
memref<16x32xi8, affine_map<(d0, d1)[s0] -> (d0 * 32 + d1 + s0)>>{
- %0 = memref.cast %arg : memref<4x6x16x32xi8> to memref<?x?x16x32xi8>
+ %0 = memref_cast %arg : memref<4x6x16x32xi8> to memref<?x?x16x32xi8>
%1 = subview %0[0, 1, 0, 0] [1, 1, 16, 32] [1, 1, 1, 1] :
memref<?x?x16x32xi8> to
memref<16x32xi8, affine_map<(d0, d1)[s0] -> (d0 * 32 + d1 + s0)>>
diff --git a/mlir/test/Dialect/Standard/invalid.mlir b/mlir/test/Dialect/Standard/invalid.mlir
index ee8412f037c2..7a8af9f409c4 100644
--- a/mlir/test/Dialect/Standard/invalid.mlir
+++ b/mlir/test/Dialect/Standard/invalid.mlir
@@ -18,21 +18,21 @@ func @test_index_cast_tensor_error(%arg0 : tensor<index>) -> i64 {
func @transpose_not_permutation(%v : memref<?x?xf32, affine_map<(i, j)[off, M]->(off + M * i + j)>>) {
// expected-error @+1 {{expected a permutation map}}
- memref.transpose %v (i, j) -> (i, i) : memref<?x?xf32, affine_map<(i, j)[off, M]->(off + M * i + j)>> to memref<?x?xf32, affine_map<(i, j)[off, M]->(off + M * i + j)>>
+ transpose %v (i, j) -> (i, i) : memref<?x?xf32, affine_map<(i, j)[off, M]->(off + M * i + j)>> to memref<?x?xf32, affine_map<(i, j)[off, M]->(off + M * i + j)>>
}
// -----
func @transpose_bad_rank(%v : memref<?x?xf32, affine_map<(i, j)[off, M]->(off + M * i + j)>>) {
// expected-error @+1 {{expected a permutation map of same rank as the input}}
- memref.transpose %v (i) -> (i) : memref<?x?xf32, affine_map<(i, j)[off, M]->(off + M * i + j)>> to memref<?x?xf32, affine_map<(i, j)[off, M]->(off + M * i + j)>>
+ transpose %v (i) -> (i) : memref<?x?xf32, affine_map<(i, j)[off, M]->(off + M * i + j)>> to memref<?x?xf32, affine_map<(i, j)[off, M]->(off + M * i + j)>>
}
// -----
func @transpose_wrong_type(%v : memref<?x?xf32, affine_map<(i, j)[off, M]->(off + M * i + j)>>) {
// expected-error @+1 {{output type 'memref<?x?xf32, affine_map<(d0, d1)[s0, s1] -> (d0 * s1 + s0 + d1)>>' does not match transposed input type 'memref<?x?xf32, affine_map<(d0, d1)[s0, s1] -> (d0 * s1 + s0 + d1)>>'}}
- memref.transpose %v (i, j) -> (j, i) : memref<?x?xf32, affine_map<(i, j)[off, M]->(off + M * i + j)>> to memref<?x?xf32, affine_map<(i, j)[off, M]->(off + M * i + j)>>
+ transpose %v (i, j) -> (j, i) : memref<?x?xf32, affine_map<(i, j)[off, M]->(off + M * i + j)>> to memref<?x?xf32, affine_map<(i, j)[off, M]->(off + M * i + j)>>
}
// -----
@@ -155,60 +155,60 @@ func @memref_reshape_result_affine_map_is_not_identity(
// -----
// expected-error @+1 {{type should be static shaped memref}}
-memref.global @foo : i32
+global_memref @foo : i32
// -----
// expected-error @+1 {{type should be static shaped memref}}
-memref.global @foo : i32 = 5
+global_memref @foo : i32 = 5
// -----
// expected-error @+1 {{type should be static shaped memref}}
-memref.global @foo : memref<*xf32>
+global_memref @foo : memref<*xf32>
// -----
// expected-error @+1 {{type should be static shaped memref}}
-memref.global @foo : memref<?x?xf32>
+global_memref @foo : memref<?x?xf32>
// -----
// expected-error @+1 {{initial value should be a unit or elements attribute}}
-memref.global @foo : memref<2x2xf32> = "foo"
+global_memref @foo : memref<2x2xf32> = "foo"
// -----
// expected-error @+1 {{inferred shape of elements literal ([2]) does not match type ([2, 2])}}
-memref.global @foo : memref<2x2xf32> = dense<[0.0, 1.0]>
+global_memref @foo : memref<2x2xf32> = dense<[0.0, 1.0]>
// -----
// expected-error @+1 {{expected valid '@'-identifier for symbol name}}
-memref.global "private" "public" @foo : memref<2x2xf32> = "foo"
+global_memref "private" "public" @foo : memref<2x2xf32> = "foo"
// -----
// expected-error @+1 {{expected valid '@'-identifier for symbol name}}
-memref.global constant external @foo : memref<2x2xf32> = "foo"
+global_memref constant external @foo : memref<2x2xf32> = "foo"
// -----
// constant qualifier must be after visibility.
// expected-error @+1 {{expected valid '@'-identifier for symbol name}}
-memref.global constant "private" @foo : memref<2x2xf32> = "foo"
+global_memref constant "private" @foo : memref<2x2xf32> = "foo"
// -----
// expected-error @+1 {{op visibility expected to be one of ["public", "private", "nested"], but got "priate"}}
-memref.global "priate" constant @memref5 : memref<2xf32> = uninitialized
+global_memref "priate" constant @memref5 : memref<2xf32> = uninitialized
// -----
func @nonexistent_global_memref() {
// expected-error @+1 {{'gv' does not reference a valid global memref}}
- %0 = memref.get_global @gv : memref<3xf32>
+ %0 = get_global_memref @gv : memref<3xf32>
return
}
@@ -218,17 +218,17 @@ func @foo()
func @nonexistent_global_memref() {
// expected-error @+1 {{'foo' does not reference a valid global memref}}
- %0 = memref.get_global @foo : memref<3xf32>
+ %0 = get_global_memref @foo : memref<3xf32>
return
}
// -----
-memref.global @gv : memref<3xi32>
+global_memref @gv : memref<3xi32>
func @mismatched_types() {
// expected-error @+1 {{result type 'memref<3xf32>' does not match type 'memref<3xi32>' of the global memref @gv}}
- %0 = memref.get_global @gv : memref<3xf32>
+ %0 = get_global_memref @gv : memref<3xf32>
return
}
diff --git a/mlir/test/Dialect/Standard/ops.mlir b/mlir/test/Dialect/Standard/ops.mlir
index b1c62fad5ca8..80fc9341e8dd 100644
--- a/mlir/test/Dialect/Standard/ops.mlir
+++ b/mlir/test/Dialect/Standard/ops.mlir
@@ -67,24 +67,24 @@ func @memref_reshape(%unranked: memref<*xf32>, %shape1: memref<1xi32>,
return %new_unranked : memref<*xf32>
}
-// CHECK-LABEL: memref.global @memref0 : memref<2xf32>
-memref.global @memref0 : memref<2xf32>
+// CHECK-LABEL: global_memref @memref0 : memref<2xf32>
+global_memref @memref0 : memref<2xf32>
-// CHECK-LABEL: memref.global constant @memref1 : memref<2xf32> = dense<[0.000000e+00, 1.000000e+00]>
-memref.global constant @memref1 : memref<2xf32> = dense<[0.0, 1.0]>
+// CHECK-LABEL: global_memref constant @memref1 : memref<2xf32> = dense<[0.000000e+00, 1.000000e+00]>
+global_memref constant @memref1 : memref<2xf32> = dense<[0.0, 1.0]>
-// CHECK-LABEL: memref.global @memref2 : memref<2xf32> = uninitialized
-memref.global @memref2 : memref<2xf32> = uninitialized
+// CHECK-LABEL: global_memref @memref2 : memref<2xf32> = uninitialized
+global_memref @memref2 : memref<2xf32> = uninitialized
-// CHECK-LABEL: memref.global "private" @memref3 : memref<2xf32> = uninitialized
-memref.global "private" @memref3 : memref<2xf32> = uninitialized
+// CHECK-LABEL: global_memref "private" @memref3 : memref<2xf32> = uninitialized
+global_memref "private" @memref3 : memref<2xf32> = uninitialized
-// CHECK-LABEL: memref.global "private" constant @memref4 : memref<2xf32> = uninitialized
-memref.global "private" constant @memref4 : memref<2xf32> = uninitialized
+// CHECK-LABEL: global_memref "private" constant @memref4 : memref<2xf32> = uninitialized
+global_memref "private" constant @memref4 : memref<2xf32> = uninitialized
// CHECK-LABEL: func @write_global_memref
func @write_global_memref() {
- %0 = memref.get_global @memref0 : memref<2xf32>
+ %0 = get_global_memref @memref0 : memref<2xf32>
%1 = constant dense<[1.0, 2.0]> : tensor<2xf32>
tensor_store %1, %0 : memref<2xf32>
return
@@ -92,7 +92,7 @@ func @write_global_memref() {
// CHECK-LABEL: func @read_global_memref
func @read_global_memref() {
- %0 = memref.get_global @memref0 : memref<2xf32>
+ %0 = get_global_memref @memref0 : memref<2xf32>
%1 = tensor_load %0 : memref<2xf32>
return
}
diff --git a/mlir/test/Dialect/Tensor/bufferize.mlir b/mlir/test/Dialect/Tensor/bufferize.mlir
index bfce2706bd9e..abc7d2af5676 100644
--- a/mlir/test/Dialect/Tensor/bufferize.mlir
+++ b/mlir/test/Dialect/Tensor/bufferize.mlir
@@ -3,7 +3,7 @@
// CHECK-LABEL: func @tensor.cast(
// CHECK-SAME: %[[TENSOR:.*]]: tensor<?xindex>) -> tensor<2xindex> {
// CHECK: %[[MEMREF:.*]] = tensor_to_memref %[[TENSOR]]
-// CHECK: %[[CASTED:.*]] = memref.cast %[[MEMREF]] : memref<?xindex> to memref<2xindex>
+// CHECK: %[[CASTED:.*]] = memref_cast %[[MEMREF]] : memref<?xindex> to memref<2xindex>
// CHECK: %[[RET:.*]] = tensor_load %[[CASTED]]
// CHECK: return %[[RET]] : tensor<2xindex>
func @tensor.cast(%arg0: tensor<?xindex>) -> tensor<2xindex> {
@@ -14,7 +14,7 @@ func @tensor.cast(%arg0: tensor<?xindex>) -> tensor<2xindex> {
// CHECK-LABEL: func @tensor.cast_from_unranked(
// CHECK-SAME: %[[TENSOR:.*]]: tensor<*xf32>) -> tensor<2xf32> {
// CHECK: %[[MEMREF:.*]] = tensor_to_memref %[[TENSOR]] : memref<*xf32>
-// CHECK: %[[CASTED_MEMREF:.*]] = memref.cast %[[MEMREF]] : memref<*xf32> to memref<2xf32>
+// CHECK: %[[CASTED_MEMREF:.*]] = memref_cast %[[MEMREF]] : memref<*xf32> to memref<2xf32>
// CHECK: %[[RET:.*]] = tensor_load %[[CASTED_MEMREF]] : memref<2xf32>
// CHECK: return %[[RET]] : tensor<2xf32>
func @tensor.cast_from_unranked(%arg0: tensor<*xf32>) -> tensor<2xf32> {
@@ -25,7 +25,7 @@ func @tensor.cast_from_unranked(%arg0: tensor<*xf32>) -> tensor<2xf32> {
// CHECK-LABEL: func @tensor.cast_to_unranked(
// CHECK-SAME: %[[TENSOR:.*]]: tensor<2xf32>) -> tensor<*xf32> {
// CHECK: %[[MEMREF:.*]] = tensor_to_memref %[[TENSOR]] : memref<2xf32>
-// CHECK: %[[CASTED_MEMREF:.*]] = memref.cast %[[MEMREF]] : memref<2xf32> to memref<*xf32>
+// CHECK: %[[CASTED_MEMREF:.*]] = memref_cast %[[MEMREF]] : memref<2xf32> to memref<*xf32>
// CHECK: %[[RET:.*]] = tensor_load %[[CASTED_MEMREF]] : memref<*xf32>
// CHECK: return %[[RET]] : tensor<*xf32>
func @tensor.cast_to_unranked(%arg0: tensor<2xf32>) -> tensor<*xf32> {
@@ -48,7 +48,7 @@ func @tensor.extract(%arg0: tensor<?xf32>, %arg1: index) -> f32 {
// CHECK-LABEL: func @tensor.from_elements(
// CHECK-SAME: %[[ELEM0:.*]]: index,
// CHECK-SAME: %[[ELEM1:.*]]: index) -> tensor<2xindex> {
-// CHECK: %[[MEMREF:.*]] = memref.alloc()
+// CHECK: %[[MEMREF:.*]] = alloc()
// CHECK: %[[C0:.*]] = constant 0 : index
// CHECK: store %[[ELEM0]], %[[MEMREF]][%[[C0]]]
// CHECK: %[[C1:.*]] = constant 1 : index
@@ -63,7 +63,7 @@ func @tensor.from_elements(%arg0: index, %arg1: index) -> tensor<2xindex> {
// CHECK-LABEL: func @tensor.generate(
// CHECK-SAME: %[[ARG:.*]]: tensor<*xf32>,
// CHECK-SAME: %[[DYNAMIC_EXTENT:.*]]: index) -> tensor<?xindex> {
-// CHECK: %[[MEMREF:.*]] = memref.alloc(%[[DYNAMIC_EXTENT]]) : memref<?xindex>
+// CHECK: %[[MEMREF:.*]] = alloc(%[[DYNAMIC_EXTENT]]) : memref<?xindex>
// CHECK: %[[C0:.*]] = constant 0 : index
// CHECK: %[[C1:.*]] = constant 1 : index
// CHECK: scf.parallel (%[[I:.*]]) = (%[[C0]]) to (%[[DYNAMIC_EXTENT]]) step (%[[C1]]) {
@@ -88,7 +88,7 @@ func @tensor.generate(%arg: tensor<*xf32>, %dynamic_extent: index) -> tensor<?xi
//
// CHECK-LABEL: func @tensor.generate_static_and_dynamic(
// CHECK-SAME: %[[DYNAMIC_EXTENT:.*]]: index) -> tensor<16x?xindex> {
-// CHECK: %[[MEMREF:.*]] = memref.alloc(%[[DYNAMIC_EXTENT]]) : memref<16x?xindex>
+// CHECK: %[[MEMREF:.*]] = alloc(%[[DYNAMIC_EXTENT]]) : memref<16x?xindex>
// CHECK: %[[C0:.*]] = constant 0 : index
// CHECK: %[[C1:.*]] = constant 1 : index
// CHECK: %[[C16:.*]] = constant 16 : index
diff --git a/mlir/test/Dialect/Tensor/canonicalize.mlir b/mlir/test/Dialect/Tensor/canonicalize.mlir
index d79caf20d962..f975a51280e5 100644
--- a/mlir/test/Dialect/Tensor/canonicalize.mlir
+++ b/mlir/test/Dialect/Tensor/canonicalize.mlir
@@ -209,12 +209,12 @@ func @extract_from_tensor.generate_2d(%idx0: index, %idx1: index, %tensor: tenso
// CHECK-SAME: %[[IDX:.*]]: index
func @extract_from_tensor.generate_sideeffects(%idx: index, %tensor: tensor<*xf32>) -> index {
%size = rank %tensor : tensor<*xf32>
- %mem = memref.alloc(%size) : memref<?xindex>
+ %mem = alloc(%size) : memref<?xindex>
// CHECK: %[[DTENSOR:.*]] = tensor.generate
%0 = tensor.generate %size {
^bb0(%arg0: index):
%1 = dim %tensor, %arg0 : tensor<*xf32>
- memref.store %1, %mem[%arg0] : memref<?xindex>
+ store %1, %mem[%arg0] : memref<?xindex>
tensor.yield %1 : index
} : tensor<?xindex>
// CHECK: %[[RES:.*]] = tensor.extract %[[DTENSOR]][%[[IDX]]]
diff --git a/mlir/test/Dialect/Vector/canonicalize.mlir b/mlir/test/Dialect/Vector/canonicalize.mlir
index 61b1e7826311..d665a2b49d5e 100644
--- a/mlir/test/Dialect/Vector/canonicalize.mlir
+++ b/mlir/test/Dialect/Vector/canonicalize.mlir
@@ -255,7 +255,7 @@ func @transpose_3D_sequence(%arg : vector<4x3x2xf32>) -> vector<4x3x2xf32> {
func @cast_transfers(%A: memref<4x8xf32>) -> (vector<4x8xf32>) {
%c0 = constant 0 : index
%f0 = constant 0.0 : f32
- %0 = memref.cast %A : memref<4x8xf32> to memref<?x?xf32>
+ %0 = memref_cast %A : memref<4x8xf32> to memref<?x?xf32>
// CHECK: vector.transfer_read %{{.*}} {masked = [false, false]} : memref<4x8xf32>, vector<4x8xf32>
%1 = vector.transfer_read %0[%c0, %c0], %f0 : memref<?x?xf32>, vector<4x8xf32>
diff --git a/mlir/test/Dialect/Vector/vector-contract-matvec-transforms.mlir b/mlir/test/Dialect/Vector/vector-contract-matvec-transforms.mlir
index 1cebf3d88911..c02de28b427e 100644
--- a/mlir/test/Dialect/Vector/vector-contract-matvec-transforms.mlir
+++ b/mlir/test/Dialect/Vector/vector-contract-matvec-transforms.mlir
@@ -59,7 +59,7 @@
// CHECK: %[[T7:.*]] = vector.extract %[[T3]][1] : vector<2x2xf32>
// CHECK: %[[T8:.*]] = vector.extract %[[T1]][1] : vector<2xf32>
// CHECK: %[[T9:.*]] = vector.outerproduct %[[T7]], %[[T8]], %[[T6]] {kind = #vector.kind<add>} : vector<2xf32>, f32
-// CHECK: memref.store %[[T9]], %[[C]][] : memref<vector<2xf32>>
+// CHECK: store %[[T9]], %[[C]][] : memref<vector<2xf32>>
// CHECK: return
func @matvec2x2(%arg0: memref<vector<2x2xf32>>, %arg1: memref<vector<2xf32>>,
%arg2: memref<vector<2xf32>>) {
@@ -67,7 +67,7 @@ func @matvec2x2(%arg0: memref<vector<2x2xf32>>, %arg1: memref<vector<2xf32>>,
%x = load %arg1[] : memref<vector<2xf32>>
%b = load %arg2[] : memref<vector<2xf32>>
%0 = vector.contract #matvec_trait %A, %x, %b : vector<2x2xf32>, vector<2xf32> into vector<2xf32>
- memref.store %0, %arg2[] : memref<vector<2xf32>>
+ store %0, %arg2[] : memref<vector<2xf32>>
return
}
@@ -85,7 +85,7 @@ func @matvec2x2(%arg0: memref<vector<2x2xf32>>, %arg1: memref<vector<2xf32>>,
// CHECK: %[[T7:.*]] = vector.extract %[[T3]][1] : vector<2x2xf32>
// CHECK: %[[T8:.*]] = vector.extract %[[T1]][1] : vector<2xf32>
// CHECK: %[[T9:.*]] = vector.outerproduct %[[T7]], %[[T8]], %[[T6]] {kind = #vector.kind<max>} : vector<2xf32>, f32
-// CHECK: memref.store %[[T9]], %[[C]][] : memref<vector<2xf32>>
+// CHECK: store %[[T9]], %[[C]][] : memref<vector<2xf32>>
// CHECK: return
func @matvecmax2x2(%arg0: memref<vector<2x2xf32>>, %arg1: memref<vector<2xf32>>,
%arg2: memref<vector<2xf32>>) {
@@ -93,7 +93,7 @@ func @matvecmax2x2(%arg0: memref<vector<2x2xf32>>, %arg1: memref<vector<2xf32>>,
%x = load %arg1[] : memref<vector<2xf32>>
%b = load %arg2[] : memref<vector<2xf32>>
%0 = vector.contract #matvecmax_trait %A, %x, %b : vector<2x2xf32>, vector<2xf32> into vector<2xf32>
- memref.store %0, %arg2[] : memref<vector<2xf32>>
+ store %0, %arg2[] : memref<vector<2xf32>>
return
}
@@ -110,7 +110,7 @@ func @matvecmax2x2(%arg0: memref<vector<2x2xf32>>, %arg1: memref<vector<2xf32>>,
// CHECK: %[[T6:.*]] = vector.extract %[[T0]][1] : vector<2x2xf32>
// CHECK: %[[T7:.*]] = vector.extract %[[T1]][1] : vector<2xf32>
// CHECK: %[[T8:.*]] = vector.outerproduct %[[T6]], %[[T7]], %[[T5]] {kind = #vector.kind<add>} : vector<2xf32>, f32
-// CHECK: memref.store %[[T8]], %[[C]][] : memref<vector<2xf32>>
+// CHECK: store %[[T8]], %[[C]][] : memref<vector<2xf32>>
// CHECK: return
func @mattransvec2x2(%arg0: memref<vector<2x2xf32>>, %arg1: memref<vector<2xf32>>,
%arg2: memref<vector<2xf32>>) {
@@ -118,7 +118,7 @@ func @mattransvec2x2(%arg0: memref<vector<2x2xf32>>, %arg1: memref<vector<2xf32>
%x = load %arg1[] : memref<vector<2xf32>>
%b = load %arg2[] : memref<vector<2xf32>>
%0 = vector.contract #mattransvec_trait %A, %x, %b : vector<2x2xf32>, vector<2xf32> into vector<2xf32>
- memref.store %0, %arg2[] : memref<vector<2xf32>>
+ store %0, %arg2[] : memref<vector<2xf32>>
return
}
@@ -136,7 +136,7 @@ func @mattransvec2x2(%arg0: memref<vector<2x2xf32>>, %arg1: memref<vector<2xf32>
// CHECK: %[[T7:.*]] = vector.extract %[[T3]][1] : vector<2x2xf32>
// CHECK: %[[T8:.*]] = vector.extract %[[T1]][1] : vector<2xf32>
// CHECK: %[[T9:.*]] = vector.outerproduct %[[T7]], %[[T8]], %[[T6]] {kind = #vector.kind<add>} : vector<2xf32>, f32
-// CHECK: memref.store %[[T9]], %[[C]][] : memref<vector<2xf32>>
+// CHECK: store %[[T9]], %[[C]][] : memref<vector<2xf32>>
// CHECK: return
func @vecmat2x2(%arg0: memref<vector<2x2xf32>>, %arg1: memref<vector<2xf32>>,
%arg2: memref<vector<2xf32>>) {
@@ -144,7 +144,7 @@ func @vecmat2x2(%arg0: memref<vector<2x2xf32>>, %arg1: memref<vector<2xf32>>,
%x = load %arg1[] : memref<vector<2xf32>>
%b = load %arg2[] : memref<vector<2xf32>>
%0 = vector.contract #vecmat_trait %x, %A, %b : vector<2xf32>, vector<2x2xf32> into vector<2xf32>
- memref.store %0, %arg2[] : memref<vector<2xf32>>
+ store %0, %arg2[] : memref<vector<2xf32>>
return
}
@@ -161,7 +161,7 @@ func @vecmat2x2(%arg0: memref<vector<2x2xf32>>, %arg1: memref<vector<2xf32>>,
// CHECK: %[[T6:.*]] = vector.extract %[[T0]][1] : vector<2x2xf32>
// CHECK: %[[T7:.*]] = vector.extract %[[T1]][1] : vector<2xf32>
// CHECK: %[[T8:.*]] = vector.outerproduct %[[T6]], %[[T7]], %[[T5]] {kind = #vector.kind<add>} : vector<2xf32>, f32
-// CHECK: memref.store %[[T8]], %[[C]][] : memref<vector<2xf32>>
+// CHECK: store %[[T8]], %[[C]][] : memref<vector<2xf32>>
// CHECK: return
func @vecmattrans2x2(%arg0: memref<vector<2x2xf32>>, %arg1: memref<vector<2xf32>>,
%arg2: memref<vector<2xf32>>) {
@@ -169,6 +169,6 @@ func @vecmattrans2x2(%arg0: memref<vector<2x2xf32>>, %arg1: memref<vector<2xf32>
%x = load %arg1[] : memref<vector<2xf32>>
%b = load %arg2[] : memref<vector<2xf32>>
%0 = vector.contract #vecmattrans_trait %x, %A, %b : vector<2xf32>, vector<2x2xf32> into vector<2xf32>
- memref.store %0, %arg2[] : memref<vector<2xf32>>
+ store %0, %arg2[] : memref<vector<2xf32>>
return
}
diff --git a/mlir/test/Dialect/Vector/vector-transfer-full-partial-split.mlir b/mlir/test/Dialect/Vector/vector-transfer-full-partial-split.mlir
index d6b4819e0231..4757b8305c69 100644
--- a/mlir/test/Dialect/Vector/vector-transfer-full-partial-split.mlir
+++ b/mlir/test/Dialect/Vector/vector-transfer-full-partial-split.mlir
@@ -29,7 +29,7 @@ func @split_vector_transfer_read_2d(%A: memref<?x8xf32>, %i: index, %j: index) -
// CHECK-DAG: %[[c8:.*]] = constant 8 : index
// CHECK-DAG: %[[cst:.*]] = constant 0.000000e+00 : f32
// alloca for boundary full tile
- // CHECK: %[[alloc:.*]] = memref.alloca() {alignment = 32 : i64} : memref<4x8xf32>
+ // CHECK: %[[alloc:.*]] = alloca() {alignment = 32 : i64} : memref<4x8xf32>
// %i + 4 <= dim(%A, 0)
// CHECK: %[[idx0:.*]] = affine.apply #[[$map_p4]]()[%[[i]]]
// CHECK: %[[d0:.*]] = dim %[[A]], %[[c0]] : memref<?x8xf32>
@@ -49,7 +49,7 @@ func @split_vector_transfer_read_2d(%A: memref<?x8xf32>, %i: index, %j: index) -
// CHECK: %[[cast_alloc:.*]] = vector.type_cast %[[alloc]] :
// CHECK-SAME: memref<4x8xf32> to memref<vector<4x8xf32>>
// CHECK: store %[[slow]], %[[cast_alloc]][] : memref<vector<4x8xf32>>
- // CHECK: %[[yielded:.*]] = memref.cast %[[alloc]] :
+ // CHECK: %[[yielded:.*]] = memref_cast %[[alloc]] :
// CHECK-SAME: memref<4x8xf32> to memref<?x8xf32>
// CHECK: scf.yield %[[yielded]], %[[c0]], %[[c0]] :
// CHECK-SAME: memref<?x8xf32>, index, index
@@ -62,7 +62,7 @@ func @split_vector_transfer_read_2d(%A: memref<?x8xf32>, %i: index, %j: index) -
// LINALG-DAG: %[[c8:.*]] = constant 8 : index
// LINALG-DAG: %[[cst:.*]] = constant 0.000000e+00 : f32
// alloca for boundary full tile
- // LINALG: %[[alloc:.*]] = memref.alloca() {alignment = 32 : i64} : memref<4x8xf32>
+ // LINALG: %[[alloc:.*]] = alloca() {alignment = 32 : i64} : memref<4x8xf32>
// %i + 4 <= dim(%A, 0)
// LINALG: %[[idx0:.*]] = affine.apply #[[$map_p4]]()[%[[i]]]
// LINALG: %[[d0:.*]] = dim %[[A]], %[[c0]] : memref<?x8xf32>
@@ -84,7 +84,7 @@ func @split_vector_transfer_read_2d(%A: memref<?x8xf32>, %i: index, %j: index) -
// LINALG: %[[sv:.*]] = subview %[[A]][%[[i]], %[[j]]] [%[[sv0]], %[[sv1]]] [1, 1]
// LINALG-SAME: memref<?x8xf32> to memref<?x?xf32, #[[$map_2d_stride_8x1]]>
// LINALG: linalg.copy(%[[sv]], %[[alloc]]) : memref<?x?xf32, #[[$map_2d_stride_8x1]]>, memref<4x8xf32>
- // LINALG: %[[yielded:.*]] = memref.cast %[[alloc]] :
+ // LINALG: %[[yielded:.*]] = memref_cast %[[alloc]] :
// LINALG-SAME: memref<4x8xf32> to memref<?x8xf32>
// LINALG: scf.yield %[[yielded]], %[[c0]], %[[c0]] :
// LINALG-SAME: memref<?x8xf32>, index, index
@@ -117,7 +117,7 @@ func @split_vector_transfer_read_strided_2d(
// CHECK-DAG: %[[c8:.*]] = constant 8 : index
// CHECK-DAG: %[[cst:.*]] = constant 0.000000e+00 : f32
// alloca for boundary full tile
- // CHECK: %[[alloc:.*]] = memref.alloca() {alignment = 32 : i64} : memref<4x8xf32>
+ // CHECK: %[[alloc:.*]] = alloca() {alignment = 32 : i64} : memref<4x8xf32>
// %i + 4 <= dim(%A, 0)
// CHECK: %[[idx0:.*]] = affine.apply #[[$map_p4]]()[%[[i]]]
// CHECK: %[[cmp0:.*]] = cmpi sle, %[[idx0]], %[[c7]] : index
@@ -128,7 +128,7 @@ func @split_vector_transfer_read_strided_2d(
// CHECK: %[[cond:.*]] = and %[[cmp0]], %[[cmp1]] : i1
// CHECK: %[[ifres:.*]]:3 = scf.if %[[cond]] -> (memref<?x8xf32, #[[$map_2d_stride_1]]>, index, index) {
// inBounds but not cast-compatible: yield a memref_casted form of %A
- // CHECK: %[[casted:.*]] = memref.cast %arg0 :
+ // CHECK: %[[casted:.*]] = memref_cast %arg0 :
// CHECK-SAME: memref<7x8xf32, #[[$map_2d_stride_1]]> to memref<?x8xf32, #[[$map_2d_stride_1]]>
// CHECK: scf.yield %[[casted]], %[[i]], %[[j]] :
// CHECK-SAME: memref<?x8xf32, #[[$map_2d_stride_1]]>, index, index
@@ -140,7 +140,7 @@ func @split_vector_transfer_read_strided_2d(
// CHECK-SAME: memref<4x8xf32> to memref<vector<4x8xf32>>
// CHECK: store %[[slow]], %[[cast_alloc]][] :
// CHECK-SAME: memref<vector<4x8xf32>>
- // CHECK: %[[yielded:.*]] = memref.cast %[[alloc]] :
+ // CHECK: %[[yielded:.*]] = memref_cast %[[alloc]] :
// CHECK-SAME: memref<4x8xf32> to memref<?x8xf32, #[[$map_2d_stride_1]]>
// CHECK: scf.yield %[[yielded]], %[[c0]], %[[c0]] :
// CHECK-SAME: memref<?x8xf32, #[[$map_2d_stride_1]]>, index, index
@@ -154,7 +154,7 @@ func @split_vector_transfer_read_strided_2d(
// LINALG-DAG: %[[c8:.*]] = constant 8 : index
// LINALG-DAG: %[[cst:.*]] = constant 0.000000e+00 : f32
// alloca for boundary full tile
- // LINALG: %[[alloc:.*]] = memref.alloca() {alignment = 32 : i64} : memref<4x8xf32>
+ // LINALG: %[[alloc:.*]] = alloca() {alignment = 32 : i64} : memref<4x8xf32>
// %i + 4 <= dim(%A, 0)
// LINALG: %[[idx0:.*]] = affine.apply #[[$map_p4]]()[%[[i]]]
// LINALG: %[[cmp0:.*]] = cmpi sle, %[[idx0]], %[[c7]] : index
@@ -165,7 +165,7 @@ func @split_vector_transfer_read_strided_2d(
// LINALG: %[[cond:.*]] = and %[[cmp0]], %[[cmp1]] : i1
// LINALG: %[[ifres:.*]]:3 = scf.if %[[cond]] -> (memref<?x8xf32, #[[$map_2d_stride_1]]>, index, index) {
// inBounds but not cast-compatible: yield a memref_casted form of %A
- // LINALG: %[[casted:.*]] = memref.cast %arg0 :
+ // LINALG: %[[casted:.*]] = memref_cast %arg0 :
// LINALG-SAME: memref<7x8xf32, #[[$map_2d_stride_1]]> to memref<?x8xf32, #[[$map_2d_stride_1]]>
// LINALG: scf.yield %[[casted]], %[[i]], %[[j]] :
// LINALG-SAME: memref<?x8xf32, #[[$map_2d_stride_1]]>, index, index
@@ -177,7 +177,7 @@ func @split_vector_transfer_read_strided_2d(
// LINALG: %[[sv:.*]] = subview %[[A]][%[[i]], %[[j]]] [%[[sv0]], %[[sv1]]] [1, 1]
// LINALG-SAME: memref<7x8xf32, #[[$map_2d_stride_1]]> to memref<?x?xf32, #[[$map_2d_stride_1]]>
// LINALG: linalg.copy(%[[sv]], %[[alloc]]) : memref<?x?xf32, #[[$map_2d_stride_1]]>, memref<4x8xf32>
- // LINALG: %[[yielded:.*]] = memref.cast %[[alloc]] :
+ // LINALG: %[[yielded:.*]] = memref_cast %[[alloc]] :
// LINALG-SAME: memref<4x8xf32> to memref<?x8xf32, #[[$map_2d_stride_1]]>
// LINALG: scf.yield %[[yielded]], %[[c0]], %[[c0]] :
// LINALG-SAME: memref<?x8xf32, #[[$map_2d_stride_1]]>, index, index
diff --git a/mlir/test/Dialect/Vector/vector-transforms.mlir b/mlir/test/Dialect/Vector/vector-transforms.mlir
index da899389de74..f57e5f6e7ea9 100644
--- a/mlir/test/Dialect/Vector/vector-transforms.mlir
+++ b/mlir/test/Dialect/Vector/vector-transforms.mlir
@@ -287,9 +287,9 @@ func @contraction4x4_ikj_xfer_read(%arg0 : memref<4x2xf32>,
func @vector_transfers(%arg0: index, %arg1: index) {
%cst = constant 0.000000e+00 : f32
- %0 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
- %1 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
- %2 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
+ %0 = alloc(%arg0, %arg1) : memref<?x?xf32>
+ %1 = alloc(%arg0, %arg1) : memref<?x?xf32>
+ %2 = alloc(%arg0, %arg1) : memref<?x?xf32>
%cst_0 = constant 1.000000e+00 : f32
%cst_1 = constant 2.000000e+00 : f32
affine.for %arg2 = 0 to %arg0 step 4 {
@@ -434,7 +434,7 @@ func @vector_transfers_vector_element_type() {
%cf0 = constant 0.000000e+00 : f32
%vf0 = splat %cf0 : vector<2x4xf32>
- %0 = memref.alloc() : memref<6x2x1xvector<2x4xf32>>
+ %0 = alloc() : memref<6x2x1xvector<2x4xf32>>
%1 = vector.transfer_read %0[%c0, %c0, %c0], %vf0
{permutation_map = affine_map<(d0, d1, d2) -> (d1, d2)>}
diff --git a/mlir/test/Examples/Toy/Ch5/affine-lowering.mlir b/mlir/test/Examples/Toy/Ch5/affine-lowering.mlir
index a51d49770501..62fcc880e6d6 100644
--- a/mlir/test/Examples/Toy/Ch5/affine-lowering.mlir
+++ b/mlir/test/Examples/Toy/Ch5/affine-lowering.mlir
@@ -16,9 +16,9 @@ func @main() {
// CHECK: [[VAL_3:%.*]] = constant 4.000000e+00 : f64
// CHECK: [[VAL_4:%.*]] = constant 5.000000e+00 : f64
// CHECK: [[VAL_5:%.*]] = constant 6.000000e+00 : f64
-// CHECK: [[VAL_6:%.*]] = memref.alloc() : memref<3x2xf64>
-// CHECK: [[VAL_7:%.*]] = memref.alloc() : memref<3x2xf64>
-// CHECK: [[VAL_8:%.*]] = memref.alloc() : memref<2x3xf64>
+// CHECK: [[VAL_6:%.*]] = alloc() : memref<3x2xf64>
+// CHECK: [[VAL_7:%.*]] = alloc() : memref<3x2xf64>
+// CHECK: [[VAL_8:%.*]] = alloc() : memref<2x3xf64>
// CHECK: affine.store [[VAL_0]], [[VAL_8]][0, 0] : memref<2x3xf64>
// CHECK: affine.store [[VAL_1]], [[VAL_8]][0, 1] : memref<2x3xf64>
// CHECK: affine.store [[VAL_2]], [[VAL_8]][0, 2] : memref<2x3xf64>
@@ -36,9 +36,9 @@ func @main() {
// CHECK: [[VAL_16:%.*]] = mulf [[VAL_14]], [[VAL_15]] : f64
// CHECK: affine.store [[VAL_16]], [[VAL_6]]{{\[}}[[VAL_12]], [[VAL_13]]] : memref<3x2xf64>
// CHECK: toy.print [[VAL_6]] : memref<3x2xf64>
-// CHECK: memref.dealloc [[VAL_8]] : memref<2x3xf64>
-// CHECK: memref.dealloc [[VAL_7]] : memref<3x2xf64>
-// CHECK: memref.dealloc [[VAL_6]] : memref<3x2xf64>
+// CHECK: dealloc [[VAL_8]] : memref<2x3xf64>
+// CHECK: dealloc [[VAL_7]] : memref<3x2xf64>
+// CHECK: dealloc [[VAL_6]] : memref<3x2xf64>
// OPT-LABEL: func @main()
// OPT: [[VAL_0:%.*]] = constant 1.000000e+00 : f64
@@ -47,8 +47,8 @@ func @main() {
// OPT: [[VAL_3:%.*]] = constant 4.000000e+00 : f64
// OPT: [[VAL_4:%.*]] = constant 5.000000e+00 : f64
// OPT: [[VAL_5:%.*]] = constant 6.000000e+00 : f64
-// OPT: [[VAL_6:%.*]] = memref.alloc() : memref<3x2xf64>
-// OPT: [[VAL_7:%.*]] = memref.alloc() : memref<2x3xf64>
+// OPT: [[VAL_6:%.*]] = alloc() : memref<3x2xf64>
+// OPT: [[VAL_7:%.*]] = alloc() : memref<2x3xf64>
// OPT: affine.store [[VAL_0]], [[VAL_7]][0, 0] : memref<2x3xf64>
// OPT: affine.store [[VAL_1]], [[VAL_7]][0, 1] : memref<2x3xf64>
// OPT: affine.store [[VAL_2]], [[VAL_7]][0, 2] : memref<2x3xf64>
@@ -61,5 +61,5 @@ func @main() {
// OPT: [[VAL_11:%.*]] = mulf [[VAL_10]], [[VAL_10]] : f64
// OPT: affine.store [[VAL_11]], [[VAL_6]]{{\[}}[[VAL_8]], [[VAL_9]]] : memref<3x2xf64>
// OPT: toy.print [[VAL_6]] : memref<3x2xf64>
-// OPT: memref.dealloc [[VAL_7]] : memref<2x3xf64>
-// OPT: memref.dealloc [[VAL_6]] : memref<3x2xf64>
+// OPT: dealloc [[VAL_7]] : memref<2x3xf64>
+// OPT: dealloc [[VAL_6]] : memref<3x2xf64>
diff --git a/mlir/test/Examples/Toy/Ch6/affine-lowering.mlir b/mlir/test/Examples/Toy/Ch6/affine-lowering.mlir
index 7e0e5ead736c..79bdd38de6f5 100644
--- a/mlir/test/Examples/Toy/Ch6/affine-lowering.mlir
+++ b/mlir/test/Examples/Toy/Ch6/affine-lowering.mlir
@@ -16,9 +16,9 @@ func @main() {
// CHECK: [[VAL_3:%.*]] = constant 4.000000e+00 : f64
// CHECK: [[VAL_4:%.*]] = constant 5.000000e+00 : f64
// CHECK: [[VAL_5:%.*]] = constant 6.000000e+00 : f64
-// CHECK: [[VAL_6:%.*]] = memref.alloc() : memref<3x2xf64>
-// CHECK: [[VAL_7:%.*]] = memref.alloc() : memref<3x2xf64>
-// CHECK: [[VAL_8:%.*]] = memref.alloc() : memref<2x3xf64>
+// CHECK: [[VAL_6:%.*]] = alloc() : memref<3x2xf64>
+// CHECK: [[VAL_7:%.*]] = alloc() : memref<3x2xf64>
+// CHECK: [[VAL_8:%.*]] = alloc() : memref<2x3xf64>
// CHECK: affine.store [[VAL_0]], [[VAL_8]][0, 0] : memref<2x3xf64>
// CHECK: affine.store [[VAL_1]], [[VAL_8]][0, 1] : memref<2x3xf64>
// CHECK: affine.store [[VAL_2]], [[VAL_8]][0, 2] : memref<2x3xf64>
@@ -36,9 +36,9 @@ func @main() {
// CHECK: [[VAL_16:%.*]] = mulf [[VAL_14]], [[VAL_15]] : f64
// CHECK: affine.store [[VAL_16]], [[VAL_6]]{{\[}}[[VAL_12]], [[VAL_13]]] : memref<3x2xf64>
// CHECK: toy.print [[VAL_6]] : memref<3x2xf64>
-// CHECK: memref.dealloc [[VAL_8]] : memref<2x3xf64>
-// CHECK: memref.dealloc [[VAL_7]] : memref<3x2xf64>
-// CHECK: memref.dealloc [[VAL_6]] : memref<3x2xf64>
+// CHECK: dealloc [[VAL_8]] : memref<2x3xf64>
+// CHECK: dealloc [[VAL_7]] : memref<3x2xf64>
+// CHECK: dealloc [[VAL_6]] : memref<3x2xf64>
// OPT-LABEL: func @main()
// OPT: [[VAL_0:%.*]] = constant 1.000000e+00 : f64
@@ -47,8 +47,8 @@ func @main() {
// OPT: [[VAL_3:%.*]] = constant 4.000000e+00 : f64
// OPT: [[VAL_4:%.*]] = constant 5.000000e+00 : f64
// OPT: [[VAL_5:%.*]] = constant 6.000000e+00 : f64
-// OPT: [[VAL_6:%.*]] = memref.alloc() : memref<3x2xf64>
-// OPT: [[VAL_7:%.*]] = memref.alloc() : memref<2x3xf64>
+// OPT: [[VAL_6:%.*]] = alloc() : memref<3x2xf64>
+// OPT: [[VAL_7:%.*]] = alloc() : memref<2x3xf64>
// OPT: affine.store [[VAL_0]], [[VAL_7]][0, 0] : memref<2x3xf64>
// OPT: affine.store [[VAL_1]], [[VAL_7]][0, 1] : memref<2x3xf64>
// OPT: affine.store [[VAL_2]], [[VAL_7]][0, 2] : memref<2x3xf64>
@@ -61,5 +61,5 @@ func @main() {
// OPT: [[VAL_11:%.*]] = mulf [[VAL_10]], [[VAL_10]] : f64
// OPT: affine.store [[VAL_11]], [[VAL_6]]{{\[}}[[VAL_8]], [[VAL_9]]] : memref<3x2xf64>
// OPT: toy.print [[VAL_6]] : memref<3x2xf64>
-// OPT: memref.dealloc [[VAL_7]] : memref<2x3xf64>
-// OPT: memref.dealloc [[VAL_6]] : memref<3x2xf64>
+// OPT: dealloc [[VAL_7]] : memref<2x3xf64>
+// OPT: dealloc [[VAL_6]] : memref<3x2xf64>
diff --git a/mlir/test/Examples/Toy/Ch7/affine-lowering.mlir b/mlir/test/Examples/Toy/Ch7/affine-lowering.mlir
index e19d8f87ab07..4054eb0aba8e 100644
--- a/mlir/test/Examples/Toy/Ch7/affine-lowering.mlir
+++ b/mlir/test/Examples/Toy/Ch7/affine-lowering.mlir
@@ -16,9 +16,9 @@ func @main() {
// CHECK: [[VAL_3:%.*]] = constant 4.000000e+00 : f64
// CHECK: [[VAL_4:%.*]] = constant 5.000000e+00 : f64
// CHECK: [[VAL_5:%.*]] = constant 6.000000e+00 : f64
-// CHECK: [[VAL_6:%.*]] = memref.alloc() : memref<3x2xf64>
-// CHECK: [[VAL_7:%.*]] = memref.alloc() : memref<3x2xf64>
-// CHECK: [[VAL_8:%.*]] = memref.alloc() : memref<2x3xf64>
+// CHECK: [[VAL_6:%.*]] = alloc() : memref<3x2xf64>
+// CHECK: [[VAL_7:%.*]] = alloc() : memref<3x2xf64>
+// CHECK: [[VAL_8:%.*]] = alloc() : memref<2x3xf64>
// CHECK: affine.store [[VAL_0]], [[VAL_8]][0, 0] : memref<2x3xf64>
// CHECK: affine.store [[VAL_1]], [[VAL_8]][0, 1] : memref<2x3xf64>
// CHECK: affine.store [[VAL_2]], [[VAL_8]][0, 2] : memref<2x3xf64>
@@ -36,9 +36,9 @@ func @main() {
// CHECK: [[VAL_16:%.*]] = mulf [[VAL_14]], [[VAL_15]] : f64
// CHECK: affine.store [[VAL_16]], [[VAL_6]]{{\[}}[[VAL_12]], [[VAL_13]]] : memref<3x2xf64>
// CHECK: toy.print [[VAL_6]] : memref<3x2xf64>
-// CHECK: memref.dealloc [[VAL_8]] : memref<2x3xf64>
-// CHECK: memref.dealloc [[VAL_7]] : memref<3x2xf64>
-// CHECK: memref.dealloc [[VAL_6]] : memref<3x2xf64>
+// CHECK: dealloc [[VAL_8]] : memref<2x3xf64>
+// CHECK: dealloc [[VAL_7]] : memref<3x2xf64>
+// CHECK: dealloc [[VAL_6]] : memref<3x2xf64>
// OPT-LABEL: func @main()
// OPT: [[VAL_0:%.*]] = constant 1.000000e+00 : f64
@@ -47,8 +47,8 @@ func @main() {
// OPT: [[VAL_3:%.*]] = constant 4.000000e+00 : f64
// OPT: [[VAL_4:%.*]] = constant 5.000000e+00 : f64
// OPT: [[VAL_5:%.*]] = constant 6.000000e+00 : f64
-// OPT: [[VAL_6:%.*]] = memref.alloc() : memref<3x2xf64>
-// OPT: [[VAL_7:%.*]] = memref.alloc() : memref<2x3xf64>
+// OPT: [[VAL_6:%.*]] = alloc() : memref<3x2xf64>
+// OPT: [[VAL_7:%.*]] = alloc() : memref<2x3xf64>
// OPT: affine.store [[VAL_0]], [[VAL_7]][0, 0] : memref<2x3xf64>
// OPT: affine.store [[VAL_1]], [[VAL_7]][0, 1] : memref<2x3xf64>
// OPT: affine.store [[VAL_2]], [[VAL_7]][0, 2] : memref<2x3xf64>
@@ -61,5 +61,5 @@ func @main() {
// OPT: [[VAL_11:%.*]] = mulf [[VAL_10]], [[VAL_10]] : f64
// OPT: affine.store [[VAL_11]], [[VAL_6]]{{\[}}[[VAL_8]], [[VAL_9]]] : memref<3x2xf64>
// OPT: toy.print [[VAL_6]] : memref<3x2xf64>
-// OPT: memref.dealloc [[VAL_7]] : memref<2x3xf64>
-// OPT: memref.dealloc [[VAL_6]] : memref<3x2xf64>
+// OPT: dealloc [[VAL_7]] : memref<2x3xf64>
+// OPT: dealloc [[VAL_6]] : memref<3x2xf64>
diff --git a/mlir/test/IR/core-ops.mlir b/mlir/test/IR/core-ops.mlir
index 7befe4032158..b760157bb828 100644
--- a/mlir/test/IR/core-ops.mlir
+++ b/mlir/test/IR/core-ops.mlir
@@ -546,11 +546,11 @@ func @load_store_prefetch(memref<4x4xi32>, index) {
// CHECK: %{{.*}} = load %arg0[%arg1, %arg1] : memref<4x4xi32>
%3 = load %0[%1, %1] : memref<4x4xi32>
- // CHECK: memref.prefetch %arg0[%arg1, %arg1], write, locality<1>, data : memref<4x4xi32>
- memref.prefetch %0[%1, %1], write, locality<1>, data : memref<4x4xi32>
+ // CHECK: prefetch %arg0[%arg1, %arg1], write, locality<1>, data : memref<4x4xi32>
+ prefetch %0[%1, %1], write, locality<1>, data : memref<4x4xi32>
- // CHECK: memref.prefetch %arg0[%arg1, %arg1], read, locality<3>, instr : memref<4x4xi32>
- memref.prefetch %0[%1, %1], read, locality<3>, instr : memref<4x4xi32>
+ // CHECK: prefetch %arg0[%arg1, %arg1], read, locality<3>, instr : memref<4x4xi32>
+ prefetch %0[%1, %1], read, locality<3>, instr : memref<4x4xi32>
return
}
@@ -559,10 +559,10 @@ func @load_store_prefetch(memref<4x4xi32>, index) {
// CHECK-LABEL: func @zero_dim_no_idx
func @zero_dim_no_idx(%arg0 : memref<i32>, %arg1 : memref<i32>, %arg2 : memref<i32>) {
%0 = std.load %arg0[] : memref<i32>
- memref.store %0, %arg1[] : memref<i32>
+ std.store %0, %arg1[] : memref<i32>
return
// CHECK: %0 = load %{{.*}}[] : memref<i32>
- // CHECK: memref.store %{{.*}}, %{{.*}}[] : memref<i32>
+ // CHECK: store %{{.*}}, %{{.*}}[] : memref<i32>
}
// CHECK-LABEL: func @return_op(%arg0: i32) -> i32 {
@@ -600,23 +600,23 @@ func @calls(%arg0: i32) {
// CHECK-LABEL: func @memref_cast(%arg0
func @memref_cast(%arg0: memref<4xf32>, %arg1 : memref<?xf32>, %arg2 : memref<64x16x4xf32, offset: 0, strides: [64, 4, 1]>) {
- // CHECK: %0 = memref.cast %arg0 : memref<4xf32> to memref<?xf32>
- %0 = memref.cast %arg0 : memref<4xf32> to memref<?xf32>
+ // CHECK: %0 = memref_cast %arg0 : memref<4xf32> to memref<?xf32>
+ %0 = memref_cast %arg0 : memref<4xf32> to memref<?xf32>
- // CHECK: %1 = memref.cast %arg1 : memref<?xf32> to memref<4xf32>
- %1 = memref.cast %arg1 : memref<?xf32> to memref<4xf32>
+ // CHECK: %1 = memref_cast %arg1 : memref<?xf32> to memref<4xf32>
+ %1 = memref_cast %arg1 : memref<?xf32> to memref<4xf32>
- // CHECK: {{%.*}} = memref.cast %arg2 : memref<64x16x4xf32, #[[$BASE_MAP0]]> to memref<64x16x4xf32, #[[$BASE_MAP3]]>
- %2 = memref.cast %arg2 : memref<64x16x4xf32, offset: 0, strides: [64, 4, 1]> to memref<64x16x4xf32, offset: ?, strides: [?, ?, ?]>
+ // CHECK: {{%.*}} = memref_cast %arg2 : memref<64x16x4xf32, #[[$BASE_MAP0]]> to memref<64x16x4xf32, #[[$BASE_MAP3]]>
+ %2 = memref_cast %arg2 : memref<64x16x4xf32, offset: 0, strides: [64, 4, 1]> to memref<64x16x4xf32, offset: ?, strides: [?, ?, ?]>
- // CHECK: {{%.*}} = memref.cast {{%.*}} : memref<64x16x4xf32, #[[$BASE_MAP3]]> to memref<64x16x4xf32, #[[$BASE_MAP0]]>
- %3 = memref.cast %2 : memref<64x16x4xf32, offset: ?, strides: [?, ?, ?]> to memref<64x16x4xf32, offset: 0, strides: [64, 4, 1]>
+ // CHECK: {{%.*}} = memref_cast {{%.*}} : memref<64x16x4xf32, #[[$BASE_MAP3]]> to memref<64x16x4xf32, #[[$BASE_MAP0]]>
+ %3 = memref_cast %2 : memref<64x16x4xf32, offset: ?, strides: [?, ?, ?]> to memref<64x16x4xf32, offset: 0, strides: [64, 4, 1]>
- // CHECK: memref.cast %{{.*}} : memref<4xf32> to memref<*xf32>
- %4 = memref.cast %1 : memref<4xf32> to memref<*xf32>
+ // CHECK: memref_cast %{{.*}} : memref<4xf32> to memref<*xf32>
+ %4 = memref_cast %1 : memref<4xf32> to memref<*xf32>
- // CHECK: memref.cast %{{.*}} : memref<*xf32> to memref<4xf32>
- %5 = memref.cast %4 : memref<*xf32> to memref<4xf32>
+ // CHECK: memref_cast %{{.*}} : memref<*xf32> to memref<4xf32>
+ %5 = memref_cast %4 : memref<*xf32> to memref<4xf32>
return
}
@@ -627,19 +627,19 @@ func private @unranked_memref_roundtrip(memref<*xf32, 4>)
// CHECK-LABEL: func @memref_view(%arg0
func @memref_view(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<2048xi8>
+ %0 = alloc() : memref<2048xi8>
// Test two dynamic sizes and dynamic offset.
- // CHECK: %{{.*}} = memref.view %0[%arg2][%arg0, %arg1] : memref<2048xi8> to memref<?x?xf32>
- %1 = memref.view %0[%arg2][%arg0, %arg1] : memref<2048xi8> to memref<?x?xf32>
+ // CHECK: %{{.*}} = std.view %0[%arg2][%arg0, %arg1] : memref<2048xi8> to memref<?x?xf32>
+ %1 = view %0[%arg2][%arg0, %arg1] : memref<2048xi8> to memref<?x?xf32>
// Test one dynamic size and dynamic offset.
- // CHECK: %{{.*}} = memref.view %0[%arg2][%arg1] : memref<2048xi8> to memref<4x?xf32>
- %3 = memref.view %0[%arg2][%arg1] : memref<2048xi8> to memref<4x?xf32>
+ // CHECK: %{{.*}} = std.view %0[%arg2][%arg1] : memref<2048xi8> to memref<4x?xf32>
+ %3 = view %0[%arg2][%arg1] : memref<2048xi8> to memref<4x?xf32>
// Test static sizes and static offset.
- // CHECK: %{{.*}} = memref.view %0[{{.*}}][] : memref<2048xi8> to memref<64x4xf32>
+ // CHECK: %{{.*}} = std.view %0[{{.*}}][] : memref<2048xi8> to memref<64x4xf32>
%c0 = constant 0: index
- %5 = memref.view %0[%c0][] : memref<2048xi8> to memref<64x4xf32>
+ %5 = view %0[%c0][] : memref<2048xi8> to memref<64x4xf32>
return
}
@@ -648,7 +648,7 @@ func @memref_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
%c0 = constant 0 : index
%c1 = constant 1 : index
- %0 = memref.alloc() : memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)>>
+ %0 = alloc() : memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)>>
// CHECK: subview %0[%c0, %c0, %c0] [%arg0, %arg1, %arg2] [%c1, %c1, %c1] :
// CHECK-SAME: memref<8x16x4xf32, #[[$BASE_MAP0]]>
// CHECK-SAME: to memref<?x?x?xf32, #[[$BASE_MAP3]]>
@@ -656,7 +656,7 @@ func @memref_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
: memref<8x16x4xf32, offset:0, strides: [64, 4, 1]> to
memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
- %2 = memref.alloc()[%arg2] : memref<64xf32, affine_map<(d0)[s0] -> (d0 + s0)>>
+ %2 = alloc()[%arg2] : memref<64xf32, affine_map<(d0)[s0] -> (d0 + s0)>>
// CHECK: subview %2[%c1] [%arg0] [%c1] :
// CHECK-SAME: memref<64xf32, #[[$BASE_MAP1]]>
// CHECK-SAME: to memref<?xf32, #[[$SUBVIEW_MAP1]]>
@@ -664,7 +664,7 @@ func @memref_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
: memref<64xf32, affine_map<(d0)[s0] -> (d0 + s0)>> to
memref<?xf32, affine_map<(d0)[s0, s1] -> (d0 * s1 + s0)>>
- %4 = memref.alloc() : memref<64x22xf32, affine_map<(d0, d1) -> (d0 * 22 + d1)>>
+ %4 = alloc() : memref<64x22xf32, affine_map<(d0, d1) -> (d0 * 22 + d1)>>
// CHECK: subview %4[%c0, %c1] [%arg0, %arg1] [%c1, %c0] :
// CHECK-SAME: memref<64x22xf32, #[[$BASE_MAP2]]>
// CHECK-SAME: to memref<?x?xf32, #[[$SUBVIEW_MAP2]]>
@@ -679,14 +679,14 @@ func @memref_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
: memref<8x16x4xf32, offset:0, strides: [64, 4, 1]> to
memref<4x4x4xf32, offset:8, strides: [64, 4, 1]>
- %7 = memref.alloc(%arg1, %arg2) : memref<?x?xf32>
+ %7 = alloc(%arg1, %arg2) : memref<?x?xf32>
// CHECK: subview {{%.*}}[0, 0] [4, 4] [1, 1] :
// CHECK-SAME: memref<?x?xf32>
// CHECK-SAME: to memref<4x4xf32, #[[$SUBVIEW_MAP4]]>
%8 = subview %7[0, 0][4, 4][1, 1]
: memref<?x?xf32> to memref<4x4xf32, offset: ?, strides:[?, 1]>
- %9 = memref.alloc() : memref<16x4xf32>
+ %9 = alloc() : memref<16x4xf32>
// CHECK: subview {{%.*}}[{{%.*}}, {{%.*}}] [4, 4] [{{%.*}}, {{%.*}}] :
// CHECK-SAME: memref<16x4xf32>
// CHECK-SAME: to memref<4x4xf32, #[[$SUBVIEW_MAP2]]
@@ -699,7 +699,7 @@ func @memref_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
%11 = subview %9[%arg1, %arg2][4, 4][2, 2]
: memref<16x4xf32> to memref<4x4xf32, offset: ?, strides:[8, 2]>
- %12 = memref.alloc() : memref<1x9x1x4x1xf32, affine_map<(d0, d1, d2, d3, d4) -> (36 * d0 + 36 * d1 + 4 * d2 + 4 * d3 + d4)>>
+ %12 = alloc() : memref<1x9x1x4x1xf32, affine_map<(d0, d1, d2, d3, d4) -> (36 * d0 + 36 * d1 + 4 * d2 + 4 * d3 + d4)>>
// CHECK: subview %12[%arg1, %arg1, %arg1, %arg1, %arg1]
// CHECK-SAME: [1, 9, 1, 4, 1] [%arg2, %arg2, %arg2, %arg2, %arg2] :
// CHECK-SAME: memref<1x9x1x4x1xf32, #[[$SUBVIEW_MAP6]]> to memref<9x4xf32, #[[$SUBVIEW_MAP2]]>
@@ -709,7 +709,7 @@ func @memref_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
// CHECK-SAME: memref<1x9x1x4x1xf32, #[[$SUBVIEW_MAP6]]> to memref<1x9x4xf32, #[[$BASE_MAP3]]>
%14 = subview %12[%arg1, %arg1, %arg1, %arg1, %arg1][1, 9, 1, 4, 1][%arg2, %arg2, %arg2, %arg2, %arg2] : memref<1x9x1x4x1xf32, offset: 0, strides: [36, 36, 4, 4, 1]> to memref<1x9x4xf32, offset: ?, strides: [?, ?, ?]>
- %15 = memref.alloc(%arg1, %arg2)[%c0, %c1, %arg1, %arg0, %arg0, %arg2, %arg2] : memref<1x?x5x1x?x1xf32, affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6] -> (s0 + s1 * d0 + s2 * d1 + s3 * d2 + s4 * d3 + s5 * d4 + s6 * d5)>>
+ %15 = alloc(%arg1, %arg2)[%c0, %c1, %arg1, %arg0, %arg0, %arg2, %arg2] : memref<1x?x5x1x?x1xf32, affine_map<(d0, d1, d2, d3, d4, d5)[s0, s1, s2, s3, s4, s5, s6] -> (s0 + s1 * d0 + s2 * d1 + s3 * d2 + s4 * d3 + s5 * d4 + s6 * d5)>>
// CHECK: subview %15[0, 0, 0, 0, 0, 0] [1, %arg1, 5, 1, %arg2, 1] [1, 1, 1, 1, 1, 1] :
// CHECK-SAME: memref<1x?x5x1x?x1xf32, #[[$SUBVIEW_MAP7]]> to memref<?x5x?xf32, #[[$BASE_MAP3]]>
%16 = subview %15[0, 0, 0, 0, 0, 0][1, %arg1, 5, 1, %arg2, 1][1, 1, 1, 1, 1, 1] : memref<1x?x5x1x?x1xf32, offset: ?, strides: [?, ?, ?, ?, ?, ?]> to memref<?x5x?xf32, offset: ?, strides: [?, ?, ?]>
@@ -717,21 +717,21 @@ func @memref_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
// CHECK-SAME: memref<1x?x5x1x?x1xf32, #[[$SUBVIEW_MAP7]]> to memref<?x5x?x1xf32, #[[$SUBVIEW_MAP8]]>
%17 = subview %15[%arg1, %arg1, %arg1, %arg1, %arg1, %arg1][1, %arg1, 5, 1, %arg2, 1][1, 1, 1, 1, 1, 1] : memref<1x?x5x1x?x1xf32, offset: ?, strides: [?, ?, ?, ?, ?, ?]> to memref<?x5x?x1xf32, offset: ?, strides: [?, ?, ?, ?]>
- %18 = memref.alloc() : memref<1x8xf32>
+ %18 = alloc() : memref<1x8xf32>
// CHECK: subview %18[0, 0] [1, 8] [1, 1] : memref<1x8xf32> to memref<8xf32>
%19 = subview %18[0, 0][1, 8][1, 1] : memref<1x8xf32> to memref<8xf32>
- %20 = memref.alloc() : memref<8x16x4xf32>
+ %20 = alloc() : memref<8x16x4xf32>
// CHECK: subview %20[0, 0, 0] [1, 16, 4] [1, 1, 1] : memref<8x16x4xf32> to memref<16x4xf32>
%21 = subview %20[0, 0, 0][1, 16, 4][1, 1, 1] : memref<8x16x4xf32> to memref<16x4xf32>
%22 = subview %20[3, 4, 2][1, 6, 3][1, 1, 1] : memref<8x16x4xf32> to memref<6x3xf32, offset: 210, strides: [4, 1]>
- %23 = memref.alloc() : memref<f32>
+ %23 = alloc() : memref<f32>
%78 = subview %23[] [] [] : memref<f32> to memref<f32>
/// Subview with only leading operands.
- %24 = memref.alloc() : memref<5x3xf32>
+ %24 = alloc() : memref<5x3xf32>
// CHECK: subview %{{.*}}[2] [3] [1] : memref<5x3xf32> to memref<3x3xf32, #[[$SUBVIEW_MAP9]]>
%25 = subview %24[2][3][1]: memref<5x3xf32> to memref<3x3xf32, offset: 6, strides: [3, 1]>
@@ -747,7 +747,7 @@ func @memref_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
%28 = subview %24[%arg0, 1] [1, 1] [1, 1] : memref<5x3xf32> to memref<f32, affine_map<()[s0] -> (s0)>>
// CHECK: subview %{{.*}}[0, %{{.*}}] [%{{.*}}, 1] [1, 1] : memref<?x?xf32> to memref<?xf32, #[[$SUBVIEW_MAP1]]>
- %a30 = memref.alloc(%arg0, %arg0) : memref<?x?xf32>
+ %a30 = alloc(%arg0, %arg0) : memref<?x?xf32>
%30 = subview %a30[0, %arg1][%arg2, 1][1, 1] : memref<?x?xf32> to memref<?xf32, affine_map<(d0)[s0, s1] -> (d0 * s1 + s0)>>
return
diff --git a/mlir/test/IR/invalid-ops.mlir b/mlir/test/IR/invalid-ops.mlir
index cc1a903cf1ec..b5ee96839fbd 100644
--- a/mlir/test/IR/invalid-ops.mlir
+++ b/mlir/test/IR/invalid-ops.mlir
@@ -88,7 +88,7 @@ func @bad_alloc_wrong_dynamic_dim_count() {
%0 = constant 7 : index
// Test alloc with wrong number of dynamic dimensions.
// expected-error at +1 {{dimension operand count does not equal memref dynamic dimension count}}
- %1 = memref.alloc(%0)[%0] : memref<2x4xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1>
+ %1 = alloc(%0)[%0] : memref<2x4xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1>
return
}
@@ -99,7 +99,7 @@ func @bad_alloc_wrong_symbol_count() {
%0 = constant 7 : index
// Test alloc with wrong number of symbols
// expected-error at +1 {{symbol operand count does not equal memref symbol count}}
- %1 = memref.alloc(%0) : memref<2x?xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1>
+ %1 = alloc(%0) : memref<2x?xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1>
return
}
@@ -107,19 +107,19 @@ func @bad_alloc_wrong_symbol_count() {
func @test_store_zero_results() {
^bb0:
- %0 = memref.alloc() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
+ %0 = alloc() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
%1 = constant 0 : index
%2 = constant 1 : index
%3 = load %0[%1, %2] : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
// Test that store returns zero results.
- %4 = memref.store %3, %0[%1, %2] : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> // expected-error {{cannot name an operation with no results}}
+ %4 = store %3, %0[%1, %2] : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> // expected-error {{cannot name an operation with no results}}
return
}
// -----
func @test_store_zero_results2(%x: i32, %p: memref<i32>) {
- "memref.store"(%x,%p) : (i32, memref<i32>) -> i32 // expected-error {{'memref.store' op requires zero results}}
+ "std.store"(%x,%p) : (i32, memref<i32>) -> i32 // expected-error {{'std.store' op requires zero results}}
return
}
@@ -127,7 +127,7 @@ func @test_store_zero_results2(%x: i32, %p: memref<i32>) {
func @test_alloc_memref_map_rank_mismatch() {
^bb0:
- %0 = memref.alloc() : memref<1024x64xf32, affine_map<(d0) -> (d0)>, 1> // expected-error {{memref affine map dimension mismatch}}
+ %0 = alloc() : memref<1024x64xf32, affine_map<(d0) -> (d0)>, 1> // expected-error {{memref affine map dimension mismatch}}
return
}
@@ -322,7 +322,7 @@ func @dma_start_src_index_wrong_type(
// -----
func @dma_no_dst_memref(%m : f32, %tag : f32, %c0 : index) {
- %mref = memref.alloc() : memref<8 x f32>
+ %mref = alloc() : memref<8 x f32>
// expected-error at +1 {{expected destination to be of memref type}}
dma_start %mref[%c0], %m[%c0], %c0, %tag[%c0] : memref<8 x f32>, f32, f32
}
@@ -360,7 +360,7 @@ func @dma_start_dst_index_wrong_type(
// -----
func @dma_no_tag_memref(%tag : f32, %c0 : index) {
- %mref = memref.alloc() : memref<8 x f32>
+ %mref = alloc() : memref<8 x f32>
// expected-error at +1 {{expected tag to be of memref type}}
dma_start %mref[%c0], %mref[%c0], %c0, %tag[%c0] : memref<8 x f32>, memref<8 x f32>, f32
}
@@ -856,9 +856,9 @@ func @invalid_splat(%v : f32) { // expected-note {{prior use here}}
// -----
func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<2048xi8>
+ %0 = alloc() : memref<2048xi8>
// expected-error at +1 {{expects 1 offset operand}}
- %1 = memref.view %0[][%arg0, %arg1]
+ %1 = view %0[][%arg0, %arg1]
: memref<2048xi8> to memref<?x?xf32>
return
}
@@ -866,9 +866,9 @@ func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<2048xi8, affine_map<(d0) -> (d0 floordiv 8, d0 mod 8)>>
+ %0 = alloc() : memref<2048xi8, affine_map<(d0) -> (d0 floordiv 8, d0 mod 8)>>
// expected-error at +1 {{unsupported map for base memref type}}
- %1 = memref.view %0[%arg2][%arg0, %arg1]
+ %1 = view %0[%arg2][%arg0, %arg1]
: memref<2048xi8, affine_map<(d0) -> (d0 floordiv 8, d0 mod 8)>> to
memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d0 * 4 + d1 + s0)>>
return
@@ -877,9 +877,9 @@ func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<2048xi8>
+ %0 = alloc() : memref<2048xi8>
// expected-error at +1 {{unsupported map for result memref type}}
- %1 = memref.view %0[%arg2][%arg0, %arg1]
+ %1 = view %0[%arg2][%arg0, %arg1]
: memref<2048xi8> to memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d0, d1, s0)>>
return
}
@@ -887,18 +887,18 @@ func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<2048xi8, 2>
+ %0 = alloc() : memref<2048xi8, 2>
// expected-error at +1 {{
diff erent memory spaces}}
- %1 = memref.view %0[%arg2][%arg0, %arg1] : memref<2048xi8, 2> to memref<?x?xf32, 1>
+ %1 = view %0[%arg2][%arg0, %arg1] : memref<2048xi8, 2> to memref<?x?xf32, 1>
return
}
// -----
func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<2048xi8>
+ %0 = alloc() : memref<2048xi8>
// expected-error at +1 {{incorrect number of size operands for type}}
- %1 = memref.view %0[%arg2][%arg0]
+ %1 = view %0[%arg2][%arg0]
: memref<2048xi8> to memref<?x?xf32>
return
}
@@ -906,7 +906,7 @@ func @invalid_view(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<8x16x4xf32>
+ %0 = alloc() : memref<8x16x4xf32>
// expected-error at +1 {{expected mixed offsets rank to match mixed sizes rank (2 vs 3) so the rank of the result type is well-formed}}
%1 = subview %0[0, 0][2, 2, 2][1, 1, 1]
: memref<8x16x4xf32> to memref<8x16x4xf32>
@@ -916,7 +916,7 @@ func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<8x16x4xf32>
+ %0 = alloc() : memref<8x16x4xf32>
// expected-error at +1 {{expected mixed sizes rank to match mixed strides rank (3 vs 2) so the rank of the result type is well-formed}}
%1 = subview %0[0, 0, 0][2, 2, 2][1, 1]
: memref<8x16x4xf32> to memref<8x16x4xf32>
@@ -926,7 +926,7 @@ func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<8x16x4xf32>
+ %0 = alloc() : memref<8x16x4xf32>
// expected-error at +1 {{expected mixed sizes rank to match mixed strides rank (3 vs 2) so the rank of the result type is well-formed}}
%1 = memref_reinterpret_cast %0 to offset: [0], sizes: [2, 2, 2], strides:[1, 1]
: memref<8x16x4xf32> to memref<8x16x4xf32>
@@ -936,7 +936,7 @@ func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<8x16x4xf32, offset: 0, strides: [64, 4, 1], 2>
+ %0 = alloc() : memref<8x16x4xf32, offset: 0, strides: [64, 4, 1], 2>
// expected-error at +1 {{
diff erent memory spaces}}
%1 = subview %0[0, 0, 0][%arg2, %arg2, %arg2][1, 1, 1]
: memref<8x16x4xf32, offset: 0, strides: [64, 4, 1], 2> to
@@ -947,7 +947,7 @@ func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 + d1, d1 + d2, d2)>>
+ %0 = alloc() : memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 + d1, d1 + d2, d2)>>
// expected-error at +1 {{is not strided}}
%1 = subview %0[0, 0, 0][%arg2, %arg2, %arg2][1, 1, 1]
: memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 + d1, d1 + d2, d2)>> to
@@ -958,7 +958,7 @@ func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<8x16x4xf32>
+ %0 = alloc() : memref<8x16x4xf32>
// expected-error at +1 {{expected <= 3 offset values}}
%1 = subview %0[%arg0, %arg1, 0, 0][%arg2, 0, 0, 0][1, 1, 1, 1]
: memref<8x16x4xf32> to
@@ -969,7 +969,7 @@ func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<8x16x4xf32>
+ %0 = alloc() : memref<8x16x4xf32>
// expected-error at +1 {{expected result type to be 'memref<?x?x?xf32, affine_map<(d0, d1, d2)[s0, s1, s2, s3] -> (d0 * s1 + s0 + d1 * s2 + d2 * s3)>>' or a rank-reduced version. (mismatch of result affine map)}}
%1 = subview %0[%arg0, %arg1, %arg2][%arg0, %arg1, %arg2][%arg0, %arg1, %arg2]
: memref<8x16x4xf32> to
@@ -980,7 +980,7 @@ func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<8x16x4xf32>
+ %0 = alloc() : memref<8x16x4xf32>
// expected-error at +1 {{expected result element type to be 'f32'}}
%1 = subview %0[0, 0, 0][8, 16, 4][1, 1, 1]
: memref<8x16x4xf32> to
@@ -991,7 +991,7 @@ func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<8x16x4xf32>
+ %0 = alloc() : memref<8x16x4xf32>
// expected-error at +1 {{expected result rank to be smaller or equal to the source rank.}}
%1 = subview %0[0, 0, 0][8, 16, 4][1, 1, 1]
: memref<8x16x4xf32> to
@@ -1002,7 +1002,7 @@ func @invalid_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
// -----
func @invalid_rank_reducing_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<8x16x4xf32>
+ %0 = alloc() : memref<8x16x4xf32>
// expected-error at +1 {{expected result type to be 'memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2)>>' or a rank-reduced version. (mismatch of result sizes)}}
%1 = subview %0[0, 0, 0][8, 16, 4][1, 1, 1]
: memref<8x16x4xf32> to memref<16x4xf32>
@@ -1012,7 +1012,7 @@ func @invalid_rank_reducing_subview(%arg0 : index, %arg1 : index, %arg2 : index)
// -----
func @invalid_rank_reducing_subview(%arg0 : index, %arg1 : index, %arg2 : index) {
- %0 = memref.alloc() : memref<8x16x4xf32>
+ %0 = alloc() : memref<8x16x4xf32>
// expected-error at +1 {{expected result type to be 'memref<8x16x4xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 4 + d2 + 8)>>' or a rank-reduced version. (mismatch of result sizes)}}
%1 = subview %0[0, 2, 0][8, 16, 4][1, 1, 1]
: memref<8x16x4xf32> to memref<16x4xf32>
@@ -1040,7 +1040,7 @@ func @invalid_rank_reducing_subview(%arg0 : memref<?x?xf32>, %arg1 : index, %arg
func @invalid_memref_cast(%arg0 : memref<12x4x16xf32, offset:0, strides:[64, 16, 1]>) {
// expected-error at +1{{operand type 'memref<12x4x16xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 16 + d2)>>' and result type 'memref<12x4x16xf32, affine_map<(d0, d1, d2) -> (d0 * 128 + d1 * 32 + d2 * 2)>>' are cast incompatible}}
- %0 = memref.cast %arg0 : memref<12x4x16xf32, offset:0, strides:[64, 16, 1]> to memref<12x4x16xf32, offset:0, strides:[128, 32, 2]>
+ %0 = memref_cast %arg0 : memref<12x4x16xf32, offset:0, strides:[64, 16, 1]> to memref<12x4x16xf32, offset:0, strides:[128, 32, 2]>
return
}
@@ -1048,7 +1048,7 @@ func @invalid_memref_cast(%arg0 : memref<12x4x16xf32, offset:0, strides:[64, 16,
func @invalid_memref_cast(%arg0 : memref<12x4x16xf32, offset:0, strides:[64, 16, 1]>) {
// expected-error at +1{{operand type 'memref<12x4x16xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 16 + d2)>>' and result type 'memref<12x4x16xf32, affine_map<(d0, d1, d2) -> (d0 * 64 + d1 * 16 + d2 + 16)>>' are cast incompatible}}
- %0 = memref.cast %arg0 : memref<12x4x16xf32, offset:0, strides:[64, 16, 1]> to memref<12x4x16xf32, offset:16, strides:[64, 16, 1]>
+ %0 = memref_cast %arg0 : memref<12x4x16xf32, offset:0, strides:[64, 16, 1]> to memref<12x4x16xf32, offset:16, strides:[64, 16, 1]>
return
}
@@ -1056,36 +1056,36 @@ func @invalid_memref_cast(%arg0 : memref<12x4x16xf32, offset:0, strides:[64, 16,
// incompatible element types
func @invalid_memref_cast() {
- %0 = memref.alloc() : memref<2x5xf32, 0>
+ %0 = alloc() : memref<2x5xf32, 0>
// expected-error at +1 {{operand type 'memref<2x5xf32>' and result type 'memref<*xi32>' are cast incompatible}}
- %1 = memref.cast %0 : memref<2x5xf32, 0> to memref<*xi32>
+ %1 = memref_cast %0 : memref<2x5xf32, 0> to memref<*xi32>
return
}
// -----
func @invalid_prefetch_rw(%i : index) {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
// expected-error at +1 {{rw specifier has to be 'read' or 'write'}}
- memref.prefetch %0[%i], rw, locality<0>, data : memref<10xf32>
+ prefetch %0[%i], rw, locality<0>, data : memref<10xf32>
return
}
// -----
func @invalid_prefetch_cache_type(%i : index) {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
// expected-error at +1 {{cache type has to be 'data' or 'instr'}}
- memref.prefetch %0[%i], read, locality<0>, false : memref<10xf32>
+ prefetch %0[%i], read, locality<0>, false : memref<10xf32>
return
}
// -----
func @invalid_prefetch_locality_hint(%i : index) {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
// expected-error at +1 {{32-bit signless integer attribute whose minimum value is 0 whose maximum value is 3}}
- memref.prefetch %0[%i], read, locality<5>, data : memref<10xf32>
+ prefetch %0[%i], read, locality<5>, data : memref<10xf32>
return
}
@@ -1093,9 +1093,9 @@ func @invalid_prefetch_locality_hint(%i : index) {
// incompatible memory space
func @invalid_memref_cast() {
- %0 = memref.alloc() : memref<2x5xf32, 0>
+ %0 = alloc() : memref<2x5xf32, 0>
// expected-error at +1 {{operand type 'memref<2x5xf32>' and result type 'memref<*xf32, 1>' are cast incompatible}}
- %1 = memref.cast %0 : memref<2x5xf32, 0> to memref<*xf32, 1>
+ %1 = memref_cast %0 : memref<2x5xf32, 0> to memref<*xf32, 1>
return
}
@@ -1103,10 +1103,10 @@ func @invalid_memref_cast() {
// unranked to unranked
func @invalid_memref_cast() {
- %0 = memref.alloc() : memref<2x5xf32, 0>
- %1 = memref.cast %0 : memref<2x5xf32, 0> to memref<*xf32, 0>
+ %0 = alloc() : memref<2x5xf32, 0>
+ %1 = memref_cast %0 : memref<2x5xf32, 0> to memref<*xf32, 0>
// expected-error at +1 {{operand type 'memref<*xf32>' and result type 'memref<*xf32>' are cast incompatible}}
- %2 = memref.cast %1 : memref<*xf32, 0> to memref<*xf32, 0>
+ %2 = memref_cast %1 : memref<*xf32, 0> to memref<*xf32, 0>
return
}
@@ -1177,7 +1177,7 @@ func @generic_atomic_rmw_has_side_effects(%I: memref<10xf32>, %i : index) {
%x = generic_atomic_rmw %I[%i] : memref<10xf32> {
^bb0(%old_value : f32):
%c1 = constant 1.0 : f32
- %buf = memref.alloc() : memref<2048xf32>
+ %buf = alloc() : memref<2048xf32>
atomic_yield %c1 : f32
}
}
@@ -1215,7 +1215,7 @@ func @assume_alignment(%0: memref<4x4xf16>) {
// -----
"alloca_without_scoped_alloc_parent"() ( {
- memref.alloca() : memref<1xf32>
+ std.alloca() : memref<1xf32>
// expected-error at -1 {{requires an ancestor op with AutomaticAllocationScope trait}}
return
}) : () -> ()
diff --git a/mlir/test/IR/memory-ops.mlir b/mlir/test/IR/memory-ops.mlir
index b9c0811e3959..d1860acb5076 100644
--- a/mlir/test/IR/memory-ops.mlir
+++ b/mlir/test/IR/memory-ops.mlir
@@ -6,28 +6,28 @@
func @alloc() {
^bb0:
// Test simple alloc.
- // CHECK: %0 = memref.alloc() : memref<1024x64xf32, 1>
- %0 = memref.alloc() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
+ // CHECK: %0 = alloc() : memref<1024x64xf32, 1>
+ %0 = alloc() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
%c0 = "std.constant"() {value = 0: index} : () -> index
%c1 = "std.constant"() {value = 1: index} : () -> index
// Test alloc with dynamic dimensions.
- // CHECK: %1 = memref.alloc(%c0, %c1) : memref<?x?xf32, 1>
- %1 = memref.alloc(%c0, %c1) : memref<?x?xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
+ // CHECK: %1 = alloc(%c0, %c1) : memref<?x?xf32, 1>
+ %1 = alloc(%c0, %c1) : memref<?x?xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
// Test alloc with no dynamic dimensions and one symbol.
- // CHECK: %2 = memref.alloc()[%c0] : memref<2x4xf32, #map, 1>
- %2 = memref.alloc()[%c0] : memref<2x4xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1>
+ // CHECK: %2 = alloc()[%c0] : memref<2x4xf32, #map, 1>
+ %2 = alloc()[%c0] : memref<2x4xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1>
// Test alloc with dynamic dimensions and one symbol.
- // CHECK: %3 = memref.alloc(%c1)[%c0] : memref<2x?xf32, #map, 1>
- %3 = memref.alloc(%c1)[%c0] : memref<2x?xf32, affine_map<(d0, d1)[s0] -> (d0 + s0, d1)>, 1>
+ // CHECK: %3 = alloc(%c1)[%c0] : memref<2x?xf32, #map, 1>
+ %3 = alloc(%c1)[%c0] : memref<2x?xf32, affine_map<(d0, d1)[s0] -> (d0 + s0, d1)>, 1>
// Alloc with no mappings.
// b/116054838 Parser crash while parsing ill-formed AllocOp
- // CHECK: %4 = memref.alloc() : memref<2xi32>
- %4 = memref.alloc() : memref<2 x i32>
+ // CHECK: %4 = alloc() : memref<2xi32>
+ %4 = alloc() : memref<2 x i32>
// CHECK: return
return
@@ -37,27 +37,27 @@ func @alloc() {
func @alloca() {
^bb0:
// Test simple alloc.
- // CHECK: %0 = memref.alloca() : memref<1024x64xf32, 1>
- %0 = memref.alloca() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
+ // CHECK: %0 = alloca() : memref<1024x64xf32, 1>
+ %0 = alloca() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
%c0 = "std.constant"() {value = 0: index} : () -> index
%c1 = "std.constant"() {value = 1: index} : () -> index
// Test alloca with dynamic dimensions.
- // CHECK: %1 = memref.alloca(%c0, %c1) : memref<?x?xf32, 1>
- %1 = memref.alloca(%c0, %c1) : memref<?x?xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
+ // CHECK: %1 = alloca(%c0, %c1) : memref<?x?xf32, 1>
+ %1 = alloca(%c0, %c1) : memref<?x?xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
// Test alloca with no dynamic dimensions and one symbol.
- // CHECK: %2 = memref.alloca()[%c0] : memref<2x4xf32, #map, 1>
- %2 = memref.alloca()[%c0] : memref<2x4xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1>
+ // CHECK: %2 = alloca()[%c0] : memref<2x4xf32, #map, 1>
+ %2 = alloca()[%c0] : memref<2x4xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1>
// Test alloca with dynamic dimensions and one symbol.
- // CHECK: %3 = memref.alloca(%c1)[%c0] : memref<2x?xf32, #map, 1>
- %3 = memref.alloca(%c1)[%c0] : memref<2x?xf32, affine_map<(d0, d1)[s0] -> (d0 + s0, d1)>, 1>
+ // CHECK: %3 = alloca(%c1)[%c0] : memref<2x?xf32, #map, 1>
+ %3 = alloca(%c1)[%c0] : memref<2x?xf32, affine_map<(d0, d1)[s0] -> (d0 + s0, d1)>, 1>
// Alloca with no mappings, but with alignment.
- // CHECK: %4 = memref.alloca() {alignment = 64 : i64} : memref<2xi32>
- %4 = memref.alloca() {alignment = 64} : memref<2 x i32>
+ // CHECK: %4 = alloca() {alignment = 64 : i64} : memref<2xi32>
+ %4 = alloca() {alignment = 64} : memref<2 x i32>
return
}
@@ -65,19 +65,19 @@ func @alloca() {
// CHECK-LABEL: func @dealloc() {
func @dealloc() {
^bb0:
- // CHECK: %0 = memref.alloc() : memref<1024x64xf32>
- %0 = memref.alloc() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 0>
+ // CHECK: %0 = alloc() : memref<1024x64xf32>
+ %0 = alloc() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 0>
- // CHECK: memref.dealloc %0 : memref<1024x64xf32>
- memref.dealloc %0 : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 0>
+ // CHECK: dealloc %0 : memref<1024x64xf32>
+ dealloc %0 : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 0>
return
}
// CHECK-LABEL: func @load_store
func @load_store() {
^bb0:
- // CHECK: %0 = memref.alloc() : memref<1024x64xf32, 1>
- %0 = memref.alloc() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
+ // CHECK: %0 = alloc() : memref<1024x64xf32, 1>
+ %0 = alloc() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
%1 = constant 0 : index
%2 = constant 1 : index
@@ -85,8 +85,8 @@ func @load_store() {
// CHECK: %1 = load %0[%c0, %c1] : memref<1024x64xf32, 1>
%3 = load %0[%1, %2] : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
- // CHECK: memref.store %1, %0[%c0, %c1] : memref<1024x64xf32, 1>
- memref.store %3, %0[%1, %2] : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
+ // CHECK: store %1, %0[%c0, %c1] : memref<1024x64xf32, 1>
+ store %3, %0[%1, %2] : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1>
return
}
@@ -97,9 +97,9 @@ func @dma_ops() {
%stride = constant 32 : index
%elt_per_stride = constant 16 : index
- %A = memref.alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 0>
- %Ah = memref.alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 1>
- %tag = memref.alloc() : memref<1 x f32>
+ %A = alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 0>
+ %Ah = alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 1>
+ %tag = alloc() : memref<1 x f32>
%num_elements = constant 256 : index
diff --git a/mlir/test/IR/parser.mlir b/mlir/test/IR/parser.mlir
index e61f66cff036..b63775edcfb0 100644
--- a/mlir/test/IR/parser.mlir
+++ b/mlir/test/IR/parser.mlir
@@ -287,7 +287,7 @@ func @triang_loop(%arg0: index, %arg1: memref<?x?xi32>) {
%c = constant 0 : i32 // CHECK: %{{.*}} = constant 0 : i32
affine.for %i0 = 1 to %arg0 { // CHECK: affine.for %{{.*}} = 1 to %{{.*}} {
affine.for %i1 = affine_map<(d0)[]->(d0)>(%i0)[] to %arg0 { // CHECK: affine.for %{{.*}} = #map{{[0-9]+}}(%{{.*}}) to %{{.*}} {
- memref.store %c, %arg1[%i0, %i1] : memref<?x?xi32> // CHECK: memref.store %{{.*}}, %{{.*}}[%{{.*}}, %{{.*}}]
+ store %c, %arg1[%i0, %i1] : memref<?x?xi32> // CHECK: store %{{.*}}, %{{.*}}[%{{.*}}, %{{.*}}]
} // CHECK: }
} // CHECK: }
return // CHECK: return
diff --git a/mlir/test/IR/slice.mlir b/mlir/test/IR/slice.mlir
index 9ce43fdb10a3..68ddeb6ad9d0 100644
--- a/mlir/test/IR/slice.mlir
+++ b/mlir/test/IR/slice.mlir
@@ -1,18 +1,18 @@
// RUN: mlir-opt -slice-analysis-test %s | FileCheck %s
func @slicing_linalg_op(%arg0 : index, %arg1 : index, %arg2 : index) {
- %a = memref.alloc(%arg0, %arg2) : memref<?x?xf32>
- %b = memref.alloc(%arg2, %arg1) : memref<?x?xf32>
- %c = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
- %d = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
+ %a = alloc(%arg0, %arg2) : memref<?x?xf32>
+ %b = alloc(%arg2, %arg1) : memref<?x?xf32>
+ %c = alloc(%arg0, %arg1) : memref<?x?xf32>
+ %d = alloc(%arg0, %arg1) : memref<?x?xf32>
linalg.matmul ins(%a, %b : memref<?x?xf32>, memref<?x?xf32>)
outs(%c : memref<?x?xf32>)
linalg.matmul ins(%a, %b : memref<?x?xf32>, memref<?x?xf32>)
outs(%d : memref<?x?xf32>)
- memref.dealloc %c : memref<?x?xf32>
- memref.dealloc %b : memref<?x?xf32>
- memref.dealloc %a : memref<?x?xf32>
- memref.dealloc %d : memref<?x?xf32>
+ dealloc %c : memref<?x?xf32>
+ dealloc %b : memref<?x?xf32>
+ dealloc %a : memref<?x?xf32>
+ dealloc %d : memref<?x?xf32>
return
}
@@ -20,16 +20,16 @@ func @slicing_linalg_op(%arg0 : index, %arg1 : index, %arg2 : index) {
// CHECK-SAME: %[[ARG0:[a-zA-Z0-9_]+]]: index
// CHECK-SAME: %[[ARG1:[a-zA-Z0-9_]+]]: index
// CHECK-SAME: %[[ARG2:[a-zA-Z0-9_]+]]: index
-// CHECK-DAG: %[[A:.+]] = memref.alloc(%[[ARG0]], %[[ARG2]]) : memref<?x?xf32>
-// CHECK-DAG: %[[B:.+]] = memref.alloc(%[[ARG2]], %[[ARG1]]) : memref<?x?xf32>
-// CHECK-DAG: %[[C:.+]] = memref.alloc(%[[ARG0]], %[[ARG1]]) : memref<?x?xf32>
+// CHECK-DAG: %[[A:.+]] = alloc(%[[ARG0]], %[[ARG2]]) : memref<?x?xf32>
+// CHECK-DAG: %[[B:.+]] = alloc(%[[ARG2]], %[[ARG1]]) : memref<?x?xf32>
+// CHECK-DAG: %[[C:.+]] = alloc(%[[ARG0]], %[[ARG1]]) : memref<?x?xf32>
// CHECK: return
// CHECK-LABEL: func @slicing_linalg_op__backward_slice__1
// CHECK-SAME: %[[ARG0:[a-zA-Z0-9_]+]]: index
// CHECK-SAME: %[[ARG1:[a-zA-Z0-9_]+]]: index
// CHECK-SAME: %[[ARG2:[a-zA-Z0-9_]+]]: index
-// CHECK-DAG: %[[A:.+]] = memref.alloc(%[[ARG0]], %[[ARG2]]) : memref<?x?xf32>
-// CHECK-DAG: %[[B:.+]] = memref.alloc(%[[ARG2]], %[[ARG1]]) : memref<?x?xf32>
-// CHECK-DAG: %[[C:.+]] = memref.alloc(%[[ARG0]], %[[ARG1]]) : memref<?x?xf32>
+// CHECK-DAG: %[[A:.+]] = alloc(%[[ARG0]], %[[ARG2]]) : memref<?x?xf32>
+// CHECK-DAG: %[[B:.+]] = alloc(%[[ARG2]], %[[ARG1]]) : memref<?x?xf32>
+// CHECK-DAG: %[[C:.+]] = alloc(%[[ARG0]], %[[ARG1]]) : memref<?x?xf32>
// CHECK: return
diff --git a/mlir/test/Transforms/buffer-deallocation.mlir b/mlir/test/Transforms/buffer-deallocation.mlir
index 3df862c7753a..4965324e2aea 100644
--- a/mlir/test/Transforms/buffer-deallocation.mlir
+++ b/mlir/test/Transforms/buffer-deallocation.mlir
@@ -21,7 +21,7 @@ func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
^bb1:
br ^bb3(%arg1 : memref<2xf32>)
^bb2:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
br ^bb3(%0 : memref<2xf32>)
^bb3(%1: memref<2xf32>):
@@ -30,17 +30,17 @@ func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
}
// CHECK-NEXT: cond_br
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: linalg.copy
// CHECK-NEXT: br ^bb3(%[[ALLOC0]]
-// CHECK: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC1:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
-// CHECK: %[[ALLOC2:.*]] = memref.alloc()
+// CHECK: %[[ALLOC2:.*]] = alloc()
// CHECK-NEXT: linalg.copy
-// CHECK-NEXT: memref.dealloc %[[ALLOC1]]
+// CHECK-NEXT: dealloc %[[ALLOC1]]
// CHECK-NEXT: br ^bb3(%[[ALLOC2]]
// CHECK: test.copy
-// CHECK-NEXT: memref.dealloc
+// CHECK-NEXT: dealloc
// CHECK-NEXT: return
// -----
@@ -68,7 +68,7 @@ func @condBranchDynamicType(
^bb1:
br ^bb3(%arg1 : memref<?xf32>)
^bb2(%0: index):
- %1 = memref.alloc(%0) : memref<?xf32>
+ %1 = alloc(%0) : memref<?xf32>
test.buffer_based in(%arg1: memref<?xf32>) out(%1: memref<?xf32>)
br ^bb3(%1 : memref<?xf32>)
^bb3(%2: memref<?xf32>):
@@ -78,20 +78,20 @@ func @condBranchDynamicType(
// CHECK-NEXT: cond_br
// CHECK: %[[DIM0:.*]] = dim
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc(%[[DIM0]])
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc(%[[DIM0]])
// CHECK-NEXT: linalg.copy(%{{.*}}, %[[ALLOC0]])
// CHECK-NEXT: br ^bb3(%[[ALLOC0]]
// CHECK: ^bb2(%[[IDX:.*]]:{{.*}})
-// CHECK-NEXT: %[[ALLOC1:.*]] = memref.alloc(%[[IDX]])
+// CHECK-NEXT: %[[ALLOC1:.*]] = alloc(%[[IDX]])
// CHECK-NEXT: test.buffer_based
// CHECK: %[[DIM1:.*]] = dim %[[ALLOC1]]
-// CHECK-NEXT: %[[ALLOC2:.*]] = memref.alloc(%[[DIM1]])
+// CHECK-NEXT: %[[ALLOC2:.*]] = alloc(%[[DIM1]])
// CHECK-NEXT: linalg.copy(%[[ALLOC1]], %[[ALLOC2]])
-// CHECK-NEXT: memref.dealloc %[[ALLOC1]]
+// CHECK-NEXT: dealloc %[[ALLOC1]]
// CHECK-NEXT: br ^bb3
// CHECK-NEXT: ^bb3(%[[ALLOC3:.*]]:{{.*}})
// CHECK: test.copy(%[[ALLOC3]],
-// CHECK-NEXT: memref.dealloc %[[ALLOC3]]
+// CHECK-NEXT: dealloc %[[ALLOC3]]
// CHECK-NEXT: return
// -----
@@ -126,7 +126,7 @@ func @condBranchDynamicTypeNested(
^bb1:
br ^bb6(%arg1 : memref<?xf32>)
^bb2(%0: index):
- %1 = memref.alloc(%0) : memref<?xf32>
+ %1 = alloc(%0) : memref<?xf32>
test.buffer_based in(%arg1: memref<?xf32>) out(%1: memref<?xf32>)
cond_br %arg0, ^bb3, ^bb4
^bb3:
@@ -145,11 +145,11 @@ func @condBranchDynamicTypeNested(
// CHECK-NEXT: cond_br
// CHECK: ^bb1
// CHECK: %[[DIM0:.*]] = dim
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc(%[[DIM0]])
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc(%[[DIM0]])
// CHECK-NEXT: linalg.copy(%{{.*}}, %[[ALLOC0]])
// CHECK-NEXT: br ^bb6
// CHECK: ^bb2(%[[IDX:.*]]:{{.*}})
-// CHECK-NEXT: %[[ALLOC1:.*]] = memref.alloc(%[[IDX]])
+// CHECK-NEXT: %[[ALLOC1:.*]] = alloc(%[[IDX]])
// CHECK-NEXT: test.buffer_based
// CHECK: cond_br
// CHECK: ^bb3:
@@ -158,15 +158,15 @@ func @condBranchDynamicTypeNested(
// CHECK-NEXT: br ^bb5(%[[ALLOC1]]{{.*}})
// CHECK-NEXT: ^bb5(%[[ALLOC2:.*]]:{{.*}})
// CHECK: %[[DIM2:.*]] = dim %[[ALLOC2]]
-// CHECK-NEXT: %[[ALLOC3:.*]] = memref.alloc(%[[DIM2]])
+// CHECK-NEXT: %[[ALLOC3:.*]] = alloc(%[[DIM2]])
// CHECK-NEXT: linalg.copy(%[[ALLOC2]], %[[ALLOC3]])
-// CHECK-NEXT: memref.dealloc %[[ALLOC1]]
+// CHECK-NEXT: dealloc %[[ALLOC1]]
// CHECK-NEXT: br ^bb6(%[[ALLOC3]]{{.*}})
// CHECK-NEXT: ^bb6(%[[ALLOC4:.*]]:{{.*}})
// CHECK-NEXT: br ^bb7(%[[ALLOC4]]{{.*}})
// CHECK-NEXT: ^bb7(%[[ALLOC5:.*]]:{{.*}})
// CHECK: test.copy(%[[ALLOC5]],
-// CHECK-NEXT: memref.dealloc %[[ALLOC4]]
+// CHECK-NEXT: dealloc %[[ALLOC4]]
// CHECK-NEXT: return
// -----
@@ -177,11 +177,11 @@ func @condBranchDynamicTypeNested(
// CHECK-LABEL: func @emptyUsesValue
func @emptyUsesValue(%arg0: memref<4xf32>) {
- %0 = memref.alloc() : memref<4xf32>
+ %0 = alloc() : memref<4xf32>
return
}
-// CHECK-NEXT: %[[ALLOC:.*]] = memref.alloc()
-// CHECK-NEXT: memref.dealloc %[[ALLOC]]
+// CHECK-NEXT: %[[ALLOC:.*]] = alloc()
+// CHECK-NEXT: dealloc %[[ALLOC]]
// CHECK-NEXT: return
// -----
@@ -200,7 +200,7 @@ func @emptyUsesValue(%arg0: memref<4xf32>) {
func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>)
^bb1:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
br ^bb2(%0 : memref<2xf32>)
^bb2(%1: memref<2xf32>):
@@ -208,16 +208,16 @@ func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
return
}
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: linalg.copy
// CHECK-NEXT: cond_br
-// CHECK: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC1:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
-// CHECK: %[[ALLOC2:.*]] = memref.alloc()
+// CHECK: %[[ALLOC2:.*]] = alloc()
// CHECK-NEXT: linalg.copy
-// CHECK-NEXT: memref.dealloc %[[ALLOC1]]
+// CHECK-NEXT: dealloc %[[ALLOC1]]
// CHECK: test.copy
-// CHECK-NEXT: memref.dealloc
+// CHECK-NEXT: dealloc
// CHECK-NEXT: return
// -----
@@ -233,7 +233,7 @@ func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-LABEL: func @invCriticalEdge
func @invCriticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>)
^bb1:
@@ -261,7 +261,7 @@ func @invCriticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-LABEL: func @ifElse
func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cond_br %arg0,
^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>),
@@ -271,19 +271,19 @@ func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
^bb2(%3: memref<2xf32>, %4: memref<2xf32>):
br ^bb3(%3, %4 : memref<2xf32>, memref<2xf32>)
^bb3(%5: memref<2xf32>, %6: memref<2xf32>):
- %7 = memref.alloc() : memref<2xf32>
+ %7 = alloc() : memref<2xf32>
test.buffer_based in(%5: memref<2xf32>) out(%7: memref<2xf32>)
test.copy(%7, %arg2) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %[[FIRST_ALLOC:.*]] = memref.alloc()
+// CHECK-NEXT: %[[FIRST_ALLOC:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
-// CHECK: %[[SECOND_ALLOC:.*]] = memref.alloc()
+// CHECK: %[[SECOND_ALLOC:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
-// CHECK: memref.dealloc %[[FIRST_ALLOC]]
+// CHECK: dealloc %[[FIRST_ALLOC]]
// CHECK: test.copy
-// CHECK-NEXT: memref.dealloc %[[SECOND_ALLOC]]
+// CHECK-NEXT: dealloc %[[SECOND_ALLOC]]
// CHECK-NEXT: return
// -----
@@ -299,7 +299,7 @@ func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-LABEL: func @ifElseNoUsers
func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cond_br %arg0,
^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>),
@@ -313,9 +313,9 @@ func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
return
}
-// CHECK-NEXT: %[[FIRST_ALLOC:.*]] = memref.alloc()
+// CHECK-NEXT: %[[FIRST_ALLOC:.*]] = alloc()
// CHECK: test.copy
-// CHECK-NEXT: memref.dealloc %[[FIRST_ALLOC]]
+// CHECK-NEXT: dealloc %[[FIRST_ALLOC]]
// CHECK-NEXT: return
// -----
@@ -334,7 +334,7 @@ func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-LABEL: func @ifElseNested
func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cond_br %arg0,
^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>),
@@ -348,19 +348,19 @@ func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
^bb4(%6: memref<2xf32>):
br ^bb5(%3, %6 : memref<2xf32>, memref<2xf32>)
^bb5(%7: memref<2xf32>, %8: memref<2xf32>):
- %9 = memref.alloc() : memref<2xf32>
+ %9 = alloc() : memref<2xf32>
test.buffer_based in(%7: memref<2xf32>) out(%9: memref<2xf32>)
test.copy(%9, %arg2) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %[[FIRST_ALLOC:.*]] = memref.alloc()
+// CHECK-NEXT: %[[FIRST_ALLOC:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
-// CHECK: %[[SECOND_ALLOC:.*]] = memref.alloc()
+// CHECK: %[[SECOND_ALLOC:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
-// CHECK: memref.dealloc %[[FIRST_ALLOC]]
+// CHECK: dealloc %[[FIRST_ALLOC]]
// CHECK: test.copy
-// CHECK-NEXT: memref.dealloc %[[SECOND_ALLOC]]
+// CHECK-NEXT: dealloc %[[SECOND_ALLOC]]
// CHECK-NEXT: return
// -----
@@ -371,17 +371,17 @@ func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-LABEL: func @redundantOperations
func @redundantOperations(%arg0: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>)
- %1 = memref.alloc() : memref<2xf32>
+ %1 = alloc() : memref<2xf32>
test.buffer_based in(%0: memref<2xf32>) out(%1: memref<2xf32>)
return
}
// CHECK: (%[[ARG0:.*]]: {{.*}})
-// CHECK-NEXT: %[[FIRST_ALLOC:.*]] = memref.alloc()
+// CHECK-NEXT: %[[FIRST_ALLOC:.*]] = alloc()
// CHECK-NEXT: test.buffer_based in(%[[ARG0]]{{.*}}out(%[[FIRST_ALLOC]]
-// CHECK: %[[SECOND_ALLOC:.*]] = memref.alloc()
+// CHECK: %[[SECOND_ALLOC:.*]] = alloc()
// CHECK-NEXT: test.buffer_based in(%[[FIRST_ALLOC]]{{.*}}out(%[[SECOND_ALLOC]]
// CHECK: dealloc
// CHECK-NEXT: dealloc
@@ -407,11 +407,11 @@ func @moving_alloc_and_inserting_missing_dealloc(
%arg1: memref<2xf32>) {
cond_br %cond, ^bb1, ^bb2
^bb1:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>)
br ^exit(%0 : memref<2xf32>)
^bb2:
- %1 = memref.alloc() : memref<2xf32>
+ %1 = alloc() : memref<2xf32>
test.buffer_based in(%arg0: memref<2xf32>) out(%1: memref<2xf32>)
br ^exit(%1 : memref<2xf32>)
^exit(%arg2: memref<2xf32>):
@@ -422,22 +422,22 @@ func @moving_alloc_and_inserting_missing_dealloc(
// CHECK-NEXT: cond_br
// CHECK: ^bb1
// CHECK: ^bb1
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
-// CHECK: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC1:.*]] = alloc()
// CHECK-NEXT: linalg.copy
-// CHECK-NEXT: memref.dealloc %[[ALLOC0]]
+// CHECK-NEXT: dealloc %[[ALLOC0]]
// CHECK-NEXT: br ^bb3(%[[ALLOC1]]
// CHECK-NEXT: ^bb2
-// CHECK-NEXT: %[[ALLOC2:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC2:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
-// CHECK: %[[ALLOC3:.*]] = memref.alloc()
+// CHECK: %[[ALLOC3:.*]] = alloc()
// CHECK-NEXT: linalg.copy
-// CHECK-NEXT: memref.dealloc %[[ALLOC2]]
+// CHECK-NEXT: dealloc %[[ALLOC2]]
// CHECK-NEXT: br ^bb3(%[[ALLOC3]]
// CHECK-NEXT: ^bb3(%[[ALLOC4:.*]]:{{.*}})
// CHECK: test.copy
-// CHECK-NEXT: memref.dealloc %[[ALLOC4]]
+// CHECK-NEXT: dealloc %[[ALLOC4]]
// CHECK-NEXT: return
// -----
@@ -457,23 +457,23 @@ func @moving_invalid_dealloc_op_complex(
%cond: i1,
%arg0: memref<2xf32>,
%arg1: memref<2xf32>) {
- %1 = memref.alloc() : memref<2xf32>
+ %1 = alloc() : memref<2xf32>
cond_br %cond, ^bb1, ^bb2
^bb1:
br ^exit(%arg0 : memref<2xf32>)
^bb2:
test.buffer_based in(%arg0: memref<2xf32>) out(%1: memref<2xf32>)
- memref.dealloc %1 : memref<2xf32>
+ dealloc %1 : memref<2xf32>
br ^exit(%1 : memref<2xf32>)
^exit(%arg2: memref<2xf32>):
test.copy(%arg2, %arg1) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: cond_br
// CHECK: test.copy
-// CHECK-NEXT: memref.dealloc %[[ALLOC0]]
+// CHECK-NEXT: dealloc %[[ALLOC0]]
// CHECK-NEXT: return
// -----
@@ -484,15 +484,15 @@ func @moving_invalid_dealloc_op_complex(
func @inserting_missing_dealloc_simple(
%arg0 : memref<2xf32>,
%arg1: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>)
test.copy(%0, %arg1) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc()
// CHECK: test.copy
-// CHECK-NEXT: memref.dealloc %[[ALLOC0]]
+// CHECK-NEXT: dealloc %[[ALLOC0]]
// -----
@@ -501,16 +501,16 @@ func @inserting_missing_dealloc_simple(
// CHECK-LABEL: func @moving_invalid_dealloc_op
func @moving_invalid_dealloc_op(%arg0 : memref<2xf32>, %arg1: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>)
- memref.dealloc %0 : memref<2xf32>
+ dealloc %0 : memref<2xf32>
test.copy(%0, %arg1) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc()
// CHECK: test.copy
-// CHECK-NEXT: memref.dealloc %[[ALLOC0]]
+// CHECK-NEXT: dealloc %[[ALLOC0]]
// -----
@@ -530,10 +530,10 @@ func @nested_regions_and_cond_branch(
^bb1:
br ^bb3(%arg1 : memref<2xf32>)
^bb2:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.region_buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) {
^bb0(%gen1_arg0: f32, %gen1_arg1: f32):
- %1 = memref.alloc() : memref<2xf32>
+ %1 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%1: memref<2xf32>)
%tmp1 = math.exp %gen1_arg0 : f32
test.region_yield %tmp1 : f32
@@ -545,18 +545,18 @@ func @nested_regions_and_cond_branch(
}
// CHECK: (%[[cond:.*]]: {{.*}}, %[[ARG1:.*]]: {{.*}}, %{{.*}}: {{.*}})
// CHECK-NEXT: cond_br %[[cond]], ^[[BB1:.*]], ^[[BB2:.*]]
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%[[ARG1]], %[[ALLOC0]])
// CHECK: ^[[BB2]]:
-// CHECK: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC1:.*]] = alloc()
// CHECK-NEXT: test.region_buffer_based in(%[[ARG1]]{{.*}}out(%[[ALLOC1]]
-// CHECK: %[[ALLOC2:.*]] = memref.alloc()
+// CHECK: %[[ALLOC2:.*]] = alloc()
// CHECK-NEXT: test.buffer_based in(%[[ARG1]]{{.*}}out(%[[ALLOC2]]
-// CHECK: memref.dealloc %[[ALLOC2]]
+// CHECK: dealloc %[[ALLOC2]]
// CHECK-NEXT: %{{.*}} = math.exp
-// CHECK: %[[ALLOC3:.*]] = memref.alloc()
+// CHECK: %[[ALLOC3:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%[[ALLOC1]], %[[ALLOC3]])
-// CHECK-NEXT: memref.dealloc %[[ALLOC1]]
+// CHECK-NEXT: dealloc %[[ALLOC1]]
// CHECK: ^[[BB3:.*]]({{.*}}):
// CHECK: test.copy
// CHECK-NEXT: dealloc
@@ -573,18 +573,18 @@ func @memref_in_function_results(
%arg0: memref<5xf32>,
%arg1: memref<10xf32>,
%arg2: memref<5xf32>) -> (memref<10xf32>, memref<15xf32>) {
- %x = memref.alloc() : memref<15xf32>
- %y = memref.alloc() : memref<5xf32>
+ %x = alloc() : memref<15xf32>
+ %y = alloc() : memref<5xf32>
test.buffer_based in(%arg0: memref<5xf32>) out(%y: memref<5xf32>)
test.copy(%y, %arg2) : (memref<5xf32>, memref<5xf32>)
return %arg1, %x : memref<10xf32>, memref<15xf32>
}
// CHECK: (%[[ARG0:.*]]: memref<5xf32>, %[[ARG1:.*]]: memref<10xf32>,
// CHECK-SAME: %[[RESULT:.*]]: memref<5xf32>)
-// CHECK: %[[X:.*]] = memref.alloc()
-// CHECK: %[[Y:.*]] = memref.alloc()
+// CHECK: %[[X:.*]] = alloc()
+// CHECK: %[[Y:.*]] = alloc()
// CHECK: test.copy
-// CHECK: memref.dealloc %[[Y]]
+// CHECK: dealloc %[[Y]]
// CHECK: return %[[ARG1]], %[[X]]
// -----
@@ -599,21 +599,21 @@ func @nested_region_control_flow(
%arg0 : index,
%arg1 : index) -> memref<?x?xf32> {
%0 = cmpi eq, %arg0, %arg1 : index
- %1 = memref.alloc(%arg0, %arg0) : memref<?x?xf32>
+ %1 = alloc(%arg0, %arg0) : memref<?x?xf32>
%2 = scf.if %0 -> (memref<?x?xf32>) {
scf.yield %1 : memref<?x?xf32>
} else {
- %3 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
+ %3 = alloc(%arg0, %arg1) : memref<?x?xf32>
scf.yield %1 : memref<?x?xf32>
}
return %2 : memref<?x?xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc(%arg0, %arg0)
+// CHECK: %[[ALLOC0:.*]] = alloc(%arg0, %arg0)
// CHECK-NEXT: %[[ALLOC1:.*]] = scf.if
// CHECK: scf.yield %[[ALLOC0]]
-// CHECK: %[[ALLOC2:.*]] = memref.alloc(%arg0, %arg1)
-// CHECK-NEXT: memref.dealloc %[[ALLOC2]]
+// CHECK: %[[ALLOC2:.*]] = alloc(%arg0, %arg1)
+// CHECK-NEXT: dealloc %[[ALLOC2]]
// CHECK-NEXT: scf.yield %[[ALLOC0]]
// CHECK: return %[[ALLOC1]]
@@ -629,27 +629,27 @@ func @nested_region_control_flow_div(
%arg0 : index,
%arg1 : index) -> memref<?x?xf32> {
%0 = cmpi eq, %arg0, %arg1 : index
- %1 = memref.alloc(%arg0, %arg0) : memref<?x?xf32>
+ %1 = alloc(%arg0, %arg0) : memref<?x?xf32>
%2 = scf.if %0 -> (memref<?x?xf32>) {
scf.yield %1 : memref<?x?xf32>
} else {
- %3 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
+ %3 = alloc(%arg0, %arg1) : memref<?x?xf32>
scf.yield %3 : memref<?x?xf32>
}
return %2 : memref<?x?xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc(%arg0, %arg0)
+// CHECK: %[[ALLOC0:.*]] = alloc(%arg0, %arg0)
// CHECK-NEXT: %[[ALLOC1:.*]] = scf.if
-// CHECK: %[[ALLOC2:.*]] = memref.alloc
+// CHECK: %[[ALLOC2:.*]] = alloc
// CHECK-NEXT: linalg.copy(%[[ALLOC0]], %[[ALLOC2]])
// CHECK: scf.yield %[[ALLOC2]]
-// CHECK: %[[ALLOC3:.*]] = memref.alloc(%arg0, %arg1)
-// CHECK: %[[ALLOC4:.*]] = memref.alloc
+// CHECK: %[[ALLOC3:.*]] = alloc(%arg0, %arg1)
+// CHECK: %[[ALLOC4:.*]] = alloc
// CHECK-NEXT: linalg.copy(%[[ALLOC3]], %[[ALLOC4]])
-// CHECK: memref.dealloc %[[ALLOC3]]
+// CHECK: dealloc %[[ALLOC3]]
// CHECK: scf.yield %[[ALLOC4]]
-// CHECK: memref.dealloc %[[ALLOC0]]
+// CHECK: dealloc %[[ALLOC0]]
// CHECK-NEXT: return %[[ALLOC1]]
// -----
@@ -660,7 +660,7 @@ func @nested_region_control_flow_div(
// CHECK-LABEL: func @inner_region_control_flow
func @inner_region_control_flow(%arg0 : index) -> memref<?x?xf32> {
- %0 = memref.alloc(%arg0, %arg0) : memref<?x?xf32>
+ %0 = alloc(%arg0, %arg0) : memref<?x?xf32>
%1 = test.region_if %0 : memref<?x?xf32> -> (memref<?x?xf32>) then {
^bb0(%arg1 : memref<?x?xf32>):
test.region_if_yield %arg1 : memref<?x?xf32>
@@ -674,7 +674,7 @@ func @inner_region_control_flow(%arg0 : index) -> memref<?x?xf32> {
return %1 : memref<?x?xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc(%arg0, %arg0)
+// CHECK: %[[ALLOC0:.*]] = alloc(%arg0, %arg0)
// CHECK-NEXT: %[[ALLOC1:.*]] = test.region_if
// CHECK-NEXT: ^bb0(%[[ALLOC2:.*]]:{{.*}}):
// CHECK-NEXT: test.region_if_yield %[[ALLOC2]]
@@ -688,7 +688,7 @@ func @inner_region_control_flow(%arg0 : index) -> memref<?x?xf32> {
// CHECK-LABEL: func @subview
func @subview(%arg0 : index, %arg1 : index, %arg2 : memref<?x?xf32>) {
- %0 = memref.alloc() : memref<64x4xf32, offset: 0, strides: [4, 1]>
+ %0 = alloc() : memref<64x4xf32, offset: 0, strides: [4, 1]>
%1 = subview %0[%arg0, %arg1][%arg0, %arg1][%arg0, %arg1] :
memref<64x4xf32, offset: 0, strides: [4, 1]>
to memref<?x?xf32, offset: ?, strides: [?, ?]>
@@ -697,10 +697,10 @@ func @subview(%arg0 : index, %arg1 : index, %arg2 : memref<?x?xf32>) {
return
}
-// CHECK-NEXT: %[[ALLOC:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC:.*]] = alloc()
// CHECK-NEXT: subview
// CHECK-NEXT: test.copy
-// CHECK-NEXT: memref.dealloc %[[ALLOC]]
+// CHECK-NEXT: dealloc %[[ALLOC]]
// CHECK-NEXT: return
// -----
@@ -714,7 +714,7 @@ func @condBranchAlloca(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
^bb1:
br ^bb3(%arg1 : memref<2xf32>)
^bb2:
- %0 = memref.alloca() : memref<2xf32>
+ %0 = alloca() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
br ^bb3(%0 : memref<2xf32>)
^bb3(%1: memref<2xf32>):
@@ -723,7 +723,7 @@ func @condBranchAlloca(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
}
// CHECK-NEXT: cond_br
-// CHECK: %[[ALLOCA:.*]] = memref.alloca()
+// CHECK: %[[ALLOCA:.*]] = alloca()
// CHECK: br ^bb3(%[[ALLOCA:.*]])
// CHECK-NEXT: ^bb3
// CHECK-NEXT: test.copy
@@ -737,7 +737,7 @@ func @condBranchAlloca(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-LABEL: func @ifElseAlloca
func @ifElseAlloca(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cond_br %arg0,
^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>),
@@ -747,17 +747,17 @@ func @ifElseAlloca(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
^bb2(%3: memref<2xf32>, %4: memref<2xf32>):
br ^bb3(%3, %4 : memref<2xf32>, memref<2xf32>)
^bb3(%5: memref<2xf32>, %6: memref<2xf32>):
- %7 = memref.alloca() : memref<2xf32>
+ %7 = alloca() : memref<2xf32>
test.buffer_based in(%5: memref<2xf32>) out(%7: memref<2xf32>)
test.copy(%7, %arg2) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %[[ALLOC:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
-// CHECK: %[[ALLOCA:.*]] = memref.alloca()
+// CHECK: %[[ALLOCA:.*]] = alloca()
// CHECK-NEXT: test.buffer_based
-// CHECK: memref.dealloc %[[ALLOC]]
+// CHECK: dealloc %[[ALLOC]]
// CHECK: test.copy
// CHECK-NEXT: return
@@ -768,7 +768,7 @@ func @ifElseNestedAlloca(
%arg0: i1,
%arg1: memref<2xf32>,
%arg2: memref<2xf32>) {
- %0 = memref.alloca() : memref<2xf32>
+ %0 = alloca() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cond_br %arg0,
^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>),
@@ -782,18 +782,18 @@ func @ifElseNestedAlloca(
^bb4(%6: memref<2xf32>):
br ^bb5(%3, %6 : memref<2xf32>, memref<2xf32>)
^bb5(%7: memref<2xf32>, %8: memref<2xf32>):
- %9 = memref.alloc() : memref<2xf32>
+ %9 = alloc() : memref<2xf32>
test.buffer_based in(%7: memref<2xf32>) out(%9: memref<2xf32>)
test.copy(%9, %arg2) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %[[ALLOCA:.*]] = memref.alloca()
+// CHECK-NEXT: %[[ALLOCA:.*]] = alloca()
// CHECK-NEXT: test.buffer_based
-// CHECK: %[[ALLOC:.*]] = memref.alloc()
+// CHECK: %[[ALLOC:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
// CHECK: test.copy
-// CHECK-NEXT: memref.dealloc %[[ALLOC]]
+// CHECK-NEXT: dealloc %[[ALLOC]]
// CHECK-NEXT: return
// -----
@@ -807,10 +807,10 @@ func @nestedRegionsAndCondBranchAlloca(
^bb1:
br ^bb3(%arg1 : memref<2xf32>)
^bb2:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.region_buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) {
^bb0(%gen1_arg0: f32, %gen1_arg1: f32):
- %1 = memref.alloca() : memref<2xf32>
+ %1 = alloca() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%1: memref<2xf32>)
%tmp1 = math.exp %gen1_arg0 : f32
test.region_yield %tmp1 : f32
@@ -823,17 +823,17 @@ func @nestedRegionsAndCondBranchAlloca(
// CHECK: (%[[cond:.*]]: {{.*}}, %[[ARG1:.*]]: {{.*}}, %{{.*}}: {{.*}})
// CHECK-NEXT: cond_br %[[cond]], ^[[BB1:.*]], ^[[BB2:.*]]
// CHECK: ^[[BB1]]:
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: linalg.copy
// CHECK: ^[[BB2]]:
-// CHECK: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC1:.*]] = alloc()
// CHECK-NEXT: test.region_buffer_based in(%[[ARG1]]{{.*}}out(%[[ALLOC1]]
-// CHECK: %[[ALLOCA:.*]] = memref.alloca()
+// CHECK: %[[ALLOCA:.*]] = alloca()
// CHECK-NEXT: test.buffer_based in(%[[ARG1]]{{.*}}out(%[[ALLOCA]]
// CHECK: %{{.*}} = math.exp
-// CHECK: %[[ALLOC2:.*]] = memref.alloc()
+// CHECK: %[[ALLOC2:.*]] = alloc()
// CHECK-NEXT: linalg.copy
-// CHECK-NEXT: memref.dealloc %[[ALLOC1]]
+// CHECK-NEXT: dealloc %[[ALLOC1]]
// CHECK: ^[[BB3:.*]]({{.*}}):
// CHECK: test.copy
// CHECK-NEXT: dealloc
@@ -845,20 +845,20 @@ func @nestedRegionControlFlowAlloca(
%arg0 : index,
%arg1 : index) -> memref<?x?xf32> {
%0 = cmpi eq, %arg0, %arg1 : index
- %1 = memref.alloc(%arg0, %arg0) : memref<?x?xf32>
+ %1 = alloc(%arg0, %arg0) : memref<?x?xf32>
%2 = scf.if %0 -> (memref<?x?xf32>) {
scf.yield %1 : memref<?x?xf32>
} else {
- %3 = memref.alloca(%arg0, %arg1) : memref<?x?xf32>
+ %3 = alloca(%arg0, %arg1) : memref<?x?xf32>
scf.yield %1 : memref<?x?xf32>
}
return %2 : memref<?x?xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc(%arg0, %arg0)
+// CHECK: %[[ALLOC0:.*]] = alloc(%arg0, %arg0)
// CHECK-NEXT: %[[ALLOC1:.*]] = scf.if
// CHECK: scf.yield %[[ALLOC0]]
-// CHECK: %[[ALLOCA:.*]] = memref.alloca(%arg0, %arg1)
+// CHECK: %[[ALLOCA:.*]] = alloca(%arg0, %arg1)
// CHECK-NEXT: scf.yield %[[ALLOC0]]
// CHECK: return %[[ALLOC1]]
@@ -875,33 +875,33 @@ func @loop_alloc(
%step: index,
%buf: memref<2xf32>,
%res: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%2 = cmpi eq, %i, %ub : index
- %3 = memref.alloc() : memref<2xf32>
+ %3 = alloc() : memref<2xf32>
scf.yield %3 : memref<2xf32>
}
test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
-// CHECK-NEXT: memref.dealloc %[[ALLOC0]]
-// CHECK-NEXT: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
+// CHECK-NEXT: dealloc %[[ALLOC0]]
+// CHECK-NEXT: %[[ALLOC1:.*]] = alloc()
// CHECK: linalg.copy(%arg3, %[[ALLOC1]])
// CHECK: %[[ALLOC2:.*]] = scf.for {{.*}} iter_args
// CHECK-SAME: (%[[IALLOC:.*]] = %[[ALLOC1]]
// CHECK: cmpi
-// CHECK: memref.dealloc %[[IALLOC]]
-// CHECK: %[[ALLOC3:.*]] = memref.alloc()
-// CHECK: %[[ALLOC4:.*]] = memref.alloc()
+// CHECK: dealloc %[[IALLOC]]
+// CHECK: %[[ALLOC3:.*]] = alloc()
+// CHECK: %[[ALLOC4:.*]] = alloc()
// CHECK: linalg.copy(%[[ALLOC3]], %[[ALLOC4]])
-// CHECK: memref.dealloc %[[ALLOC3]]
+// CHECK: dealloc %[[ALLOC3]]
// CHECK: scf.yield %[[ALLOC4]]
// CHECK: }
// CHECK: test.copy(%[[ALLOC2]], %arg4)
-// CHECK-NEXT: memref.dealloc %[[ALLOC2]]
+// CHECK-NEXT: dealloc %[[ALLOC2]]
// -----
@@ -918,7 +918,7 @@ func @loop_nested_if_no_alloc(
%step: index,
%buf: memref<2xf32>,
%res: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%2 = cmpi eq, %i, %ub : index
@@ -933,14 +933,14 @@ func @loop_nested_if_no_alloc(
return
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: %[[ALLOC1:.*]] = scf.for {{.*}} iter_args(%[[IALLOC:.*]] =
// CHECK: %[[ALLOC2:.*]] = scf.if
// CHECK: scf.yield %[[ALLOC0]]
// CHECK: scf.yield %[[IALLOC]]
// CHECK: scf.yield %[[ALLOC2]]
// CHECK: test.copy(%[[ALLOC1]], %arg4)
-// CHECK: memref.dealloc %[[ALLOC0]]
+// CHECK: dealloc %[[ALLOC0]]
// -----
@@ -958,12 +958,12 @@ func @loop_nested_if_alloc(
%ub: index,
%step: index,
%buf: memref<2xf32>) -> memref<2xf32> {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%2 = cmpi eq, %i, %ub : index
%3 = scf.if %2 -> (memref<2xf32>) {
- %4 = memref.alloc() : memref<2xf32>
+ %4 = alloc() : memref<2xf32>
scf.yield %4 : memref<2xf32>
} else {
scf.yield %0 : memref<2xf32>
@@ -973,30 +973,30 @@ func @loop_nested_if_alloc(
return %1 : memref<2xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
-// CHECK: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
+// CHECK: %[[ALLOC1:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%arg3, %[[ALLOC1]])
// CHECK-NEXT: %[[ALLOC2:.*]] = scf.for {{.*}} iter_args
// CHECK-SAME: (%[[IALLOC:.*]] = %[[ALLOC1]]
-// CHECK: memref.dealloc %[[IALLOC]]
+// CHECK: dealloc %[[IALLOC]]
// CHECK: %[[ALLOC3:.*]] = scf.if
-// CHECK: %[[ALLOC4:.*]] = memref.alloc()
-// CHECK-NEXT: %[[ALLOC5:.*]] = memref.alloc()
+// CHECK: %[[ALLOC4:.*]] = alloc()
+// CHECK-NEXT: %[[ALLOC5:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%[[ALLOC4]], %[[ALLOC5]])
-// CHECK-NEXT: memref.dealloc %[[ALLOC4]]
+// CHECK-NEXT: dealloc %[[ALLOC4]]
// CHECK-NEXT: scf.yield %[[ALLOC5]]
-// CHECK: %[[ALLOC6:.*]] = memref.alloc()
+// CHECK: %[[ALLOC6:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%[[ALLOC0]], %[[ALLOC6]])
// CHECK-NEXT: scf.yield %[[ALLOC6]]
-// CHECK: %[[ALLOC7:.*]] = memref.alloc()
+// CHECK: %[[ALLOC7:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%[[ALLOC3:.*]], %[[ALLOC7]])
-// CHECK-NEXT: memref.dealloc %[[ALLOC3]]
+// CHECK-NEXT: dealloc %[[ALLOC3]]
// CHECK-NEXT: scf.yield %[[ALLOC7]]
-// CHECK: memref.dealloc %[[ALLOC0]]
+// CHECK: dealloc %[[ALLOC0]]
// CHECK-NEXT: return %[[ALLOC2]]
// -----
@@ -1013,17 +1013,17 @@ func @loop_nested_alloc(
%step: index,
%buf: memref<2xf32>,
%res: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%2 = scf.for %i2 = %lb to %ub step %step
iter_args(%iterBuf2 = %iterBuf) -> memref<2xf32> {
%3 = scf.for %i3 = %lb to %ub step %step
iter_args(%iterBuf3 = %iterBuf2) -> memref<2xf32> {
- %4 = memref.alloc() : memref<2xf32>
+ %4 = alloc() : memref<2xf32>
%5 = cmpi eq, %i, %ub : index
%6 = scf.if %5 -> (memref<2xf32>) {
- %7 = memref.alloc() : memref<2xf32>
+ %7 = alloc() : memref<2xf32>
scf.yield %7 : memref<2xf32>
} else {
scf.yield %iterBuf3 : memref<2xf32>
@@ -1038,55 +1038,55 @@ func @loop_nested_alloc(
return
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
-// CHECK-NEXT: memref.dealloc %[[ALLOC0]]
-// CHECK-NEXT: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
+// CHECK-NEXT: dealloc %[[ALLOC0]]
+// CHECK-NEXT: %[[ALLOC1:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%arg3, %[[ALLOC1]])
// CHECK-NEXT: %[[VAL_7:.*]] = scf.for {{.*}} iter_args
// CHECK-SAME: (%[[IALLOC0:.*]] = %[[ALLOC1]])
-// CHECK: %[[ALLOC2:.*]] = memref.alloc()
+// CHECK: %[[ALLOC2:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%[[IALLOC0]], %[[ALLOC2]])
-// CHECK-NEXT: memref.dealloc %[[IALLOC0]]
+// CHECK-NEXT: dealloc %[[IALLOC0]]
// CHECK-NEXT: %[[ALLOC3:.*]] = scf.for {{.*}} iter_args
// CHECK-SAME: (%[[IALLOC1:.*]] = %[[ALLOC2]])
-// CHECK: %[[ALLOC5:.*]] = memref.alloc()
+// CHECK: %[[ALLOC5:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%[[IALLOC1]], %[[ALLOC5]])
-// CHECK-NEXT: memref.dealloc %[[IALLOC1]]
+// CHECK-NEXT: dealloc %[[IALLOC1]]
// CHECK: %[[ALLOC6:.*]] = scf.for {{.*}} iter_args
// CHECK-SAME: (%[[IALLOC2:.*]] = %[[ALLOC5]])
-// CHECK: %[[ALLOC8:.*]] = memref.alloc()
-// CHECK-NEXT: memref.dealloc %[[ALLOC8]]
+// CHECK: %[[ALLOC8:.*]] = alloc()
+// CHECK-NEXT: dealloc %[[ALLOC8]]
// CHECK: %[[ALLOC9:.*]] = scf.if
-// CHECK: %[[ALLOC11:.*]] = memref.alloc()
-// CHECK-NEXT: %[[ALLOC12:.*]] = memref.alloc()
+// CHECK: %[[ALLOC11:.*]] = alloc()
+// CHECK-NEXT: %[[ALLOC12:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%[[ALLOC11]], %[[ALLOC12]])
-// CHECK-NEXT: memref.dealloc %[[ALLOC11]]
+// CHECK-NEXT: dealloc %[[ALLOC11]]
// CHECK-NEXT: scf.yield %[[ALLOC12]]
-// CHECK: %[[ALLOC13:.*]] = memref.alloc()
+// CHECK: %[[ALLOC13:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%[[IALLOC2]], %[[ALLOC13]])
// CHECK-NEXT: scf.yield %[[ALLOC13]]
-// CHECK: memref.dealloc %[[IALLOC2]]
-// CHECK-NEXT: %[[ALLOC10:.*]] = memref.alloc()
+// CHECK: dealloc %[[IALLOC2]]
+// CHECK-NEXT: %[[ALLOC10:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%[[ALLOC9]], %[[ALLOC10]])
-// CHECK-NEXT: memref.dealloc %[[ALLOC9]]
+// CHECK-NEXT: dealloc %[[ALLOC9]]
// CHECK-NEXT: scf.yield %[[ALLOC10]]
-// CHECK: %[[ALLOC7:.*]] = memref.alloc()
+// CHECK: %[[ALLOC7:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%[[ALLOC6]], %[[ALLOC7]])
-// CHECK-NEXT: memref.dealloc %[[ALLOC6]]
+// CHECK-NEXT: dealloc %[[ALLOC6]]
// CHECK-NEXT: scf.yield %[[ALLOC7]]
-// CHECK: %[[ALLOC4:.*]] = memref.alloc()
+// CHECK: %[[ALLOC4:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%[[ALLOC3]], %[[ALLOC4]])
-// CHECK-NEXT: memref.dealloc %[[ALLOC3]]
+// CHECK-NEXT: dealloc %[[ALLOC3]]
// CHECK-NEXT: scf.yield %[[ALLOC4]]
// CHECK: test.copy(%[[VAL_7]], %arg4)
-// CHECK-NEXT: memref.dealloc %[[VAL_7]]
+// CHECK-NEXT: dealloc %[[VAL_7]]
// -----
@@ -1113,7 +1113,7 @@ func @loop_dynalloc(
%const1 = constant 1 : i32
%inc = addi %val, %const1 : i32
%size = std.index_cast %inc : i32 to index
- %alloc1 = memref.alloc(%size) : memref<?xf32>
+ %alloc1 = alloc(%size) : memref<?xf32>
br ^loopHeader(%inc, %alloc1 : i32, memref<?xf32>)
^exit(%buff3 : memref<?xf32>):
@@ -1139,7 +1139,7 @@ func @do_loop_alloc(
^loopBody(%val : i32, %buff2: memref<2xf32>):
%const1 = constant 1 : i32
%inc = addi %val, %const1 : i32
- %alloc1 = memref.alloc() : memref<2xf32>
+ %alloc1 = alloc() : memref<2xf32>
br ^loopHeader(%inc, %alloc1 : i32, memref<2xf32>)
^loopHeader(%i : i32, %buff : memref<2xf32>):
@@ -1162,12 +1162,12 @@ func @assumingOp(
%arg3: memref<2xf32>) {
// Confirm the alloc will be dealloc'ed in the block.
%1 = shape.assuming %arg0 -> memref<2xf32> {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
shape.assuming_yield %arg2 : memref<2xf32>
}
// Confirm the alloc will be returned and dealloc'ed after its use.
%3 = shape.assuming %arg0 -> memref<2xf32> {
- %2 = memref.alloc() : memref<2xf32>
+ %2 = alloc() : memref<2xf32>
shape.assuming_yield %2 : memref<2xf32>
}
test.copy(%3, %arg3) : (memref<2xf32>, memref<2xf32>)
@@ -1178,17 +1178,17 @@ func @assumingOp(
// CHECK-SAME: %[[ARG1:.*]]: {{.*}},
// CHECK-SAME: %[[ARG2:.*]]: {{.*}}
// CHECK: %[[UNUSED_RESULT:.*]] = shape.assuming %[[ARG0]]
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc()
-// CHECK-NEXT: memref.dealloc %[[ALLOC0]]
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc()
+// CHECK-NEXT: dealloc %[[ALLOC0]]
// CHECK-NEXT: shape.assuming_yield %[[ARG1]]
// CHECK: %[[ASSUMING_RESULT:.*]] = shape.assuming %[[ARG0]]
-// CHECK-NEXT: %[[TMP_ALLOC:.*]] = memref.alloc()
-// CHECK-NEXT: %[[RETURNING_ALLOC:.*]] = memref.alloc()
+// CHECK-NEXT: %[[TMP_ALLOC:.*]] = alloc()
+// CHECK-NEXT: %[[RETURNING_ALLOC:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%[[TMP_ALLOC]], %[[RETURNING_ALLOC]])
-// CHECK-NEXT: memref.dealloc %[[TMP_ALLOC]]
+// CHECK-NEXT: dealloc %[[TMP_ALLOC]]
// CHECK-NEXT: shape.assuming_yield %[[RETURNING_ALLOC]]
// CHECK: test.copy(%[[ASSUMING_RESULT:.*]], %[[ARG2]])
-// CHECK-NEXT: memref.dealloc %[[ASSUMING_RESULT]]
+// CHECK-NEXT: dealloc %[[ASSUMING_RESULT]]
// -----
diff --git a/mlir/test/Transforms/buffer-hoisting.mlir b/mlir/test/Transforms/buffer-hoisting.mlir
index aee458d16e77..706c768f511d 100644
--- a/mlir/test/Transforms/buffer-hoisting.mlir
+++ b/mlir/test/Transforms/buffer-hoisting.mlir
@@ -18,7 +18,7 @@ func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
^bb1:
br ^bb3(%arg1 : memref<2xf32>)
^bb2:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
br ^bb3(%0 : memref<2xf32>)
^bb3(%1: memref<2xf32>):
@@ -26,7 +26,7 @@ func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
return
}
-// CHECK-NEXT: %[[ALLOC:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC:.*]] = alloc()
// CHECK-NEXT: cond_br
// -----
@@ -51,7 +51,7 @@ func @condBranchDynamicType(
^bb1:
br ^bb3(%arg1 : memref<?xf32>)
^bb2(%0: index):
- %1 = memref.alloc(%0) : memref<?xf32>
+ %1 = alloc(%0) : memref<?xf32>
test.buffer_based in(%arg1: memref<?xf32>) out(%1: memref<?xf32>)
br ^bb3(%1 : memref<?xf32>)
^bb3(%2: memref<?xf32>):
@@ -62,7 +62,7 @@ func @condBranchDynamicType(
// CHECK-NEXT: cond_br
// CHECK: ^bb2
// CHECK: ^bb2(%[[IDX:.*]]:{{.*}})
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc(%[[IDX]])
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc(%[[IDX]])
// CHECK-NEXT: test.buffer_based
// -----
@@ -93,7 +93,7 @@ func @condBranchDynamicTypeNested(
^bb1:
br ^bb6(%arg1 : memref<?xf32>)
^bb2(%0: index):
- %1 = memref.alloc(%0) : memref<?xf32>
+ %1 = alloc(%0) : memref<?xf32>
test.buffer_based in(%arg1: memref<?xf32>) out(%1: memref<?xf32>)
cond_br %arg0, ^bb3, ^bb4
^bb3:
@@ -112,7 +112,7 @@ func @condBranchDynamicTypeNested(
// CHECK-NEXT: cond_br
// CHECK: ^bb2
// CHECK: ^bb2(%[[IDX:.*]]:{{.*}})
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc(%[[IDX]])
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc(%[[IDX]])
// CHECK-NEXT: test.buffer_based
// -----
@@ -130,7 +130,7 @@ func @condBranchDynamicTypeNested(
func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>)
^bb1:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
br ^bb2(%0 : memref<2xf32>)
^bb2(%1: memref<2xf32>):
@@ -138,7 +138,7 @@ func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
return
}
-// CHECK-NEXT: %[[ALLOC:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC:.*]] = alloc()
// CHECK-NEXT: cond_br
// -----
@@ -153,7 +153,7 @@ func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-LABEL: func @ifElse
func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cond_br %arg0,
^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>),
@@ -163,18 +163,18 @@ func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
^bb2(%3: memref<2xf32>, %4: memref<2xf32>):
br ^bb3(%3, %4 : memref<2xf32>, memref<2xf32>)
^bb3(%5: memref<2xf32>, %6: memref<2xf32>):
- %7 = memref.alloc() : memref<2xf32>
+ %7 = alloc() : memref<2xf32>
test.buffer_based in(%7: memref<2xf32>) out(%7: memref<2xf32>)
test.copy(%7, %arg2) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
// CHECK: br ^bb3
// CHECK: br ^bb3
// CHECK-NEXT: ^bb3
-// CHECK: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC1:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
// CHECK: test.copy(%[[ALLOC1]]
// CHECK-NEXT: return
@@ -191,7 +191,7 @@ func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-LABEL: func @ifElseNoUsers
func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cond_br %arg0,
^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>),
@@ -205,7 +205,7 @@ func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
return
}
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
// -----
@@ -223,7 +223,7 @@ func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-LABEL: func @ifElseNested
func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cond_br %arg0,
^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>),
@@ -237,19 +237,19 @@ func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
^bb4(%6: memref<2xf32>):
br ^bb5(%3, %6 : memref<2xf32>, memref<2xf32>)
^bb5(%7: memref<2xf32>, %8: memref<2xf32>):
- %9 = memref.alloc() : memref<2xf32>
+ %9 = alloc() : memref<2xf32>
test.buffer_based in(%7: memref<2xf32>) out(%9: memref<2xf32>)
test.copy(%9, %arg2) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
// CHECK: br ^bb5
// CHECK: br ^bb5
// CHECK: br ^bb5
// CHECK-NEXT: ^bb5
-// CHECK: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC1:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
// -----
@@ -259,16 +259,16 @@ func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-LABEL: func @redundantOperations
func @redundantOperations(%arg0: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>)
- %1 = memref.alloc() : memref<2xf32>
+ %1 = alloc() : memref<2xf32>
test.buffer_based in(%0: memref<2xf32>) out(%1: memref<2xf32>)
return
}
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
-// CHECK: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC1:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
// -----
@@ -289,11 +289,11 @@ func @moving_alloc_and_inserting_missing_dealloc(
%arg1: memref<2xf32>) {
cond_br %cond, ^bb1, ^bb2
^bb1:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>)
br ^exit(%0 : memref<2xf32>)
^bb2:
- %1 = memref.alloc() : memref<2xf32>
+ %1 = alloc() : memref<2xf32>
test.buffer_based in(%arg0: memref<2xf32>) out(%1: memref<2xf32>)
br ^exit(%1 : memref<2xf32>)
^exit(%arg2: memref<2xf32>):
@@ -301,8 +301,8 @@ func @moving_alloc_and_inserting_missing_dealloc(
return
}
-// CHECK-NEXT: %{{.*}} = memref.alloc()
-// CHECK-NEXT: %{{.*}} = memref.alloc()
+// CHECK-NEXT: %{{.*}} = alloc()
+// CHECK-NEXT: %{{.*}} = alloc()
// CHECK-NEXT: cond_br
// -----
@@ -326,16 +326,16 @@ func @moving_invalid_dealloc_op_complex(
^bb1:
br ^exit(%arg0 : memref<2xf32>)
^bb2:
- %1 = memref.alloc() : memref<2xf32>
+ %1 = alloc() : memref<2xf32>
test.buffer_based in(%arg0: memref<2xf32>) out(%1: memref<2xf32>)
- memref.dealloc %1 : memref<2xf32>
+ dealloc %1 : memref<2xf32>
br ^exit(%1 : memref<2xf32>)
^exit(%arg2: memref<2xf32>):
test.copy(%arg2, %arg1) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %{{.*}} = memref.alloc()
+// CHECK-NEXT: %{{.*}} = alloc()
// CHECK-NEXT: cond_br
// -----
@@ -355,10 +355,10 @@ func @nested_regions_and_cond_branch(
^bb1:
br ^bb3(%arg1 : memref<2xf32>)
^bb2:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.region_buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) {
^bb0(%gen1_arg0: f32, %gen1_arg1: f32):
- %1 = memref.alloc() : memref<2xf32>
+ %1 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%1: memref<2xf32>)
%tmp1 = math.exp %gen1_arg0 : f32
test.region_yield %tmp1 : f32
@@ -368,10 +368,10 @@ func @nested_regions_and_cond_branch(
test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: cond_br
// CHECK: test.region_buffer_based
-// CHECK: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC1:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
// -----
@@ -385,20 +385,20 @@ func @nested_region_control_flow(
%arg0 : index,
%arg1 : index) -> memref<?x?xf32> {
%0 = cmpi eq, %arg0, %arg1 : index
- %1 = memref.alloc(%arg0, %arg0) : memref<?x?xf32>
+ %1 = alloc(%arg0, %arg0) : memref<?x?xf32>
%2 = scf.if %0 -> (memref<?x?xf32>) {
scf.yield %1 : memref<?x?xf32>
} else {
- %3 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
+ %3 = alloc(%arg0, %arg1) : memref<?x?xf32>
scf.yield %1 : memref<?x?xf32>
}
return %2 : memref<?x?xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc(%arg0, %arg0)
+// CHECK: %[[ALLOC0:.*]] = alloc(%arg0, %arg0)
// CHECK-NEXT: %{{.*}} = scf.if
// CHECK: else
-// CHECK-NEXT: %[[ALLOC1:.*]] = memref.alloc(%arg0, %arg1)
+// CHECK-NEXT: %[[ALLOC1:.*]] = alloc(%arg0, %arg1)
// -----
@@ -411,18 +411,18 @@ func @nested_region_control_flow_div(
%arg0 : index,
%arg1 : index) -> memref<?x?xf32> {
%0 = cmpi eq, %arg0, %arg1 : index
- %1 = memref.alloc(%arg0, %arg0) : memref<?x?xf32>
+ %1 = alloc(%arg0, %arg0) : memref<?x?xf32>
%2 = scf.if %0 -> (memref<?x?xf32>) {
scf.yield %1 : memref<?x?xf32>
} else {
- %3 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
+ %3 = alloc(%arg0, %arg1) : memref<?x?xf32>
scf.yield %3 : memref<?x?xf32>
}
return %2 : memref<?x?xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc(%arg0, %arg0)
-// CHECK-NEXT: %[[ALLOC1:.*]] = memref.alloc(%arg0, %arg1)
+// CHECK: %[[ALLOC0:.*]] = alloc(%arg0, %arg0)
+// CHECK-NEXT: %[[ALLOC1:.*]] = alloc(%arg0, %arg1)
// CHECK-NEXT: %{{.*}} = scf.if
// -----
@@ -437,24 +437,24 @@ func @nested_region_control_flow_div_nested(
%arg0 : index,
%arg1 : index) -> memref<?x?xf32> {
%0 = cmpi eq, %arg0, %arg1 : index
- %1 = memref.alloc(%arg0, %arg0) : memref<?x?xf32>
+ %1 = alloc(%arg0, %arg0) : memref<?x?xf32>
%2 = scf.if %0 -> (memref<?x?xf32>) {
%3 = scf.if %0 -> (memref<?x?xf32>) {
scf.yield %1 : memref<?x?xf32>
} else {
- %4 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
+ %4 = alloc(%arg0, %arg1) : memref<?x?xf32>
scf.yield %4 : memref<?x?xf32>
}
scf.yield %3 : memref<?x?xf32>
} else {
- %5 = memref.alloc(%arg1, %arg1) : memref<?x?xf32>
+ %5 = alloc(%arg1, %arg1) : memref<?x?xf32>
scf.yield %5 : memref<?x?xf32>
}
return %2 : memref<?x?xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc(%arg0, %arg0)
-// CHECK-NEXT: %[[ALLOC1:.*]] = memref.alloc(%arg0, %arg1)
-// CHECK-NEXT: %[[ALLOC2:.*]] = memref.alloc(%arg1, %arg1)
+// CHECK: %[[ALLOC0:.*]] = alloc(%arg0, %arg0)
+// CHECK-NEXT: %[[ALLOC1:.*]] = alloc(%arg0, %arg1)
+// CHECK-NEXT: %[[ALLOC2:.*]] = alloc(%arg1, %arg1)
// CHECK-NEXT: %{{.*}} = scf.if
// -----
@@ -464,7 +464,7 @@ func @nested_region_control_flow_div_nested(
// CHECK-LABEL: func @inner_region_control_flow
func @inner_region_control_flow(%arg0 : index) -> memref<?x?xf32> {
- %0 = memref.alloc(%arg0, %arg0) : memref<?x?xf32>
+ %0 = alloc(%arg0, %arg0) : memref<?x?xf32>
%1 = test.region_if %0 : memref<?x?xf32> -> (memref<?x?xf32>) then {
^bb0(%arg1 : memref<?x?xf32>):
test.region_if_yield %arg1 : memref<?x?xf32>
@@ -478,7 +478,7 @@ func @inner_region_control_flow(%arg0 : index) -> memref<?x?xf32> {
return %1 : memref<?x?xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc(%arg0, %arg0)
+// CHECK: %[[ALLOC0:.*]] = alloc(%arg0, %arg0)
// CHECK-NEXT: {{.*}} test.region_if
// -----
@@ -491,13 +491,13 @@ func @inner_region_control_flow(%arg0 : index) -> memref<?x?xf32> {
func @inner_region_control_flow_div(
%arg0 : index,
%arg1 : index) -> memref<?x?xf32> {
- %0 = memref.alloc(%arg0, %arg0) : memref<?x?xf32>
+ %0 = alloc(%arg0, %arg0) : memref<?x?xf32>
%1 = test.region_if %0 : memref<?x?xf32> -> (memref<?x?xf32>) then {
^bb0(%arg2 : memref<?x?xf32>):
test.region_if_yield %arg2 : memref<?x?xf32>
} else {
^bb0(%arg2 : memref<?x?xf32>):
- %2 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
+ %2 = alloc(%arg0, %arg1) : memref<?x?xf32>
test.region_if_yield %2 : memref<?x?xf32>
} join {
^bb0(%arg2 : memref<?x?xf32>):
@@ -506,8 +506,8 @@ func @inner_region_control_flow_div(
return %1 : memref<?x?xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc(%arg0, %arg0)
-// CHECK-NEXT: %[[ALLOC1:.*]] = memref.alloc(%arg0, %arg1)
+// CHECK: %[[ALLOC0:.*]] = alloc(%arg0, %arg0)
+// CHECK-NEXT: %[[ALLOC1:.*]] = alloc(%arg0, %arg1)
// CHECK-NEXT: {{.*}} test.region_if
// -----
@@ -520,7 +520,7 @@ func @condBranchAlloca(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
^bb1:
br ^bb3(%arg1 : memref<2xf32>)
^bb2:
- %0 = memref.alloca() : memref<2xf32>
+ %0 = alloca() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
br ^bb3(%0 : memref<2xf32>)
^bb3(%1: memref<2xf32>):
@@ -531,7 +531,7 @@ func @condBranchAlloca(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-NEXT: cond_br
// CHECK: ^bb2
// CHECK: ^bb2
-// CHECK-NEXT: %[[ALLOCA:.*]] = memref.alloca()
+// CHECK-NEXT: %[[ALLOCA:.*]] = alloca()
// CHECK-NEXT: test.buffer_based
// -----
@@ -544,7 +544,7 @@ func @ifElseNestedAlloca(
%arg0: i1,
%arg1: memref<2xf32>,
%arg2: memref<2xf32>) {
- %0 = memref.alloca() : memref<2xf32>
+ %0 = alloca() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cond_br %arg0,
^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>),
@@ -558,19 +558,19 @@ func @ifElseNestedAlloca(
^bb4(%6: memref<2xf32>):
br ^bb5(%3, %6 : memref<2xf32>, memref<2xf32>)
^bb5(%7: memref<2xf32>, %8: memref<2xf32>):
- %9 = memref.alloc() : memref<2xf32>
+ %9 = alloc() : memref<2xf32>
test.buffer_based in(%7: memref<2xf32>) out(%9: memref<2xf32>)
test.copy(%9, %arg2) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %[[ALLOCA:.*]] = memref.alloca()
+// CHECK-NEXT: %[[ALLOCA:.*]] = alloca()
// CHECK-NEXT: test.buffer_based
// CHECK: ^bb5
// CHECK: ^bb5
// CHECK: ^bb5
// CHECK-NEXT: ^bb5
-// CHECK-NEXT: %[[ALLOC:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
// -----
@@ -587,10 +587,10 @@ func @nestedRegionsAndCondBranchAlloca(
^bb1:
br ^bb3(%arg1 : memref<2xf32>)
^bb2:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.region_buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) {
^bb0(%gen1_arg0: f32, %gen1_arg1: f32):
- %1 = memref.alloca() : memref<2xf32>
+ %1 = alloca() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%1: memref<2xf32>)
%tmp1 = math.exp %gen1_arg0 : f32
test.region_yield %tmp1 : f32
@@ -600,10 +600,10 @@ func @nestedRegionsAndCondBranchAlloca(
test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %[[ALLOC:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC:.*]] = alloc()
// CHECK-NEXT: cond_br
// CHECK: test.region_buffer_based
-// CHECK: %[[ALLOCA:.*]] = memref.alloca()
+// CHECK: %[[ALLOCA:.*]] = alloca()
// CHECK-NEXT: test.buffer_based
// -----
@@ -618,20 +618,20 @@ func @loop_alloc(
%step: index,
%buf: memref<2xf32>,
%res: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%2 = cmpi eq, %i, %ub : index
- %3 = memref.alloc() : memref<2xf32>
+ %3 = alloc() : memref<2xf32>
scf.yield %3 : memref<2xf32>
}
test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: {{.*}} scf.for
-// CHECK: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC1:.*]] = alloc()
// -----
@@ -645,12 +645,12 @@ func @loop_nested_if_alloc(
%ub: index,
%step: index,
%buf: memref<2xf32>) -> memref<2xf32> {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%2 = cmpi eq, %i, %ub : index
%3 = scf.if %2 -> (memref<2xf32>) {
- %4 = memref.alloc() : memref<2xf32>
+ %4 = alloc() : memref<2xf32>
scf.yield %4 : memref<2xf32>
} else {
scf.yield %0 : memref<2xf32>
@@ -660,9 +660,9 @@ func @loop_nested_if_alloc(
return %1 : memref<2xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: {{.*}} scf.for
-// CHECK: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC1:.*]] = alloc()
// -----
@@ -677,17 +677,17 @@ func @loop_nested_alloc(
%step: index,
%buf: memref<2xf32>,
%res: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%2 = scf.for %i2 = %lb to %ub step %step
iter_args(%iterBuf2 = %iterBuf) -> memref<2xf32> {
%3 = scf.for %i3 = %lb to %ub step %step
iter_args(%iterBuf3 = %iterBuf2) -> memref<2xf32> {
- %4 = memref.alloc() : memref<2xf32>
+ %4 = alloc() : memref<2xf32>
%5 = cmpi eq, %i, %ub : index
%6 = scf.if %5 -> (memref<2xf32>) {
- %7 = memref.alloc() : memref<2xf32>
+ %7 = alloc() : memref<2xf32>
scf.yield %7 : memref<2xf32>
} else {
scf.yield %iterBuf3 : memref<2xf32>
@@ -702,12 +702,12 @@ func @loop_nested_alloc(
return
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: {{.*}} = scf.for
// CHECK-NEXT: {{.*}} = scf.for
// CHECK-NEXT: {{.*}} = scf.for
-// CHECK-NEXT: %[[ALLOC1:.*]] = memref.alloc()
-// CHECK: %[[ALLOC2:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC1:.*]] = alloc()
+// CHECK: %[[ALLOC2:.*]] = alloc()
// -----
@@ -719,7 +719,7 @@ func @loop_nested_alloc_dyn_dependency(
%arg0: index,
%buf: memref<?xf32>,
%res: memref<?xf32>) {
- %0 = memref.alloc(%arg0) : memref<?xf32>
+ %0 = alloc(%arg0) : memref<?xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<?xf32> {
%2 = scf.for %i2 = %lb to %ub step %step
@@ -728,7 +728,7 @@ func @loop_nested_alloc_dyn_dependency(
iter_args(%iterBuf3 = %iterBuf2) -> memref<?xf32> {
%5 = cmpi eq, %i, %ub : index
%6 = scf.if %5 -> (memref<?xf32>) {
- %7 = memref.alloc(%i3) : memref<?xf32>
+ %7 = alloc(%i3) : memref<?xf32>
scf.yield %7 : memref<?xf32>
} else {
scf.yield %iterBuf3 : memref<?xf32>
@@ -744,8 +744,8 @@ func @loop_nested_alloc_dyn_dependency(
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc({{.*}})
+// CHECK: %[[ALLOC0:.*]] = alloc({{.*}})
// CHECK-NEXT: {{.*}} = scf.for
// CHECK-NEXT: {{.*}} = scf.for
// CHECK-NEXT: {{.*}} = scf.for
-// CHECK: %[[ALLOC1:.*]] = memref.alloc({{.*}})
+// CHECK: %[[ALLOC1:.*]] = alloc({{.*}})
diff --git a/mlir/test/Transforms/buffer-loop-hoisting.mlir b/mlir/test/Transforms/buffer-loop-hoisting.mlir
index c5e727b89449..085a4d63b762 100644
--- a/mlir/test/Transforms/buffer-loop-hoisting.mlir
+++ b/mlir/test/Transforms/buffer-loop-hoisting.mlir
@@ -17,7 +17,7 @@ func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
^bb1:
br ^bb3(%arg1 : memref<2xf32>)
^bb2:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
br ^bb3(%0 : memref<2xf32>)
^bb3(%1: memref<2xf32>):
@@ -26,7 +26,7 @@ func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
}
// CHECK-NEXT: cond_br
-// CHECK: %[[ALLOC:.*]] = memref.alloc()
+// CHECK: %[[ALLOC:.*]] = alloc()
// -----
@@ -50,7 +50,7 @@ func @condBranchDynamicType(
^bb1:
br ^bb3(%arg1 : memref<?xf32>)
^bb2(%0: index):
- %1 = memref.alloc(%0) : memref<?xf32>
+ %1 = alloc(%0) : memref<?xf32>
test.buffer_based in(%arg1: memref<?xf32>) out(%1: memref<?xf32>)
br ^bb3(%1 : memref<?xf32>)
^bb3(%2: memref<?xf32>):
@@ -61,7 +61,7 @@ func @condBranchDynamicType(
// CHECK-NEXT: cond_br
// CHECK: ^bb2
// CHECK: ^bb2(%[[IDX:.*]]:{{.*}})
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc(%[[IDX]])
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc(%[[IDX]])
// CHECK-NEXT: test.buffer_based
// -----
@@ -81,10 +81,10 @@ func @nested_regions_and_cond_branch(
^bb1:
br ^bb3(%arg1 : memref<2xf32>)
^bb2:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.region_buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) {
^bb0(%gen1_arg0: f32, %gen1_arg1: f32):
- %1 = memref.alloc() : memref<2xf32>
+ %1 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%1: memref<2xf32>)
%tmp1 = math.exp %gen1_arg0 : f32
test.region_yield %tmp1 : f32
@@ -95,9 +95,9 @@ func @nested_regions_and_cond_branch(
return
}
// CHECK-NEXT: cond_br
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
// CHECK: test.region_buffer_based
-// CHECK: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC1:.*]] = alloc()
// CHECK-NEXT: test.buffer_based
// -----
@@ -111,20 +111,20 @@ func @nested_region_control_flow(
%arg0 : index,
%arg1 : index) -> memref<?x?xf32> {
%0 = cmpi eq, %arg0, %arg1 : index
- %1 = memref.alloc(%arg0, %arg0) : memref<?x?xf32>
+ %1 = alloc(%arg0, %arg0) : memref<?x?xf32>
%2 = scf.if %0 -> (memref<?x?xf32>) {
scf.yield %1 : memref<?x?xf32>
} else {
- %3 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
+ %3 = alloc(%arg0, %arg1) : memref<?x?xf32>
scf.yield %1 : memref<?x?xf32>
}
return %2 : memref<?x?xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc(%arg0, %arg0)
+// CHECK: %[[ALLOC0:.*]] = alloc(%arg0, %arg0)
// CHECK-NEXT: %{{.*}} = scf.if
// CHECK: else
-// CHECK-NEXT: %[[ALLOC1:.*]] = memref.alloc(%arg0, %arg1)
+// CHECK-NEXT: %[[ALLOC1:.*]] = alloc(%arg0, %arg1)
// -----
@@ -138,20 +138,20 @@ func @loop_alloc(
%step: index,
%buf: memref<2xf32>,
%res: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%2 = cmpi eq, %i, %ub : index
- %3 = memref.alloc() : memref<2xf32>
+ %3 = alloc() : memref<2xf32>
scf.yield %3 : memref<2xf32>
}
test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: {{.*}} scf.for
-// CHECK: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC1:.*]] = alloc()
// -----
@@ -165,12 +165,12 @@ func @loop_nested_if_alloc(
%ub: index,
%step: index,
%buf: memref<2xf32>) -> memref<2xf32> {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%2 = cmpi eq, %i, %ub : index
%3 = scf.if %2 -> (memref<2xf32>) {
- %4 = memref.alloc() : memref<2xf32>
+ %4 = alloc() : memref<2xf32>
scf.yield %4 : memref<2xf32>
} else {
scf.yield %0 : memref<2xf32>
@@ -180,9 +180,9 @@ func @loop_nested_if_alloc(
return %1 : memref<2xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: {{.*}} scf.for
-// CHECK: %[[ALLOC1:.*]] = memref.alloc()
+// CHECK: %[[ALLOC1:.*]] = alloc()
// -----
@@ -198,23 +198,23 @@ func @loop_nested_alloc(
%step: index,
%buf: memref<2xf32>,
%res: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%2 = scf.for %i2 = %lb to %ub step %step
iter_args(%iterBuf2 = %iterBuf) -> memref<2xf32> {
%3 = scf.for %i3 = %lb to %ub step %step
iter_args(%iterBuf3 = %iterBuf2) -> memref<2xf32> {
- %4 = memref.alloc() : memref<2xf32>
+ %4 = alloc() : memref<2xf32>
%5 = cmpi eq, %i, %ub : index
%6 = scf.if %5 -> (memref<2xf32>) {
- %7 = memref.alloc() : memref<2xf32>
- %8 = memref.alloc() : memref<2xf32>
+ %7 = alloc() : memref<2xf32>
+ %8 = alloc() : memref<2xf32>
scf.yield %8 : memref<2xf32>
} else {
scf.yield %iterBuf3 : memref<2xf32>
}
- %9 = memref.alloc() : memref<2xf32>
+ %9 = alloc() : memref<2xf32>
scf.yield %6 : memref<2xf32>
}
scf.yield %3 : memref<2xf32>
@@ -225,15 +225,15 @@ func @loop_nested_alloc(
return
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
-// CHECK-NEXT: %[[ALLOC1:.*]] = memref.alloc()
-// CHECK-NEXT: %[[ALLOC2:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
+// CHECK-NEXT: %[[ALLOC1:.*]] = alloc()
+// CHECK-NEXT: %[[ALLOC2:.*]] = alloc()
// CHECK-NEXT: {{.*}} = scf.for
// CHECK-NEXT: {{.*}} = scf.for
// CHECK-NEXT: {{.*}} = scf.for
// CHECK: {{.*}} = scf.if
-// CHECK: %[[ALLOC3:.*]] = memref.alloc()
-// CHECK: %[[ALLOC4:.*]] = memref.alloc()
+// CHECK: %[[ALLOC3:.*]] = alloc()
+// CHECK: %[[ALLOC4:.*]] = alloc()
// -----
@@ -245,22 +245,22 @@ func @loop_nested_alloc_dyn_dependency(
%arg0: index,
%buf: memref<?xf32>,
%res: memref<?xf32>) {
- %0 = memref.alloc(%arg0) : memref<?xf32>
+ %0 = alloc(%arg0) : memref<?xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<?xf32> {
%2 = scf.for %i2 = %lb to %ub step %step
iter_args(%iterBuf2 = %iterBuf) -> memref<?xf32> {
%3 = scf.for %i3 = %lb to %ub step %step
iter_args(%iterBuf3 = %iterBuf2) -> memref<?xf32> {
- %4 = memref.alloc(%i3) : memref<?xf32>
+ %4 = alloc(%i3) : memref<?xf32>
%5 = cmpi eq, %i, %ub : index
%6 = scf.if %5 -> (memref<?xf32>) {
- %7 = memref.alloc(%i3) : memref<?xf32>
+ %7 = alloc(%i3) : memref<?xf32>
scf.yield %7 : memref<?xf32>
} else {
scf.yield %iterBuf3 : memref<?xf32>
}
- %8 = memref.alloc(%i3) : memref<?xf32>
+ %8 = alloc(%i3) : memref<?xf32>
scf.yield %6 : memref<?xf32>
}
scf.yield %3 : memref<?xf32>
@@ -271,12 +271,12 @@ func @loop_nested_alloc_dyn_dependency(
return
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc({{.*}})
+// CHECK: %[[ALLOC0:.*]] = alloc({{.*}})
// CHECK-NEXT: {{.*}} = scf.for
// CHECK-NEXT: {{.*}} = scf.for
// CHECK-NEXT: {{.*}} = scf.for
-// CHECK: %[[ALLOC1:.*]] = memref.alloc({{.*}})
-// CHECK: %[[ALLOC2:.*]] = memref.alloc({{.*}})
+// CHECK: %[[ALLOC1:.*]] = alloc({{.*}})
+// CHECK: %[[ALLOC2:.*]] = alloc({{.*}})
// -----
@@ -287,18 +287,18 @@ func @hoist_one_loop(
%step: index,
%buf: memref<2xf32>,
%res: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
- %2 = memref.alloc() : memref<2xf32>
+ %2 = alloc() : memref<2xf32>
scf.yield %0 : memref<2xf32>
}
test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc({{.*}})
-// CHECK-NEXT: %[[ALLOC1:.*]] = memref.alloc({{.*}})
+// CHECK: %[[ALLOC0:.*]] = alloc({{.*}})
+// CHECK-NEXT: %[[ALLOC1:.*]] = alloc({{.*}})
// CHECK-NEXT: {{.*}} = scf.for
// -----
@@ -312,7 +312,7 @@ func @no_hoist_one_loop(
%res: memref<2xf32>) {
%0 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
- %1 = memref.alloc() : memref<2xf32>
+ %1 = alloc() : memref<2xf32>
scf.yield %1 : memref<2xf32>
}
test.copy(%0, %res) : (memref<2xf32>, memref<2xf32>)
@@ -320,7 +320,7 @@ func @no_hoist_one_loop(
}
// CHECK: {{.*}} = scf.for
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc({{.*}})
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc({{.*}})
// -----
@@ -331,12 +331,12 @@ func @hoist_multiple_loop(
%step: index,
%buf: memref<2xf32>,
%res: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%2 = scf.for %i2 = %lb to %ub step %step
iter_args(%iterBuf2 = %iterBuf) -> memref<2xf32> {
- %3 = memref.alloc() : memref<2xf32>
+ %3 = alloc() : memref<2xf32>
scf.yield %0 : memref<2xf32>
}
scf.yield %0 : memref<2xf32>
@@ -345,8 +345,8 @@ func @hoist_multiple_loop(
return
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc({{.*}})
-// CHECK-NEXT: %[[ALLOC1:.*]] = memref.alloc({{.*}})
+// CHECK: %[[ALLOC0:.*]] = alloc({{.*}})
+// CHECK-NEXT: %[[ALLOC1:.*]] = alloc({{.*}})
// CHECK-NEXT: {{.*}} = scf.for
// -----
@@ -362,7 +362,7 @@ func @no_hoist_one_loop_conditional(
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%1 = cmpi eq, %i, %ub : index
%2 = scf.if %1 -> (memref<2xf32>) {
- %3 = memref.alloc() : memref<2xf32>
+ %3 = alloc() : memref<2xf32>
scf.yield %3 : memref<2xf32>
} else {
scf.yield %iterBuf : memref<2xf32>
@@ -375,7 +375,7 @@ func @no_hoist_one_loop_conditional(
// CHECK: {{.*}} = scf.for
// CHECK: {{.*}} = scf.if
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc({{.*}})
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc({{.*}})
// -----
@@ -386,12 +386,12 @@ func @hoist_one_loop_conditional(
%step: index,
%buf: memref<2xf32>,
%res: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = cmpi eq, %lb, %ub : index
%2 = scf.if %1 -> (memref<2xf32>) {
%3 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
- %4 = memref.alloc() : memref<2xf32>
+ %4 = alloc() : memref<2xf32>
scf.yield %0 : memref<2xf32>
}
scf.yield %0 : memref<2xf32>
@@ -405,7 +405,7 @@ func @hoist_one_loop_conditional(
}
// CHECK: {{.*}} = scf.if
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc({{.*}})
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc({{.*}})
// CHECK: {{.*}} = scf.for
// -----
@@ -417,19 +417,19 @@ func @no_hoist_one_loop_dependency(
%step: index,
%buf: memref<2xf32>,
%res: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
- %2 = memref.alloc(%i) : memref<?xf32>
+ %2 = alloc(%i) : memref<?xf32>
scf.yield %0 : memref<2xf32>
}
test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc({{.*}})
+// CHECK: %[[ALLOC0:.*]] = alloc({{.*}})
// CHECK-NEXT: {{.*}} = scf.for
-// CHECK-NEXT: %[[ALLOC1:.*]] = memref.alloc({{.*}})
+// CHECK-NEXT: %[[ALLOC1:.*]] = alloc({{.*}})
// -----
@@ -440,12 +440,12 @@ func @partial_hoist_multiple_loop_dependency(
%step: index,
%buf: memref<2xf32>,
%res: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%2 = scf.for %i2 = %lb to %ub step %step
iter_args(%iterBuf2 = %iterBuf) -> memref<2xf32> {
- %3 = memref.alloc(%i) : memref<?xf32>
+ %3 = alloc(%i) : memref<?xf32>
scf.yield %0 : memref<2xf32>
}
scf.yield %0 : memref<2xf32>
@@ -454,7 +454,7 @@ func @partial_hoist_multiple_loop_dependency(
return
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc({{.*}})
+// CHECK: %[[ALLOC0:.*]] = alloc({{.*}})
// CHECK-NEXT: {{.*}} = scf.for
-// CHECK-NEXT: %[[ALLOC1:.*]] = memref.alloc({{.*}})
+// CHECK-NEXT: %[[ALLOC1:.*]] = alloc({{.*}})
// CHECK-NEXT: {{.*}} = scf.for
diff --git a/mlir/test/Transforms/buffer-results-to-out-params.mlir b/mlir/test/Transforms/buffer-results-to-out-params.mlir
index cac3e7461225..cde929739475 100644
--- a/mlir/test/Transforms/buffer-results-to-out-params.mlir
+++ b/mlir/test/Transforms/buffer-results-to-out-params.mlir
@@ -60,7 +60,7 @@ func private @mixed_result_attrs() -> (memref<1xf32>, memref<2xf32> {test.some_a
func private @callee() -> memref<1xf32>
// CHECK-LABEL: func @call_basic() {
-// CHECK: %[[OUTPARAM:.*]] = memref.alloc() : memref<1xf32>
+// CHECK: %[[OUTPARAM:.*]] = alloc() : memref<1xf32>
// CHECK: call @callee(%[[OUTPARAM]]) : (memref<1xf32>) -> ()
// CHECK: "test.sink"(%[[OUTPARAM]]) : (memref<1xf32>) -> ()
// CHECK: return
@@ -77,8 +77,8 @@ func @call_basic() {
func private @callee() -> (memref<1xf32>, memref<2xf32>)
// CHECK-LABEL: func @call_multiple_result() {
-// CHECK: %[[RESULT0:.*]] = memref.alloc() : memref<1xf32>
-// CHECK: %[[RESULT1:.*]] = memref.alloc() : memref<2xf32>
+// CHECK: %[[RESULT0:.*]] = alloc() : memref<1xf32>
+// CHECK: %[[RESULT1:.*]] = alloc() : memref<2xf32>
// CHECK: call @callee(%[[RESULT0]], %[[RESULT1]]) : (memref<1xf32>, memref<2xf32>) -> ()
// CHECK: "test.sink"(%[[RESULT0]], %[[RESULT1]]) : (memref<1xf32>, memref<2xf32>) -> ()
// CHECK: }
@@ -93,7 +93,7 @@ func @call_multiple_result() {
func private @callee() -> (i1, memref<1xf32>, i32)
// CHECK-LABEL: func @call_non_memref_result() {
-// CHECK: %[[RESULT0:.*]] = memref.alloc() : memref<1xf32>
+// CHECK: %[[RESULT0:.*]] = alloc() : memref<1xf32>
// CHECK: %[[NON_MEMREF_RESULTS:.*]]:2 = call @callee(%[[RESULT0]]) : (memref<1xf32>) -> (i1, i32)
// CHECK: "test.sink"(%[[NON_MEMREF_RESULTS]]#0, %[[RESULT0]], %[[NON_MEMREF_RESULTS]]#1) : (i1, memref<1xf32>, i32) -> ()
// CHECK: }
diff --git a/mlir/test/Transforms/canonicalize-block-merge.mlir b/mlir/test/Transforms/canonicalize-block-merge.mlir
index 2606fb776e7b..98d274a63fc2 100644
--- a/mlir/test/Transforms/canonicalize-block-merge.mlir
+++ b/mlir/test/Transforms/canonicalize-block-merge.mlir
@@ -213,13 +213,13 @@ func @mismatch_operand_types(%arg0 : i1, %arg1 : memref<i32>, %arg2 : memref<i1>
cond_br %arg0, ^bb2, ^bb3
^bb2:
- // CHECK: memref.store %{{.*}}, %{{.*}} : memref<i32>
- memref.store %c0_i32, %arg1[] : memref<i32>
+ // CHECK: store %{{.*}}, %{{.*}} : memref<i32>
+ store %c0_i32, %arg1[] : memref<i32>
br ^bb1
^bb3:
- // CHECK: memref.store %{{.*}}, %{{.*}} : memref<i1>
- memref.store %true, %arg2[] : memref<i1>
+ // CHECK: store %{{.*}}, %{{.*}} : memref<i1>
+ store %true, %arg2[] : memref<i1>
br ^bb1
}
diff --git a/mlir/test/Transforms/canonicalize.mlir b/mlir/test/Transforms/canonicalize.mlir
index 837baa0dacf9..62c07dd8a063 100644
--- a/mlir/test/Transforms/canonicalize.mlir
+++ b/mlir/test/Transforms/canonicalize.mlir
@@ -61,9 +61,9 @@ func @trivial_dce(%arg0: tensor<8x4xf32>) {
// CHECK-LABEL: func @load_dce
func @load_dce(%arg0: index) {
%c4 = constant 4 : index
- %a = memref.alloc(%c4) : memref<?xf32>
+ %a = alloc(%c4) : memref<?xf32>
%2 = load %a[%arg0] : memref<?xf32>
- memref.dealloc %a: memref<?xf32>
+ dealloc %a: memref<?xf32>
// CHECK-NEXT: return
return
}
@@ -313,7 +313,7 @@ func @xor_self_tensor(%arg0: tensor<4x5xi32>) -> tensor<4x5xi32> {
// CHECK-LABEL: func @memref_cast_folding
func @memref_cast_folding(%arg0: memref<4 x f32>, %arg1: f32) -> (f32, f32) {
- %0 = memref.cast %arg0 : memref<4xf32> to memref<?xf32>
+ %0 = memref_cast %arg0 : memref<4xf32> to memref<?xf32>
// CHECK-NEXT: %c0 = constant 0 : index
%c0 = constant 0 : index
%dim = dim %0, %c0 : memref<? x f32>
@@ -321,14 +321,14 @@ func @memref_cast_folding(%arg0: memref<4 x f32>, %arg1: f32) -> (f32, f32) {
// CHECK-NEXT: affine.load %arg0[3]
%1 = affine.load %0[%dim - 1] : memref<?xf32>
- // CHECK-NEXT: memref.store %arg1, %arg0[%c0] : memref<4xf32>
- memref.store %arg1, %0[%c0] : memref<?xf32>
+ // CHECK-NEXT: store %arg1, %arg0[%c0] : memref<4xf32>
+ store %arg1, %0[%c0] : memref<?xf32>
// CHECK-NEXT: %{{.*}} = load %arg0[%c0] : memref<4xf32>
%2 = load %0[%c0] : memref<?xf32>
- // CHECK-NEXT: memref.dealloc %arg0 : memref<4xf32>
- memref.dealloc %0: memref<?xf32>
+ // CHECK-NEXT: dealloc %arg0 : memref<4xf32>
+ dealloc %0: memref<?xf32>
// CHECK-NEXT: return %{{.*}}
return %1, %2 : f32, f32
@@ -337,10 +337,10 @@ func @memref_cast_folding(%arg0: memref<4 x f32>, %arg1: f32) -> (f32, f32) {
// CHECK-LABEL: @fold_memref_cast_in_memref_cast
// CHECK-SAME: (%[[ARG0:.*]]: memref<42x42xf64>)
func @fold_memref_cast_in_memref_cast(%0: memref<42x42xf64>) {
- // CHECK: %[[folded:.*]] = memref.cast %[[ARG0]] : memref<42x42xf64> to memref<?x?xf64>
- %4 = memref.cast %0 : memref<42x42xf64> to memref<?x42xf64>
- // CHECK-NOT: memref.cast
- %5 = memref.cast %4 : memref<?x42xf64> to memref<?x?xf64>
+ // CHECK: %[[folded:.*]] = memref_cast %[[ARG0]] : memref<42x42xf64> to memref<?x?xf64>
+ %4 = memref_cast %0 : memref<42x42xf64> to memref<?x42xf64>
+ // CHECK-NOT: memref_cast
+ %5 = memref_cast %4 : memref<?x42xf64> to memref<?x?xf64>
// CHECK: "test.user"(%[[folded]])
"test.user"(%5) : (memref<?x?xf64>) -> ()
return
@@ -349,9 +349,9 @@ func @fold_memref_cast_in_memref_cast(%0: memref<42x42xf64>) {
// CHECK-LABEL: @fold_memref_cast_chain
// CHECK-SAME: (%[[ARG0:.*]]: memref<42x42xf64>)
func @fold_memref_cast_chain(%0: memref<42x42xf64>) {
- // CHECK-NOT: memref.cast
- %4 = memref.cast %0 : memref<42x42xf64> to memref<?x42xf64>
- %5 = memref.cast %4 : memref<?x42xf64> to memref<42x42xf64>
+ // CHECK-NOT: memref_cast
+ %4 = memref_cast %0 : memref<42x42xf64> to memref<?x42xf64>
+ %5 = memref_cast %4 : memref<?x42xf64> to memref<42x42xf64>
// CHECK: "test.user"(%[[ARG0]])
"test.user"(%5) : (memref<42x42xf64>) -> ()
return
@@ -359,11 +359,11 @@ func @fold_memref_cast_chain(%0: memref<42x42xf64>) {
// CHECK-LABEL: func @alloc_const_fold
func @alloc_const_fold() -> memref<?xf32> {
- // CHECK-NEXT: %0 = memref.alloc() : memref<4xf32>
+ // CHECK-NEXT: %0 = alloc() : memref<4xf32>
%c4 = constant 4 : index
- %a = memref.alloc(%c4) : memref<?xf32>
+ %a = alloc(%c4) : memref<?xf32>
- // CHECK-NEXT: %1 = memref.cast %0 : memref<4xf32> to memref<?xf32>
+ // CHECK-NEXT: %1 = memref_cast %0 : memref<4xf32> to memref<?xf32>
// CHECK-NEXT: return %1 : memref<?xf32>
return %a : memref<?xf32>
}
@@ -372,30 +372,30 @@ func @alloc_const_fold() -> memref<?xf32> {
func @dead_alloc_fold() {
// CHECK-NEXT: return
%c4 = constant 4 : index
- %a = memref.alloc(%c4) : memref<?xf32>
+ %a = alloc(%c4) : memref<?xf32>
return
}
// CHECK-LABEL: func @dead_dealloc_fold
func @dead_dealloc_fold() {
// CHECK-NEXT: return
- %a = memref.alloc() : memref<4xf32>
- memref.dealloc %a: memref<4xf32>
+ %a = alloc() : memref<4xf32>
+ dealloc %a: memref<4xf32>
return
}
// CHECK-LABEL: func @dead_dealloc_fold_multi_use
func @dead_dealloc_fold_multi_use(%cond : i1) {
// CHECK-NEXT: return
- %a = memref.alloc() : memref<4xf32>
+ %a = alloc() : memref<4xf32>
cond_br %cond, ^bb1, ^bb2
^bb1:
- memref.dealloc %a: memref<4xf32>
+ dealloc %a: memref<4xf32>
return
^bb2:
- memref.dealloc %a: memref<4xf32>
+ dealloc %a: memref<4xf32>
return
}
@@ -423,29 +423,29 @@ func @dyn_shape_fold(%L : index, %M : index) -> (memref<? x ? x i32>, memref<? x
%N = constant 1024 : index
%K = constant 512 : index
- // CHECK-NEXT: memref.alloc(%arg0) : memref<?x1024xf32>
- %a = memref.alloc(%L, %N) : memref<? x ? x f32>
+ // CHECK-NEXT: alloc(%arg0) : memref<?x1024xf32>
+ %a = alloc(%L, %N) : memref<? x ? x f32>
- // CHECK-NEXT: memref.alloc(%arg1) : memref<4x1024x8x512x?xf32>
- %b = memref.alloc(%N, %K, %M) : memref<4 x ? x 8 x ? x ? x f32>
+ // CHECK-NEXT: alloc(%arg1) : memref<4x1024x8x512x?xf32>
+ %b = alloc(%N, %K, %M) : memref<4 x ? x 8 x ? x ? x f32>
- // CHECK-NEXT: memref.alloc() : memref<512x1024xi32>
- %c = memref.alloc(%K, %N) : memref<? x ? x i32>
+ // CHECK-NEXT: alloc() : memref<512x1024xi32>
+ %c = alloc(%K, %N) : memref<? x ? x i32>
- // CHECK: memref.alloc() : memref<9x9xf32>
- %d = memref.alloc(%nine, %nine) : memref<? x ? x f32>
+ // CHECK: alloc() : memref<9x9xf32>
+ %d = alloc(%nine, %nine) : memref<? x ? x f32>
- // CHECK: memref.alloca(%arg1) : memref<4x1024x8x512x?xf32>
- %e = memref.alloca(%N, %K, %M) : memref<4 x ? x 8 x ? x ? x f32>
+ // CHECK: alloca(%arg1) : memref<4x1024x8x512x?xf32>
+ %e = alloca(%N, %K, %M) : memref<4 x ? x 8 x ? x ? x f32>
// CHECK: affine.for
affine.for %i = 0 to %L {
// CHECK-NEXT: affine.for
affine.for %j = 0 to 10 {
// CHECK-NEXT: load %0[%arg2, %arg3] : memref<?x1024xf32>
- // CHECK-NEXT: memref.store %{{.*}}, %1[%c0, %c0, %arg2, %arg3, %c0] : memref<4x1024x8x512x?xf32>
+ // CHECK-NEXT: store %{{.*}}, %1[%c0, %c0, %arg2, %arg3, %c0] : memref<4x1024x8x512x?xf32>
%v = load %a[%i, %j] : memref<?x?xf32>
- memref.store %v, %b[%zero, %zero, %i, %j, %zero] : memref<4x?x8x?x?xf32>
+ store %v, %b[%zero, %zero, %i, %j, %zero] : memref<4x?x8x?x?xf32>
}
}
@@ -468,15 +468,15 @@ func @dim_op_fold(%arg0: index, %arg1: index, %arg2: index, %BUF: memref<?xi8>,
%c0 = constant 0 : index
%c1 = constant 1 : index
%c2 = constant 2 : index
- %0 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
- %1 = memref.alloc(%arg1, %arg2) : memref<?x8x?xf32>
+ %0 = alloc(%arg0, %arg1) : memref<?x?xf32>
+ %1 = alloc(%arg1, %arg2) : memref<?x8x?xf32>
%2 = dim %1, %c2 : memref<?x8x?xf32>
affine.for %arg3 = 0 to %2 {
- %3 = memref.alloc(%arg0) : memref<?xi8>
+ %3 = alloc(%arg0) : memref<?xi8>
%ub = dim %3, %c0 : memref<?xi8>
affine.for %arg4 = 0 to %ub {
%s = dim %0, %c0 : memref<?x?xf32>
- %v = memref.view %3[%c0][%arg4, %s] : memref<?xi8> to memref<?x?xf32>
+ %v = std.view %3[%c0][%arg4, %s] : memref<?xi8> to memref<?x?xf32>
%sv = subview %0[%c0, %c0][%s,%arg4][%c1,%c1] : memref<?x?xf32> to memref<?x?xf32, #map1>
%l = dim %v, %c1 : memref<?x?xf32>
%u = dim %sv, %c0 : memref<?x?xf32, #map1>
@@ -502,9 +502,9 @@ func @dim_op_fold(%arg0: index, %arg1: index, %arg2: index, %BUF: memref<?xi8>,
// CHECK-NEXT: }
// CHECK-NEXT: }
- %A = memref.view %BUF[%c0][%M, %K] : memref<?xi8> to memref<?x?xf32>
- %B = memref.view %BUF[%c0][%K, %N] : memref<?xi8> to memref<?x?xf32>
- %C = memref.view %BUF[%c0][%M, %N] : memref<?xi8> to memref<?x?xf32>
+ %A = view %BUF[%c0][%M, %K] : memref<?xi8> to memref<?x?xf32>
+ %B = view %BUF[%c0][%K, %N] : memref<?xi8> to memref<?x?xf32>
+ %C = view %BUF[%c0][%M, %N] : memref<?xi8> to memref<?x?xf32>
%M_ = dim %A, %c0 : memref<?x?xf32>
%K_ = dim %A, %c1 : memref<?x?xf32>
@@ -533,9 +533,9 @@ func @hoist_constant(%arg0: memref<8xi32>) {
// CHECK-NEXT: %c42_i32 = constant 42 : i32
// CHECK-NEXT: affine.for %arg1 = 0 to 8 {
affine.for %arg1 = 0 to 8 {
- // CHECK-NEXT: memref.store %c42_i32, %arg0[%arg1]
+ // CHECK-NEXT: store %c42_i32, %arg0[%arg1]
%c42_i32 = constant 42 : i32
- memref.store %c42_i32, %arg0[%arg1] : memref<8xi32>
+ store %c42_i32, %arg0[%arg1] : memref<8xi32>
}
return
}
@@ -547,8 +547,8 @@ func @const_fold_propagate() -> memref<?x?xf32> {
%VT_i_s = affine.apply affine_map<(d0) -> (d0 floordiv 8)> (%VT_i)
%VT_k_l = affine.apply affine_map<(d0) -> (d0 floordiv 16)> (%VT_i)
- // CHECK: = memref.alloc() : memref<64x32xf32>
- %Av = memref.alloc(%VT_i_s, %VT_k_l) : memref<?x?xf32>
+ // CHECK: = alloc() : memref<64x32xf32>
+ %Av = alloc(%VT_i_s, %VT_k_l) : memref<?x?xf32>
return %Av : memref<?x?xf32>
}
@@ -663,11 +663,11 @@ func @lowered_affine_ceildiv() -> (index, index) {
// CHECK-LABEL: cast_values
func @cast_values(%arg0: memref<?xi32>) -> memref<2xi32> {
// NOP cast
- %1 = memref.cast %arg0 : memref<?xi32> to memref<?xi32>
- // CHECK-NEXT: %[[RET:.*]] = memref.cast %arg0 : memref<?xi32> to memref<2xi32>
- %3 = memref.cast %1 : memref<?xi32> to memref<2xi32>
+ %1 = memref_cast %arg0 : memref<?xi32> to memref<?xi32>
+ // CHECK-NEXT: %[[RET:.*]] = memref_cast %arg0 : memref<?xi32> to memref<2xi32>
+ %3 = memref_cast %1 : memref<?xi32> to memref<2xi32>
// NOP cast
- %5 = memref.cast %3 : memref<2xi32> to memref<2xi32>
+ %5 = memref_cast %3 : memref<2xi32> to memref<2xi32>
// CHECK-NEXT: return %[[RET]] : memref<2xi32>
return %5 : memref<2xi32>
}
@@ -677,32 +677,32 @@ func @cast_values(%arg0: memref<?xi32>) -> memref<2xi32> {
// CHECK-LABEL: func @view
func @view(%arg0 : index) -> (f32, f32, f32, f32) {
// CHECK: %[[C15:.*]] = constant 15 : index
- // CHECK: %[[ALLOC_MEM:.*]] = memref.alloc() : memref<2048xi8>
- %0 = memref.alloc() : memref<2048xi8>
+ // CHECK: %[[ALLOC_MEM:.*]] = alloc() : memref<2048xi8>
+ %0 = alloc() : memref<2048xi8>
%c0 = constant 0 : index
%c7 = constant 7 : index
%c11 = constant 11 : index
%c15 = constant 15 : index
// Test: fold constant sizes.
- // CHECK: memref.view %[[ALLOC_MEM]][%[[C15]]][] : memref<2048xi8> to memref<7x11xf32>
- %1 = memref.view %0[%c15][%c7, %c11] : memref<2048xi8> to memref<?x?xf32>
+ // CHECK: std.view %[[ALLOC_MEM]][%[[C15]]][] : memref<2048xi8> to memref<7x11xf32>
+ %1 = view %0[%c15][%c7, %c11] : memref<2048xi8> to memref<?x?xf32>
%r0 = load %1[%c0, %c0] : memref<?x?xf32>
// Test: fold one constant size.
- // CHECK: memref.view %[[ALLOC_MEM]][%[[C15]]][%arg0, %arg0] : memref<2048xi8> to memref<?x?x7xf32>
- %2 = memref.view %0[%c15][%arg0, %arg0, %c7] : memref<2048xi8> to memref<?x?x?xf32>
+ // CHECK: std.view %[[ALLOC_MEM]][%[[C15]]][%arg0, %arg0] : memref<2048xi8> to memref<?x?x7xf32>
+ %2 = view %0[%c15][%arg0, %arg0, %c7] : memref<2048xi8> to memref<?x?x?xf32>
%r1 = load %2[%c0, %c0, %c0] : memref<?x?x?xf32>
// Test: preserve an existing static size.
- // CHECK: memref.view %[[ALLOC_MEM]][%[[C15]]][] : memref<2048xi8> to memref<7x4xf32>
- %3 = memref.view %0[%c15][%c7] : memref<2048xi8> to memref<?x4xf32>
+ // CHECK: std.view %[[ALLOC_MEM]][%[[C15]]][] : memref<2048xi8> to memref<7x4xf32>
+ %3 = view %0[%c15][%c7] : memref<2048xi8> to memref<?x4xf32>
%r2 = load %3[%c0, %c0] : memref<?x4xf32>
- // Test: folding static alloc and memref.cast into a view.
- // CHECK memref.view %[[ALLOC_MEM]][%[[C15]]][] : memref<2048xi8> to memref<15x7xf32>
- %4 = memref.cast %0 : memref<2048xi8> to memref<?xi8>
- %5 = memref.view %4[%c15][%c15, %c7] : memref<?xi8> to memref<?x?xf32>
+ // Test: folding static alloc and memref_cast into a view.
+ // CHECK: std.view %[[ALLOC_MEM]][%[[C15]]][] : memref<2048xi8> to memref<15x7xf32>
+ %4 = memref_cast %0 : memref<2048xi8> to memref<?xi8>
+ %5 = view %4[%c15][%c15, %c7] : memref<?xi8> to memref<?x?xf32>
%r3 = load %5[%c0, %c0] : memref<?x?xf32>
return %r0, %r1, %r2, %r3 : f32, f32, f32, f32
}
@@ -739,8 +739,8 @@ func @subview(%arg0 : index, %arg1 : index) -> (index, index) {
// CHECK-NOT: constant 15 : index
%c15 = constant 15 : index
- // CHECK: %[[ALLOC0:.*]] = memref.alloc()
- %0 = memref.alloc() : memref<8x16x4xf32, offset : 0, strides : [64, 4, 1]>
+ // CHECK: %[[ALLOC0:.*]] = alloc()
+ %0 = alloc() : memref<8x16x4xf32, offset : 0, strides : [64, 4, 1]>
// Test: subview with constant base memref and constant operands is folded.
// Note that the subview uses the base memrefs layout map because it used
@@ -760,10 +760,10 @@ func @subview(%arg0 : index, %arg1 : index) -> (index, index) {
%2 = subview %0[%c0, %arg0, %c0] [%c7, %c11, %c15] [%c1, %c1, %c1]
: memref<8x16x4xf32, offset : 0, strides : [64, 4, 1]> to
memref<?x?x?xf32, offset : ?, strides : [?, ?, ?]>
- memref.store %v0, %2[%c0, %c0, %c0] : memref<?x?x?xf32, offset : ?, strides : [?, ?, ?]>
+ store %v0, %2[%c0, %c0, %c0] : memref<?x?x?xf32, offset : ?, strides : [?, ?, ?]>
- // CHECK: %[[ALLOC1:.*]] = memref.alloc(%[[ARG0]])
- %3 = memref.alloc(%arg0) : memref<?x16x4xf32, offset : 0, strides : [64, 4, 1]>
+ // CHECK: %[[ALLOC1:.*]] = alloc(%[[ARG0]])
+ %3 = alloc(%arg0) : memref<?x16x4xf32, offset : 0, strides : [64, 4, 1]>
// Test: subview with constant operands but dynamic base memref is folded as long as the strides and offset of the base memref are static.
// CHECK: subview %[[ALLOC1]][0, 0, 0] [7, 11, 15] [1, 1, 1] :
// CHECK-SAME: memref<?x16x4xf32, #[[$BASE_MAP0]]>
@@ -771,7 +771,7 @@ func @subview(%arg0 : index, %arg1 : index) -> (index, index) {
%4 = subview %3[%c0, %c0, %c0] [%c7, %c11, %c15] [%c1, %c1, %c1]
: memref<?x16x4xf32, offset : 0, strides : [64, 4, 1]> to
memref<?x?x?xf32, offset : ?, strides : [?, ?, ?]>
- memref.store %v0, %4[%c0, %c0, %c0] : memref<?x?x?xf32, offset : ?, strides : [?, ?, ?]>
+ store %v0, %4[%c0, %c0, %c0] : memref<?x?x?xf32, offset : ?, strides : [?, ?, ?]>
// Test: subview offset operands are folded correctly w.r.t. base strides.
// CHECK: subview %[[ALLOC0]][1, 2, 7] [7, 11, 2] [1, 1, 1] :
@@ -780,7 +780,7 @@ func @subview(%arg0 : index, %arg1 : index) -> (index, index) {
%5 = subview %0[%c1, %c2, %c7] [%c7, %c11, %c2] [%c1, %c1, %c1]
: memref<8x16x4xf32, offset : 0, strides : [64, 4, 1]> to
memref<?x?x?xf32, offset : ?, strides : [?, ?, ?]>
- memref.store %v0, %5[%c0, %c0, %c0] : memref<?x?x?xf32, offset : ?, strides : [?, ?, ?]>
+ store %v0, %5[%c0, %c0, %c0] : memref<?x?x?xf32, offset : ?, strides : [?, ?, ?]>
// Test: subview stride operands are folded correctly w.r.t. base strides.
// CHECK: subview %[[ALLOC0]][0, 0, 0] [7, 11, 2] [2, 7, 11] :
@@ -789,7 +789,7 @@ func @subview(%arg0 : index, %arg1 : index) -> (index, index) {
%6 = subview %0[%c0, %c0, %c0] [%c7, %c11, %c2] [%c2, %c7, %c11]
: memref<8x16x4xf32, offset : 0, strides : [64, 4, 1]> to
memref<?x?x?xf32, offset : ?, strides : [?, ?, ?]>
- memref.store %v0, %6[%c0, %c0, %c0] : memref<?x?x?xf32, offset : ?, strides : [?, ?, ?]>
+ store %v0, %6[%c0, %c0, %c0] : memref<?x?x?xf32, offset : ?, strides : [?, ?, ?]>
// Test: subview shape are folded, but offsets and strides are not even if base memref is static
// CHECK: subview %[[ALLOC0]][%[[ARG0]], %[[ARG0]], %[[ARG0]]] [7, 11, 2] [%[[ARG1]], %[[ARG1]], %[[ARG1]]] :
@@ -798,7 +798,7 @@ func @subview(%arg0 : index, %arg1 : index) -> (index, index) {
%10 = subview %0[%arg0, %arg0, %arg0] [%c7, %c11, %c2] [%arg1, %arg1, %arg1] :
memref<8x16x4xf32, offset:0, strides:[64, 4, 1]> to
memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
- memref.store %v0, %10[%arg1, %arg1, %arg1] :
+ store %v0, %10[%arg1, %arg1, %arg1] :
memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
// Test: subview strides are folded, but offsets and shape are not even if base memref is static
@@ -808,7 +808,7 @@ func @subview(%arg0 : index, %arg1 : index) -> (index, index) {
%11 = subview %0[%arg0, %arg0, %arg0] [%arg1, %arg1, %arg1] [%c2, %c7, %c11] :
memref<8x16x4xf32, offset:0, strides:[64, 4, 1]> to
memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
- memref.store %v0, %11[%arg0, %arg0, %arg0] :
+ store %v0, %11[%arg0, %arg0, %arg0] :
memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
// Test: subview offsets are folded, but strides and shape are not even if base memref is static
@@ -818,11 +818,11 @@ func @subview(%arg0 : index, %arg1 : index) -> (index, index) {
%13 = subview %0[%c1, %c2, %c7] [%arg1, %arg1, %arg1] [%arg0, %arg0, %arg0] :
memref<8x16x4xf32, offset:0, strides:[64, 4, 1]> to
memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
- memref.store %v0, %13[%arg1, %arg1, %arg1] :
+ store %v0, %13[%arg1, %arg1, %arg1] :
memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
- // CHECK: %[[ALLOC2:.*]] = memref.alloc(%[[ARG0]], %[[ARG0]], %[[ARG1]])
- %14 = memref.alloc(%arg0, %arg0, %arg1) : memref<?x?x?xf32>
+ // CHECK: %[[ALLOC2:.*]] = alloc(%[[ARG0]], %[[ARG0]], %[[ARG1]])
+ %14 = alloc(%arg0, %arg0, %arg1) : memref<?x?x?xf32>
// Test: subview shape are folded, even if base memref is not static
// CHECK: subview %[[ALLOC2]][%[[ARG0]], %[[ARG0]], %[[ARG0]]] [7, 11, 2] [%[[ARG1]], %[[ARG1]], %[[ARG1]]] :
// CHECK-SAME: memref<?x?x?xf32> to
@@ -830,7 +830,7 @@ func @subview(%arg0 : index, %arg1 : index) -> (index, index) {
%15 = subview %14[%arg0, %arg0, %arg0] [%c7, %c11, %c2] [%arg1, %arg1, %arg1] :
memref<?x?x?xf32> to
memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
- memref.store %v0, %15[%arg1, %arg1, %arg1] : memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
+ store %v0, %15[%arg1, %arg1, %arg1] : memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
// TEST: subview strides are folded, in the type only the most minor stride is folded.
// CHECK: subview %[[ALLOC2]][%[[ARG0]], %[[ARG0]], %[[ARG0]]] [%[[ARG1]], %[[ARG1]], %[[ARG1]]] [2, 2, 2] :
@@ -839,7 +839,7 @@ func @subview(%arg0 : index, %arg1 : index) -> (index, index) {
%16 = subview %14[%arg0, %arg0, %arg0] [%arg1, %arg1, %arg1] [%c2, %c2, %c2] :
memref<?x?x?xf32> to
memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
- memref.store %v0, %16[%arg0, %arg0, %arg0] : memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
+ store %v0, %16[%arg0, %arg0, %arg0] : memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
// TEST: subview offsets are folded but the type offset remains dynamic, when the base memref is not static
// CHECK: subview %[[ALLOC2]][1, 1, 1] [%[[ARG0]], %[[ARG0]], %[[ARG0]]] [%[[ARG1]], %[[ARG1]], %[[ARG1]]] :
@@ -848,10 +848,10 @@ func @subview(%arg0 : index, %arg1 : index) -> (index, index) {
%17 = subview %14[%c1, %c1, %c1] [%arg0, %arg0, %arg0] [%arg1, %arg1, %arg1] :
memref<?x?x?xf32> to
memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
- memref.store %v0, %17[%arg0, %arg0, %arg0] : memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
+ store %v0, %17[%arg0, %arg0, %arg0] : memref<?x?x?xf32, offset: ?, strides: [?, ?, ?]>
- // CHECK: %[[ALLOC3:.*]] = memref.alloc() : memref<12x4xf32>
- %18 = memref.alloc() : memref<12x4xf32>
+ // CHECK: %[[ALLOC3:.*]] = alloc() : memref<12x4xf32>
+ %18 = alloc() : memref<12x4xf32>
%c4 = constant 4 : index
// TEST: subview strides are maintained when sizes are folded
@@ -861,7 +861,7 @@ func @subview(%arg0 : index, %arg1 : index) -> (index, index) {
%19 = subview %18[%arg1, %arg1] [%c2, %c4] [1, 1] :
memref<12x4xf32> to
memref<?x?xf32, offset: ?, strides:[4, 1]>
- memref.store %v0, %19[%arg1, %arg1] : memref<?x?xf32, offset: ?, strides:[4, 1]>
+ store %v0, %19[%arg1, %arg1] : memref<?x?xf32, offset: ?, strides:[4, 1]>
// TEST: subview strides and sizes are maintained when offsets are folded
// CHECK: subview %[[ALLOC3]][2, 4] [12, 4] [1, 1] :
@@ -870,7 +870,7 @@ func @subview(%arg0 : index, %arg1 : index) -> (index, index) {
%20 = subview %18[%c2, %c4] [12, 4] [1, 1] :
memref<12x4xf32> to
memref<12x4xf32, offset: ?, strides:[4, 1]>
- memref.store %v0, %20[%arg1, %arg1] : memref<12x4xf32, offset: ?, strides:[4, 1]>
+ store %v0, %20[%arg1, %arg1] : memref<12x4xf32, offset: ?, strides:[4, 1]>
// Test: dim on subview is rewritten to size operand.
%7 = dim %4, %c0 : memref<?x?x?xf32, offset : ?, strides : [?, ?, ?]>
@@ -1006,7 +1006,7 @@ func @tensor_ceildivi_signed_by_one(%arg0: tensor<4x5xi32>) -> tensor<4x5xi32> {
// CHECK-LABEL: func @memref_cast_folding_subview
func @memref_cast_folding_subview(%arg0: memref<4x5xf32>, %i: index) -> (memref<?x?xf32, offset:? , strides: [?, ?]>) {
- %0 = memref.cast %arg0 : memref<4x5xf32> to memref<?x?xf32>
+ %0 = memref_cast %arg0 : memref<4x5xf32> to memref<?x?xf32>
// CHECK-NEXT: subview %{{.*}}: memref<4x5xf32>
%1 = subview %0[%i, %i][%i, %i][%i, %i]: memref<?x?xf32> to memref<?x?xf32, offset:? , strides: [?, ?]>
// CHECK-NEXT: return %{{.*}}
@@ -1022,10 +1022,11 @@ func @memref_cast_folding_subview(%arg0: memref<4x5xf32>, %i: index) -> (memref<
func @memref_cast_folding_subview_static(%V: memref<16x16xf32>, %a: index, %b: index)
-> memref<3x4xf32, offset:?, strides:[?, 1]>
{
- %0 = memref.cast %V : memref<16x16xf32> to memref<?x?xf32>
+ %0 = memref_cast %V : memref<16x16xf32> to memref<?x?xf32>
%1 = subview %0[0, 0][3, 4][1, 1] : memref<?x?xf32> to memref<3x4xf32, offset:?, strides:[?, 1]>
// CHECK: subview{{.*}}: memref<16x16xf32> to memref<3x4xf32, #[[$map0]]>
+ // CHECK: memref_cast{{.*}}: memref<3x4xf32, #[[$map0]]> to memref<3x4xf32, #[[$map1]]>
return %1: memref<3x4xf32, offset:?, strides:[?, 1]>
}
@@ -1033,8 +1034,8 @@ func @memref_cast_folding_subview_static(%V: memref<16x16xf32>, %a: index, %b: i
// CHECK-LABEL: func @subtensor
// CHECK-SAME: %[[ARG0:[0-9a-z]*]]: index, %[[ARG1:[0-9a-z]*]]: index
-func @subtensor(%t: tensor<8x16x4xf32>, %arg0 : index, %arg1 : index)
- -> tensor<?x?x?xf32>
+func @subtensor(%t: tensor<8x16x4xf32>, %arg0 : index, %arg1 : index)
+ -> tensor<?x?x?xf32>
{
%c0 = constant 0 : index
%c1 = constant 1 : index
diff --git a/mlir/test/Transforms/constant-fold.mlir b/mlir/test/Transforms/constant-fold.mlir
index be56749372e8..74dea976ab1f 100644
--- a/mlir/test/Transforms/constant-fold.mlir
+++ b/mlir/test/Transforms/constant-fold.mlir
@@ -13,8 +13,8 @@ func @affine_for(%p : memref<f32>) {
%2 = addf %0, %1 : f32
- // CHECK-NEXT: memref.store [[C]], [[ARG]][]
- memref.store %2, %p[] : memref<f32>
+ // CHECK-NEXT: store [[C]], [[ARG]][]
+ store %2, %p[] : memref<f32>
}
}
return
diff --git a/mlir/test/Transforms/copy-removal.mlir b/mlir/test/Transforms/copy-removal.mlir
index ae60fb785b61..1432037f2110 100644
--- a/mlir/test/Transforms/copy-removal.mlir
+++ b/mlir/test/Transforms/copy-removal.mlir
@@ -6,7 +6,7 @@
// CHECK-LABEL: func @nested_region_control_flow_div_nested
func @nested_region_control_flow_div_nested(%arg0: index, %arg1: index) -> memref<?x?xf32> {
%0 = cmpi eq, %arg0, %arg1 : index
- %1 = memref.alloc(%arg0, %arg0) : memref<?x?xf32>
+ %1 = alloc(%arg0, %arg0) : memref<?x?xf32>
// CHECK: %{{.*}} = scf.if
%2 = scf.if %0 -> (memref<?x?xf32>) {
// CHECK: %[[PERCENT3:.*]] = scf.if
@@ -15,24 +15,24 @@ func @nested_region_control_flow_div_nested(%arg0: index, %arg1: index) -> memre
%7 = dim %1, %c0_0 : memref<?x?xf32>
%c1_1 = constant 1 : index
%8 = dim %1, %c1_1 : memref<?x?xf32>
- %9 = memref.alloc(%7, %8) : memref<?x?xf32>
+ %9 = alloc(%7, %8) : memref<?x?xf32>
// CHECK: linalg.copy({{.*}}, %[[PERCENT9:.*]])
linalg.copy(%1, %9) : memref<?x?xf32>, memref<?x?xf32>
// CHECK: scf.yield %[[PERCENT9]]
scf.yield %9 : memref<?x?xf32>
} else {
- // CHECK: %[[PERCENT7:.*]] = memref.alloc
- %7 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
+ // CHECK: %[[PERCENT7:.*]] = alloc
+ %7 = alloc(%arg0, %arg1) : memref<?x?xf32>
%c0_0 = constant 0 : index
%8 = dim %7, %c0_0 : memref<?x?xf32>
%c1_1 = constant 1 : index
%9 = dim %7, %c1_1 : memref<?x?xf32>
- // CHECK-NOT: %{{.*}} = memref.alloc
+ // CHECK-NOT: %{{.*}} = alloc
// CHECK-NOT: linalg.copy(%[[PERCENT7]], %{{.*}})
- // CHECK-NOT: memref.dealloc %[[PERCENT7]]
- %10 = memref.alloc(%8, %9) : memref<?x?xf32>
+ // CHECK-NOT: dealloc %[[PERCENT7]]
+ %10 = alloc(%8, %9) : memref<?x?xf32>
linalg.copy(%7, %10) : memref<?x?xf32>, memref<?x?xf32>
- memref.dealloc %7 : memref<?x?xf32>
+ dealloc %7 : memref<?x?xf32>
// CHECK: scf.yield %[[PERCENT7]]
scf.yield %10 : memref<?x?xf32>
}
@@ -40,31 +40,31 @@ func @nested_region_control_flow_div_nested(%arg0: index, %arg1: index) -> memre
%4 = dim %3, %c0 : memref<?x?xf32>
%c1 = constant 1 : index
%5 = dim %3, %c1 : memref<?x?xf32>
- // CHECK-NOT: %{{.*}} = memref.alloc
+ // CHECK-NOT: %{{.*}} = alloc
// CHECK-NOT: linalg.copy(%[[PERCENT3]], %{{.*}})
- // CHECK-NOT: memref.dealloc %[[PERCENT3]]
- %6 = memref.alloc(%4, %5) : memref<?x?xf32>
+ // CHECK-NOT: dealloc %[[PERCENT3]]
+ %6 = alloc(%4, %5) : memref<?x?xf32>
linalg.copy(%3, %6) : memref<?x?xf32>, memref<?x?xf32>
- memref.dealloc %3 : memref<?x?xf32>
+ dealloc %3 : memref<?x?xf32>
// CHECK: scf.yield %[[PERCENT3]]
scf.yield %6 : memref<?x?xf32>
} else {
- // CHECK: %[[PERCENT3:.*]] = memref.alloc
- %3 = memref.alloc(%arg1, %arg1) : memref<?x?xf32>
+ // CHECK: %[[PERCENT3:.*]] = alloc
+ %3 = alloc(%arg1, %arg1) : memref<?x?xf32>
%c0 = constant 0 : index
%4 = dim %3, %c0 : memref<?x?xf32>
%c1 = constant 1 : index
%5 = dim %3, %c1 : memref<?x?xf32>
- // CHECK-NOT: %{{.*}} = memref.alloc
+ // CHECK-NOT: %{{.*}} = alloc
// CHECK-NOT: linalg.copy(%[[PERCENT3]], %{{.*}})
- // CHECK-NOT: memref.dealloc %[[PERCENT3]]
- %6 = memref.alloc(%4, %5) : memref<?x?xf32>
+ // CHECK-NOT: dealloc %[[PERCENT3]]
+ %6 = alloc(%4, %5) : memref<?x?xf32>
linalg.copy(%3, %6) : memref<?x?xf32>, memref<?x?xf32>
- memref.dealloc %3 : memref<?x?xf32>
+ dealloc %3 : memref<?x?xf32>
// CHECK: scf.yield %[[PERCENT3]]
scf.yield %6 : memref<?x?xf32>
}
- memref.dealloc %1 : memref<?x?xf32>
+ dealloc %1 : memref<?x?xf32>
return %2 : memref<?x?xf32>
}
@@ -72,16 +72,16 @@ func @nested_region_control_flow_div_nested(%arg0: index, %arg1: index) -> memre
// CHECK-LABEL: func @simple_test
func @simple_test() -> memref<5xf32> {
- %temp = memref.alloc() : memref<5xf32>
- %ret = memref.alloc() : memref<5xf32>
+ %temp = alloc() : memref<5xf32>
+ %ret = alloc() : memref<5xf32>
linalg.copy(%ret, %temp) : memref<5xf32>, memref<5xf32>
- memref.dealloc %ret : memref<5xf32>
+ dealloc %ret : memref<5xf32>
return %temp : memref<5xf32>
}
// CHECK-SAME: () -> memref<5xf32>
-// CHECK-NEXT: %[[ret:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ret:.*]] = alloc()
// CHECK-NOT: linalg.copy(%[[ret]], %{{.*}})
-// CHECK-NOT: memref.dealloc %[[ret]]
+// CHECK-NOT: dealloc %[[ret]]
// CHECK: return %[[ret]]
// -----
@@ -92,20 +92,20 @@ func @simple_test() -> memref<5xf32> {
// CHECK-LABEL: func @test_with_ret_usage_before_copy
func @test_with_ret_usage_before_copy() -> memref<5xf32> {
- %ret = memref.alloc() : memref<5xf32>
- %temp = memref.alloc() : memref<5xf32>
+ %ret = alloc() : memref<5xf32>
+ %temp = alloc() : memref<5xf32>
%c0 = constant 0 : index
%dimension = dim %ret, %c0 : memref<5xf32>
linalg.copy(%ret, %temp) : memref<5xf32>, memref<5xf32>
- memref.dealloc %ret : memref<5xf32>
+ dealloc %ret : memref<5xf32>
return %temp : memref<5xf32>
}
-// CHECK-NEXT: %[[ret:.*]] = memref.alloc()
-// CHECK-NOT: %{{.*}} = memref.alloc
+// CHECK-NEXT: %[[ret:.*]] = alloc()
+// CHECK-NOT: %{{.*}} = alloc
// CHECK-NEXT: %{{.*}} = constant
// CHECK-NEXT: %[[DIM:.*]] = dim %[[ret]]
// CHECK-NOT: linalg.copy(%[[ret]], %{{.*}})
-// CHECK-NOT: memref.dealloc %[[ret]]
+// CHECK-NOT: dealloc %[[ret]]
// CHECK: return %[[ret]]
// -----
@@ -115,13 +115,13 @@ func @test_with_ret_usage_before_copy() -> memref<5xf32> {
// CHECK-LABEL: func @test_with_ret_usage_after_copy
func @test_with_ret_usage_after_copy() -> memref<5xf32> {
- %ret = memref.alloc() : memref<5xf32>
- %temp = memref.alloc() : memref<5xf32>
+ %ret = alloc() : memref<5xf32>
+ %temp = alloc() : memref<5xf32>
// CHECK: linalg.copy
linalg.copy(%ret, %temp) : memref<5xf32>, memref<5xf32>
%c0 = constant 0 : index
%dimension = dim %ret, %c0 : memref<5xf32>
- memref.dealloc %ret : memref<5xf32>
+ dealloc %ret : memref<5xf32>
return %temp : memref<5xf32>
}
@@ -132,13 +132,13 @@ func @test_with_ret_usage_after_copy() -> memref<5xf32> {
// CHECK-LABEL: func @test_with_temp_usage_before_copy
func @test_with_temp_usage_before_copy() -> memref<5xf32> {
- %ret = memref.alloc() : memref<5xf32>
- %temp = memref.alloc() : memref<5xf32>
+ %ret = alloc() : memref<5xf32>
+ %temp = alloc() : memref<5xf32>
%c0 = constant 0 : index
%dimension = dim %temp, %c0 : memref<5xf32>
// CHECK: linalg.copy
linalg.copy(%ret, %temp) : memref<5xf32>, memref<5xf32>
- memref.dealloc %ret : memref<5xf32>
+ dealloc %ret : memref<5xf32>
return %temp : memref<5xf32>
}
@@ -149,11 +149,11 @@ func @test_with_temp_usage_before_copy() -> memref<5xf32> {
// removed.
// However the following pattern is not handled by copy removal.
-// %from = memref.alloc()
-// %to = memref.alloc()
+// %from = alloc()
+// %to = alloc()
// copy(%from, %to)
// read_from(%from) + write_to(%something_else)
-// memref.dealloc(%from)
+// dealloc(%from)
// return %to
// In particular, linalg.generic is a memoryEffectOp between copy and dealloc.
// Since no alias analysis is performed and no distinction is made between reads
@@ -163,9 +163,9 @@ func @test_with_temp_usage_before_copy() -> memref<5xf32> {
// CHECK-LABEL: func @test_with_temp_usage_after_copy
func @test_with_temp_usage_after_copy() -> memref<5xf32> {
- %ret = memref.alloc() : memref<5xf32>
- %res = memref.alloc() : memref<5xf32>
- %temp = memref.alloc() : memref<5xf32>
+ %ret = alloc() : memref<5xf32>
+ %res = alloc() : memref<5xf32>
+ %temp = alloc() : memref<5xf32>
linalg.copy(%ret, %temp) : memref<5xf32>, memref<5xf32>
linalg.generic {
indexing_maps = [#map0, #map0],
@@ -176,22 +176,22 @@ func @test_with_temp_usage_after_copy() -> memref<5xf32> {
%tmp1 = math.exp %gen1_arg0 : f32
linalg.yield %tmp1 : f32
}
- memref.dealloc %ret : memref<5xf32>
+ dealloc %ret : memref<5xf32>
return %temp : memref<5xf32>
}
-// CHECK-NEXT: %[[ret:.*]] = memref.alloc()
-// CHECK-NEXT: %[[res:.*]] = memref.alloc()
-// CHECK-NEXT: %[[temp:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ret:.*]] = alloc()
+// CHECK-NEXT: %[[res:.*]] = alloc()
+// CHECK-NEXT: %[[temp:.*]] = alloc()
// CHECK-NEXT: linalg.copy(%[[ret]], %[[temp]])
// CHECK-NEXT: linalg.generic
-// CHECK: memref.dealloc %[[ret]]
+// CHECK: dealloc %[[ret]]
// CHECK: return %[[temp]]
// -----
// CHECK-LABEL: func @make_allocation
func @make_allocation() -> memref<5xf32> {
- %mem = memref.alloc() : memref<5xf32>
+ %mem = alloc() : memref<5xf32>
return %mem : memref<5xf32>
}
@@ -199,12 +199,12 @@ func @make_allocation() -> memref<5xf32> {
func @test_with_function_call() -> memref<5xf32> {
// CHECK-NEXT: %[[ret:.*]] = call @make_allocation() : () -> memref<5xf32>
%ret = call @make_allocation() : () -> (memref<5xf32>)
- // CHECK-NOT: %{{.*}} = memref.alloc
+ // CHECK-NOT: %{{.*}} = alloc
// CHECK-NOT: linalg.copy(%[[ret]], %{{.*}})
- // CHECK-NOT: memref.dealloc %[[ret]]
- %temp = memref.alloc() : memref<5xf32>
+ // CHECK-NOT: dealloc %[[ret]]
+ %temp = alloc() : memref<5xf32>
linalg.copy(%ret, %temp) : memref<5xf32>, memref<5xf32>
- memref.dealloc %ret : memref<5xf32>
+ dealloc %ret : memref<5xf32>
// CHECK: return %[[ret]]
return %temp : memref<5xf32>
}
@@ -213,20 +213,20 @@ func @test_with_function_call() -> memref<5xf32> {
// CHECK-LABEL: func @multiple_deallocs_in_
diff erent_blocks
func @multiple_deallocs_in_
diff erent_blocks(%cond : i1) -> memref<5xf32> {
- // CHECK-NEXT: %[[PERCENT0:.*]] = memref.alloc()
- %0 = memref.alloc() : memref<5xf32>
+ // CHECK-NEXT: %[[PERCENT0:.*]] = alloc()
+ %0 = alloc() : memref<5xf32>
cond_br %cond, ^bb1, ^bb2
^bb1:
- memref.dealloc %0 : memref<5xf32>
+ dealloc %0 : memref<5xf32>
// CHECK: br ^[[BB3:.*]](%[[PERCENT0]]
br ^bb3(%0 : memref<5xf32>)
^bb2:
- // CHECK-NOT: %{{.*}} = memref.alloc
+ // CHECK-NOT: %{{.*}} = alloc
// CHECK-NOT: linalg.copy(%[[PERCENT0]], %{{.*}})
- // CHECK-NOT: memref.dealloc %[[PERCENT0]]
- %temp = memref.alloc() : memref<5xf32>
+ // CHECK-NOT: dealloc %[[PERCENT0]]
+ %temp = alloc() : memref<5xf32>
linalg.copy(%0, %temp) : memref<5xf32>, memref<5xf32>
- memref.dealloc %0 : memref<5xf32>
+ dealloc %0 : memref<5xf32>
// CHECK: br ^[[BB3]](%[[PERCENT0]]
br ^bb3(%temp : memref<5xf32>)
^bb3(%res : memref<5xf32>):
@@ -240,12 +240,12 @@ func @multiple_deallocs_in_
diff erent_blocks(%cond : i1) -> memref<5xf32> {
// CHECK-LABEL: func @test_ReuseCopyTargetAsSource
func @test_ReuseCopyTargetAsSource(%arg0: memref<2xf32>, %result: memref<2xf32>){
// CHECK-SAME: (%[[ARG0:.*]]: memref<2xf32>, %[[RES:.*]]: memref<2xf32>)
- // CHECK-NOT: %{{.*}} = memref.alloc
- %temp = memref.alloc() : memref<2xf32>
+ // CHECK-NOT: %{{.*}} = alloc
+ %temp = alloc() : memref<2xf32>
// CHECK-NEXT: linalg.generic
// CHECK-SAME: ins(%[[ARG0]]{{.*}}outs(%[[RES]]
// CHECK-NOT: linalg.copy(%{{.*}}, %[[RES]])
- // CHECK-NOT: memref.dealloc %{{.*}}
+ // CHECK-NOT: dealloc %{{.*}}
linalg.generic {
indexing_maps = [#map0, #map0],
iterator_types = ["parallel"]}
@@ -256,7 +256,7 @@ func @test_ReuseCopyTargetAsSource(%arg0: memref<2xf32>, %result: memref<2xf32>)
linalg.yield %tmp2 : f32
}
linalg.copy(%temp, %result) : memref<2xf32>, memref<2xf32>
- memref.dealloc %temp : memref<2xf32>
+ dealloc %temp : memref<2xf32>
// CHECK: return
return
}
@@ -270,8 +270,8 @@ func @test_ReuseCopyTargetAsSource(%arg0: memref<2xf32>, %result: memref<2xf32>)
// CHECK-LABEL: func @test_ReuseCopyTargetAsSource
func @test_ReuseCopyTargetAsSource(%arg0: memref<2xf32>){
- %to = memref.alloc() : memref<2xf32>
- %temp = memref.alloc() : memref<2xf32>
+ %to = alloc() : memref<2xf32>
+ %temp = alloc() : memref<2xf32>
linalg.generic {
indexing_maps = [#map0, #map0],
iterator_types = ["parallel"]}
@@ -292,7 +292,7 @@ func @test_ReuseCopyTargetAsSource(%arg0: memref<2xf32>){
}
// CHECK: linalg.copy
linalg.copy(%temp, %to) : memref<2xf32>, memref<2xf32>
- memref.dealloc %temp : memref<2xf32>
+ dealloc %temp : memref<2xf32>
return
}
@@ -302,34 +302,34 @@ func @test_ReuseCopyTargetAsSource(%arg0: memref<2xf32>){
// CHECK-LABEL: func @loop_alloc
func @loop_alloc(%arg0: index, %arg1: index, %arg2: index, %arg3: memref<2xf32>, %arg4: memref<2xf32>) {
- // CHECK: %{{.*}} = memref.alloc()
- %0 = memref.alloc() : memref<2xf32>
- memref.dealloc %0 : memref<2xf32>
- // CHECK: %{{.*}} = memref.alloc()
- %1 = memref.alloc() : memref<2xf32>
+ // CHECK: %{{.*}} = alloc()
+ %0 = alloc() : memref<2xf32>
+ dealloc %0 : memref<2xf32>
+ // CHECK: %{{.*}} = alloc()
+ %1 = alloc() : memref<2xf32>
// CHECK: linalg.copy
linalg.copy(%arg3, %1) : memref<2xf32>, memref<2xf32>
%2 = scf.for %arg5 = %arg0 to %arg1 step %arg2 iter_args(%arg6 = %1) -> (memref<2xf32>) {
%3 = cmpi eq, %arg5, %arg1 : index
- // CHECK: memref.dealloc
- memref.dealloc %arg6 : memref<2xf32>
- // CHECK: %[[PERCENT4:.*]] = memref.alloc()
- %4 = memref.alloc() : memref<2xf32>
- // CHECK-NOT: memref.alloc
+ // CHECK: dealloc
+ dealloc %arg6 : memref<2xf32>
+ // CHECK: %[[PERCENT4:.*]] = alloc()
+ %4 = alloc() : memref<2xf32>
+ // CHECK-NOT: alloc
// CHECK-NOT: linalg.copy
- // CHECK-NOT: memref.dealloc
- %5 = memref.alloc() : memref<2xf32>
+ // CHECK-NOT: dealloc
+ %5 = alloc() : memref<2xf32>
linalg.copy(%4, %5) : memref<2xf32>, memref<2xf32>
- memref.dealloc %4 : memref<2xf32>
- // CHECK: %[[PERCENT6:.*]] = memref.alloc()
- %6 = memref.alloc() : memref<2xf32>
+ dealloc %4 : memref<2xf32>
+ // CHECK: %[[PERCENT6:.*]] = alloc()
+ %6 = alloc() : memref<2xf32>
// CHECK: linalg.copy(%[[PERCENT4]], %[[PERCENT6]])
linalg.copy(%5, %6) : memref<2xf32>, memref<2xf32>
scf.yield %6 : memref<2xf32>
}
// CHECK: linalg.copy
linalg.copy(%2, %arg4) : memref<2xf32>, memref<2xf32>
- memref.dealloc %2 : memref<2xf32>
+ dealloc %2 : memref<2xf32>
return
}
@@ -341,8 +341,8 @@ func @loop_alloc(%arg0: index, %arg1: index, %arg2: index, %arg3: memref<2xf32>,
// CHECK-LABEL: func @check_with_affine_dialect
func @check_with_affine_dialect(%arg0: memref<4xf32>, %arg1: memref<4xf32>, %arg2: memref<4xf32>) {
// CHECK-SAME: (%[[ARG0:.*]]: memref<4xf32>, %[[ARG1:.*]]: memref<4xf32>, %[[RES:.*]]: memref<4xf32>)
- // CHECK-NOT: memref.alloc
- %0 = memref.alloc() : memref<4xf32>
+ // CHECK-NOT: alloc
+ %0 = alloc() : memref<4xf32>
affine.for %arg3 = 0 to 4 {
%5 = affine.load %arg0[%arg3] : memref<4xf32>
%6 = affine.load %arg1[%arg3] : memref<4xf32>
@@ -355,7 +355,7 @@ func @check_with_affine_dialect(%arg0: memref<4xf32>, %arg1: memref<4xf32>, %arg
// CHECK-NOT: linalg.copy
// CHECK-NOT: dealloc
linalg.copy(%0, %arg2) : memref<4xf32>, memref<4xf32>
- memref.dealloc %0 : memref<4xf32>
+ dealloc %0 : memref<4xf32>
//CHECK: return
return
}
diff --git a/mlir/test/Transforms/cse.mlir b/mlir/test/Transforms/cse.mlir
index 455d560d9471..1c9b7650ac97 100644
--- a/mlir/test/Transforms/cse.mlir
+++ b/mlir/test/Transforms/cse.mlir
@@ -96,11 +96,11 @@ func @
diff erent_attributes(index, index) -> (i1, i1, i1) {
/// Check that operations with side effects are not eliminated.
// CHECK-LABEL: @side_effect
func @side_effect() -> (memref<2x1xf32>, memref<2x1xf32>) {
- // CHECK: %0 = memref.alloc() : memref<2x1xf32>
- %0 = memref.alloc() : memref<2x1xf32>
+ // CHECK: %0 = alloc() : memref<2x1xf32>
+ %0 = alloc() : memref<2x1xf32>
- // CHECK-NEXT: %1 = memref.alloc() : memref<2x1xf32>
- %1 = memref.alloc() : memref<2x1xf32>
+ // CHECK-NEXT: %1 = alloc() : memref<2x1xf32>
+ %1 = alloc() : memref<2x1xf32>
// CHECK-NEXT: return %0, %1 : memref<2x1xf32>, memref<2x1xf32>
return %0, %1 : memref<2x1xf32>, memref<2x1xf32>
diff --git a/mlir/test/Transforms/loop-fusion-dependence-check.mlir b/mlir/test/Transforms/loop-fusion-dependence-check.mlir
index 95bb68c268cf..3d8f8017826f 100644
--- a/mlir/test/Transforms/loop-fusion-dependence-check.mlir
+++ b/mlir/test/Transforms/loop-fusion-dependence-check.mlir
@@ -4,9 +4,9 @@
// CHECK-LABEL: func @cannot_fuse_would_create_cycle() {
func @cannot_fuse_would_create_cycle() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
- %c = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
+ %c = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
@@ -37,9 +37,9 @@ func @cannot_fuse_would_create_cycle() {
// CHECK-LABEL: func @can_fuse_rar_dependence() {
func @can_fuse_rar_dependence() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
- %c = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
+ %c = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
@@ -69,10 +69,10 @@ func @can_fuse_rar_dependence() {
// CHECK-LABEL: func @can_fuse_
diff erent_memrefs() {
func @can_fuse_
diff erent_memrefs() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
- %c = memref.alloc() : memref<10xf32>
- %d = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
+ %c = alloc() : memref<10xf32>
+ %d = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
@@ -102,7 +102,7 @@ func @can_fuse_
diff erent_memrefs() {
// CHECK-LABEL: func @should_not_fuse_across_intermediate_store() {
func @should_not_fuse_across_intermediate_store() {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
%c0 = constant 0 : index
%cf7 = constant 7.0 : f32
@@ -127,7 +127,7 @@ func @should_not_fuse_across_intermediate_store() {
// CHECK-LABEL: func @should_not_fuse_across_intermediate_load() {
func @should_not_fuse_across_intermediate_load() {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
%c0 = constant 0 : index
%cf7 = constant 7.0 : f32
@@ -152,8 +152,8 @@ func @should_not_fuse_across_intermediate_load() {
// CHECK-LABEL: func @should_not_fuse_across_ssa_value_def() {
func @should_not_fuse_across_ssa_value_def() {
- %0 = memref.alloc() : memref<10xf32>
- %1 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
+ %1 = alloc() : memref<10xf32>
%c0 = constant 0 : index
%cf7 = constant 7.0 : f32
@@ -182,7 +182,7 @@ func @should_not_fuse_across_ssa_value_def() {
// CHECK-LABEL: func @should_not_fuse_store_before_load() {
func @should_not_fuse_store_before_load() {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
%c0 = constant 0 : index
%cf7 = constant 7.0 : f32
@@ -208,7 +208,7 @@ func @should_not_fuse_store_before_load() {
// CHECK-LABEL: func @should_not_fuse_across_load_at_depth1() {
func @should_not_fuse_across_load_at_depth1() {
- %0 = memref.alloc() : memref<10x10xf32>
+ %0 = alloc() : memref<10x10xf32>
%c0 = constant 0 : index
%cf7 = constant 7.0 : f32
@@ -232,7 +232,7 @@ func @should_not_fuse_across_load_at_depth1() {
// CHECK-LABEL: func @should_not_fuse_across_load_in_loop_at_depth1() {
func @should_not_fuse_across_load_in_loop_at_depth1() {
- %0 = memref.alloc() : memref<10x10xf32>
+ %0 = alloc() : memref<10x10xf32>
%c0 = constant 0 : index
%cf7 = constant 7.0 : f32
@@ -258,7 +258,7 @@ func @should_not_fuse_across_load_in_loop_at_depth1() {
// CHECK-LABEL: func @should_not_fuse_across_store_at_depth1() {
func @should_not_fuse_across_store_at_depth1() {
- %0 = memref.alloc() : memref<10x10xf32>
+ %0 = alloc() : memref<10x10xf32>
%c0 = constant 0 : index
%cf7 = constant 7.0 : f32
@@ -282,7 +282,7 @@ func @should_not_fuse_across_store_at_depth1() {
// CHECK-LABEL: func @should_not_fuse_across_store_in_loop_at_depth1() {
func @should_not_fuse_across_store_in_loop_at_depth1() {
- %0 = memref.alloc() : memref<10x10xf32>
+ %0 = alloc() : memref<10x10xf32>
%c0 = constant 0 : index
%cf7 = constant 7.0 : f32
@@ -308,8 +308,8 @@ func @should_not_fuse_across_store_in_loop_at_depth1() {
// CHECK-LABEL: func @should_not_fuse_across_ssa_value_def_at_depth1() {
func @should_not_fuse_across_ssa_value_def_at_depth1() {
- %0 = memref.alloc() : memref<10x10xf32>
- %1 = memref.alloc() : memref<10x10xf32>
+ %0 = alloc() : memref<10x10xf32>
+ %1 = alloc() : memref<10x10xf32>
%c0 = constant 0 : index
%cf7 = constant 7.0 : f32
diff --git a/mlir/test/Transforms/loop-fusion-slice-computation.mlir b/mlir/test/Transforms/loop-fusion-slice-computation.mlir
index 7a29ebab932d..cc54a09ce0c7 100644
--- a/mlir/test/Transforms/loop-fusion-slice-computation.mlir
+++ b/mlir/test/Transforms/loop-fusion-slice-computation.mlir
@@ -4,7 +4,7 @@
// CHECK-LABEL: func @slice_depth1_loop_nest() {
func @slice_depth1_loop_nest() {
- %0 = memref.alloc() : memref<100xf32>
+ %0 = alloc() : memref<100xf32>
%cst = constant 7.000000e+00 : f32
affine.for %i0 = 0 to 16 {
// expected-remark at -1 {{slice ( src loop: 1, dst loop: 0, depth: 1 : insert point: (1, 1) loop bounds: [(d0) -> (d0), (d0) -> (d0 + 1)] )}}
@@ -24,7 +24,7 @@ func @slice_depth1_loop_nest() {
// same location.
// CHECK-LABEL: func @slice_depth1_loop_nest_with_offsets() {
func @slice_depth1_loop_nest_with_offsets() {
- %0 = memref.alloc() : memref<100xf32>
+ %0 = alloc() : memref<100xf32>
%cst = constant 7.000000e+00 : f32
affine.for %i0 = 0 to 16 {
// expected-remark at -1 {{slice ( src loop: 1, dst loop: 0, depth: 1 : insert point: (1, 2) loop bounds: [(d0) -> (d0 + 3), (d0) -> (d0 + 4)] )}}
@@ -45,7 +45,7 @@ func @slice_depth1_loop_nest_with_offsets() {
// Slices at loop depth 2 should slice loop bounds of both loops.
// CHECK-LABEL: func @slice_depth2_loop_nest() {
func @slice_depth2_loop_nest() {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
%cst = constant 7.000000e+00 : f32
affine.for %i0 = 0 to 16 {
// expected-remark at -1 {{slice ( src loop: 1, dst loop: 0, depth: 1 : insert point: (1, 1) loop bounds: [(d0) -> (d0), (d0) -> (d0 + 1)] [(d0) -> (0), (d0) -> (8)] )}}
@@ -71,7 +71,7 @@ func @slice_depth2_loop_nest() {
// depths 1 and 2 because the dependent store in loop nest %i0 is at depth 2.
// CHECK-LABEL: func @slice_depth2_loop_nest_two_loads() {
func @slice_depth2_loop_nest_two_loads() {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
%c0 = constant 0 : index
%cst = constant 7.000000e+00 : f32
affine.for %i0 = 0 to 16 {
@@ -99,7 +99,7 @@ func @slice_depth2_loop_nest_two_loads() {
// loop nest %i2 is at depth 2.
// CHECK-LABEL: func @slice_depth2_loop_nest_two_stores() {
func @slice_depth2_loop_nest_two_stores() {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
%c0 = constant 0 : index
%cst = constant 7.000000e+00 : f32
affine.for %i0 = 0 to 16 {
@@ -124,7 +124,7 @@ func @slice_depth2_loop_nest_two_stores() {
// Test loop nest which has a smaller outer trip count than its inner scf.
// CHECK-LABEL: func @slice_loop_nest_with_smaller_outer_trip_count() {
func @slice_loop_nest_with_smaller_outer_trip_count() {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
%c0 = constant 0 : index
%cst = constant 7.000000e+00 : f32
affine.for %i0 = 0 to 16 {
diff --git a/mlir/test/Transforms/loop-fusion-transformation.mlir b/mlir/test/Transforms/loop-fusion-transformation.mlir
index c978218b532b..1b335fa1669a 100644
--- a/mlir/test/Transforms/loop-fusion-transformation.mlir
+++ b/mlir/test/Transforms/loop-fusion-transformation.mlir
@@ -2,7 +2,7 @@
// CHECK-LABEL: func @slice_depth1_loop_nest() {
func @slice_depth1_loop_nest() {
- %0 = memref.alloc() : memref<100xf32>
+ %0 = alloc() : memref<100xf32>
%cst = constant 7.000000e+00 : f32
affine.for %i0 = 0 to 16 {
affine.store %cst, %0[%i0] : memref<100xf32>
@@ -24,9 +24,9 @@ func @slice_depth1_loop_nest() {
// CHECK-LABEL: func @should_fuse_reduction_to_pointwise() {
func @should_fuse_reduction_to_pointwise() {
- %a = memref.alloc() : memref<10x10xf32>
- %b = memref.alloc() : memref<10xf32>
- %c = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10x10xf32>
+ %b = alloc() : memref<10xf32>
+ %c = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
@@ -64,9 +64,9 @@ func @should_fuse_reduction_to_pointwise() {
// CHECK-LABEL: func @should_fuse_avoiding_dependence_cycle() {
func @should_fuse_avoiding_dependence_cycle() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
- %c = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
+ %c = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
diff --git a/mlir/test/Transforms/loop-fusion.mlir b/mlir/test/Transforms/loop-fusion.mlir
index daf65a843d24..0c20ea46ad5e 100644
--- a/mlir/test/Transforms/loop-fusion.mlir
+++ b/mlir/test/Transforms/loop-fusion.mlir
@@ -12,7 +12,7 @@
// CHECK-LABEL: func @should_fuse_raw_dep_for_locality() {
func @should_fuse_raw_dep_for_locality() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 10 {
@@ -33,9 +33,9 @@ func @should_fuse_raw_dep_for_locality() {
// CHECK-LABEL: func @should_fuse_reduction_to_pointwise() {
func @should_fuse_reduction_to_pointwise() {
- %a = memref.alloc() : memref<10x10xf32>
- %b = memref.alloc() : memref<10xf32>
- %c = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10x10xf32>
+ %b = alloc() : memref<10xf32>
+ %c = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
@@ -76,7 +76,7 @@ func @should_fuse_reduction_to_pointwise() {
// CHECK-LABEL: func @should_fuse_loop_nests_with_shifts() {
func @should_fuse_loop_nests_with_shifts() {
- %a = memref.alloc() : memref<10x10xf32>
+ %a = alloc() : memref<10x10xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 9 {
@@ -116,8 +116,8 @@ func @should_fuse_loop_nests_with_shifts() {
// CHECK-LABEL: func @should_fuse_loop_nest() {
func @should_fuse_loop_nest() {
- %a = memref.alloc() : memref<10x10xf32>
- %b = memref.alloc() : memref<10x10xf32>
+ %a = alloc() : memref<10x10xf32>
+ %b = alloc() : memref<10x10xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 10 {
@@ -137,8 +137,8 @@ func @should_fuse_loop_nest() {
}
}
// Expecting private memref for '%a' first, then private memref for '%b'.
- // CHECK-DAG: [[NEWA:%[0-9]+]] = memref.alloc() : memref<1x1xf32>
- // CHECK-DAG: [[NEWB:%[0-9]+]] = memref.alloc() : memref<1x1xf32>
+ // CHECK-DAG: [[NEWA:%[0-9]+]] = alloc() : memref<1x1xf32>
+ // CHECK-DAG: [[NEWB:%[0-9]+]] = alloc() : memref<1x1xf32>
// CHECK: affine.for %{{.*}} = 0 to 10 {
// CHECK-NEXT: affine.for %{{.*}} = 0 to 10 {
// CHECK-NEXT: affine.store %{{.*}}, [[NEWA]][0, 0] : memref<1x1xf32>
@@ -155,9 +155,9 @@ func @should_fuse_loop_nest() {
// CHECK-LABEL: func @should_fuse_across_intermediate_loop_with_no_deps() {
func @should_fuse_across_intermediate_loop_with_no_deps() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
- %c = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
+ %c = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
@@ -190,8 +190,8 @@ func @should_fuse_across_intermediate_loop_with_no_deps() {
// CHECK-LABEL: func @should_fuse_all_loops() {
func @should_fuse_all_loops() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
// Set up flow dependences from first and second loops to third.
@@ -208,8 +208,8 @@ func @should_fuse_all_loops() {
// Should fuse first and second loops into third.
// Expecting private memref for '%a' first, then private memref for '%b'.
- // CHECK-DAG: [[NEWA:%[0-9]+]] = memref.alloc() : memref<1xf32>
- // CHECK-DAG: [[NEWB:%[0-9]+]] = memref.alloc() : memref<1xf32>
+ // CHECK-DAG: [[NEWA:%[0-9]+]] = alloc() : memref<1xf32>
+ // CHECK-DAG: [[NEWB:%[0-9]+]] = alloc() : memref<1xf32>
// CHECK: affine.for %{{.*}} = 0 to 10 {
// CHECK-NEXT: affine.store %{{.*}}, [[NEWA]][0] : memref<1xf32>
// CHECK-NEXT: affine.store %{{.*}}, [[NEWB]][0] : memref<1xf32>
@@ -224,9 +224,9 @@ func @should_fuse_all_loops() {
// CHECK-LABEL: func @should_fuse_first_and_second_loops() {
func @should_fuse_first_and_second_loops() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
- %c = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
+ %c = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
@@ -260,9 +260,9 @@ func @should_fuse_first_and_second_loops() {
// CHECK-LABEL: func @should_not_fuse_would_create_cycle() {
func @should_not_fuse_would_create_cycle() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
- %c = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
+ %c = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
@@ -303,7 +303,7 @@ func @should_not_fuse_would_create_cycle() {
// CHECK-LABEL: func @should_fuse_producer_consumer() {
func @should_fuse_producer_consumer() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 10 {
@@ -319,7 +319,7 @@ func @should_fuse_producer_consumer() {
// %i1, but OK to fuse %i1 into %i2.
// TODO: When the fusion pass is run to a fixed-point, it should
// fuse all three of these loop nests.
- // CHECK: memref.alloc() : memref<1xf32>
+ // CHECK: alloc() : memref<1xf32>
// CHECK: affine.for %{{.*}} = 0 to 10 {
// CHECK-NEXT: affine.store %{{.*}}, %{{.*}}[0] : memref<1xf32>
// CHECK-NEXT: affine.store %{{.*}}, %{{.*}}[0] : memref<1xf32>
@@ -333,8 +333,8 @@ func @should_fuse_producer_consumer() {
// CHECK-LABEL: func @should_fuse_and_move_to_preserve_war_dep() {
func @should_fuse_and_move_to_preserve_war_dep() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 10 {
@@ -366,7 +366,7 @@ func @should_fuse_and_move_to_preserve_war_dep() {
// CHECK-LABEL: func @should_fuse_if_top_level_access() {
func @should_fuse_if_top_level_access() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 10 {
@@ -380,7 +380,7 @@ func @should_fuse_if_top_level_access() {
%v1 = affine.load %m[%c0] : memref<10xf32>
// Top-level load to '%m' should prevent creating a private memref but
// loop nests should be fused and '%i0' should be removed.
- // CHECK: %[[m:.*]] = memref.alloc() : memref<10xf32>
+ // CHECK: %[[m:.*]] = alloc() : memref<10xf32>
// CHECK-NOT: alloc
// CHECK: affine.for %[[i1:.*]] = 0 to 10 {
@@ -395,7 +395,7 @@ func @should_fuse_if_top_level_access() {
// CHECK-LABEL: func @should_fuse_but_not_remove_src() {
func @should_fuse_but_not_remove_src() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 100 {
@@ -424,7 +424,7 @@ func @should_fuse_but_not_remove_src() {
// CHECK-LABEL: func @should_fuse_no_top_level_access() {
func @should_fuse_no_top_level_access() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 10 {
@@ -447,7 +447,7 @@ func @should_fuse_no_top_level_access() {
// CHECK-LABEL: func @should_not_fuse_if_inst_at_top_level() {
func @should_not_fuse_if_inst_at_top_level() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 10 {
@@ -475,7 +475,7 @@ func @should_not_fuse_if_inst_at_top_level() {
// CHECK-LABEL: func @should_not_fuse_if_inst_in_loop_nest() {
func @should_not_fuse_if_inst_in_loop_nest() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
%c4 = constant 4 : index
@@ -504,7 +504,7 @@ func @should_not_fuse_if_inst_in_loop_nest() {
// CHECK-LABEL: func @permute_and_fuse() {
func @permute_and_fuse() {
- %m = memref.alloc() : memref<10x20x30xf32>
+ %m = alloc() : memref<10x20x30xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 10 {
@@ -545,7 +545,7 @@ func @permute_and_fuse() {
// Reshape from a 64 x f32 to 16 x 4 x f32.
// CHECK-LABEL: func @fuse_reshape_64_16_4
func @fuse_reshape_64_16_4(%in : memref<64xf32>) {
- %out = memref.alloc() : memref<16x4xf32>
+ %out = alloc() : memref<16x4xf32>
affine.for %i0 = 0 to 64 {
%v = affine.load %in[%i0] : memref<64xf32>
@@ -575,8 +575,8 @@ func @fuse_reshape_64_16_4(%in : memref<64xf32>) {
// Reshape a 16x4xf32 to 64xf32.
// CHECK-LABEL: func @fuse_reshape_16_4_64
func @fuse_reshape_16_4_64() {
- %in = memref.alloc() : memref<16x4xf32>
- %out = memref.alloc() : memref<64xf32>
+ %in = alloc() : memref<16x4xf32>
+ %out = alloc() : memref<64xf32>
affine.for %i0 = 0 to 16 {
affine.for %i1 = 0 to 4 {
@@ -608,9 +608,9 @@ func @fuse_reshape_16_4_64() {
// All three loop nests below (6-d one, 2-d one, 2-d one is fused into a single
// 2-d loop nest).
func @R6_to_R2_reshape_square() -> memref<64x9xi32> {
- %in = memref.alloc() : memref<2x2x3x3x16x1xi32>
- %out = memref.alloc() : memref<64x9xi32>
- %live_out = memref.alloc() : memref<64x9xi32>
+ %in = alloc() : memref<2x2x3x3x16x1xi32>
+ %out = alloc() : memref<64x9xi32>
+ %live_out = alloc() : memref<64x9xi32>
// Initialize input.
affine.for %i0 = 0 to 2 {
@@ -670,9 +670,9 @@ func @R6_to_R2_reshape_square() -> memref<64x9xi32> {
//
// CHECK-LABEL: func @R6_to_R2_reshape
-// CHECK: memref.alloc() : memref<1x2x3x3x16x1xi32>
-// CHECK: memref.alloc() : memref<1x1xi32>
-// CHECK: memref.alloc() : memref<64x9xi32>
+// CHECK: alloc() : memref<1x2x3x3x16x1xi32>
+// CHECK: alloc() : memref<1x1xi32>
+// CHECK: alloc() : memref<64x9xi32>
// CHECK-NEXT: affine.for %{{.*}} = 0 to 64 {
// CHECK-NEXT: affine.for %{{.*}} = 0 to 9 {
// CHECK-NEXT: affine.apply [[$MAP0]](%{{.*}}, %{{.*}})
@@ -703,7 +703,7 @@ func @R6_to_R2_reshape_square() -> memref<64x9xi32> {
// CHECK-LABEL: func @fuse_symbolic_bounds
func @fuse_symbolic_bounds(%M : index, %N : index) {
%N_plus_5 = affine.apply affine_map<(d0) -> (d0 + 5)>(%N)
- %m = memref.alloc(%M, %N_plus_5) : memref<? x ? x f32>
+ %m = alloc(%M, %N_plus_5) : memref<? x ? x f32>
%c0 = constant 0.0 : f32
%s = constant 5 : index
@@ -727,8 +727,8 @@ func @fuse_symbolic_bounds(%M : index, %N : index) {
// CHECK-LABEL: func @should_fuse_reduction_at_depth_of_one
func @should_fuse_reduction_at_depth_of_one() {
- %a = memref.alloc() : memref<10x100xf32>
- %b = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10x100xf32>
+ %b = alloc() : memref<10xf32>
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 100 {
@@ -772,8 +772,8 @@ func @should_fuse_reduction_at_depth_of_one() {
// CHECK-LABEL: func @should_fuse_at_src_depth1_and_dst_depth1
func @should_fuse_at_src_depth1_and_dst_depth1() {
- %a = memref.alloc() : memref<100x16xf32>
- %b = memref.alloc() : memref<100x16xf32>
+ %a = alloc() : memref<100x16xf32>
+ %b = alloc() : memref<100x16xf32>
affine.for %i0 = 0 to 100 {
affine.for %i1 = 0 to 16 {
@@ -820,7 +820,7 @@ func @should_fuse_at_src_depth1_and_dst_depth1() {
// CHECK-LABEL: func @should_fuse_src_depth1_at_dst_depth2
func @should_fuse_src_depth1_at_dst_depth2() {
- %a = memref.alloc() : memref<100xf32>
+ %a = alloc() : memref<100xf32>
%c0 = constant 0.0 : f32
affine.for %i0 = 0 to 100 {
@@ -851,7 +851,7 @@ func @should_fuse_src_depth1_at_dst_depth2() {
// CHECK-LABEL: func @fusion_at_depth0_not_currently_supported
func @fusion_at_depth0_not_currently_supported() {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
%c0 = constant 0 : index
%cst = constant 0.000000e+00 : f32
affine.for %i0 = 0 to 10 {
@@ -862,7 +862,7 @@ func @fusion_at_depth0_not_currently_supported() {
}
// NOTE: Should shrink memref size to 1 element access by load in dst loop
// nest, and make the store in the slice store to the same element.
- // CHECK-DAG: memref.alloc() : memref<1xf32>
+ // CHECK-DAG: alloc() : memref<1xf32>
// CHECK: affine.for %{{.*}} = 0 to 10 {
// CHECK-NEXT: affine.store %{{.*}}, %{{.*}}[0] : memref<1xf32>
// CHECK-NEXT: affine.load %{{.*}}[0] : memref<1xf32>
@@ -875,9 +875,9 @@ func @fusion_at_depth0_not_currently_supported() {
// CHECK-LABEL: func @should_fuse_deep_loop_nests
func @should_fuse_deep_loop_nests() {
- %0 = memref.alloc() : memref<2x2x3x3x16x10xf32, 2>
- %1 = memref.alloc() : memref<2x2x3x3x16x10xf32, 2>
- %2 = memref.alloc() : memref<3x3x3x3x16x10xf32, 2>
+ %0 = alloc() : memref<2x2x3x3x16x10xf32, 2>
+ %1 = alloc() : memref<2x2x3x3x16x10xf32, 2>
+ %2 = alloc() : memref<3x3x3x3x16x10xf32, 2>
%c0 = constant 0 : index
%c1 = constant 1 : index
%c1_0 = constant 1 : index
@@ -934,7 +934,7 @@ func @should_fuse_deep_loop_nests() {
// bounds which are a function of the first four loops of destination loop nest,
// where the destination loops nests have been interchanged.
-// CHECK-DAG: memref.alloc() : memref<1x1x1x1x16x10xf32, 2>
+// CHECK-DAG: alloc() : memref<1x1x1x1x16x10xf32, 2>
// CHECK: affine.for %{{.*}} = 0 to 3 {
// CHECK-NEXT: affine.for %{{.*}} = 0 to 3 {
// CHECK-NEXT: affine.for %{{.*}} = 0 to 2 {
@@ -979,8 +979,8 @@ func @should_fuse_deep_loop_nests() {
// CHECK-LABEL: func @should_fuse_at_depth1_and_reduce_slice_trip_count
func @should_fuse_at_depth1_and_reduce_slice_trip_count() {
- %a = memref.alloc() : memref<4x256xf32>
- %b = memref.alloc() : memref<4x256xf32>
+ %a = alloc() : memref<4x256xf32>
+ %b = alloc() : memref<4x256xf32>
%c0 = constant 0 : index
%cf0 = constant 0.0 : f32
@@ -1008,7 +1008,7 @@ func @should_fuse_at_depth1_and_reduce_slice_trip_count() {
// NOTE: the size of the private memref created for the fused loop nest
// is reduced from the original shape from 4x256 to 4x16 because of the
// data accessed by the load.
- // CHECK-DAG: memref.alloc() : memref<1x16xf32>
+ // CHECK-DAG: alloc() : memref<1x16xf32>
// CHECK: affine.for %{{.*}} = 0 to 4 {
// CHECK-NEXT: affine.for %{{.*}} = 0 to 256 {
// CHECK-NEXT: affine.load %{{.*}}[%{{.*}}, %{{.*}}] : memref<4x256xf32>
@@ -1028,7 +1028,7 @@ func @should_fuse_at_depth1_and_reduce_slice_trip_count() {
// CHECK-LABEL: func @should_fuse_at_depth1_with_trip_count_20
func @should_fuse_at_depth1_with_trip_count_20() {
- %a = memref.alloc() : memref<100xf32>
+ %a = alloc() : memref<100xf32>
%c0 = constant 0 : index
%cf0 = constant 0.0 : f32
@@ -1047,7 +1047,7 @@ func @should_fuse_at_depth1_with_trip_count_20() {
}
}
// NOTE: The size of the private memref created for fusion is shrunk to 20xf32
- // CHECK-DAG: memref.alloc() : memref<20xf32>
+ // CHECK-DAG: alloc() : memref<20xf32>
// CHECK: affine.for %{{.*}} = 0 to 5 {
// CHECK-NEXT: affine.for %{{.*}} = 0 to 20 {
// CHECK-NEXT: affine.store %{{.*}}, %{{.*}}[%{{.*}}] : memref<20xf32>
@@ -1069,7 +1069,7 @@ func @should_fuse_at_depth1_with_trip_count_20() {
// CHECK-LABEL: func @should_fuse_at_depth1_with_trip_count_19
func @should_fuse_at_depth1_with_trip_count_19() {
- %a = memref.alloc() : memref<100xf32>
+ %a = alloc() : memref<100xf32>
%c0 = constant 0 : index
%cf0 = constant 0.0 : f32
@@ -1088,7 +1088,7 @@ func @should_fuse_at_depth1_with_trip_count_19() {
}
}
// NOTE: The size of the private memref created for fusion is shrunk to 19xf32
- // CHECK-DAG: memref.alloc() : memref<19xf32>
+ // CHECK-DAG: alloc() : memref<19xf32>
// CHECK: affine.for %{{.*}} = 0 to 5 {
// CHECK-NEXT: affine.for %{{.*}} = 0 to 19 {
// CHECK-NEXT: affine.store %{{.*}}, %{{.*}}[%{{.*}}] : memref<19xf32>
@@ -1111,7 +1111,7 @@ func @should_fuse_at_depth1_with_trip_count_19() {
// CHECK-LABEL: func @should_fuse_with_private_memrefs_with_
diff _shapes() {
func @should_fuse_with_private_memrefs_with_
diff _shapes() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 100 {
@@ -1125,8 +1125,8 @@ func @should_fuse_with_private_memrefs_with_
diff _shapes() {
}
// Should create two new private memrefs customized to the shapes accessed
// by loops %{{.*}} and %{{.*}}.
- // CHECK-DAG: memref.alloc() : memref<1xf32>
- // CHECK-DAG: memref.alloc() : memref<1xf32>
+ // CHECK-DAG: alloc() : memref<1xf32>
+ // CHECK-DAG: alloc() : memref<1xf32>
// CHECK: affine.for %{{.*}} = 0 to 17 {
// CHECK-NEXT: affine.store %{{.*}}, %{{.*}}[0] : memref<1xf32>
// CHECK-NEXT: affine.load %{{.*}}[0] : memref<1xf32>
@@ -1195,7 +1195,7 @@ func @should_fuse_live_out_arg(%arg0: memref<10xf32>) {
// CHECK-LABEL: func @should_fuse_escaping_memref_but_preserve_src_loop() -> memref<10xf32>
func @should_fuse_escaping_memref_but_preserve_src_loop() -> memref<10xf32> {
%cf7 = constant 7.0 : f32
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
affine.for %i0 = 0 to 10 {
affine.store %cf7, %m[%i0] : memref<10xf32>
}
@@ -1206,7 +1206,7 @@ func @should_fuse_escaping_memref_but_preserve_src_loop() -> memref<10xf32> {
// because it writes to memref '%m', which is returned by the function, and
// the '%i1' memory region does not cover '%i0' memory region.
- // CHECK-DAG: memref.alloc() : memref<10xf32>
+ // CHECK-DAG: alloc() : memref<10xf32>
// CHECK: affine.for %{{.*}} = 0 to 10 {
// CHECK-NEXT: affine.store %{{.*}}, %{{.*}}[%{{.*}}] : memref<10xf32>
// CHECK-NEXT: }
@@ -1221,7 +1221,7 @@ func @should_fuse_escaping_memref_but_preserve_src_loop() -> memref<10xf32> {
// This should fuse with the %in becoming a 1x1x1.
func @R3_to_R2_reshape() {
- %in = memref.alloc() : memref<2x3x16xi32>
+ %in = alloc() : memref<2x3x16xi32>
%c0 = constant 0 : index
@@ -1249,7 +1249,7 @@ func @R3_to_R2_reshape() {
// CHECK-DAG: [[$MAP2:#map[0-9]+]] = affine_map<(d0) -> (d0 floordiv 48)>
// CHECK-LABEL: func @R3_to_R2_reshape()
-// CHECK-DAG: memref.alloc() : memref<1x1x1xi32>
+// CHECK-DAG: alloc() : memref<1x1x1xi32>
// CHECK: affine.for %{{.*}} = 0 to 32 {
// CHECK-NEXT: affine.for %{{.*}} = 0 to 3 {
// CHECK-NEXT: affine.apply [[$MAP0]](%{{.*}}, %{{.*}})
@@ -1265,8 +1265,8 @@ func @R3_to_R2_reshape() {
// -----
func @should_fuse_multi_output_producer() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
@@ -1293,9 +1293,9 @@ func @should_fuse_multi_output_producer() {
// CHECK-LABEL: func @fusion_preventing_deps_on_middle_loop() {
func @fusion_preventing_deps_on_middle_loop() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
- %c = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
+ %c = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
@@ -1334,9 +1334,9 @@ func @fusion_preventing_deps_on_middle_loop() {
// CHECK-LABEL: func @should_fuse_and_move_to_preserve_war_dep() {
func @should_fuse_and_move_to_preserve_war_dep() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
- %c = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
+ %c = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
@@ -1368,7 +1368,7 @@ func @should_fuse_and_move_to_preserve_war_dep() {
// It is possible to fuse loop '%i0' into '%i3' and preserve dependences
// if the fused loop nest is inserted between loops '%i1' and '%i2'.
- // CHECK-DAG: memref.alloc() : memref<1xf32>
+ // CHECK-DAG: alloc() : memref<1xf32>
// CHECK: affine.for %{{.*}} = 0 to 3 {
// CHECK-NEXT: affine.load %{{.*}}[%{{.*}}] : memref<10xf32>
// CHECK-NEXT: }
@@ -1389,9 +1389,9 @@ func @should_fuse_and_move_to_preserve_war_dep() {
// CHECK-LABEL: func @fusion_preventing_dep_on_constant() {
func @fusion_preventing_dep_on_constant() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
- %c = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
+ %c = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
@@ -1430,9 +1430,9 @@ func @fusion_preventing_dep_on_constant() {
// CHECK-LABEL: func @should_fuse_and_preserve_dep_on_constant() {
func @should_fuse_and_preserve_dep_on_constant() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
- %c = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
+ %c = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
%cf11 = constant 11.0 : f32
@@ -1470,7 +1470,7 @@ func @should_fuse_and_preserve_dep_on_constant() {
// CHECK-LABEL: func @should_fuse_at_depth_above_loop_carried_dependence(%{{.*}}: memref<64x4xf32>, %{{.*}}: memref<64x4xf32>) {
func @should_fuse_at_depth_above_loop_carried_dependence(%arg0: memref<64x4xf32>, %arg1: memref<64x4xf32>) {
- %out = memref.alloc() : memref<64x4xf32>
+ %out = alloc() : memref<64x4xf32>
%0 = constant 0.0 : f32
affine.for %i0 = 0 to 64 {
affine.for %i1 = 0 to 4 {
@@ -1506,7 +1506,7 @@ func @should_fuse_at_depth_above_loop_carried_dependence(%arg0: memref<64x4xf32>
// loop nest iteration bounds on its loop '%i1' are reduced to 1, so the
// memref size can be reduced to 128x1xf32.
- // CHECK: memref.alloc() : memref<64x1xf32>
+ // CHECK: alloc() : memref<64x1xf32>
// CHECK: affine.for %{{.*}} = 0 to 4 {
// CHECK-NEXT: affine.for %{{.*}} = 0 to 64 {
// CHECK-NEXT: affine.store %{{.*}}, %{{.*}}[%{{.*}}, 0] : memref<64x1xf32>
@@ -1538,8 +1538,8 @@ func @should_fuse_at_depth_above_loop_carried_dependence(%arg0: memref<64x4xf32>
// CHECK-LABEL: func @should_fuse_only_two_loops_and_remove_producer() {
func @should_fuse_only_two_loops_and_remove_producer() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
@@ -1582,7 +1582,7 @@ func @should_fuse_only_two_loops_and_remove_producer() {
// CHECK-LABEL: func @should_fuse_after_one_loop_interchange() {
func @should_fuse_after_one_loop_interchange() {
- %a = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
%cf0 = constant 0.0 : f32
affine.for %i0 = 0 to 10 {
@@ -1617,7 +1617,7 @@ func @should_fuse_after_one_loop_interchange() {
// CHECK-LABEL: func @should_fuse_after_two_loop_interchanges() {
func @should_fuse_after_two_loop_interchanges() {
- %a = memref.alloc() : memref<6x8xf32>
+ %a = alloc() : memref<6x8xf32>
%cf0 = constant 0.0 : f32
affine.for %i0 = 0 to 6 {
@@ -1739,8 +1739,8 @@ func @slice_tile(%arg0: memref<128x8xf32>, %arg1: memref<32x8xf32>, %0 : f32) ->
// Test case which illustrates fix for b/126454413
func @test_add_slice_bounds() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
%c0 = constant 0 : index
@@ -1785,7 +1785,7 @@ func @test_add_slice_bounds() {
// -----
func @should_fuse_init_loops_siblings_then_shared_producer(%arg0: memref<10x10xf32>, %arg1: memref<10x10xf32>) {
- %0 = memref.alloc() : memref<10x10xf32>
+ %0 = alloc() : memref<10x10xf32>
%cst = constant 0.000000e+00 : f32
%cst_0 = constant 1.000000e+00 : f32
%cst_1 = constant 7.000000e+00 : f32
@@ -1852,11 +1852,11 @@ func @should_fuse_init_loops_siblings_then_shared_producer(%arg0: memref<10x10xf
// -----
func @two_matrix_vector_products() {
- %in_matrix = memref.alloc() : memref<10x10xf32>
- %in_vec0 = memref.alloc() : memref<10xf32>
- %in_vec1 = memref.alloc() : memref<10xf32>
- %out_vec0 = memref.alloc() : memref<10xf32>
- %out_vec1 = memref.alloc() : memref<10xf32>
+ %in_matrix = alloc() : memref<10x10xf32>
+ %in_vec0 = alloc() : memref<10xf32>
+ %in_vec1 = alloc() : memref<10xf32>
+ %out_vec0 = alloc() : memref<10xf32>
+ %out_vec1 = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
// Populate input matrix.
@@ -1916,7 +1916,7 @@ func @two_matrix_vector_products() {
// -----
func @should_not_slice_past_slice_barrier() {
- %0 = memref.alloc() : memref<100x16xf32>
+ %0 = alloc() : memref<100x16xf32>
affine.for %i0 = 0 to 100 {
affine.for %i1 = 0 to 16 {
%1 = "op1"() : () -> f32
@@ -1948,7 +1948,7 @@ func @should_not_slice_past_slice_barrier() {
#map0 = affine_map<(d0, d1) -> (d0 * 16 + d1)>
func @fuse_across_dim_mismatch(%arg0: memref<4x4x16x1xf32>, %arg1: memref<144x9xf32>, %arg2: memref<9xf32>) {
- %1 = memref.alloc() : memref<144x4xf32>
+ %1 = alloc() : memref<144x4xf32>
%2 = constant 0.0 : f32
affine.for %i2 = 0 to 9 {
affine.for %i3 = 0 to 4 {
@@ -1972,7 +1972,7 @@ func @fuse_across_dim_mismatch(%arg0: memref<4x4x16x1xf32>, %arg1: memref<144x9x
}
// MAXIMAL: #map = affine_map<(d0, d1) -> (d0 * 16 + d1)>
// MAXIMAL-LABEL: func @fuse_across_dim_mismatch
-// MAXIMAL: memref.alloc() : memref<1x1xf32>
+// MAXIMAL: alloc() : memref<1x1xf32>
// MAXIMAL: affine.for %{{.*}} = 0 to 9 {
// MAXIMAL-NEXT: affine.for %{{.*}} = 0 to 9 {
// MAXIMAL-NEXT: affine.for %{{.*}} = 0 to 4 {
@@ -1998,9 +1998,9 @@ func @fuse_across_dim_mismatch(%arg0: memref<4x4x16x1xf32>, %arg1: memref<144x9x
#map12 = affine_map<(d0, d1) -> (d0 * 16 - d1 + 15)>
func @fuse_across_varying_dims_complex(%arg0: f32) {
%c0 = constant 0 : index
- %0 = memref.alloc() : memref<2x2x3x3x16x1xf32>
- %1 = memref.alloc() : memref<64x9xf32>
- %2 = memref.alloc() : memref<144x4xf32>
+ %0 = alloc() : memref<2x2x3x3x16x1xf32>
+ %1 = alloc() : memref<64x9xf32>
+ %2 = alloc() : memref<144x4xf32>
affine.for %i0 = 0 to 64 {
affine.for %i1 = 0 to 9 {
%4 = affine.apply #map3(%i0, %i1)
@@ -2044,10 +2044,10 @@ func @fuse_across_varying_dims_complex(%arg0: f32) {
// MAXIMAL-DAG: [[$MAP7:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 * 16 + d1)>
// MAXIMAL-DAG: [[$MAP8:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 * 16 - d1 + 15)>
// MAXIMAL-LABEL: func @fuse_across_varying_dims_complex
-// MAXIMAL-NEXT: memref.alloc() : memref<64x1xf32>
+// MAXIMAL-NEXT: alloc() : memref<64x1xf32>
// MAXIMAL-NEXT: constant 0 : index
-// MAXIMAL-NEXT: memref.alloc() : memref<2x2x3x3x16x1xf32>
-// MAXIMAL-NEXT: memref.alloc() : memref<144x4xf32>
+// MAXIMAL-NEXT: alloc() : memref<2x2x3x3x16x1xf32>
+// MAXIMAL-NEXT: alloc() : memref<144x4xf32>
// MAXIMAL-NEXT: affine.for %{{.*}} = 0 to 9 {
// MAXIMAL-NEXT: affine.for %{{.*}} = 0 to 9 {
// MAXIMAL-NEXT: affine.for %{{.*}} = 0 to 4 {
@@ -2081,7 +2081,7 @@ func @fuse_across_varying_dims_complex(%arg0: f32) {
// -----
func @should_fuse_with_slice_union() {
- %a = memref.alloc() : memref<100xf32>
+ %a = alloc() : memref<100xf32>
%c0 = constant 0 : index
%cf0 = constant 0.0 : f32
@@ -2284,8 +2284,8 @@ func @affine_2_dependent_mm_fused(%arg0: memref<1024x1024xf32>, %arg1: memref<10
// CHECK-LABEL: func @should_fuse_self_dependence_multi_store_producer() {
func @should_fuse_self_dependence_multi_store_producer() {
- %m = memref.alloc() : memref<10xf32>
- %local_m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
+ %local_m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 10 {
@@ -2310,8 +2310,8 @@ func @should_fuse_self_dependence_multi_store_producer() {
// CHECK-LABEL: func @should_fuse_dead_multi_store_producer() {
func @should_fuse_dead_multi_store_producer() {
- %m = memref.alloc() : memref<10xf32>
- %dead_m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
+ %dead_m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 10 {
@@ -2334,7 +2334,7 @@ func @should_fuse_dead_multi_store_producer() {
// CHECK-LABEL: func @should_fuse_function_live_out_multi_store_producer
func @should_fuse_function_live_out_multi_store_producer(%live_in_out_m : memref<10xf32>) {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 10 {
@@ -2359,7 +2359,7 @@ func @should_fuse_function_live_out_multi_store_producer(%live_in_out_m : memref
// CHECK-LABEL: func @mul_add_0
func @mul_add_0(%arg0: memref<3x4xf32>, %arg1: memref<4x3xf32>, %arg2: memref<3x3xf32>, %arg3: memref<3x3xf32>) {
%cst = constant 0.000000e+00 : f32
- %0 = memref.alloc() : memref<3x3xf32>
+ %0 = alloc() : memref<3x3xf32>
affine.for %arg4 = 0 to 3 {
affine.for %arg5 = 0 to 3 {
affine.store %cst, %0[%arg4, %arg5] : memref<3x3xf32>
@@ -2468,7 +2468,7 @@ func @should_fuse_producer_with_multi_outgoing_edges(%a : memref<1xf32>, %b : me
// MAXIMAL-LABEL: func @reshape_into_matmul
func @reshape_into_matmul(%lhs : memref<1024x1024xf32>,
%R: memref<16x64x1024xf32>, %out: memref<1024x1024xf32>) {
- %rhs = memref.alloc() : memref<1024x1024xf32>
+ %rhs = alloc() : memref<1024x1024xf32>
// Reshape from 3-d to 2-d.
affine.for %i0 = 0 to 16 {
@@ -2495,7 +2495,7 @@ func @reshape_into_matmul(%lhs : memref<1024x1024xf32>,
}
return
}
-// MAXIMAL-NEXT: memref.alloc
+// MAXIMAL-NEXT: alloc
// MAXIMAL-NEXT: affine.for
// MAXIMAL-NEXT: affine.for
// MAXIMAL-NEXT: affine.for
@@ -2580,7 +2580,7 @@ func @multi_outgoing_edges(%in0 : memref<32xf32>,
// CHECK-LABEL: func @calc
func @calc(%arg0: memref<?xf32>, %arg1: memref<?xf32>, %arg2: memref<?xf32>, %len: index) {
%c1 = constant 1 : index
- %1 = memref.alloc(%len) : memref<?xf32>
+ %1 = alloc(%len) : memref<?xf32>
affine.for %arg4 = 1 to 10 {
%7 = affine.load %arg0[%arg4] : memref<?xf32>
%8 = affine.load %arg1[%arg4] : memref<?xf32>
@@ -2595,7 +2595,7 @@ func @calc(%arg0: memref<?xf32>, %arg1: memref<?xf32>, %arg2: memref<?xf32>, %le
}
return
}
-// CHECK: memref.alloc() : memref<1xf32>
+// CHECK: alloc() : memref<1xf32>
// CHECK: affine.for %arg{{.*}} = 1 to 10 {
// CHECK-NEXT: affine.load %arg{{.*}}
// CHECK-NEXT: affine.load %arg{{.*}}
@@ -2623,7 +2623,7 @@ func @should_not_fuse_since_non_affine_users(%in0 : memref<32xf32>,
%lhs = load %in0[%d] : memref<32xf32>
%rhs = load %in1[%d] : memref<32xf32>
%add = subf %lhs, %rhs : f32
- memref.store %add, %in0[%d] : memref<32xf32>
+ store %add, %in0[%d] : memref<32xf32>
}
affine.for %d = 0 to 32 {
%lhs = affine.load %in0[%d] : memref<32xf32>
@@ -2646,12 +2646,12 @@ func @should_not_fuse_since_non_affine_users(%in0 : memref<32xf32>,
// CHECK-LABEL: func @should_not_fuse_since_top_level_non_affine_users
func @should_not_fuse_since_top_level_non_affine_users(%in0 : memref<32xf32>,
%in1 : memref<32xf32>) {
- %sum = memref.alloc() : memref<f32>
+ %sum = alloc() : memref<f32>
affine.for %d = 0 to 32 {
%lhs = affine.load %in0[%d] : memref<32xf32>
%rhs = affine.load %in1[%d] : memref<32xf32>
%add = addf %lhs, %rhs : f32
- memref.store %add, %sum[] : memref<f32>
+ store %add, %sum[] : memref<f32>
affine.store %add, %in0[%d] : memref<32xf32>
}
%load_sum = load %sum[] : memref<f32>
@@ -2662,7 +2662,7 @@ func @should_not_fuse_since_top_level_non_affine_users(%in0 : memref<32xf32>,
%sub = subf %add, %load_sum: f32
affine.store %sub, %in0[%d] : memref<32xf32>
}
- memref.dealloc %sum : memref<f32>
+ dealloc %sum : memref<f32>
return
}
@@ -2686,7 +2686,7 @@ func @should_not_fuse_since_top_level_non_affine_mem_write_users(
%add = addf %lhs, %rhs : f32
affine.store %add, %in0[%d] : memref<32xf32>
}
- memref.store %cst_0, %in0[%c0] : memref<32xf32>
+ store %cst_0, %in0[%c0] : memref<32xf32>
affine.for %d = 0 to 32 {
%lhs = affine.load %in0[%d] : memref<32xf32>
%rhs = affine.load %in1[%d] : memref<32xf32>
@@ -2705,7 +2705,7 @@ func @should_not_fuse_since_top_level_non_affine_mem_write_users(
// MAXIMAL-LABEL: func @fuse_minor_affine_map
func @fuse_minor_affine_map(%in: memref<128xf32>, %out: memref<20x512xf32>) {
- %tmp = memref.alloc() : memref<128xf32>
+ %tmp = alloc() : memref<128xf32>
affine.for %arg4 = 0 to 128 {
%ld = affine.load %in[%arg4] : memref<128xf32>
@@ -2725,7 +2725,7 @@ func @fuse_minor_affine_map(%in: memref<128xf32>, %out: memref<20x512xf32>) {
// TODO: The size of the private memref is not properly computed in the presence
// of the 'mod' operation. It should be memref<1xf32> instead of
// memref<128xf32>: https://bugs.llvm.org/show_bug.cgi?id=46973
-// MAXIMAL: memref.alloc() : memref<128xf32>
+// MAXIMAL: alloc() : memref<128xf32>
// MAXIMAL: affine.for
// MAXIMAL-NEXT: affine.for
// MAXIMAL-NOT: affine.for
@@ -2735,9 +2735,9 @@ func @fuse_minor_affine_map(%in: memref<128xf32>, %out: memref<20x512xf32>) {
// CHECK-LABEL: func @should_fuse_multi_store_producer_and_privatize_memfefs
func @should_fuse_multi_store_producer_and_privatize_memfefs() {
- %a = memref.alloc() : memref<10xf32>
- %b = memref.alloc() : memref<10xf32>
- %c = memref.alloc() : memref<10xf32>
+ %a = alloc() : memref<10xf32>
+ %b = alloc() : memref<10xf32>
+ %c = alloc() : memref<10xf32>
%cst = constant 0.000000e+00 : f32
affine.for %arg0 = 0 to 10 {
affine.store %cst, %a[%arg0] : memref<10xf32>
diff --git a/mlir/test/Transforms/loop-invariant-code-motion.mlir b/mlir/test/Transforms/loop-invariant-code-motion.mlir
index 198b925f876f..7f299b6b645d 100644
--- a/mlir/test/Transforms/loop-invariant-code-motion.mlir
+++ b/mlir/test/Transforms/loop-invariant-code-motion.mlir
@@ -1,7 +1,7 @@
// RUN: mlir-opt %s -split-input-file -loop-invariant-code-motion | FileCheck %s
func @nested_loops_both_having_invariant_code() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
%cf8 = constant 8.0 : f32
@@ -13,7 +13,7 @@ func @nested_loops_both_having_invariant_code() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %[[CST0:.*]] = constant 7.000000e+00 : f32
// CHECK-NEXT: %[[CST1:.*]] = constant 8.000000e+00 : f32
// CHECK-NEXT: %[[ADD0:.*]] = addf %[[CST0]], %[[CST1]] : f32
@@ -28,7 +28,7 @@ func @nested_loops_both_having_invariant_code() {
// -----
func @nested_loops_code_invariant_to_both() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
%cf8 = constant 8.0 : f32
@@ -38,7 +38,7 @@ func @nested_loops_code_invariant_to_both() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 7.000000e+00 : f32
// CHECK-NEXT: %cst_0 = constant 8.000000e+00 : f32
// CHECK-NEXT: %1 = addf %cst, %cst_0 : f32
@@ -49,8 +49,8 @@ func @nested_loops_code_invariant_to_both() {
// -----
func @single_loop_nothing_invariant() {
- %m1 = memref.alloc() : memref<10xf32>
- %m2 = memref.alloc() : memref<10xf32>
+ %m1 = alloc() : memref<10xf32>
+ %m2 = alloc() : memref<10xf32>
affine.for %arg0 = 0 to 10 {
%v0 = affine.load %m1[%arg0] : memref<10xf32>
%v1 = affine.load %m2[%arg0] : memref<10xf32>
@@ -58,8 +58,8 @@ func @single_loop_nothing_invariant() {
affine.store %v2, %m1[%arg0] : memref<10xf32>
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
- // CHECK-NEXT: %1 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
+ // CHECK-NEXT: %1 = alloc() : memref<10xf32>
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: %2 = affine.load %0[%arg0] : memref<10xf32>
// CHECK-NEXT: %3 = affine.load %1[%arg0] : memref<10xf32>
@@ -72,7 +72,7 @@ func @single_loop_nothing_invariant() {
// -----
func @invariant_code_inside_affine_if() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf8 = constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
@@ -84,7 +84,7 @@ func @invariant_code_inside_affine_if() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: %1 = affine.apply #map(%arg0)
@@ -100,7 +100,7 @@ func @invariant_code_inside_affine_if() {
// -----
func @invariant_affine_if() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf8 = constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
affine.for %arg1 = 0 to 10 {
@@ -110,7 +110,7 @@ func @invariant_affine_if() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %[[CST:.*]] = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %[[ARG:.*]] = 0 to 10 {
// CHECK-NEXT: }
@@ -125,7 +125,7 @@ func @invariant_affine_if() {
// -----
func @invariant_affine_if2() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf8 = constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
affine.for %arg1 = 0 to 10 {
@@ -136,7 +136,7 @@ func @invariant_affine_if2() {
}
}
- // CHECK: memref.alloc
+ // CHECK: alloc
// CHECK-NEXT: constant
// CHECK-NEXT: affine.for
// CHECK-NEXT: affine.for
@@ -152,7 +152,7 @@ func @invariant_affine_if2() {
// -----
func @invariant_affine_nested_if() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf8 = constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
affine.for %arg1 = 0 to 10 {
@@ -165,7 +165,7 @@ func @invariant_affine_nested_if() {
}
}
- // CHECK: memref.alloc
+ // CHECK: alloc
// CHECK-NEXT: constant
// CHECK-NEXT: affine.for
// CHECK-NEXT: affine.for
@@ -184,7 +184,7 @@ func @invariant_affine_nested_if() {
// -----
func @invariant_affine_nested_if_else() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf8 = constant 8.0 : f32
affine.for %arg0 = 0 to 10 {
affine.for %arg1 = 0 to 10 {
@@ -200,7 +200,7 @@ func @invariant_affine_nested_if_else() {
}
}
- // CHECK: memref.alloc
+ // CHECK: alloc
// CHECK-NEXT: constant
// CHECK-NEXT: affine.for
// CHECK-NEXT: affine.for
@@ -225,7 +225,7 @@ func @invariant_loop_dialect() {
%ci0 = constant 0 : index
%ci10 = constant 10 : index
%ci1 = constant 1 : index
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
%cf8 = constant 8.0 : f32
scf.for %arg0 = %ci0 to %ci10 step %ci1 {
@@ -234,7 +234,7 @@ func @invariant_loop_dialect() {
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 7.000000e+00 : f32
// CHECK-NEXT: %cst_0 = constant 8.000000e+00 : f32
// CHECK-NEXT: %1 = addf %cst, %cst_0 : f32
@@ -248,14 +248,14 @@ func @variant_loop_dialect() {
%ci0 = constant 0 : index
%ci10 = constant 10 : index
%ci1 = constant 1 : index
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
scf.for %arg0 = %ci0 to %ci10 step %ci1 {
scf.for %arg1 = %ci0 to %ci10 step %ci1 {
%v0 = addi %arg0, %arg1 : index
}
}
- // CHECK: %0 = memref.alloc() : memref<10xf32>
+ // CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: scf.for
// CHECK-NEXT: scf.for
// CHECK-NEXT: addi
diff --git a/mlir/test/Transforms/memref-bound-check.mlir b/mlir/test/Transforms/memref-bound-check.mlir
index 25aa343ad3c2..a8d83cc65a2c 100644
--- a/mlir/test/Transforms/memref-bound-check.mlir
+++ b/mlir/test/Transforms/memref-bound-check.mlir
@@ -8,8 +8,8 @@ func @test() {
%minusone = constant -1 : index
%sym = constant 111 : index
- %A = memref.alloc() : memref<9 x 9 x i32>
- %B = memref.alloc() : memref<111 x i32>
+ %A = alloc() : memref<9 x 9 x i32>
+ %B = alloc() : memref<111 x i32>
affine.for %i = -1 to 10 {
affine.for %j = -1 to 10 {
@@ -41,7 +41,7 @@ func @test() {
// CHECK-LABEL: func @test_mod_floordiv_ceildiv
func @test_mod_floordiv_ceildiv() {
%zero = constant 0 : index
- %A = memref.alloc() : memref<128 x 64 x 64 x i32>
+ %A = alloc() : memref<128 x 64 x 64 x i32>
affine.for %i = 0 to 256 {
affine.for %j = 0 to 256 {
@@ -64,9 +64,9 @@ func @test_mod_floordiv_ceildiv() {
// CHECK-LABEL: func @test_no_out_of_bounds()
func @test_no_out_of_bounds() {
%zero = constant 0 : index
- %A = memref.alloc() : memref<257 x 256 x i32>
- %C = memref.alloc() : memref<257 x i32>
- %B = memref.alloc() : memref<1 x i32>
+ %A = alloc() : memref<257 x 256 x i32>
+ %C = alloc() : memref<257 x i32>
+ %B = alloc() : memref<1 x i32>
affine.for %i = 0 to 256 {
affine.for %j = 0 to 256 {
@@ -90,7 +90,7 @@ func @test_no_out_of_bounds() {
// CHECK-LABEL: func @mod_div
func @mod_div() {
%zero = constant 0 : index
- %A = memref.alloc() : memref<128 x 64 x 64 x i32>
+ %A = alloc() : memref<128 x 64 x 64 x i32>
affine.for %i = 0 to 256 {
affine.for %j = 0 to 256 {
@@ -113,7 +113,7 @@ func @mod_div() {
// Tests with nested mod's and floordiv's.
// CHECK-LABEL: func @mod_floordiv_nested() {
func @mod_floordiv_nested() {
- %A = memref.alloc() : memref<256 x 256 x i32>
+ %A = alloc() : memref<256 x 256 x i32>
affine.for %i = 0 to 256 {
affine.for %j = 0 to 256 {
%idx0 = affine.apply affine_map<(d0, d1) -> ((d0 mod 1024) floordiv 4)>(%i, %j)
@@ -126,7 +126,7 @@ func @mod_floordiv_nested() {
// CHECK-LABEL: func @test_semi_affine_bailout
func @test_semi_affine_bailout(%N : index) {
- %B = memref.alloc() : memref<10 x i32>
+ %B = alloc() : memref<10 x i32>
affine.for %i = 0 to 10 {
%idx = affine.apply affine_map<(d0)[s0] -> (d0 * s0)>(%i)[%N]
%y = affine.load %B[%idx] : memref<10 x i32>
@@ -137,7 +137,7 @@ func @test_semi_affine_bailout(%N : index) {
// CHECK-LABEL: func @multi_mod_floordiv
func @multi_mod_floordiv() {
- %A = memref.alloc() : memref<2x2xi32>
+ %A = alloc() : memref<2x2xi32>
affine.for %ii = 0 to 64 {
%idx0 = affine.apply affine_map<(d0) -> ((d0 mod 147456) floordiv 1152)> (%ii)
%idx1 = affine.apply affine_map<(d0) -> (((d0 mod 147456) mod 1152) floordiv 384)> (%ii)
@@ -149,8 +149,8 @@ func @multi_mod_floordiv() {
// CHECK-LABEL: func @delinearize_mod_floordiv
func @delinearize_mod_floordiv() {
%c0 = constant 0 : index
- %in = memref.alloc() : memref<2x2x3x3x16x1xi32>
- %out = memref.alloc() : memref<64x9xi32>
+ %in = alloc() : memref<2x2x3x3x16x1xi32>
+ %out = alloc() : memref<64x9xi32>
// Reshape '%in' into '%out'.
affine.for %ii = 0 to 64 {
@@ -186,7 +186,7 @@ func @zero_d_memref(%arg0: memref<i32>) {
// CHECK-LABEL: func @out_of_bounds
func @out_of_bounds() {
- %in = memref.alloc() : memref<1xi32>
+ %in = alloc() : memref<1xi32>
%c9 = constant 9 : i32
affine.for %i0 = 10 to 11 {
@@ -208,7 +208,7 @@ func @out_of_bounds() {
// CHECK-LABEL: func @test_complex_mod_floordiv
func @test_complex_mod_floordiv(%arg0: memref<4x4x16x1xf32>) {
%c0 = constant 0 : index
- %0 = memref.alloc() : memref<1x2x3x3x16x1xf32>
+ %0 = alloc() : memref<1x2x3x3x16x1xf32>
affine.for %i0 = 0 to 64 {
affine.for %i1 = 0 to 9 {
%2 = affine.apply #map3(%i0, %i1)
@@ -228,8 +228,8 @@ func @test_complex_mod_floordiv(%arg0: memref<4x4x16x1xf32>) {
// CHECK-LABEL: func @test_mod_bound
func @test_mod_bound() {
- %0 = memref.alloc() : memref<7 x f32>
- %1 = memref.alloc() : memref<6 x f32>
+ %0 = alloc() : memref<7 x f32>
+ %1 = alloc() : memref<6 x f32>
affine.for %i0 = 0 to 4096 {
affine.for %i1 = #map0(%i0) to #map1(%i0) {
affine.load %0[%i1] : memref<7 x f32>
@@ -248,9 +248,9 @@ func @test_mod_bound() {
// CHECK-LABEL: func @test_floordiv_bound
func @test_floordiv_bound() {
- %0 = memref.alloc() : memref<1027 x f32>
- %1 = memref.alloc() : memref<1026 x f32>
- %2 = memref.alloc() : memref<4096 x f32>
+ %0 = alloc() : memref<1027 x f32>
+ %1 = alloc() : memref<1026 x f32>
+ %2 = alloc() : memref<4096 x f32>
%N = constant 2048 : index
affine.for %i0 = 0 to 4096 {
affine.for %i1 = #map0(%i0) to #map1(%i0) {
@@ -287,7 +287,7 @@ func @non_composed_bound_operand(%arg0: memref<1024xf32>) {
// CHECK-LABEL: func @zero_d_memref
func @zero_d_memref() {
- %Z = memref.alloc() : memref<f32>
+ %Z = alloc() : memref<f32>
affine.for %i = 0 to 100 {
affine.load %Z[] : memref<f32>
}
diff --git a/mlir/test/Transforms/memref-dataflow-opt.mlir b/mlir/test/Transforms/memref-dataflow-opt.mlir
index 49a3dcbd2018..dfda19372813 100644
--- a/mlir/test/Transforms/memref-dataflow-opt.mlir
+++ b/mlir/test/Transforms/memref-dataflow-opt.mlir
@@ -9,7 +9,7 @@
// CHECK-LABEL: func @simple_store_load() {
func @simple_store_load() {
%cf7 = constant 7.0 : f32
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
affine.for %i0 = 0 to 10 {
affine.store %cf7, %m[%i0] : memref<10xf32>
%v0 = affine.load %m[%i0] : memref<10xf32>
@@ -29,7 +29,7 @@ func @multi_store_load() {
%cf7 = constant 7.0 : f32
%cf8 = constant 8.0 : f32
%cf9 = constant 9.0 : f32
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
affine.for %i0 = 0 to 10 {
affine.store %cf7, %m[%i0] : memref<10xf32>
%v0 = affine.load %m[%i0] : memref<10xf32>
@@ -58,7 +58,7 @@ func @multi_store_load() {
// CHECK-LABEL: func @store_load_affine_apply
func @store_load_affine_apply() -> memref<10x10xf32> {
%cf7 = constant 7.0 : f32
- %m = memref.alloc() : memref<10x10xf32>
+ %m = alloc() : memref<10x10xf32>
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 10 {
%t0 = affine.apply affine_map<(d0, d1) -> (d1 + 1)>(%i0, %i1)
@@ -74,7 +74,7 @@ func @store_load_affine_apply() -> memref<10x10xf32> {
// The memref and its stores won't be erased due to this memref return.
return %m : memref<10x10xf32>
// CHECK: %{{.*}} = constant 7.000000e+00 : f32
-// CHECK-NEXT: %{{.*}} = memref.alloc() : memref<10x10xf32>
+// CHECK-NEXT: %{{.*}} = alloc() : memref<10x10xf32>
// CHECK-NEXT: affine.for %{{.*}} = 0 to 10 {
// CHECK-NEXT: affine.for %{{.*}} = 0 to 10 {
// CHECK-NEXT: %{{.*}} = affine.apply [[$MAP0]](%{{.*}}, %{{.*}})
@@ -91,7 +91,7 @@ func @store_load_affine_apply() -> memref<10x10xf32> {
// CHECK-LABEL: func @store_load_nested
func @store_load_nested(%N : index) {
%cf7 = constant 7.0 : f32
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
affine.for %i0 = 0 to 10 {
affine.store %cf7, %m[%i0] : memref<10xf32>
affine.for %i1 = 0 to %N {
@@ -116,7 +116,7 @@ func @store_load_nested(%N : index) {
func @multi_store_load_nested_no_fwd(%N : index) {
%cf7 = constant 7.0 : f32
%cf8 = constant 8.0 : f32
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
affine.for %i0 = 0 to 10 {
affine.store %cf7, %m[%i0] : memref<10xf32>
affine.for %i1 = 0 to %N {
@@ -137,7 +137,7 @@ func @multi_store_load_nested_no_fwd(%N : index) {
func @store_load_store_nested_no_fwd(%N : index) {
%cf7 = constant 7.0 : f32
%cf9 = constant 9.0 : f32
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
affine.for %i0 = 0 to 10 {
affine.store %cf7, %m[%i0] : memref<10xf32>
affine.for %i1 = 0 to %N {
@@ -158,7 +158,7 @@ func @multi_store_load_nested_fwd(%N : index) {
%cf8 = constant 8.0 : f32
%cf9 = constant 9.0 : f32
%cf10 = constant 10.0 : f32
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
affine.for %i0 = 0 to 10 {
affine.store %cf7, %m[%i0] : memref<10xf32>
affine.for %i1 = 0 to %N {
@@ -181,7 +181,7 @@ func @multi_store_load_nested_fwd(%N : index) {
// CHECK-LABEL: func @store_load_no_fwd
func @store_load_no_fwd() {
%cf7 = constant 7.0 : f32
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
affine.for %i0 = 0 to 10 {
affine.store %cf7, %m[%i0] : memref<10xf32>
affine.for %i1 = 0 to 10 {
@@ -200,7 +200,7 @@ func @store_load_no_fwd() {
func @store_load_fwd() {
%cf7 = constant 7.0 : f32
%c0 = constant 0 : index
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
affine.store %cf7, %m[%c0] : memref<10xf32>
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 10 {
@@ -222,7 +222,7 @@ func @store_load_store_nested_fwd(%N : index) -> f32 {
%cf9 = constant 9.0 : f32
%c0 = constant 0 : index
%c1 = constant 1 : index
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
affine.for %i0 = 0 to 10 {
affine.store %cf7, %m[%i0] : memref<10xf32>
affine.for %i1 = 0 to %N {
@@ -235,7 +235,7 @@ func @store_load_store_nested_fwd(%N : index) -> f32 {
// Due to this load, the memref isn't optimized away.
%v3 = affine.load %m[%c1] : memref<10xf32>
return %v3 : f32
-// CHECK: %{{.*}} = memref.alloc() : memref<10xf32>
+// CHECK: %{{.*}} = alloc() : memref<10xf32>
// CHECK-NEXT: affine.for %{{.*}} = 0 to 10 {
// CHECK-NEXT: affine.store %{{.*}}, %{{.*}}[%{{.*}}] : memref<10xf32>
// CHECK-NEXT: affine.for %{{.*}} = 0 to %{{.*}} {
@@ -285,7 +285,7 @@ func @refs_not_known_to_be_equal(%A : memref<100 x 100 x f32>, %M : index) {
// The value loaded from %in can directly be stored to %out by eliminating
// store and load from %tmp.
func @vector_forwarding(%in : memref<512xf32>, %out : memref<512xf32>) {
- %tmp = memref.alloc() : memref<512xf32>
+ %tmp = alloc() : memref<512xf32>
affine.for %i = 0 to 16 {
%ld0 = affine.vector_load %in[32*%i] : memref<512xf32>, vector<32xf32>
affine.vector_store %ld0, %tmp[32*%i] : memref<512xf32>, vector<32xf32>
diff --git a/mlir/test/Transforms/memref-dependence-check.mlir b/mlir/test/Transforms/memref-dependence-check.mlir
index af8614406293..fbe0a149e9f4 100644
--- a/mlir/test/Transforms/memref-dependence-check.mlir
+++ b/mlir/test/Transforms/memref-dependence-check.mlir
@@ -6,7 +6,7 @@
// CHECK-LABEL: func @store_may_execute_before_load() {
func @store_may_execute_before_load() {
- %m = memref.alloc() : memref<10xf32>
+ %m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
%c0 = constant 4 : index
// There is no dependence from store 0 to load 1 at depth if we take into account
@@ -33,7 +33,7 @@ func @store_may_execute_before_load() {
// CHECK-LABEL: func @dependent_loops() {
func @dependent_loops() {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
%cst = constant 7.000000e+00 : f32
// There is a dependence from 0 to 1 at depth 1 (common surrounding loops 0)
// because the first loop with the store dominates the second scf.
@@ -55,8 +55,8 @@ func @dependent_loops() {
// -----
// CHECK-LABEL: func @
diff erent_memrefs() {
func @
diff erent_memrefs() {
- %m.a = memref.alloc() : memref<100xf32>
- %m.b = memref.alloc() : memref<100xf32>
+ %m.a = alloc() : memref<100xf32>
+ %m.b = alloc() : memref<100xf32>
%c0 = constant 0 : index
%c1 = constant 1.0 : f32
affine.store %c1, %m.a[%c0] : memref<100xf32>
@@ -71,7 +71,7 @@ func @
diff erent_memrefs() {
// -----
// CHECK-LABEL: func @store_load_
diff erent_elements() {
func @store_load_
diff erent_elements() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c0 = constant 0 : index
%c1 = constant 1 : index
%c7 = constant 7.0 : f32
@@ -87,7 +87,7 @@ func @store_load_
diff erent_elements() {
// -----
// CHECK-LABEL: func @load_store_
diff erent_elements() {
func @load_store_
diff erent_elements() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c0 = constant 0 : index
%c1 = constant 1 : index
%c7 = constant 7.0 : f32
@@ -103,7 +103,7 @@ func @load_store_
diff erent_elements() {
// -----
// CHECK-LABEL: func @store_load_same_element() {
func @store_load_same_element() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c11 = constant 11 : index
%c7 = constant 7.0 : f32
affine.store %c7, %m[%c11] : memref<100xf32>
@@ -118,7 +118,7 @@ func @store_load_same_element() {
// -----
// CHECK-LABEL: func @load_load_same_element() {
func @load_load_same_element() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c11 = constant 11 : index
%c7 = constant 7.0 : f32
%v0 = affine.load %m[%c11] : memref<100xf32>
@@ -133,7 +133,7 @@ func @load_load_same_element() {
// -----
// CHECK-LABEL: func @store_load_same_symbol(%arg0: index) {
func @store_load_same_symbol(%arg0: index) {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
affine.store %c7, %m[%arg0] : memref<100xf32>
// expected-remark at above {{dependence from 0 to 0 at depth 1 = false}}
@@ -147,7 +147,7 @@ func @store_load_same_symbol(%arg0: index) {
// -----
// CHECK-LABEL: func @store_load_
diff erent_symbols(%arg0: index, %arg1: index) {
func @store_load_
diff erent_symbols(%arg0: index, %arg1: index) {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
affine.store %c7, %m[%arg0] : memref<100xf32>
// expected-remark at above {{dependence from 0 to 0 at depth 1 = false}}
@@ -161,7 +161,7 @@ func @store_load_
diff erent_symbols(%arg0: index, %arg1: index) {
// -----
// CHECK-LABEL: func @store_load_
diff _element_affine_apply_const() {
func @store_load_
diff _element_affine_apply_const() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c1 = constant 1 : index
%c8 = constant 8.0 : f32
%a0 = affine.apply affine_map<(d0) -> (d0)> (%c1)
@@ -178,7 +178,7 @@ func @store_load_
diff _element_affine_apply_const() {
// -----
// CHECK-LABEL: func @store_load_same_element_affine_apply_const() {
func @store_load_same_element_affine_apply_const() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%c9 = constant 9 : index
%c11 = constant 11 : index
@@ -196,7 +196,7 @@ func @store_load_same_element_affine_apply_const() {
// -----
// CHECK-LABEL: func @store_load_affine_apply_symbol(%arg0: index) {
func @store_load_affine_apply_symbol(%arg0: index) {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%a0 = affine.apply affine_map<(d0) -> (d0)> (%arg0)
affine.store %c7, %m[%a0] : memref<100xf32>
@@ -212,7 +212,7 @@ func @store_load_affine_apply_symbol(%arg0: index) {
// -----
// CHECK-LABEL: func @store_load_affine_apply_symbol_offset(%arg0: index) {
func @store_load_affine_apply_symbol_offset(%arg0: index) {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%a0 = affine.apply affine_map<(d0) -> (d0)> (%arg0)
affine.store %c7, %m[%a0] : memref<100xf32>
@@ -228,7 +228,7 @@ func @store_load_affine_apply_symbol_offset(%arg0: index) {
// -----
// CHECK-LABEL: func @store_range_load_after_range() {
func @store_range_load_after_range() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%c10 = constant 10 : index
affine.for %i0 = 0 to 10 {
@@ -251,7 +251,7 @@ func @store_range_load_after_range() {
// -----
// CHECK-LABEL: func @store_load_func_symbol(%arg0: index, %arg1: index) {
func @store_load_func_symbol(%arg0: index, %arg1: index) {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%c10 = constant 10 : index
affine.for %i0 = 0 to %arg1 {
@@ -274,7 +274,7 @@ func @store_load_func_symbol(%arg0: index, %arg1: index) {
// -----
// CHECK-LABEL: func @store_range_load_last_in_range() {
func @store_range_load_last_in_range() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%c10 = constant 10 : index
affine.for %i0 = 0 to 10 {
@@ -302,7 +302,7 @@ func @store_range_load_last_in_range() {
// -----
// CHECK-LABEL: func @store_range_load_before_range() {
func @store_range_load_before_range() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%c0 = constant 0 : index
affine.for %i0 = 1 to 11 {
@@ -325,7 +325,7 @@ func @store_range_load_before_range() {
// -----
// CHECK-LABEL: func @store_range_load_first_in_range() {
func @store_range_load_first_in_range() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%c0 = constant 0 : index
affine.for %i0 = 1 to 11 {
@@ -351,7 +351,7 @@ func @store_range_load_first_in_range() {
// -----
// CHECK-LABEL: func @store_plus_3() {
func @store_plus_3() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
affine.for %i0 = 1 to 11 {
%a0 = affine.apply affine_map<(d0) -> (d0 + 3)> (%i0)
@@ -373,7 +373,7 @@ func @store_plus_3() {
// -----
// CHECK-LABEL: func @load_minus_2() {
func @load_minus_2() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
affine.for %i0 = 2 to 11 {
%a0 = affine.apply affine_map<(d0) -> (d0)> (%i0)
@@ -395,7 +395,7 @@ func @load_minus_2() {
// -----
// CHECK-LABEL: func @perfectly_nested_loops_loop_independent() {
func @perfectly_nested_loops_loop_independent() {
- %m = memref.alloc() : memref<10x10xf32>
+ %m = alloc() : memref<10x10xf32>
%c7 = constant 7.0 : f32
affine.for %i0 = 0 to 11 {
affine.for %i1 = 0 to 11 {
@@ -426,7 +426,7 @@ func @perfectly_nested_loops_loop_independent() {
// -----
// CHECK-LABEL: func @perfectly_nested_loops_loop_carried_at_depth1() {
func @perfectly_nested_loops_loop_carried_at_depth1() {
- %m = memref.alloc() : memref<10x10xf32>
+ %m = alloc() : memref<10x10xf32>
%c7 = constant 7.0 : f32
affine.for %i0 = 0 to 9 {
affine.for %i1 = 0 to 9 {
@@ -457,7 +457,7 @@ func @perfectly_nested_loops_loop_carried_at_depth1() {
// -----
// CHECK-LABEL: func @perfectly_nested_loops_loop_carried_at_depth2() {
func @perfectly_nested_loops_loop_carried_at_depth2() {
- %m = memref.alloc() : memref<10x10xf32>
+ %m = alloc() : memref<10x10xf32>
%c7 = constant 7.0 : f32
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 10 {
@@ -488,7 +488,7 @@ func @perfectly_nested_loops_loop_carried_at_depth2() {
// -----
// CHECK-LABEL: func @one_common_loop() {
func @one_common_loop() {
- %m = memref.alloc() : memref<10x10xf32>
+ %m = alloc() : memref<10x10xf32>
%c7 = constant 7.0 : f32
// There is a loop-independent dependence from access 0 to 1 at depth 2.
affine.for %i0 = 0 to 10 {
@@ -519,8 +519,8 @@ func @one_common_loop() {
// -----
// CHECK-LABEL: func @dependence_cycle() {
func @dependence_cycle() {
- %m.a = memref.alloc() : memref<100xf32>
- %m.b = memref.alloc() : memref<100xf32>
+ %m.a = alloc() : memref<100xf32>
+ %m.b = alloc() : memref<100xf32>
// Dependences:
// *) loop-independent dependence from access 1 to 2 at depth 2.
@@ -573,7 +573,7 @@ func @dependence_cycle() {
// -----
// CHECK-LABEL: func @negative_and_positive_direction_vectors(%arg0: index, %arg1: index) {
func @negative_and_positive_direction_vectors(%arg0: index, %arg1: index) {
- %m = memref.alloc() : memref<10x10xf32>
+ %m = alloc() : memref<10x10xf32>
%c7 = constant 7.0 : f32
affine.for %i0 = 0 to %arg0 {
affine.for %i1 = 0 to %arg1 {
@@ -603,7 +603,7 @@ func @negative_and_positive_direction_vectors(%arg0: index, %arg1: index) {
// -----
// CHECK-LABEL: func @war_raw_waw_deps() {
func @war_raw_waw_deps() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
affine.for %i0 = 0 to 10 {
affine.for %i1 = 0 to 10 {
@@ -631,7 +631,7 @@ func @war_raw_waw_deps() {
// -----
// CHECK-LABEL: func @mod_deps() {
func @mod_deps() {
- %m = memref.alloc() : memref<100xf32>
+ %m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
affine.for %i0 = 0 to 10 {
%a0 = affine.apply affine_map<(d0) -> (d0 mod 2)> (%i0)
@@ -655,7 +655,7 @@ func @mod_deps() {
// -----
// CHECK-LABEL: func @loop_nest_depth() {
func @loop_nest_depth() {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
%c7 = constant 7.0 : f32
affine.for %i0 = 0 to 128 {
@@ -691,7 +691,7 @@ func @loop_nest_depth() {
// mod/div's successively.
// CHECK-LABEL: func @mod_div_3d() {
func @mod_div_3d() {
- %M = memref.alloc() : memref<2x2x2xi32>
+ %M = alloc() : memref<2x2x2xi32>
%c0 = constant 0 : i32
affine.for %i0 = 0 to 8 {
affine.for %i1 = 0 to 8 {
@@ -716,8 +716,8 @@ func @mod_div_3d() {
func @delinearize_mod_floordiv() {
%c0 = constant 0 : index
%val = constant 0 : i32
- %in = memref.alloc() : memref<2x2x3x3x16x1xi32>
- %out = memref.alloc() : memref<64x9xi32>
+ %in = alloc() : memref<2x2x3x3x16x1xi32>
+ %out = alloc() : memref<64x9xi32>
affine.for %i0 = 0 to 2 {
affine.for %i1 = 0 to 2 {
@@ -788,7 +788,7 @@ func @delinearize_mod_floordiv() {
// Load and store ops access the same elements in strided scf.
// CHECK-LABEL: func @strided_loop_with_dependence_at_depth2
func @strided_loop_with_dependence_at_depth2() {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
%cf0 = constant 0.0 : f32
affine.for %i0 = 0 to 8 step 2 {
affine.store %cf0, %0[%i0] : memref<10xf32>
@@ -810,7 +810,7 @@ func @strided_loop_with_dependence_at_depth2() {
// Load and store ops access alternating memref elements: no dependence.
// CHECK-LABEL: func @strided_loop_with_no_dependence
func @strided_loop_with_no_dependence() {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
%cf0 = constant 0.0 : f32
affine.for %i0 = 0 to 8 step 2 {
%a0 = affine.apply affine_map<(d0) -> (d0 + 1)>(%i0)
@@ -833,7 +833,7 @@ func @strided_loop_with_no_dependence() {
// Affine.Store op accesses memref elements at offset causing loop-carried dependence.
// CHECK-LABEL: func @strided_loop_with_loop_carried_dependence_at_depth1
func @strided_loop_with_loop_carried_dependence_at_depth1() {
- %0 = memref.alloc() : memref<10xf32>
+ %0 = alloc() : memref<10xf32>
%cf0 = constant 0.0 : f32
affine.for %i0 = 0 to 8 step 2 {
%a0 = affine.apply affine_map<(d0) -> (d0 + 4)>(%i0)
@@ -857,7 +857,7 @@ func @strided_loop_with_loop_carried_dependence_at_depth1() {
// properly computed when the load and store are at
diff erent loop depths.
// CHECK-LABEL: func @test_dep_store_depth1_load_depth2
func @test_dep_store_depth1_load_depth2() {
- %0 = memref.alloc() : memref<100xf32>
+ %0 = alloc() : memref<100xf32>
%cst = constant 7.000000e+00 : f32
affine.for %i0 = 0 to 10 {
%a0 = affine.apply affine_map<(d0) -> (d0 - 1)>(%i0)
@@ -884,7 +884,7 @@ func @test_dep_store_depth1_load_depth2() {
// properly computed when the load and store are at
diff erent loop depths.
// CHECK-LABEL: func @test_dep_store_depth2_load_depth1
func @test_dep_store_depth2_load_depth1() {
- %0 = memref.alloc() : memref<100xf32>
+ %0 = alloc() : memref<100xf32>
%cst = constant 7.000000e+00 : f32
affine.for %i0 = 0 to 10 {
affine.for %i1 = affine_map<(d0) -> (d0)>(%i0) to affine_map<(d0) -> (d0 + 1)>(%i0) {
@@ -912,7 +912,7 @@ func @test_dep_store_depth2_load_depth1() {
// CHECK-LABEL: func @test_affine_for_if_same_block() {
func @test_affine_for_if_same_block() {
- %0 = memref.alloc() : memref<100xf32>
+ %0 = alloc() : memref<100xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 100 {
@@ -940,7 +940,7 @@ func @test_affine_for_if_same_block() {
// CHECK-LABEL: func @test_affine_for_if_separated() {
func @test_affine_for_if_separated() {
- %0 = memref.alloc() : memref<100xf32>
+ %0 = alloc() : memref<100xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 10 {
@@ -970,7 +970,7 @@ func @test_affine_for_if_separated() {
// CHECK-LABEL: func @test_affine_for_if_partially_joined() {
func @test_affine_for_if_partially_joined() {
- %0 = memref.alloc() : memref<100xf32>
+ %0 = alloc() : memref<100xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 100 {
@@ -1001,7 +1001,7 @@ func @test_affine_for_if_partially_joined() {
// CHECK-LABEL: func @test_interleaved_affine_for_if() {
func @test_interleaved_affine_for_if() {
- %0 = memref.alloc() : memref<100x100xf32>
+ %0 = alloc() : memref<100x100xf32>
%cf7 = constant 7.0 : f32
affine.for %i0 = 0 to 100 {
@@ -1039,7 +1039,7 @@ func @test_interleaved_affine_for_if() {
// CHECK-LABEL: func @test_interleaved_affine_for_if() {
func @test_interleaved_affine_for_if() {
- %0 = memref.alloc() : memref<101xf32>
+ %0 = alloc() : memref<101xf32>
%c0 = constant 0 : index
%N = dim %0, %c0 : memref<101xf32>
%cf7 = constant 7.0 : f32
diff --git a/mlir/test/Transforms/normalize-memrefs-ops.mlir b/mlir/test/Transforms/normalize-memrefs-ops.mlir
index aae96f06133a..84b817aa7f24 100644
--- a/mlir/test/Transforms/normalize-memrefs-ops.mlir
+++ b/mlir/test/Transforms/normalize-memrefs-ops.mlir
@@ -16,13 +16,13 @@
// CHECK-LABEL: test_norm
// CHECK-SAME: (%[[ARG0:.*]]: memref<1x16x1x1x32x64xf32>)
func @test_norm(%arg0 : memref<1x16x14x14xf32, #map0>) -> () {
- %0 = memref.alloc() : memref<1x16x14x14xf32, #map0>
+ %0 = alloc() : memref<1x16x14x14xf32, #map0>
"test.op_norm"(%arg0, %0) : (memref<1x16x14x14xf32, #map0>, memref<1x16x14x14xf32, #map0>) -> ()
- memref.dealloc %0 : memref<1x16x14x14xf32, #map0>
+ dealloc %0 : memref<1x16x14x14xf32, #map0>
- // CHECK: %[[v0:.*]] = memref.alloc() : memref<1x16x1x1x32x64xf32>
+ // CHECK: %[[v0:.*]] = alloc() : memref<1x16x1x1x32x64xf32>
// CHECK: "test.op_norm"(%[[ARG0]], %[[v0]]) : (memref<1x16x1x1x32x64xf32>, memref<1x16x1x1x32x64xf32>) -> ()
- // CHECK: memref.dealloc %[[v0]] : memref<1x16x1x1x32x64xf32>
+ // CHECK: dealloc %[[v0]] : memref<1x16x1x1x32x64xf32>
return
}
@@ -31,13 +31,13 @@ func @test_norm(%arg0 : memref<1x16x14x14xf32, #map0>) -> () {
// CHECK-LABEL: test_nonnorm
// CHECK-SAME: (%[[ARG0:.*]]: memref<1x16x14x14xf32, #map>)
func @test_nonnorm(%arg0 : memref<1x16x14x14xf32, #map0>) -> () {
- %0 = memref.alloc() : memref<1x16x14x14xf32, #map0>
+ %0 = alloc() : memref<1x16x14x14xf32, #map0>
"test.op_nonnorm"(%arg0, %0) : (memref<1x16x14x14xf32, #map0>, memref<1x16x14x14xf32, #map0>) -> ()
- memref.dealloc %0 : memref<1x16x14x14xf32, #map0>
+ dealloc %0 : memref<1x16x14x14xf32, #map0>
- // CHECK: %[[v0:.*]] = memref.alloc() : memref<1x16x14x14xf32, #map>
+ // CHECK: %[[v0:.*]] = alloc() : memref<1x16x14x14xf32, #map>
// CHECK: "test.op_nonnorm"(%[[ARG0]], %[[v0]]) : (memref<1x16x14x14xf32, #map>, memref<1x16x14x14xf32, #map>) -> ()
- // CHECK: memref.dealloc %[[v0]] : memref<1x16x14x14xf32, #map>
+ // CHECK: dealloc %[[v0]] : memref<1x16x14x14xf32, #map>
return
}
@@ -46,13 +46,13 @@ func @test_nonnorm(%arg0 : memref<1x16x14x14xf32, #map0>) -> () {
// CHECK-LABEL: test_norm_mix
// CHECK-SAME: (%[[ARG0:.*]]: memref<1x16x1x1x32x64xf32>
func @test_norm_mix(%arg0 : memref<1x16x1x1x32x64xf32>) -> () {
- %0 = memref.alloc() : memref<1x16x14x14xf32, #map0>
+ %0 = alloc() : memref<1x16x14x14xf32, #map0>
"test.op_norm"(%arg0, %0) : (memref<1x16x1x1x32x64xf32>, memref<1x16x14x14xf32, #map0>) -> ()
- memref.dealloc %0 : memref<1x16x14x14xf32, #map0>
+ dealloc %0 : memref<1x16x14x14xf32, #map0>
- // CHECK: %[[v0:.*]] = memref.alloc() : memref<1x16x1x1x32x64xf32>
+ // CHECK: %[[v0:.*]] = alloc() : memref<1x16x1x1x32x64xf32>
// CHECK: "test.op_norm"(%[[ARG0]], %[[v0]]) : (memref<1x16x1x1x32x64xf32>, memref<1x16x1x1x32x64xf32>) -> ()
- // CHECK: memref.dealloc %[[v0]] : memref<1x16x1x1x32x64xf32>
+ // CHECK: dealloc %[[v0]] : memref<1x16x1x1x32x64xf32>
return
}
@@ -63,10 +63,10 @@ func @test_norm_mix(%arg0 : memref<1x16x1x1x32x64xf32>) -> () {
// CHECK-LABEL: test_load_store
// CHECK-SAME: (%[[ARG0:.*]]: memref<1x16x14x14xf32>
func @test_load_store(%arg0 : memref<1x16x14x14xf32>) -> () {
- %0 = memref.alloc() : memref<1x16x14x14xf32, #map_tile>
- // CHECK: %[[v0:.*]] = memref.alloc() : memref<1x16x1x1x32x32xf32>
- %1 = memref.alloc() : memref<1x16x14x14xf32>
- // CHECK: %[[v1:.*]] = memref.alloc() : memref<1x16x14x14xf32>
+ %0 = alloc() : memref<1x16x14x14xf32, #map_tile>
+ // CHECK: %[[v0:.*]] = alloc() : memref<1x16x1x1x32x32xf32>
+ %1 = alloc() : memref<1x16x14x14xf32>
+ // CHECK: %[[v1:.*]] = alloc() : memref<1x16x14x14xf32>
"test.op_norm"(%0, %1) : (memref<1x16x14x14xf32, #map_tile>, memref<1x16x14x14xf32>) -> ()
// CHECK: "test.op_norm"(%[[v0]], %[[v1]]) : (memref<1x16x1x1x32x32xf32>, memref<1x16x14x14xf32>) -> ()
%cst = constant 3.0 : f32
@@ -77,16 +77,16 @@ func @test_load_store(%arg0 : memref<1x16x14x14xf32>) -> () {
%2 = load %1[%i, %j, %k, %l] : memref<1x16x14x14xf32>
// CHECK: memref<1x16x14x14xf32>
%3 = addf %2, %cst : f32
- memref.store %3, %arg0[%i, %j, %k, %l] : memref<1x16x14x14xf32>
+ store %3, %arg0[%i, %j, %k, %l] : memref<1x16x14x14xf32>
// CHECK: memref<1x16x14x14xf32>
}
}
}
}
- memref.dealloc %0 : memref<1x16x14x14xf32, #map_tile>
- // CHECK: memref.dealloc %[[v0]] : memref<1x16x1x1x32x32xf32>
- memref.dealloc %1 : memref<1x16x14x14xf32>
- // CHECK: memref.dealloc %[[v1]] : memref<1x16x14x14xf32>
+ dealloc %0 : memref<1x16x14x14xf32, #map_tile>
+ // CHECK: dealloc %[[v0]] : memref<1x16x1x1x32x32xf32>
+ dealloc %1 : memref<1x16x14x14xf32>
+ // CHECK: dealloc %[[v1]] : memref<1x16x14x14xf32>
return
}
@@ -95,16 +95,16 @@ func @test_load_store(%arg0 : memref<1x16x14x14xf32>) -> () {
// CHECK-LABEL: test_norm_ret
// CHECK-SAME: (%[[ARG0:.*]]: memref<1x16x1x1x32x32xf32>) -> (memref<1x16x1x1x32x32xf32>, memref<1x16x14x14xf32>) {
func @test_norm_ret(%arg0: memref<1x16x14x14xf32, #map_tile>) -> (memref<1x16x14x14xf32, #map_tile>, memref<1x16x14x14xf32>) {
- %0 = memref.alloc() : memref<1x16x14x14xf32, #map_tile>
- // CHECK-NEXT: %[[v0:.*]] = memref.alloc() : memref<1x16x1x1x32x32xf32>
+ %0 = alloc() : memref<1x16x14x14xf32, #map_tile>
+ // CHECK-NEXT: %[[v0:.*]] = alloc() : memref<1x16x1x1x32x32xf32>
%1, %2 = "test.op_norm_ret"(%arg0) : (memref<1x16x14x14xf32, #map_tile>) -> (memref<1x16x14x14xf32, #map_tile>, memref<1x16x14x14xf32>)
// CHECK-NEXT: %[[v1:.*]], %[[v2:.*]] = "test.op_norm_ret"
// CHECK-SAME: (memref<1x16x1x1x32x32xf32>) -> (memref<1x16x1x1x32x32xf32>, memref<1x16x14x14xf32>)
"test.op_norm"(%1, %0) : (memref<1x16x14x14xf32, #map_tile>, memref<1x16x14x14xf32, #map_tile>) -> ()
// CHECK-NEXT: "test.op_norm"
// CHECK-SAME: : (memref<1x16x1x1x32x32xf32>, memref<1x16x1x1x32x32xf32>) -> ()
- memref.dealloc %0 : memref<1x16x14x14xf32, #map_tile>
- // CHECK-NEXT: memref.dealloc %[[v0]] : memref<1x16x1x1x32x32xf32>
+ dealloc %0 : memref<1x16x14x14xf32, #map_tile>
+ // CHECK-NEXT: dealloc %[[v0]] : memref<1x16x1x1x32x32xf32>
return %1, %2 : memref<1x16x14x14xf32, #map_tile>, memref<1x16x14x14xf32>
// CHECK-NEXT: return %[[v1]], %[[v2]] : memref<1x16x1x1x32x32xf32>, memref<1x16x14x14xf32>
}
diff --git a/mlir/test/Transforms/normalize-memrefs.mlir b/mlir/test/Transforms/normalize-memrefs.mlir
index 68ae325edad7..7bdbfe6bfb35 100644
--- a/mlir/test/Transforms/normalize-memrefs.mlir
+++ b/mlir/test/Transforms/normalize-memrefs.mlir
@@ -5,32 +5,32 @@
// CHECK-LABEL: func @permute()
func @permute() {
- %A = memref.alloc() : memref<64x256xf32, affine_map<(d0, d1) -> (d1, d0)>>
+ %A = alloc() : memref<64x256xf32, affine_map<(d0, d1) -> (d1, d0)>>
affine.for %i = 0 to 64 {
affine.for %j = 0 to 256 {
%1 = affine.load %A[%i, %j] : memref<64x256xf32, affine_map<(d0, d1) -> (d1, d0)>>
"prevent.dce"(%1) : (f32) -> ()
}
}
- memref.dealloc %A : memref<64x256xf32, affine_map<(d0, d1) -> (d1, d0)>>
+ dealloc %A : memref<64x256xf32, affine_map<(d0, d1) -> (d1, d0)>>
return
}
// The old memref alloc should disappear.
// CHECK-NOT: memref<64x256xf32>
-// CHECK: [[MEM:%[0-9]+]] = memref.alloc() : memref<256x64xf32>
+// CHECK: [[MEM:%[0-9]+]] = alloc() : memref<256x64xf32>
// CHECK-NEXT: affine.for %[[I:arg[0-9]+]] = 0 to 64 {
// CHECK-NEXT: affine.for %[[J:arg[0-9]+]] = 0 to 256 {
// CHECK-NEXT: affine.load [[MEM]][%[[J]], %[[I]]] : memref<256x64xf32>
// CHECK-NEXT: "prevent.dce"
// CHECK-NEXT: }
// CHECK-NEXT: }
-// CHECK-NEXT: memref.dealloc [[MEM]]
+// CHECK-NEXT: dealloc [[MEM]]
// CHECK-NEXT: return
// CHECK-LABEL: func @shift
func @shift(%idx : index) {
- // CHECK-NEXT: memref.alloc() : memref<65xf32>
- %A = memref.alloc() : memref<64xf32, affine_map<(d0) -> (d0 + 1)>>
+ // CHECK-NEXT: alloc() : memref<65xf32>
+ %A = alloc() : memref<64xf32, affine_map<(d0) -> (d0 + 1)>>
// CHECK-NEXT: affine.load %{{.*}}[symbol(%arg0) + 1] : memref<65xf32>
affine.load %A[%idx] : memref<64xf32, affine_map<(d0) -> (d0 + 1)>>
affine.for %i = 0 to 64 {
@@ -44,7 +44,7 @@ func @shift(%idx : index) {
// CHECK-LABEL: func @high_dim_permute()
func @high_dim_permute() {
// CHECK-NOT: memref<64x128x256xf32,
- %A = memref.alloc() : memref<64x128x256xf32, affine_map<(d0, d1, d2) -> (d2, d0, d1)>>
+ %A = alloc() : memref<64x128x256xf32, affine_map<(d0, d1, d2) -> (d2, d0, d1)>>
// CHECK: %[[I:arg[0-9]+]]
affine.for %i = 0 to 64 {
// CHECK: %[[J:arg[0-9]+]]
@@ -62,16 +62,16 @@ func @high_dim_permute() {
// CHECK-LABEL: func @invalid_map
func @invalid_map() {
- %A = memref.alloc() : memref<64x128xf32, affine_map<(d0, d1) -> (d0, -d1 - 10)>>
- // CHECK: %{{.*}} = memref.alloc() : memref<64x128xf32,
+ %A = alloc() : memref<64x128xf32, affine_map<(d0, d1) -> (d0, -d1 - 10)>>
+ // CHECK: %{{.*}} = alloc() : memref<64x128xf32,
return
}
// A tiled layout.
// CHECK-LABEL: func @data_tiling
func @data_tiling(%idx : index) {
- // CHECK: memref.alloc() : memref<8x32x8x16xf32>
- %A = memref.alloc() : memref<64x512xf32, affine_map<(d0, d1) -> (d0 floordiv 8, d1 floordiv 16, d0 mod 8, d1 mod 16)>>
+ // CHECK: alloc() : memref<8x32x8x16xf32>
+ %A = alloc() : memref<64x512xf32, affine_map<(d0, d1) -> (d0 floordiv 8, d1 floordiv 16, d0 mod 8, d1 mod 16)>>
// CHECK: affine.load %{{.*}}[symbol(%arg0) floordiv 8, symbol(%arg0) floordiv 16, symbol(%arg0) mod 8, symbol(%arg0) mod 16]
%1 = affine.load %A[%idx, %idx] : memref<64x512xf32, affine_map<(d0, d1) -> (d0 floordiv 8, d1 floordiv 16, d0 mod 8, d1 mod 16)>>
"prevent.dce"(%1) : (f32) -> ()
@@ -81,7 +81,7 @@ func @data_tiling(%idx : index) {
// Strides 2 and 4 along respective dimensions.
// CHECK-LABEL: func @strided
func @strided() {
- %A = memref.alloc() : memref<64x128xf32, affine_map<(d0, d1) -> (2*d0, 4*d1)>>
+ %A = alloc() : memref<64x128xf32, affine_map<(d0, d1) -> (2*d0, 4*d1)>>
// CHECK: affine.for %[[IV0:.*]] =
affine.for %i = 0 to 64 {
// CHECK: affine.for %[[IV1:.*]] =
@@ -97,7 +97,7 @@ func @strided() {
// Strided, but the strides are in the linearized space.
// CHECK-LABEL: func @strided_cumulative
func @strided_cumulative() {
- %A = memref.alloc() : memref<2x5xf32, affine_map<(d0, d1) -> (3*d0 + 17*d1)>>
+ %A = alloc() : memref<2x5xf32, affine_map<(d0, d1) -> (3*d0 + 17*d1)>>
// CHECK: affine.for %[[IV0:.*]] =
affine.for %i = 0 to 2 {
// CHECK: affine.for %[[IV1:.*]] =
@@ -114,8 +114,8 @@ func @strided_cumulative() {
// when the index remap has symbols.
// CHECK-LABEL: func @symbolic_operands
func @symbolic_operands(%s : index) {
- // CHECK: memref.alloc() : memref<100xf32>
- %A = memref.alloc()[%s] : memref<10x10xf32, affine_map<(d0,d1)[s0] -> (10*d0 + d1)>>
+ // CHECK: alloc() : memref<100xf32>
+ %A = alloc()[%s] : memref<10x10xf32, affine_map<(d0,d1)[s0] -> (10*d0 + d1)>>
affine.for %i = 0 to 10 {
affine.for %j = 0 to 10 {
// CHECK: affine.load %{{.*}}[%{{.*}} * 10 + %{{.*}}] : memref<100xf32>
@@ -129,7 +129,7 @@ func @symbolic_operands(%s : index) {
// Semi-affine maps, normalization not implemented yet.
// CHECK-LABEL: func @semi_affine_layout_map
func @semi_affine_layout_map(%s0: index, %s1: index) {
- %A = memref.alloc()[%s0, %s1] : memref<256x1024xf32, affine_map<(d0, d1)[s0, s1] -> (d0*s0 + d1*s1)>>
+ %A = alloc()[%s0, %s1] : memref<256x1024xf32, affine_map<(d0, d1)[s0, s1] -> (d0*s0 + d1*s1)>>
affine.for %i = 0 to 256 {
affine.for %j = 0 to 1024 {
// CHECK: memref<256x1024xf32, #map{{[0-9]+}}>
@@ -141,8 +141,8 @@ func @semi_affine_layout_map(%s0: index, %s1: index) {
// CHECK-LABEL: func @alignment
func @alignment() {
- %A = memref.alloc() {alignment = 32 : i64}: memref<64x128x256xf32, affine_map<(d0, d1, d2) -> (d2, d0, d1)>>
- // CHECK-NEXT: memref.alloc() {alignment = 32 : i64} : memref<256x64x128xf32>
+ %A = alloc() {alignment = 32 : i64}: memref<64x128x256xf32, affine_map<(d0, d1, d2) -> (d2, d0, d1)>>
+ // CHECK-NEXT: alloc() {alignment = 32 : i64} : memref<256x64x128xf32>
return
}
@@ -171,20 +171,20 @@ func @multiple_argument_type(%A: memref<16xf64, #tile>, %B: f64, %C: memref<8xf6
// CHECK-LABEL: func @single_argument_type
// CHECK-SAME: (%[[C:arg[0-9]+]]: memref<2x4xf64>)
func @single_argument_type(%C : memref<8xf64, #tile>) {
- %a = memref.alloc(): memref<8xf64, #tile>
- %b = memref.alloc(): memref<16xf64, #tile>
+ %a = alloc(): memref<8xf64, #tile>
+ %b = alloc(): memref<16xf64, #tile>
%d = constant 23.0 : f64
- %e = memref.alloc(): memref<24xf64>
+ %e = alloc(): memref<24xf64>
call @single_argument_type(%a): (memref<8xf64, #tile>) -> ()
call @single_argument_type(%C): (memref<8xf64, #tile>) -> ()
call @multiple_argument_type(%b, %d, %a, %e): (memref<16xf64, #tile>, f64, memref<8xf64, #tile>, memref<24xf64>) -> f64
return
}
-// CHECK: %[[a:[0-9]+]] = memref.alloc() : memref<2x4xf64>
-// CHECK: %[[b:[0-9]+]] = memref.alloc() : memref<4x4xf64>
+// CHECK: %[[a:[0-9]+]] = alloc() : memref<2x4xf64>
+// CHECK: %[[b:[0-9]+]] = alloc() : memref<4x4xf64>
// CHECK: %cst = constant 2.300000e+01 : f64
-// CHECK: %[[e:[0-9]+]] = memref.alloc() : memref<24xf64>
+// CHECK: %[[e:[0-9]+]] = alloc() : memref<24xf64>
// CHECK: call @single_argument_type(%[[a]]) : (memref<2x4xf64>) -> ()
// CHECK: call @single_argument_type(%[[C]]) : (memref<2x4xf64>) -> ()
// CHECK: call @multiple_argument_type(%[[b]], %cst, %[[a]], %[[e]]) : (memref<4x4xf64>, f64, memref<2x4xf64>, memref<24xf64>) -> f64
@@ -227,8 +227,8 @@ func @ret_multiple_argument_type(%A: memref<16xf64, #tile>, %B: f64, %C: memref<
// CHECK-LABEL: func @ret_single_argument_type
// CHECK-SAME: (%[[C:arg[0-9]+]]: memref<2x4xf64>) -> (memref<4x4xf64>, memref<2x4xf64>)
func @ret_single_argument_type(%C: memref<8xf64, #tile>) -> (memref<16xf64, #tile>, memref<8xf64, #tile>){
- %a = memref.alloc() : memref<8xf64, #tile>
- %b = memref.alloc() : memref<16xf64, #tile>
+ %a = alloc() : memref<8xf64, #tile>
+ %b = alloc() : memref<16xf64, #tile>
%d = constant 23.0 : f64
call @ret_single_argument_type(%a) : (memref<8xf64, #tile>) -> (memref<16xf64, #tile>, memref<8xf64, #tile>)
call @ret_single_argument_type(%C) : (memref<8xf64, #tile>) -> (memref<16xf64, #tile>, memref<8xf64, #tile>)
@@ -237,8 +237,8 @@ func @ret_single_argument_type(%C: memref<8xf64, #tile>) -> (memref<16xf64, #til
return %b, %a: memref<16xf64, #tile>, memref<8xf64, #tile>
}
-// CHECK: %[[a:[0-9]+]] = memref.alloc() : memref<2x4xf64>
-// CHECK: %[[b:[0-9]+]] = memref.alloc() : memref<4x4xf64>
+// CHECK: %[[a:[0-9]+]] = alloc() : memref<2x4xf64>
+// CHECK: %[[b:[0-9]+]] = alloc() : memref<4x4xf64>
// CHECK: %cst = constant 2.300000e+01 : f64
// CHECK: %[[resA:[0-9]+]]:2 = call @ret_single_argument_type(%[[a]]) : (memref<2x4xf64>) -> (memref<4x4xf64>, memref<2x4xf64>)
// CHECK: %[[resB:[0-9]+]]:2 = call @ret_single_argument_type(%[[C]]) : (memref<2x4xf64>) -> (memref<4x4xf64>, memref<2x4xf64>)
@@ -304,11 +304,11 @@ func private @external_func_B(memref<16xf64, #tile>, f64) -> (memref<8xf64, #til
// CHECK-LABEL: func @simply_call_external()
func @simply_call_external() {
- %a = memref.alloc() : memref<16xf64, #tile>
+ %a = alloc() : memref<16xf64, #tile>
call @external_func_A(%a) : (memref<16xf64, #tile>) -> ()
return
}
-// CHECK: %[[a:[0-9]+]] = memref.alloc() : memref<4x4xf64>
+// CHECK: %[[a:[0-9]+]] = alloc() : memref<4x4xf64>
// CHECK: call @external_func_A(%[[a]]) : (memref<4x4xf64>) -> ()
// CHECK-LABEL: func @use_value_of_external
diff --git a/mlir/test/Transforms/pipeline-data-transfer.mlir b/mlir/test/Transforms/pipeline-data-transfer.mlir
index 33d86799e244..80256a17d0a0 100644
--- a/mlir/test/Transforms/pipeline-data-transfer.mlir
+++ b/mlir/test/Transforms/pipeline-data-transfer.mlir
@@ -8,10 +8,10 @@
// CHECK-LABEL: func @loop_nest_dma() {
func @loop_nest_dma() {
- %A = memref.alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 0>
- %Ah = memref.alloc() : memref<32 x f32, affine_map<(d0) -> (d0)>, 1>
+ %A = alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 0>
+ %Ah = alloc() : memref<32 x f32, affine_map<(d0) -> (d0)>, 1>
- %tag = memref.alloc() : memref<1 x f32>
+ %tag = alloc() : memref<1 x f32>
%zero = constant 0 : index
%num_elts = constant 32 : index
@@ -26,13 +26,13 @@ func @loop_nest_dma() {
"do_more_compute"(%i, %j) : (index, index) -> ()
}
}
- memref.dealloc %tag : memref<1 x f32>
- memref.dealloc %Ah : memref<32 x f32, affine_map<(d0) -> (d0)>, 1>
+ dealloc %tag : memref<1 x f32>
+ dealloc %Ah : memref<32 x f32, affine_map<(d0) -> (d0)>, 1>
return
}
-// CHECK: %{{.*}} = memref.alloc() : memref<256xf32>
-// CHECK: %{{.*}} = memref.alloc() : memref<2x32xf32, 1>
-// CHECK-NEXT: %{{.*}} = memref.alloc() : memref<2x1xf32>
+// CHECK: %{{.*}} = alloc() : memref<256xf32>
+// CHECK: %{{.*}} = alloc() : memref<2x32xf32, 1>
+// CHECK-NEXT: %{{.*}} = alloc() : memref<2x1xf32>
// CHECK-NEXT: affine.dma_start %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}} mod 2, %{{.*}}], %{{.*}}[%{{.*}} mod 2, 0], %{{.*}} : memref<256xf32>, memref<2x32xf32, 1>, memref<2x1xf32>
// CHECK-NEXT: affine.for %{{.*}} = 1 to 8 {
// CHECK-NEXT: affine.dma_start %{{.*}}[%{{.*}}], %{{.*}}[%{{.*}} mod 2, %{{.*}}], %{{.*}}[%{{.*}} mod 2, 0], %{{.*}} : memref<256xf32>, memref<2x32xf32, 1>, memref<2x1xf32>
@@ -57,8 +57,8 @@ func @loop_nest_dma() {
// CHECK-NEXT: affine.for %{{.*}} = 0 to 32 {
// CHECK-NEXT: "do_more_compute"(%{{.*}}, %{{.*}}) : (index, index) -> ()
// CHECK-NEXT: }
-// CHECK-NEXT: memref.dealloc %{{.*}} : memref<2x1xf32>
-// CHECK-NEXT: memref.dealloc %{{.*}} : memref<2x32xf32, 1>
+// CHECK-NEXT: dealloc %{{.*}} : memref<2x1xf32>
+// CHECK-NEXT: dealloc %{{.*}} : memref<2x32xf32, 1>
// CHECK-NEXT: return
// CHECK-NEXT:}
@@ -73,19 +73,19 @@ func @loop_step(%arg0: memref<512xf32>,
%c0 = constant 0 : index
%c4 = constant 4 : index
affine.for %i0 = 0 to 512 step 4 {
- %1 = memref.alloc() : memref<4xf32, 1>
- %2 = memref.alloc() : memref<1xi32>
+ %1 = alloc() : memref<4xf32, 1>
+ %2 = alloc() : memref<1xi32>
affine.dma_start %arg0[%i0], %1[%c0], %2[%c0], %c4,
: memref<512xf32>, memref<4xf32, 1>, memref<1xi32>
affine.dma_wait %2[%c0], %c4 : memref<1xi32>
"compute"(%i0) : (index) -> ()
- memref.dealloc %2 : memref<1xi32>
- memref.dealloc %1 : memref<4xf32, 1>
+ dealloc %2 : memref<1xi32>
+ dealloc %1 : memref<4xf32, 1>
}
return
}
-// CHECK: [[BUF:%[0-9]+]] = memref.alloc() : memref<2x4xf32, 1>
-// CHECK: [[TAG:%[0-9]+]] = memref.alloc() : memref<2x1xi32>
+// CHECK: [[BUF:%[0-9]+]] = alloc() : memref<2x4xf32, 1>
+// CHECK: [[TAG:%[0-9]+]] = alloc() : memref<2x1xi32>
// CHECK-NEXT: affine.dma_start %{{.*}}[%{{.*}}], %{{.*}}[(%{{.*}} floordiv 4) mod 2, 0], [[TAG]][(%{{.*}} floordiv 4) mod 2, 0], %{{.*}} : memref<512xf32>, memref<2x4xf32, 1>, memref<2x1xi32>
// CHECK-NEXT: affine.for %{{.*}} = 4 to 512 step 4 {
// CHECK-NEXT: affine.dma_start %{{.*}}[%{{.*}}], %{{.*}}[(%{{.*}} floordiv 4) mod 2, 0], [[TAG]][(%{{.*}} floordiv 4) mod 2, 0], %{{.*}} : memref<512xf32>, memref<2x4xf32, 1>, memref<2x1xi32>
@@ -98,8 +98,8 @@ func @loop_step(%arg0: memref<512xf32>,
// CHECK-NEXT: %{{.*}} = affine.apply [[$FLOOR_MOD_2]]([[SHIFTED]])
// CHECK: affine.dma_wait [[TAG]][(%{{.*}} floordiv 4) mod 2, 0], %{{.*}} : memref<2x1xi32>
// CHECK-NEXT: "compute"(%{{.*}}) : (index) -> ()
-// CHECK-NEXT: memref.dealloc [[TAG]] : memref<2x1xi32>
-// CHECK-NEXT: memref.dealloc [[BUF]] : memref<2x4xf32, 1>
+// CHECK-NEXT: dealloc [[TAG]] : memref<2x1xi32>
+// CHECK-NEXT: dealloc [[BUF]] : memref<2x4xf32, 1>
// CHECK-NEXT: return
// CHECK-NEXT: }
@@ -111,15 +111,15 @@ func @loop_step(%arg0: memref<512xf32>,
func @loop_dma_nested(%arg0: memref<512x32xvector<8xf32>>, %arg1: memref<512x32xvector<8xf32>>, %arg2: memref<512x32xvector<8xf32>>) {
%num_elts = constant 256 : index
%c0 = constant 0 : index
- %0 = memref.alloc() : memref<64x4xvector<8xf32>, 2>
- %1 = memref.alloc() : memref<64x4xvector<8xf32>, 2>
- %2 = memref.alloc() : memref<64x4xvector<8xf32>, 2>
- %3 = memref.alloc() : memref<2xi32>
- %4 = memref.alloc() : memref<2xi32>
- %5 = memref.alloc() : memref<2xi32>
+ %0 = alloc() : memref<64x4xvector<8xf32>, 2>
+ %1 = alloc() : memref<64x4xvector<8xf32>, 2>
+ %2 = alloc() : memref<64x4xvector<8xf32>, 2>
+ %3 = alloc() : memref<2xi32>
+ %4 = alloc() : memref<2xi32>
+ %5 = alloc() : memref<2xi32>
// Prologue for DMA overlap on arg2.
- // CHECK-DAG: [[BUF_ARG2:%[0-9]+]] = memref.alloc() : memref<2x64x4xvector<8xf32>, 2>
- // CHECK-DAG: [[TAG_ARG2:%[0-9]+]] = memref.alloc() : memref<2x2xi32>
+ // CHECK-DAG: [[BUF_ARG2:%[0-9]+]] = alloc() : memref<2x64x4xvector<8xf32>, 2>
+ // CHECK-DAG: [[TAG_ARG2:%[0-9]+]] = alloc() : memref<2x2xi32>
// CHECK: affine.dma_start %{{.*}}[
// CHECK: affine.for %{{.*}} = 1 to 8 {
affine.for %i0 = 0 to 8 {
@@ -130,10 +130,10 @@ func @loop_dma_nested(%arg0: memref<512x32xvector<8xf32>>, %arg1: memref<512x32x
// CHECK: affine.dma_start %{{.*}}[
// CHECK: affine.dma_wait [[TAG_ARG2]]
// Prologue for DMA overlap on arg0, arg1 nested within i0
- // CHECK: [[BUF_ARG0:%[0-9]+]] = memref.alloc() : memref<2x64x4xvector<8xf32>, 2>
- // CHECK: [[BUF_ARG1:%[0-9]+]] = memref.alloc() : memref<2x64x4xvector<8xf32>, 2>
- // CHECK: [[TAG_ARG0:%[0-9]+]] = memref.alloc() : memref<2x2xi32>
- // CHECK: [[TAG_ARG1:%[0-9]+]] = memref.alloc() : memref<2x2xi32>
+ // CHECK: [[BUF_ARG0:%[0-9]+]] = alloc() : memref<2x64x4xvector<8xf32>, 2>
+ // CHECK: [[BUF_ARG1:%[0-9]+]] = alloc() : memref<2x64x4xvector<8xf32>, 2>
+ // CHECK: [[TAG_ARG0:%[0-9]+]] = alloc() : memref<2x2xi32>
+ // CHECK: [[TAG_ARG1:%[0-9]+]] = alloc() : memref<2x2xi32>
// CHECK: affine.dma_start %{{.*}}[
// CHECK: affine.dma_start %{{.*}}[
// CHECK-NEXT: affine.for %{{.*}} = 1 to 8 {
@@ -157,17 +157,17 @@ func @loop_dma_nested(%arg0: memref<512x32xvector<8xf32>>, %arg1: memref<512x32x
// epilogue for arg0, arg1
// CHECK: affine.dma_wait [[TAG_ARG0]]
// CHECK: affine.dma_wait [[TAG_ARG1]]
- // CHECK-DAG: memref.dealloc [[TAG_ARG1]] : memref<2x2xi32>
- // CHECK-DAG: memref.dealloc [[TAG_ARG0]] : memref<2x2xi32>
- // CHECK-DAG: memref.dealloc [[BUF_ARG1]] : memref<2x64x4xvector<8xf32>, 2>
- // CHECK-DAG: memref.dealloc [[BUF_ARG0]] : memref<2x64x4xvector<8xf32>, 2>
+ // CHECK-DAG: dealloc [[TAG_ARG1]] : memref<2x2xi32>
+ // CHECK-DAG: dealloc [[TAG_ARG0]] : memref<2x2xi32>
+ // CHECK-DAG: dealloc [[BUF_ARG1]] : memref<2x64x4xvector<8xf32>, 2>
+ // CHECK-DAG: dealloc [[BUF_ARG0]] : memref<2x64x4xvector<8xf32>, 2>
// epilogue for DMA overlap on %arg2
// CHECK: affine.dma_wait [[TAG_ARG2]]
// Within the epilogue for arg2's DMA, we have the DMAs on %arg1, %arg2 nested.
- // CHECK: [[BUF_ARG0_NESTED:%[0-9]+]] = memref.alloc() : memref<2x64x4xvector<8xf32>, 2>
- // CHECK: [[BUF_ARG1_NESTED:%[0-9]+]] = memref.alloc() : memref<2x64x4xvector<8xf32>, 2>
- // CHECK: [[TAG_ARG0_NESTED:%[0-9]+]] = memref.alloc() : memref<2x2xi32>
- // CHECK: [[TAG_ARG1_NESTED:%[0-9]+]] = memref.alloc() : memref<2x2xi32>
+ // CHECK: [[BUF_ARG0_NESTED:%[0-9]+]] = alloc() : memref<2x64x4xvector<8xf32>, 2>
+ // CHECK: [[BUF_ARG1_NESTED:%[0-9]+]] = alloc() : memref<2x64x4xvector<8xf32>, 2>
+ // CHECK: [[TAG_ARG0_NESTED:%[0-9]+]] = alloc() : memref<2x2xi32>
+ // CHECK: [[TAG_ARG1_NESTED:%[0-9]+]] = alloc() : memref<2x2xi32>
// CHECK: affine.dma_start %{{.*}}[
// CHECK: affine.dma_start %{{.*}}[
// CHECK: affine.for %{{.*}} = 1 to 8 {
@@ -181,20 +181,20 @@ func @loop_dma_nested(%arg0: memref<512x32xvector<8xf32>>, %arg1: memref<512x32x
// CHECK: affine.dma_wait [[TAG_ARG1_NESTED]]
// CHECK: affine.for %{{.*}} = 0 to 4 {
}
- memref.dealloc %5 : memref<2xi32>
- memref.dealloc %4 : memref<2xi32>
- memref.dealloc %3 : memref<2xi32>
- memref.dealloc %2 : memref<64x4xvector<8xf32>, 2>
- memref.dealloc %1 : memref<64x4xvector<8xf32>, 2>
- memref.dealloc %0 : memref<64x4xvector<8xf32>, 2>
+ dealloc %5 : memref<2xi32>
+ dealloc %4 : memref<2xi32>
+ dealloc %3 : memref<2xi32>
+ dealloc %2 : memref<64x4xvector<8xf32>, 2>
+ dealloc %1 : memref<64x4xvector<8xf32>, 2>
+ dealloc %0 : memref<64x4xvector<8xf32>, 2>
return
// CHECK: }
-// CHECK-DAG: memref.dealloc [[TAG_ARG1_NESTED]] : memref<2x2xi32>
-// CHECK-DAG: memref.dealloc [[TAG_ARG0_NESTED]] : memref<2x2xi32>
-// CHECK-DAG: memref.dealloc [[BUF_ARG1_NESTED]] : memref<2x64x4xvector<8xf32>, 2>
-// CHECK-DAG: memref.dealloc [[BUF_ARG0_NESTED]] : memref<2x64x4xvector<8xf32>, 2>
-// CHECK-DAG: memref.dealloc [[TAG_ARG2]] : memref<2x2xi32>
-// CHECK-DAG: memref.dealloc [[BUF_ARG2]] : memref<2x64x4xvector<8xf32>, 2>
+// CHECK-DAG: dealloc [[TAG_ARG1_NESTED]] : memref<2x2xi32>
+// CHECK-DAG: dealloc [[TAG_ARG0_NESTED]] : memref<2x2xi32>
+// CHECK-DAG: dealloc [[BUF_ARG1_NESTED]] : memref<2x64x4xvector<8xf32>, 2>
+// CHECK-DAG: dealloc [[BUF_ARG0_NESTED]] : memref<2x64x4xvector<8xf32>, 2>
+// CHECK-DAG: dealloc [[TAG_ARG2]] : memref<2x2xi32>
+// CHECK-DAG: dealloc [[BUF_ARG2]] : memref<2x64x4xvector<8xf32>, 2>
// CHECK-NEXT: return
}
@@ -205,12 +205,12 @@ func @loop_dma_nested(%arg0: memref<512x32xvector<8xf32>>, %arg1: memref<512x32x
func @loop_dma_dependent(%arg2: memref<512x32xvector<8xf32>>) {
%num_elts = constant 256 : index
%c0 = constant 0 : index
- %0 = memref.alloc() : memref<64x4xvector<8xf32>, 2>
- %1 = memref.alloc() : memref<64x4xvector<8xf32>, 2>
- %2 = memref.alloc() : memref<64x4xvector<8xf32>, 2>
- %3 = memref.alloc() : memref<2xi32>
- %4 = memref.alloc() : memref<2xi32>
- %5 = memref.alloc() : memref<2xi32>
+ %0 = alloc() : memref<64x4xvector<8xf32>, 2>
+ %1 = alloc() : memref<64x4xvector<8xf32>, 2>
+ %2 = alloc() : memref<64x4xvector<8xf32>, 2>
+ %3 = alloc() : memref<2xi32>
+ %4 = alloc() : memref<2xi32>
+ %5 = alloc() : memref<2xi32>
// The two DMAs below are dependent (incoming and outgoing on the same
// memref) in the same iteration; so no pipelining here.
@@ -224,12 +224,12 @@ func @loop_dma_dependent(%arg2: memref<512x32xvector<8xf32>>) {
affine.dma_start %2[%c0, %c0], %arg2[%6, %c0], %5[%c0], %num_elts : memref<64x4xvector<8xf32>, 2>, memref<512x32xvector<8xf32>>, memref<2xi32>
affine.dma_wait %5[%c0], %num_elts : memref<2xi32>
}
- memref.dealloc %5 : memref<2xi32>
- memref.dealloc %4 : memref<2xi32>
- memref.dealloc %3 : memref<2xi32>
- memref.dealloc %2 : memref<64x4xvector<8xf32>, 2>
- memref.dealloc %1 : memref<64x4xvector<8xf32>, 2>
- memref.dealloc %0 : memref<64x4xvector<8xf32>, 2>
+ dealloc %5 : memref<2xi32>
+ dealloc %4 : memref<2xi32>
+ dealloc %3 : memref<2xi32>
+ dealloc %2 : memref<64x4xvector<8xf32>, 2>
+ dealloc %1 : memref<64x4xvector<8xf32>, 2>
+ dealloc %0 : memref<64x4xvector<8xf32>, 2>
return
}
@@ -240,8 +240,8 @@ func @escaping_use(%arg0: memref<512 x 32 x f32>) {
%c32 = constant 32 : index
%num_elt = constant 512 : index
%zero = constant 0 : index
- %Av = memref.alloc() : memref<32 x 32 x f32, 2>
- %tag = memref.alloc() : memref<1 x i32>
+ %Av = alloc() : memref<32 x 32 x f32, 2>
+ %tag = alloc() : memref<1 x i32>
// CHECK-NOT: affine.dma_start
// CHECK: affine.for %{{.*}} = 0 to 16 {
@@ -253,8 +253,8 @@ func @escaping_use(%arg0: memref<512 x 32 x f32>) {
// escaping use; no DMA pipelining / double buffering will be done.
"foo"(%Av) : (memref<32 x 32 x f32, 2>) -> ()
}
- memref.dealloc %tag : memref<1 x i32>
- memref.dealloc %Av : memref<32 x 32 x f32, 2>
+ dealloc %tag : memref<1 x i32>
+ dealloc %Av : memref<32 x 32 x f32, 2>
return
// CHECK: "foo"(%{{[0-9]+}}) : (memref<32x32xf32, 2>) -> ()
// CHECK: }
@@ -268,8 +268,8 @@ func @escaping_tag(%arg0: memref<512 x 32 x f32>) {
%c32 = constant 32 : index
%num_elt = constant 512 : index
%zero = constant 0 : index
- %Av = memref.alloc() : memref<32 x 32 x f32, 2>
- %tag = memref.alloc() : memref<1 x i32>
+ %Av = alloc() : memref<32 x 32 x f32, 2>
+ %tag = alloc() : memref<1 x i32>
// CHECK-NOT: affine.dma_start
// CHECK: affine.for %{{.*}} = 0 to 16 {
@@ -281,8 +281,8 @@ func @escaping_tag(%arg0: memref<512 x 32 x f32>) {
// escaping use; no DMA pipelining / double buffering will be done.
"foo"(%tag) : (memref<1 x i32>) -> ()
}
- memref.dealloc %tag : memref<1 x i32>
- memref.dealloc %Av : memref<32 x 32 x f32, 2>
+ dealloc %tag : memref<1 x i32>
+ dealloc %Av : memref<32 x 32 x f32, 2>
return
// CHECK: "foo"(%{{[0-9]+}}) : (memref<1xi32>) -> ()
// CHECK: }
@@ -297,8 +297,8 @@ func @live_out_use(%arg0: memref<512 x 32 x f32>) -> f32 {
%c32 = constant 32 : index
%num_elt = constant 512 : index
%zero = constant 0 : index
- %Av = memref.alloc() : memref<32 x 32 x f32, 2>
- %tag = memref.alloc() : memref<1 x i32>
+ %Av = alloc() : memref<32 x 32 x f32, 2>
+ %tag = alloc() : memref<1 x i32>
// CHECK-NOT: affine.dma_start
// CHECK: affine.for %{{.*}} = 0 to 16 {
@@ -310,8 +310,8 @@ func @live_out_use(%arg0: memref<512 x 32 x f32>) -> f32 {
}
// Use live out of 'affine.for' op; no DMA pipelining will be done.
%v = affine.load %Av[%zero, %zero] : memref<32 x 32 x f32, 2>
- memref.dealloc %tag : memref<1 x i32>
- memref.dealloc %Av : memref<32 x 32 x f32, 2>
+ dealloc %tag : memref<1 x i32>
+ dealloc %Av : memref<32 x 32 x f32, 2>
return %v : f32
// CHECK: affine.load %{{[0-9]+}}[%{{.*}}, %{{.*}}] : memref<32x32xf32, 2>
// CHECK: return
@@ -325,16 +325,16 @@ func @dynamic_shape_dma_buffer(%arg0: memref<512 x 32 x f32>) {
%num_elt = constant 512 : index
%zero = constant 0 : index
- %Av = memref.alloc(%c32, %c32) : memref<? x ? x f32, 2>
- %tag = memref.alloc() : memref<1 x i32>
+ %Av = alloc(%c32, %c32) : memref<? x ? x f32, 2>
+ %tag = alloc() : memref<1 x i32>
// Double buffering for dynamic shaped buffer.
-// CHECK: memref.alloc(%{{.*}}, %{{.*}}) : memref<?x?xf32, 2>
+// CHECK: alloc(%{{.*}}, %{{.*}}) : memref<?x?xf32, 2>
// CHECK-NEXT: %[[C0:.*]] = constant 0 : index
// CHECK-NEXT: dim %{{.*}}, %[[C0]] : memref<?x?xf32, 2>
// CHECK-NEXT: %[[C1:.*]] = constant 1 : index
// CHECK-NEXT: dim %{{.*}}, %[[C1]] : memref<?x?xf32, 2>
-// CHECK-NEXT: memref.alloc(%{{.*}}, %{{.*}}) : memref<2x?x?xf32, 2>
+// CHECK-NEXT: alloc(%{{.*}}, %{{.*}}) : memref<2x?x?xf32, 2>
// CHECK: affine.dma_start %{{.*}}[%{{.*}}, %{{.*}}], %{{.*}}[%{{.*}} mod 2, 0, 0], %{{.*}}[%{{.*}} mod 2, 0], %{{.*}}
affine.for %kTT = 0 to 16 {
affine.dma_start %arg0[%zero, %zero], %Av[%zero, %zero], %tag[%zero], %num_elt :
@@ -342,7 +342,7 @@ func @dynamic_shape_dma_buffer(%arg0: memref<512 x 32 x f32>) {
memref<? x ? x f32, 2>, memref<1 x i32>
affine.dma_wait %tag[%zero], %num_elt : memref<1 x i32>
}
- memref.dealloc %Av : memref<? x ? x f32, 2>
+ dealloc %Av : memref<? x ? x f32, 2>
return
// CHECK-NEXT: affine.for %{{.*}} = 1 to 16 {
// CHECK: affine.dma_start %{{.*}}[%{{.*}}, %{{.*}}], %{{.*}}[%{{.*}} mod 2, 0, 0], %{{.*}}[%{{.*}} mod 2, 0], %{{.*}}
@@ -358,9 +358,9 @@ func @dynamic_shape_dma_buffer(%arg0: memref<512 x 32 x f32>) {
// before performing any replacement.
// CHECK-LABEL: func @escaping_and_indexed_use_mix
func @escaping_and_indexed_use_mix() {
- %A = memref.alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 0>
- %Ah = memref.alloc() : memref<32 x f32, affine_map<(d0) -> (d0)>, 1>
- %tag = memref.alloc() : memref<1 x f32>
+ %A = alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 0>
+ %Ah = alloc() : memref<32 x f32, affine_map<(d0) -> (d0)>, 1>
+ %tag = alloc() : memref<1 x f32>
%zero = constant 0 : index
%num_elts = constant 32 : index
@@ -372,8 +372,8 @@ func @escaping_and_indexed_use_mix() {
%v = affine.load %Ah[%i] : memref<32 x f32, affine_map<(d0) -> (d0)>, 1>
"foo"(%v) : (f32) -> ()
}
- memref.dealloc %A : memref<256 x f32, affine_map<(d0) -> (d0)>, 0>
- memref.dealloc %Ah : memref<32 x f32, affine_map<(d0) -> (d0)>, 1>
+ dealloc %A : memref<256 x f32, affine_map<(d0) -> (d0)>, 0>
+ dealloc %Ah : memref<32 x f32, affine_map<(d0) -> (d0)>, 1>
return
}
// No replacement.
diff --git a/mlir/test/Transforms/promote-buffers-to-stack.mlir b/mlir/test/Transforms/promote-buffers-to-stack.mlir
index b92c9ff4f668..bf07a1290de3 100644
--- a/mlir/test/Transforms/promote-buffers-to-stack.mlir
+++ b/mlir/test/Transforms/promote-buffers-to-stack.mlir
@@ -21,7 +21,7 @@ func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
^bb1:
br ^bb3(%arg1 : memref<2xf32>)
^bb2:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
br ^bb3(%0 : memref<2xf32>)
^bb3(%1: memref<2xf32>):
@@ -31,7 +31,7 @@ func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-NEXT: cond_br {{.*}}
// CHECK: ^bb2
-// CHECK-NEXT: %[[ALLOCA:.*]] = memref.alloca()
+// CHECK-NEXT: %[[ALLOCA:.*]] = alloca()
// CHECK: test.copy
// CHECK-NEXT: return
@@ -56,7 +56,7 @@ func @condBranchDynamicType(
^bb1:
br ^bb3(%arg1 : memref<?xf32>)
^bb2(%0: index):
- %1 = memref.alloc(%0) : memref<?xf32>
+ %1 = alloc(%0) : memref<?xf32>
test.buffer_based in(%arg1: memref<?xf32>) out(%1: memref<?xf32>)
br ^bb3(%1 : memref<?xf32>)
^bb3(%2: memref<?xf32>):
@@ -67,7 +67,7 @@ func @condBranchDynamicType(
// CHECK-NEXT: cond_br
// CHECK: ^bb2
// CHECK: ^bb2(%[[IDX:.*]]:{{.*}})
-// CHECK-NEXT: %[[ALLOC0:.*]] = memref.alloc(%[[IDX]])
+// CHECK-NEXT: %[[ALLOC0:.*]] = alloc(%[[IDX]])
// CHECK-NEXT: test.buffer_based
// CHECK: br ^bb3
// CHECK-NEXT: ^bb3(%[[ALLOC0:.*]]:{{.*}})
@@ -79,35 +79,35 @@ func @condBranchDynamicType(
// CHECK-LABEL: func @dynamicRanked
func @dynamicRanked(%tensor: tensor<*xf32>) {
%0 = rank %tensor : tensor<*xf32>
- %1 = memref.alloc(%0) : memref<?xindex>
+ %1 = alloc(%0) : memref<?xindex>
return
}
// CHECK-NEXT: %[[RANK:.*]] = rank
-// CHECK-NEXT: %[[ALLOCA:.*]] = memref.alloca(%[[RANK]])
+// CHECK-NEXT: %[[ALLOCA:.*]] = alloca(%[[RANK]])
// -----
// CHECK-LABEL: func @dynamicRanked2D
func @dynamicRanked2D(%tensor: tensor<*xf32>) {
%0 = rank %tensor : tensor<*xf32>
- %1 = memref.alloc(%0, %0) : memref<?x?xindex>
+ %1 = alloc(%0, %0) : memref<?x?xindex>
return
}
// CHECK-NEXT: %[[RANK:.*]] = rank
-// RANK-NEXT: %[[ALLOC:.*]] = memref.alloca(%[[RANK]], %[[RANK]])
-// DEFINDEX-NEXT: %[[ALLOC:.*]] = memref.alloc(%[[RANK]], %[[RANK]])
+// RANK-NEXT: %[[ALLOC:.*]] = alloca(%[[RANK]], %[[RANK]])
+// DEFINDEX-NEXT: %[[ALLOC:.*]] = alloc(%[[RANK]], %[[RANK]])
// -----
// CHECK-LABEL: func @dynamicNoRank
func @dynamicNoRank(%arg0: index) {
- %0 = memref.alloc(%arg0) : memref<?xindex>
+ %0 = alloc(%arg0) : memref<?xindex>
return
}
-// CHECK-NEXT: %[[ALLOC:.*]] = memref.alloc
+// CHECK-NEXT: %[[ALLOC:.*]] = alloc
// -----
@@ -117,10 +117,10 @@ func @dynamicNoRank(%arg0: index) {
// CHECK-LABEL: func @emptyUsesValue
func @emptyUsesValue(%arg0: memref<4xf32>) {
- %0 = memref.alloc() : memref<4xf32>
+ %0 = alloc() : memref<4xf32>
return
}
-// CHECK-NEXT: %[[ALLOCA:.*]] = memref.alloca()
+// CHECK-NEXT: %[[ALLOCA:.*]] = alloca()
// CHECK-NEXT: return
// -----
@@ -138,7 +138,7 @@ func @emptyUsesValue(%arg0: memref<4xf32>) {
func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>)
^bb1:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
br ^bb2(%0 : memref<2xf32>)
^bb2(%1: memref<2xf32>):
@@ -148,7 +148,7 @@ func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-NEXT: cond_br {{.*}}
// CHECK: ^bb1
-// CHECK-NEXT: %[[ALLOCA:.*]] = memref.alloca()
+// CHECK-NEXT: %[[ALLOCA:.*]] = alloca()
// CHECK: test.copy
// CHECK-NEXT: return
@@ -164,7 +164,7 @@ func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-LABEL: func @invCriticalEdge
func @invCriticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>)
^bb1:
@@ -174,7 +174,7 @@ func @invCriticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
return
}
-// CHECK-NEXT: %[[ALLOCA:.*]] = memref.alloca()
+// CHECK-NEXT: %[[ALLOCA:.*]] = alloca()
// CHECK: cond_br
// CHECK: test.copy
// CHECK-NEXT: return
@@ -191,7 +191,7 @@ func @invCriticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-LABEL: func @ifElse
func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cond_br %arg0,
^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>),
@@ -201,15 +201,15 @@ func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
^bb2(%3: memref<2xf32>, %4: memref<2xf32>):
br ^bb3(%3, %4 : memref<2xf32>, memref<2xf32>)
^bb3(%5: memref<2xf32>, %6: memref<2xf32>):
- %7 = memref.alloc() : memref<2xf32>
+ %7 = alloc() : memref<2xf32>
test.buffer_based in(%5: memref<2xf32>) out(%7: memref<2xf32>)
test.copy(%7, %arg2) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %[[ALLOCA0:.*]] = memref.alloca()
+// CHECK-NEXT: %[[ALLOCA0:.*]] = alloca()
// CHECK-NEXT: test.buffer_based
-// CHECK: %[[ALLOCA1:.*]] = memref.alloca()
+// CHECK: %[[ALLOCA1:.*]] = alloca()
// CHECK: test.buffer_based
// CHECK: test.copy(%[[ALLOCA1]]
// CHECK-NEXT: return
@@ -226,7 +226,7 @@ func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-LABEL: func @ifElseNoUsers
func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cond_br %arg0,
^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>),
@@ -240,7 +240,7 @@ func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
return
}
-// CHECK-NEXT: %[[ALLOCA:.*]] = memref.alloca()
+// CHECK-NEXT: %[[ALLOCA:.*]] = alloca()
// CHECK: return
// -----
@@ -259,7 +259,7 @@ func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-LABEL: func @ifElseNested
func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>)
cond_br %arg0,
^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>),
@@ -273,15 +273,15 @@ func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
^bb4(%6: memref<2xf32>):
br ^bb5(%3, %6 : memref<2xf32>, memref<2xf32>)
^bb5(%7: memref<2xf32>, %8: memref<2xf32>):
- %9 = memref.alloc() : memref<2xf32>
+ %9 = alloc() : memref<2xf32>
test.buffer_based in(%7: memref<2xf32>) out(%9: memref<2xf32>)
test.copy(%9, %arg2) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %[[ALLOCA0:.*]] = memref.alloca()
+// CHECK-NEXT: %[[ALLOCA0:.*]] = alloca()
// CHECK-NEXT: test.buffer_based
-// CHECK: %[[ALLOCA1:.*]] = memref.alloca()
+// CHECK: %[[ALLOCA1:.*]] = alloca()
// CHECK: test.buffer_based
// CHECK: test.copy(%[[ALLOCA1]]
// CHECK-NEXT: return
@@ -294,17 +294,17 @@ func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
// CHECK-LABEL: func @redundantOperations
func @redundantOperations(%arg0: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>)
- %1 = memref.alloc() : memref<2xf32>
+ %1 = alloc() : memref<2xf32>
test.buffer_based in(%0: memref<2xf32>) out(%1: memref<2xf32>)
return
}
// CHECK: (%[[ARG0:.*]]: {{.*}})
-// CHECK-NEXT: %[[ALLOCA0:.*]] = memref.alloca()
+// CHECK-NEXT: %[[ALLOCA0:.*]] = alloca()
// CHECK-NEXT: test.buffer_based in(%[[ARG0]]{{.*}} out(%[[ALLOCA0]]
-// CHECK: %[[ALLOCA1:.*]] = memref.alloca()
+// CHECK: %[[ALLOCA1:.*]] = alloca()
// CHECK-NEXT: test.buffer_based in(%[[ALLOCA0]]{{.*}} out(%[[ALLOCA1]]
// CHECK: return
@@ -326,11 +326,11 @@ func @moving_alloc_and_inserting_missing_dealloc(
%arg1: memref<2xf32>) {
cond_br %cond, ^bb1, ^bb2
^bb1:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>)
br ^exit(%0 : memref<2xf32>)
^bb2:
- %1 = memref.alloc() : memref<2xf32>
+ %1 = alloc() : memref<2xf32>
test.buffer_based in(%arg0: memref<2xf32>) out(%1: memref<2xf32>)
br ^exit(%1 : memref<2xf32>)
^exit(%arg2: memref<2xf32>):
@@ -340,9 +340,9 @@ func @moving_alloc_and_inserting_missing_dealloc(
// CHECK-NEXT: cond_br {{.*}}
// CHECK: ^bb1
-// CHECK-NEXT: %{{.*}} = memref.alloca()
+// CHECK-NEXT: %{{.*}} = alloca()
// CHECK: ^bb2
-// CHECK-NEXT: %{{.*}} = memref.alloca()
+// CHECK-NEXT: %{{.*}} = alloca()
// CHECK: test.copy
// CHECK-NEXT: return
@@ -362,10 +362,10 @@ func @nested_regions_and_cond_branch(
^bb1:
br ^bb3(%arg1 : memref<2xf32>)
^bb2:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
test.region_buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) {
^bb0(%gen1_arg0: f32, %gen1_arg1: f32):
- %1 = memref.alloc() : memref<2xf32>
+ %1 = alloc() : memref<2xf32>
test.buffer_based in(%arg1: memref<2xf32>) out(%1: memref<2xf32>)
%tmp1 = math.exp %gen1_arg0 : f32
test.region_yield %tmp1 : f32
@@ -378,9 +378,9 @@ func @nested_regions_and_cond_branch(
// CHECK-NEXT: cond_br {{.*}}
// CHECK: ^bb2
-// CHECK-NEXT: %[[ALLOCA0:.*]] = memref.alloca()
+// CHECK-NEXT: %[[ALLOCA0:.*]] = alloca()
// CHECK: ^bb0
-// CHECK-NEXT: %[[ALLOCA1:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOCA1:.*]] = alloc()
// -----
@@ -394,16 +394,16 @@ func @memref_in_function_results(
%arg0: memref<5xf32>,
%arg1: memref<10xf32>,
%arg2: memref<5xf32>) -> (memref<10xf32>, memref<15xf32>) {
- %x = memref.alloc() : memref<15xf32>
- %y = memref.alloc() : memref<5xf32>
+ %x = alloc() : memref<15xf32>
+ %y = alloc() : memref<5xf32>
test.buffer_based in(%arg0: memref<5xf32>) out(%y: memref<5xf32>)
test.copy(%y, %arg2) : (memref<5xf32>, memref<5xf32>)
return %arg1, %x : memref<10xf32>, memref<15xf32>
}
// CHECK: (%[[ARG0:.*]]: memref<5xf32>, %[[ARG1:.*]]: memref<10xf32>,
// CHECK-SAME: %[[RESULT:.*]]: memref<5xf32>)
-// CHECK: %[[ALLOC:.*]] = memref.alloc()
-// CHECK: %[[ALLOCA:.*]] = memref.alloca()
+// CHECK: %[[ALLOC:.*]] = alloc()
+// CHECK: %[[ALLOCA:.*]] = alloca()
// CHECK: test.copy
// CHECK: return %[[ARG1]], %[[ALLOC]]
@@ -418,20 +418,20 @@ func @nested_region_control_flow(
%arg0 : index,
%arg1 : index) -> memref<?x?xf32> {
%0 = cmpi eq, %arg0, %arg1 : index
- %1 = memref.alloc(%arg0, %arg0) : memref<?x?xf32>
+ %1 = alloc(%arg0, %arg0) : memref<?x?xf32>
%2 = scf.if %0 -> (memref<?x?xf32>) {
scf.yield %1 : memref<?x?xf32>
} else {
- %3 = memref.alloc(%arg0, %arg1) : memref<?x?xf32>
+ %3 = alloc(%arg0, %arg1) : memref<?x?xf32>
scf.yield %1 : memref<?x?xf32>
}
return %2 : memref<?x?xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc(%arg0, %arg0)
+// CHECK: %[[ALLOC0:.*]] = alloc(%arg0, %arg0)
// CHECK-NEXT: %[[ALLOC1:.*]] = scf.if
// CHECK: scf.yield %[[ALLOC0]]
-// CHECK: %[[ALLOC2:.*]] = memref.alloc(%arg0, %arg1)
+// CHECK: %[[ALLOC2:.*]] = alloc(%arg0, %arg1)
// CHECK-NEXT: scf.yield %[[ALLOC0]]
// CHECK: return %[[ALLOC1]]
@@ -443,7 +443,7 @@ func @nested_region_control_flow(
// CHECK-LABEL: func @inner_region_control_flow
func @inner_region_control_flow(%arg0 : index) -> memref<2x2xf32> {
- %0 = memref.alloc() : memref<2x2xf32>
+ %0 = alloc() : memref<2x2xf32>
%1 = test.region_if %0 : memref<2x2xf32> -> (memref<2x2xf32>) then {
^bb0(%arg1 : memref<2x2xf32>):
test.region_if_yield %arg1 : memref<2x2xf32>
@@ -457,7 +457,7 @@ func @inner_region_control_flow(%arg0 : index) -> memref<2x2xf32> {
return %1 : memref<2x2xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: %[[ALLOC1:.*]] = test.region_if
// CHECK-NEXT: ^bb0(%[[ALLOC2:.*]]:{{.*}}):
// CHECK-NEXT: test.region_if_yield %[[ALLOC2]]
@@ -479,20 +479,20 @@ func @loop_alloc(
%step: index,
%buf: memref<2xf32>,
%res: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%2 = cmpi eq, %i, %ub : index
- %3 = memref.alloc() : memref<2xf32>
+ %3 = alloc() : memref<2xf32>
scf.yield %3 : memref<2xf32>
}
test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>)
return
}
-// CHECK-NEXT: %[[ALLOCA:.*]] = memref.alloca()
+// CHECK-NEXT: %[[ALLOCA:.*]] = alloca()
// CHECK-NEXT: scf.for
-// CHECK: %[[ALLOC:.*]] = memref.alloc()
+// CHECK: %[[ALLOC:.*]] = alloc()
// -----
@@ -509,7 +509,7 @@ func @loop_nested_if_no_alloc(
%step: index,
%buf: memref<2xf32>,
%res: memref<2xf32>) {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%2 = cmpi eq, %i, %ub : index
@@ -524,7 +524,7 @@ func @loop_nested_if_no_alloc(
return
}
-// CHECK: %[[ALLOCA0:.*]] = memref.alloca()
+// CHECK: %[[ALLOCA0:.*]] = alloca()
// CHECK-NEXT: %[[ALLOCA1:.*]] = scf.for {{.*}} iter_args(%[[IALLOCA:.*]] =
// CHECK: %[[ALLOCA2:.*]] = scf.if
// CHECK: scf.yield %[[ALLOCA0]]
@@ -544,12 +544,12 @@ func @loop_nested_if_alloc(
%ub: index,
%step: index,
%buf: memref<2xf32>) -> memref<2xf32> {
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
%1 = scf.for %i = %lb to %ub step %step
iter_args(%iterBuf = %buf) -> memref<2xf32> {
%2 = cmpi eq, %i, %ub : index
%3 = scf.if %2 -> (memref<2xf32>) {
- %4 = memref.alloc() : memref<2xf32>
+ %4 = alloc() : memref<2xf32>
scf.yield %4 : memref<2xf32>
} else {
scf.yield %0 : memref<2xf32>
@@ -559,10 +559,10 @@ func @loop_nested_if_alloc(
return %1 : memref<2xf32>
}
-// CHECK: %[[ALLOC0:.*]] = memref.alloc()
+// CHECK: %[[ALLOC0:.*]] = alloc()
// CHECK-NEXT: %[[ALLOC1:.*]] = scf.for {{.*}}
// CHECK: %[[ALLOC2:.*]] = scf.if
-// CHECK: %[[ALLOC3:.*]] = memref.alloc()
+// CHECK: %[[ALLOC3:.*]] = alloc()
// CHECK-NEXT: scf.yield %[[ALLOC3]]
// CHECK: scf.yield %[[ALLOC0]]
// CHECK: scf.yield %[[ALLOC2]]
@@ -575,12 +575,12 @@ func @loop_nested_if_alloc(
// CHECK-LABEL: func @large_buffer_allocation
func @large_buffer_allocation(%arg0: memref<2048xf32>) {
- %0 = memref.alloc() : memref<2048xf32>
+ %0 = alloc() : memref<2048xf32>
test.copy(%0, %arg0) : (memref<2048xf32>, memref<2048xf32>)
return
}
-// CHECK-NEXT: %[[ALLOC:.*]] = memref.alloc()
+// CHECK-NEXT: %[[ALLOC:.*]] = alloc()
// CHECK-NEXT: test.copy
// -----
@@ -591,11 +591,11 @@ func @large_buffer_allocation(%arg0: memref<2048xf32>) {
// CHECK-LABEL: func @indexElementType
func @indexElementType() {
- %0 = memref.alloc() : memref<4xindex>
+ %0 = alloc() : memref<4xindex>
return
}
-// DEFINDEX-NEXT: memref.alloca()
-// BIGINDEX-NEXT: memref.alloca()
-// LOWLIMIT-NEXT: memref.alloc()
-// RANK-NEXT: memref.alloca()
+// DEFINDEX-NEXT: alloca()
+// BIGINDEX-NEXT: alloca()
+// LOWLIMIT-NEXT: alloc()
+// RANK-NEXT: alloca()
// CHECK-NEXT: return
diff --git a/mlir/test/lib/Transforms/TestLinalgTransforms.cpp b/mlir/test/lib/Transforms/TestLinalgTransforms.cpp
index 9139bfe2fa61..a492d496af51 100644
--- a/mlir/test/lib/Transforms/TestLinalgTransforms.cpp
+++ b/mlir/test/lib/Transforms/TestLinalgTransforms.cpp
@@ -266,17 +266,17 @@ static Optional<Value> allocCallBackFn(OpBuilder &b, SubViewOp subView,
OperationFolder *folder) {
SmallVector<int64_t, 4> shape(boundingSubViewSize.size(), -1);
return b
- .create<memref::AllocOp>(
- subView.getLoc(),
- MemRefType::get(shape, subView.getType().getElementType(),
- /*affineMapComposition =*/{}, 3),
- boundingSubViewSize)
+ .create<AllocOp>(subView.getLoc(),
+ MemRefType::get(shape,
+ subView.getType().getElementType(),
+ /*affineMapComposition =*/{}, 3),
+ boundingSubViewSize)
.getResult();
}
// Deallocation callback
static LogicalResult deallocCallBackFn(OpBuilder &b, Value buffer) {
- b.create<memref::DeallocOp>(buffer.getLoc(), buffer);
+ b.create<DeallocOp>(buffer.getLoc(), buffer);
return success();
}
diff --git a/mlir/test/lib/Transforms/TestMemRefStrideCalculation.cpp b/mlir/test/lib/Transforms/TestMemRefStrideCalculation.cpp
index 8b5c507b3794..3d7625973126 100644
--- a/mlir/test/lib/Transforms/TestMemRefStrideCalculation.cpp
+++ b/mlir/test/lib/Transforms/TestMemRefStrideCalculation.cpp
@@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/Pass/Pass.h"
@@ -24,7 +23,7 @@ struct TestMemRefStrideCalculation
/// Traverse AllocOp and compute strides of each MemRefType independently.
void TestMemRefStrideCalculation::runOnFunction() {
llvm::outs() << "Testing: " << getFunction().getName() << "\n";
- getFunction().walk([&](memref::AllocOp allocOp) {
+ getFunction().walk([&](AllocOp allocOp) {
auto memrefType = allocOp.getResult().getType().cast<MemRefType>();
int64_t offset;
SmallVector<int64_t, 4> strides;
diff --git a/mlir/test/lib/Transforms/TestVectorTransforms.cpp b/mlir/test/lib/Transforms/TestVectorTransforms.cpp
index b0dfe0f28b50..17da2d42fa32 100644
--- a/mlir/test/lib/Transforms/TestVectorTransforms.cpp
+++ b/mlir/test/lib/Transforms/TestVectorTransforms.cpp
@@ -11,7 +11,6 @@
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Linalg/IR/LinalgOps.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Vector/VectorOps.h"
@@ -269,7 +268,7 @@ struct TestVectorToLoopPatterns
type.getNumElements() % multiplicity != 0)
return mlir::WalkResult::advance();
auto filterAlloc = [](Operation *op) {
- if (isa<ConstantOp, memref::AllocOp, CallOp>(op))
+ if (isa<ConstantOp, AllocOp, CallOp>(op))
return false;
return true;
};
diff --git a/mlir/test/mlir-cpu-runner/async-value.mlir b/mlir/test/mlir-cpu-runner/async-value.mlir
index a6e39a1e83ba..1460875f8ab8 100644
--- a/mlir/test/mlir-cpu-runner/async-value.mlir
+++ b/mlir/test/mlir-cpu-runner/async-value.mlir
@@ -44,13 +44,13 @@ func @main() {
// Memref allocated inside async.execute region.
// ------------------------------------------------------------------------ //
%token2, %result2 = async.execute[%token0] -> !async.value<memref<f32>> {
- %5 = memref.alloc() : memref<f32>
+ %5 = alloc() : memref<f32>
%c0 = constant 0.25 : f32
- memref.store %c0, %5[]: memref<f32>
+ store %c0, %5[]: memref<f32>
async.yield %5 : memref<f32>
}
%6 = async.await %result2 : !async.value<memref<f32>>
- %7 = memref.cast %6 : memref<f32> to memref<*xf32>
+ %7 = memref_cast %6 : memref<f32> to memref<*xf32>
// CHECK: Unranked Memref
// CHECK-SAME: rank = 0 offset = 0 sizes = [] strides = []
@@ -63,7 +63,7 @@ func @main() {
%token3 = async.execute(%result2 as %unwrapped : !async.value<memref<f32>>) {
%8 = load %unwrapped[]: memref<f32>
%9 = addf %8, %8 : f32
- memref.store %9, %unwrapped[]: memref<f32>
+ store %9, %unwrapped[]: memref<f32>
async.yield
}
async.await %token3 : !async.token
@@ -73,7 +73,7 @@ func @main() {
// CHECK-NEXT: [0.5]
call @print_memref_f32(%7): (memref<*xf32>) -> ()
- memref.dealloc %6 : memref<f32>
+ dealloc %6 : memref<f32>
return
}
diff --git a/mlir/test/mlir-cpu-runner/async.mlir b/mlir/test/mlir-cpu-runner/async.mlir
index 30967928fc62..ce30741e1015 100644
--- a/mlir/test/mlir-cpu-runner/async.mlir
+++ b/mlir/test/mlir-cpu-runner/async.mlir
@@ -24,23 +24,23 @@ func @main() {
%c3 = constant 3.0 : f32
%c4 = constant 4.0 : f32
- %A = memref.alloc() : memref<4xf32>
+ %A = alloc() : memref<4xf32>
linalg.fill(%A, %c0) : memref<4xf32>, f32
// CHECK: [0, 0, 0, 0]
- %U = memref.cast %A : memref<4xf32> to memref<*xf32>
+ %U = memref_cast %A : memref<4xf32> to memref<*xf32>
call @print_memref_f32(%U): (memref<*xf32>) -> ()
// CHECK: Current thread id: [[MAIN:.*]]
// CHECK: [1, 0, 0, 0]
- memref.store %c1, %A[%i0]: memref<4xf32>
+ store %c1, %A[%i0]: memref<4xf32>
call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
call @print_memref_f32(%U): (memref<*xf32>) -> ()
%outer = async.execute {
// CHECK: Current thread id: [[THREAD0:.*]]
// CHECK: [1, 2, 0, 0]
- memref.store %c2, %A[%i1]: memref<4xf32>
+ store %c2, %A[%i1]: memref<4xf32>
call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
call @print_memref_f32(%U): (memref<*xf32>) -> ()
@@ -54,7 +54,7 @@ func @main() {
%inner = async.execute [%noop] {
// CHECK: Current thread id: [[THREAD2:.*]]
// CHECK: [1, 2, 3, 0]
- memref.store %c3, %A[%i2]: memref<4xf32>
+ store %c3, %A[%i2]: memref<4xf32>
call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
call @print_memref_f32(%U): (memref<*xf32>) -> ()
@@ -64,7 +64,7 @@ func @main() {
// CHECK: Current thread id: [[THREAD3:.*]]
// CHECK: [1, 2, 3, 4]
- memref.store %c4, %A[%i3]: memref<4xf32>
+ store %c4, %A[%i3]: memref<4xf32>
call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
call @print_memref_f32(%U): (memref<*xf32>) -> ()
@@ -77,7 +77,7 @@ func @main() {
call @mlirAsyncRuntimePrintCurrentThreadId(): () -> ()
call @print_memref_f32(%U): (memref<*xf32>) -> ()
- memref.dealloc %A : memref<4xf32>
+ dealloc %A : memref<4xf32>
return
}
diff --git a/mlir/test/mlir-cpu-runner/bare_ptr_call_conv.mlir b/mlir/test/mlir-cpu-runner/bare_ptr_call_conv.mlir
index 7e4e65b13898..155c3e858420 100644
--- a/mlir/test/mlir-cpu-runner/bare_ptr_call_conv.mlir
+++ b/mlir/test/mlir-cpu-runner/bare_ptr_call_conv.mlir
@@ -14,12 +14,12 @@ func @simple_add1_add2_test(%arg0: memref<2xf32>, %arg1: memref<2xf32>) {
scf.for %arg2 = %c0 to %c2 step %c1 {
%0 = load %arg0[%arg2] : memref<2xf32>
%1 = addf %0, %cst : f32
- memref.store %1, %arg0[%arg2] : memref<2xf32>
+ store %1, %arg0[%arg2] : memref<2xf32>
// CHECK: 2, 2
%2 = load %arg1[%arg2] : memref<2xf32>
%3 = addf %1, %cst_0 : f32
- memref.store %3, %arg1[%arg2] : memref<2xf32>
+ store %3, %arg1[%arg2] : memref<2xf32>
// CHECK-NEXT: 4, 4
}
return
@@ -39,11 +39,11 @@ func @main()
%c1 = constant 1 : index
%cst = constant 1.000000e+00 : f32
%cst_0 = constant 2.000000e+00 : f32
- %a = memref.alloc() : memref<2xf32>
- %b = memref.alloc() : memref<2xf32>
+ %a = alloc() : memref<2xf32>
+ %b = alloc() : memref<2xf32>
scf.for %i = %c0 to %c2 step %c1 {
- memref.store %cst, %a[%i] : memref<2xf32>
- memref.store %cst, %b[%i] : memref<2xf32>
+ store %cst, %a[%i] : memref<2xf32>
+ store %cst, %b[%i] : memref<2xf32>
}
call @simple_add1_add2_test(%a, %b) : (memref<2xf32>, memref<2xf32>) -> ()
@@ -62,7 +62,7 @@ func @main()
call @printF32(%l3) : (f32) -> ()
call @printNewline() : () -> ()
- memref.dealloc %a : memref<2xf32>
- memref.dealloc %b : memref<2xf32>
+ dealloc %a : memref<2xf32>
+ dealloc %b : memref<2xf32>
return
}
diff --git a/mlir/test/mlir-cpu-runner/global_memref.mlir b/mlir/test/mlir-cpu-runner/global_memref.mlir
index 1d2a2e02dfb2..5dbd75a62a50 100644
--- a/mlir/test/mlir-cpu-runner/global_memref.mlir
+++ b/mlir/test/mlir-cpu-runner/global_memref.mlir
@@ -4,10 +4,10 @@ func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface
func private @print_memref_i32(memref<*xi32>) attributes { llvm.emit_c_interface }
func private @printNewline() -> ()
-memref.global "private" @gv0 : memref<4xf32> = dense<[0.0, 1.0, 2.0, 3.0]>
+global_memref "private" @gv0 : memref<4xf32> = dense<[0.0, 1.0, 2.0, 3.0]>
func @test1DMemref() {
- %0 = memref.get_global @gv0 : memref<4xf32>
- %U = memref.cast %0 : memref<4xf32> to memref<*xf32>
+ %0 = get_global_memref @gv0 : memref<4xf32>
+ %U = memref_cast %0 : memref<4xf32> to memref<*xf32>
// CHECK: rank = 1
// CHECK: offset = 0
// CHECK: sizes = [4]
@@ -21,8 +21,8 @@ func @test1DMemref() {
%c2 = constant 2 : index
%fp0 = constant 4.0 : f32
%fp1 = constant 5.0 : f32
- memref.store %fp0, %0[%c0] : memref<4xf32>
- memref.store %fp1, %0[%c2] : memref<4xf32>
+ store %fp0, %0[%c0] : memref<4xf32>
+ store %fp1, %0[%c2] : memref<4xf32>
// CHECK: rank = 1
// CHECK: offset = 0
// CHECK: sizes = [4]
@@ -33,10 +33,10 @@ func @test1DMemref() {
return
}
-memref.global constant @gv1 : memref<3x2xi32> = dense<[[0, 1],[2, 3],[4, 5]]>
+global_memref constant @gv1 : memref<3x2xi32> = dense<[[0, 1],[2, 3],[4, 5]]>
func @testConstantMemref() {
- %0 = memref.get_global @gv1 : memref<3x2xi32>
- %U = memref.cast %0 : memref<3x2xi32> to memref<*xi32>
+ %0 = get_global_memref @gv1 : memref<3x2xi32>
+ %U = memref_cast %0 : memref<3x2xi32> to memref<*xi32>
// CHECK: rank = 2
// CHECK: offset = 0
// CHECK: sizes = [3, 2]
@@ -49,10 +49,10 @@ func @testConstantMemref() {
return
}
-memref.global "private" @gv2 : memref<4x2xf32> = dense<[[0.0, 1.0], [2.0, 3.0], [4.0, 5.0], [6.0, 7.0]]>
+global_memref "private" @gv2 : memref<4x2xf32> = dense<[[0.0, 1.0], [2.0, 3.0], [4.0, 5.0], [6.0, 7.0]]>
func @test2DMemref() {
- %0 = memref.get_global @gv2 : memref<4x2xf32>
- %U = memref.cast %0 : memref<4x2xf32> to memref<*xf32>
+ %0 = get_global_memref @gv2 : memref<4x2xf32>
+ %U = memref_cast %0 : memref<4x2xf32> to memref<*xf32>
// CHECK: rank = 2
// CHECK: offset = 0
// CHECK: sizes = [4, 2]
@@ -68,7 +68,7 @@ func @test2DMemref() {
%c0 = constant 0 : index
%c1 = constant 1 : index
%fp10 = constant 10.0 : f32
- memref.store %fp10, %0[%c0, %c1] : memref<4x2xf32>
+ store %fp10, %0[%c0, %c1] : memref<4x2xf32>
// CHECK: rank = 2
// CHECK: offset = 0
// CHECK: sizes = [4, 2]
@@ -82,10 +82,10 @@ func @test2DMemref() {
return
}
-memref.global @gv3 : memref<i32> = dense<11>
+global_memref @gv3 : memref<i32> = dense<11>
func @testScalarMemref() {
- %0 = memref.get_global @gv3 : memref<i32>
- %U = memref.cast %0 : memref<i32> to memref<*xi32>
+ %0 = get_global_memref @gv3 : memref<i32>
+ %U = memref_cast %0 : memref<i32> to memref<*xi32>
// CHECK: rank = 0
// CHECK: offset = 0
// CHECK: sizes = []
diff --git a/mlir/test/mlir-cpu-runner/memref_reinterpret_cast.mlir b/mlir/test/mlir-cpu-runner/memref_reinterpret_cast.mlir
index 8094b90cdb13..62a252988c96 100644
--- a/mlir/test/mlir-cpu-runner/memref_reinterpret_cast.mlir
+++ b/mlir/test/mlir-cpu-runner/memref_reinterpret_cast.mlir
@@ -10,7 +10,7 @@ func @main() -> () {
%c1 = constant 1 : index
// Initialize input.
- %input = memref.alloc() : memref<2x3xf32>
+ %input = alloc() : memref<2x3xf32>
%dim_x = dim %input, %c0 : memref<2x3xf32>
%dim_y = dim %input, %c1 : memref<2x3xf32>
scf.parallel (%i, %j) = (%c0, %c0) to (%dim_x, %dim_y) step (%c1, %c1) {
@@ -18,9 +18,9 @@ func @main() -> () {
%val = addi %prod, %j : index
%val_i64 = index_cast %val : index to i64
%val_f32 = sitofp %val_i64 : i64 to f32
- memref.store %val_f32, %input[%i, %j] : memref<2x3xf32>
+ store %val_f32, %input[%i, %j] : memref<2x3xf32>
}
- %unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32>
+ %unranked_input = memref_cast %input : memref<2x3xf32> to memref<*xf32>
call @print_memref_f32(%unranked_input) : (memref<*xf32>) -> ()
// CHECK: rank = 2 offset = 0 sizes = [2, 3] strides = [3, 1]
// CHECK-NEXT: [0, 1, 2]
@@ -39,7 +39,7 @@ func @cast_ranked_memref_to_static_shape(%input : memref<2x3xf32>) {
offset: [0], sizes: [6, 1], strides: [1, 1]
: memref<2x3xf32> to memref<6x1xf32>
- %unranked_output = memref.cast %output
+ %unranked_output = memref_cast %output
: memref<6x1xf32> to memref<*xf32>
call @print_memref_f32(%unranked_output) : (memref<*xf32>) -> ()
// CHECK: rank = 2 offset = 0 sizes = [6, 1] strides = [1, 1] data =
@@ -60,7 +60,7 @@ func @cast_ranked_memref_to_dynamic_shape(%input : memref<2x3xf32>) {
offset: [%c0], sizes: [%c1, %c6], strides: [%c6, %c1]
: memref<2x3xf32> to memref<?x?xf32, offset: ?, strides: [?, ?]>
- %unranked_output = memref.cast %output
+ %unranked_output = memref_cast %output
: memref<?x?xf32, offset: ?, strides: [?, ?]> to memref<*xf32>
call @print_memref_f32(%unranked_output) : (memref<*xf32>) -> ()
// CHECK: rank = 2 offset = 0 sizes = [1, 6] strides = [6, 1] data =
@@ -69,12 +69,12 @@ func @cast_ranked_memref_to_dynamic_shape(%input : memref<2x3xf32>) {
}
func @cast_unranked_memref_to_static_shape(%input : memref<2x3xf32>) {
- %unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32>
+ %unranked_input = memref_cast %input : memref<2x3xf32> to memref<*xf32>
%output = memref_reinterpret_cast %unranked_input to
offset: [0], sizes: [6, 1], strides: [1, 1]
: memref<*xf32> to memref<6x1xf32>
- %unranked_output = memref.cast %output
+ %unranked_output = memref_cast %output
: memref<6x1xf32> to memref<*xf32>
call @print_memref_f32(%unranked_output) : (memref<*xf32>) -> ()
// CHECK: rank = 2 offset = 0 sizes = [6, 1] strides = [1, 1] data =
@@ -88,7 +88,7 @@ func @cast_unranked_memref_to_static_shape(%input : memref<2x3xf32>) {
}
func @cast_unranked_memref_to_dynamic_shape(%input : memref<2x3xf32>) {
- %unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32>
+ %unranked_input = memref_cast %input : memref<2x3xf32> to memref<*xf32>
%c0 = constant 0 : index
%c1 = constant 1 : index
%c6 = constant 6 : index
@@ -96,7 +96,7 @@ func @cast_unranked_memref_to_dynamic_shape(%input : memref<2x3xf32>) {
offset: [%c0], sizes: [%c1, %c6], strides: [%c6, %c1]
: memref<*xf32> to memref<?x?xf32, offset: ?, strides: [?, ?]>
- %unranked_output = memref.cast %output
+ %unranked_output = memref_cast %output
: memref<?x?xf32, offset: ?, strides: [?, ?]> to memref<*xf32>
call @print_memref_f32(%unranked_output) : (memref<*xf32>) -> ()
// CHECK: rank = 2 offset = 0 sizes = [1, 6] strides = [6, 1] data =
diff --git a/mlir/test/mlir-cpu-runner/memref_reshape.mlir b/mlir/test/mlir-cpu-runner/memref_reshape.mlir
index 3ddeb7f83822..aa031802350c 100644
--- a/mlir/test/mlir-cpu-runner/memref_reshape.mlir
+++ b/mlir/test/mlir-cpu-runner/memref_reshape.mlir
@@ -11,7 +11,7 @@ func @main() -> () {
%c1 = constant 1 : index
// Initialize input.
- %input = memref.alloc() : memref<2x3xf32>
+ %input = alloc() : memref<2x3xf32>
%dim_x = dim %input, %c0 : memref<2x3xf32>
%dim_y = dim %input, %c1 : memref<2x3xf32>
scf.parallel (%i, %j) = (%c0, %c0) to (%dim_x, %dim_y) step (%c1, %c1) {
@@ -19,20 +19,20 @@ func @main() -> () {
%val = addi %prod, %j : index
%val_i64 = index_cast %val : index to i64
%val_f32 = sitofp %val_i64 : i64 to f32
- memref.store %val_f32, %input[%i, %j] : memref<2x3xf32>
+ store %val_f32, %input[%i, %j] : memref<2x3xf32>
}
- %unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32>
+ %unranked_input = memref_cast %input : memref<2x3xf32> to memref<*xf32>
call @print_memref_f32(%unranked_input) : (memref<*xf32>) -> ()
// CHECK: rank = 2 offset = 0 sizes = [2, 3] strides = [3, 1]
// CHECK-NEXT: [0, 1, 2]
// CHECK-NEXT: [3, 4, 5]
// Initialize shape.
- %shape = memref.alloc() : memref<2xindex>
+ %shape = alloc() : memref<2xindex>
%c2 = constant 2 : index
%c3 = constant 3 : index
- memref.store %c3, %shape[%c0] : memref<2xindex>
- memref.store %c2, %shape[%c1] : memref<2xindex>
+ store %c3, %shape[%c0] : memref<2xindex>
+ store %c2, %shape[%c1] : memref<2xindex>
// Test cases.
call @reshape_ranked_memref_to_ranked(%input, %shape)
@@ -51,7 +51,7 @@ func @reshape_ranked_memref_to_ranked(%input : memref<2x3xf32>,
%output = memref_reshape %input(%shape)
: (memref<2x3xf32>, memref<2xindex>) -> memref<?x?xf32>
- %unranked_output = memref.cast %output : memref<?x?xf32> to memref<*xf32>
+ %unranked_output = memref_cast %output : memref<?x?xf32> to memref<*xf32>
call @print_memref_f32(%unranked_output) : (memref<*xf32>) -> ()
// CHECK: rank = 2 offset = 0 sizes = [3, 2] strides = [2, 1] data =
// CHECK: [0, 1],
@@ -62,11 +62,11 @@ func @reshape_ranked_memref_to_ranked(%input : memref<2x3xf32>,
func @reshape_unranked_memref_to_ranked(%input : memref<2x3xf32>,
%shape : memref<2xindex>) {
- %unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32>
+ %unranked_input = memref_cast %input : memref<2x3xf32> to memref<*xf32>
%output = memref_reshape %input(%shape)
: (memref<2x3xf32>, memref<2xindex>) -> memref<?x?xf32>
- %unranked_output = memref.cast %output : memref<?x?xf32> to memref<*xf32>
+ %unranked_output = memref_cast %output : memref<?x?xf32> to memref<*xf32>
call @print_memref_f32(%unranked_output) : (memref<*xf32>) -> ()
// CHECK: rank = 2 offset = 0 sizes = [3, 2] strides = [2, 1] data =
// CHECK: [0, 1],
@@ -77,7 +77,7 @@ func @reshape_unranked_memref_to_ranked(%input : memref<2x3xf32>,
func @reshape_ranked_memref_to_unranked(%input : memref<2x3xf32>,
%shape : memref<2xindex>) {
- %dyn_size_shape = memref.cast %shape : memref<2xindex> to memref<?xindex>
+ %dyn_size_shape = memref_cast %shape : memref<2xindex> to memref<?xindex>
%output = memref_reshape %input(%dyn_size_shape)
: (memref<2x3xf32>, memref<?xindex>) -> memref<*xf32>
@@ -91,8 +91,8 @@ func @reshape_ranked_memref_to_unranked(%input : memref<2x3xf32>,
func @reshape_unranked_memref_to_unranked(%input : memref<2x3xf32>,
%shape : memref<2xindex>) {
- %unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32>
- %dyn_size_shape = memref.cast %shape : memref<2xindex> to memref<?xindex>
+ %unranked_input = memref_cast %input : memref<2x3xf32> to memref<*xf32>
+ %dyn_size_shape = memref_cast %shape : memref<2xindex> to memref<?xindex>
%output = memref_reshape %input(%dyn_size_shape)
: (memref<2x3xf32>, memref<?xindex>) -> memref<*xf32>
diff --git a/mlir/test/mlir-cpu-runner/sgemm_naive_codegen.mlir b/mlir/test/mlir-cpu-runner/sgemm_naive_codegen.mlir
index 0b3ca053c443..5653d77ffede 100644
--- a/mlir/test/mlir-cpu-runner/sgemm_naive_codegen.mlir
+++ b/mlir/test/mlir-cpu-runner/sgemm_naive_codegen.mlir
@@ -1,9 +1,9 @@
// RUN: mlir-opt -convert-linalg-to-loops -lower-affine -convert-scf-to-std -convert-vector-to-llvm -convert-std-to-llvm %s | mlir-cpu-runner -O3 -e main -entry-point-result=void -shared-libs=%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext | FileCheck %s
func @main() {
- %A = memref.alloc() : memref<16x16xf32>
- %B = memref.alloc() : memref<16x16xf32>
- %C = memref.alloc() : memref<16x16xf32>
+ %A = alloc() : memref<16x16xf32>
+ %B = alloc() : memref<16x16xf32>
+ %C = alloc() : memref<16x16xf32>
%cf1 = constant 1.00000e+00 : f32
@@ -50,7 +50,7 @@ func @sgemm_naive(%arg0: memref<16x16xf32>, %arg1: memref<16x16xf32>, %arg2: mem
%c0 = constant 0 : index
affine.for %arg3 = 0 to 16 {
affine.for %arg4 = 0 to 16 {
- %m = memref.alloc() : memref<1xf32>
+ %m = alloc() : memref<1xf32>
%v = affine.load %arg2[%arg3, %arg4] : memref<16x16xf32>
affine.store %v, %m[%c0] : memref<1xf32>
affine.for %arg5 = 0 to 16 {
@@ -63,7 +63,7 @@ func @sgemm_naive(%arg0: memref<16x16xf32>, %arg1: memref<16x16xf32>, %arg2: mem
}
%s = affine.load %m[%c0] : memref<1xf32>
affine.store %s, %arg2[%arg3, %arg4] : memref<16x16xf32>
- memref.dealloc %m : memref<1xf32>
+ dealloc %m : memref<1xf32>
}
}
return
diff --git a/mlir/test/mlir-cpu-runner/unranked_memref.mlir b/mlir/test/mlir-cpu-runner/unranked_memref.mlir
index 6edb3260e595..af19f6952ece 100644
--- a/mlir/test/mlir-cpu-runner/unranked_memref.mlir
+++ b/mlir/test/mlir-cpu-runner/unranked_memref.mlir
@@ -39,35 +39,35 @@
// CHECK-SAME: strides = [3, 1]
// CHECK-COUNT-4: [1, 1, 1]
func @main() -> () {
- %A = memref.alloc() : memref<10x3xf32, 0>
+ %A = alloc() : memref<10x3xf32, 0>
%f2 = constant 2.00000e+00 : f32
%f5 = constant 5.00000e+00 : f32
%f10 = constant 10.00000e+00 : f32
- %V = memref.cast %A : memref<10x3xf32, 0> to memref<?x?xf32>
+ %V = memref_cast %A : memref<10x3xf32, 0> to memref<?x?xf32>
linalg.fill(%V, %f10) : memref<?x?xf32, 0>, f32
- %U = memref.cast %A : memref<10x3xf32, 0> to memref<*xf32>
+ %U = memref_cast %A : memref<10x3xf32, 0> to memref<*xf32>
call @print_memref_f32(%U) : (memref<*xf32>) -> ()
- %V2 = memref.cast %U : memref<*xf32> to memref<?x?xf32>
+ %V2 = memref_cast %U : memref<*xf32> to memref<?x?xf32>
linalg.fill(%V2, %f5) : memref<?x?xf32, 0>, f32
- %U2 = memref.cast %V2 : memref<?x?xf32, 0> to memref<*xf32>
+ %U2 = memref_cast %V2 : memref<?x?xf32, 0> to memref<*xf32>
call @print_memref_f32(%U2) : (memref<*xf32>) -> ()
- %V3 = memref.cast %V2 : memref<?x?xf32> to memref<*xf32>
- %V4 = memref.cast %V3 : memref<*xf32> to memref<?x?xf32>
+ %V3 = memref_cast %V2 : memref<?x?xf32> to memref<*xf32>
+ %V4 = memref_cast %V3 : memref<*xf32> to memref<?x?xf32>
linalg.fill(%V4, %f2) : memref<?x?xf32, 0>, f32
- %U3 = memref.cast %V2 : memref<?x?xf32> to memref<*xf32>
+ %U3 = memref_cast %V2 : memref<?x?xf32> to memref<*xf32>
call @print_memref_f32(%U3) : (memref<*xf32>) -> ()
// 122 is ASCII for 'z'.
%i8_z = constant 122 : i8
- %I8 = memref.alloc() : memref<i8>
- memref.store %i8_z, %I8[]: memref<i8>
- %U4 = memref.cast %I8 : memref<i8> to memref<*xi8>
+ %I8 = alloc() : memref<i8>
+ store %i8_z, %I8[]: memref<i8>
+ %U4 = memref_cast %I8 : memref<i8> to memref<*xi8>
call @print_memref_i8(%U4) : (memref<*xi8>) -> ()
- memref.dealloc %A : memref<10x3xf32, 0>
+ dealloc %A : memref<10x3xf32, 0>
call @return_var_memref_caller() : () -> ()
call @return_two_var_memref_caller() : () -> ()
@@ -79,7 +79,7 @@ func private @print_memref_i8(memref<*xi8>) attributes { llvm.emit_c_interface }
func private @print_memref_f32(memref<*xf32>) attributes { llvm.emit_c_interface }
func @return_two_var_memref_caller() {
- %0 = memref.alloca() : memref<4x3xf32>
+ %0 = alloca() : memref<4x3xf32>
%c0f32 = constant 1.0 : f32
linalg.fill(%0, %c0f32) : memref<4x3xf32>, f32
%1:2 = call @return_two_var_memref(%0) : (memref<4x3xf32>) -> (memref<*xf32>, memref<*xf32>)
@@ -89,12 +89,12 @@ func @return_two_var_memref_caller() {
}
func @return_two_var_memref(%arg0: memref<4x3xf32>) -> (memref<*xf32>, memref<*xf32>) {
- %0 = memref.cast %arg0 : memref<4x3xf32> to memref<*xf32>
+ %0 = memref_cast %arg0 : memref<4x3xf32> to memref<*xf32>
return %0, %0 : memref<*xf32>, memref<*xf32>
}
func @return_var_memref_caller() {
- %0 = memref.alloca() : memref<4x3xf32>
+ %0 = alloca() : memref<4x3xf32>
%c0f32 = constant 1.0 : f32
linalg.fill(%0, %c0f32) : memref<4x3xf32>, f32
%1 = call @return_var_memref(%0) : (memref<4x3xf32>) -> memref<*xf32>
@@ -103,7 +103,7 @@ func @return_var_memref_caller() {
}
func @return_var_memref(%arg0: memref<4x3xf32>) -> memref<*xf32> {
- %0 = memref.cast %arg0: memref<4x3xf32> to memref<*xf32>
+ %0 = memref_cast %arg0: memref<4x3xf32> to memref<*xf32>
return %0 : memref<*xf32>
}
@@ -111,8 +111,8 @@ func private @printU64(index) -> ()
func private @printNewline() -> ()
func @dim_op_of_unranked() {
- %ranked = memref.alloc() : memref<4x3xf32>
- %unranked = memref.cast %ranked: memref<4x3xf32> to memref<*xf32>
+ %ranked = alloc() : memref<4x3xf32>
+ %unranked = memref_cast %ranked: memref<4x3xf32> to memref<*xf32>
%c0 = constant 0 : index
%dim_0 = dim %unranked, %c0 : memref<*xf32>
diff --git a/mlir/test/mlir-cpu-runner/utils.mlir b/mlir/test/mlir-cpu-runner/utils.mlir
index 4a2eee086f9d..b823ad4557ea 100644
--- a/mlir/test/mlir-cpu-runner/utils.mlir
+++ b/mlir/test/mlir-cpu-runner/utils.mlir
@@ -5,11 +5,11 @@
func @print_0d() {
%f = constant 2.00000e+00 : f32
- %A = memref.alloc() : memref<f32>
- memref.store %f, %A[]: memref<f32>
- %U = memref.cast %A : memref<f32> to memref<*xf32>
+ %A = alloc() : memref<f32>
+ store %f, %A[]: memref<f32>
+ %U = memref_cast %A : memref<f32> to memref<*xf32>
call @print_memref_f32(%U): (memref<*xf32>) -> ()
- memref.dealloc %A : memref<f32>
+ dealloc %A : memref<f32>
return
}
// PRINT-0D: Unranked Memref base@ = {{.*}} rank = 0 offset = 0 sizes = [] strides = [] data =
@@ -17,12 +17,12 @@ func @print_0d() {
func @print_1d() {
%f = constant 2.00000e+00 : f32
- %A = memref.alloc() : memref<16xf32>
- %B = memref.cast %A: memref<16xf32> to memref<?xf32>
+ %A = alloc() : memref<16xf32>
+ %B = memref_cast %A: memref<16xf32> to memref<?xf32>
linalg.fill(%B, %f) : memref<?xf32>, f32
- %U = memref.cast %B : memref<?xf32> to memref<*xf32>
+ %U = memref_cast %B : memref<?xf32> to memref<*xf32>
call @print_memref_f32(%U): (memref<*xf32>) -> ()
- memref.dealloc %A : memref<16xf32>
+ dealloc %A : memref<16xf32>
return
}
// PRINT-1D: Unranked Memref base@ = {{.*}} rank = 1 offset = 0 sizes = [16] strides = [1] data =
@@ -31,15 +31,15 @@ func @print_1d() {
func @print_3d() {
%f = constant 2.00000e+00 : f32
%f4 = constant 4.00000e+00 : f32
- %A = memref.alloc() : memref<3x4x5xf32>
- %B = memref.cast %A: memref<3x4x5xf32> to memref<?x?x?xf32>
+ %A = alloc() : memref<3x4x5xf32>
+ %B = memref_cast %A: memref<3x4x5xf32> to memref<?x?x?xf32>
linalg.fill(%B, %f) : memref<?x?x?xf32>, f32
%c2 = constant 2 : index
- memref.store %f4, %B[%c2, %c2, %c2]: memref<?x?x?xf32>
- %U = memref.cast %B : memref<?x?x?xf32> to memref<*xf32>
+ store %f4, %B[%c2, %c2, %c2]: memref<?x?x?xf32>
+ %U = memref_cast %B : memref<?x?x?xf32> to memref<*xf32>
call @print_memref_f32(%U): (memref<*xf32>) -> ()
- memref.dealloc %A : memref<3x4x5xf32>
+ dealloc %A : memref<3x4x5xf32>
return
}
// PRINT-3D: Unranked Memref base@ = {{.*}} rank = 3 offset = 0 sizes = [3, 4, 5] strides = [20, 5, 1] data =
@@ -57,13 +57,13 @@ func @vector_splat_2d() {
%c0 = constant 0 : index
%f10 = constant 10.0 : f32
%vf10 = splat %f10: !vector_type_C
- %C = memref.alloc() : !matrix_type_CC
- memref.store %vf10, %C[%c0, %c0]: !matrix_type_CC
+ %C = alloc() : !matrix_type_CC
+ store %vf10, %C[%c0, %c0]: !matrix_type_CC
- %CC = memref.cast %C: !matrix_type_CC to memref<?x?x!vector_type_C>
+ %CC = memref_cast %C: !matrix_type_CC to memref<?x?x!vector_type_C>
call @print_memref_vector_4x4xf32(%CC): (memref<?x?x!vector_type_C>) -> ()
- memref.dealloc %C : !matrix_type_CC
+ dealloc %C : !matrix_type_CC
return
}
diff --git a/mlir/test/mlir-opt/commandline.mlir b/mlir/test/mlir-opt/commandline.mlir
index 206be60d55dc..9e73ba2c775a 100644
--- a/mlir/test/mlir-opt/commandline.mlir
+++ b/mlir/test/mlir-opt/commandline.mlir
@@ -14,7 +14,6 @@
// CHECK-NEXT: llvm_arm_sve
// CHECK-NEXT: llvm_avx512
// CHECK-NEXT: math
-// CHECK-NEXT: memref
// CHECK-NEXT: nvvm
// CHECK-NEXT: omp
// CHECK-NEXT: pdl
diff --git a/mlir/test/mlir-reduce/multiple-function.mlir b/mlir/test/mlir-reduce/multiple-function.mlir
index 64609c1abcee..c668271571f1 100644
--- a/mlir/test/mlir-reduce/multiple-function.mlir
+++ b/mlir/test/mlir-reduce/multiple-function.mlir
@@ -1,7 +1,7 @@
// UNSUPPORTED: system-windows
// RUN: mlir-reduce %s -test %S/failure-test.sh -pass-test function-reducer | FileCheck %s
-// This input should be reduced by the pass pipeline so that only
-// the @simple5 function remains as this is the shortest function
+// This input should be reduced by the pass pipeline so that only
+// the @simple5 function remains as this is the shortest function
// containing the interesting behavior.
// CHECK-NOT: func @simple1() {
@@ -26,7 +26,7 @@ func @simple4(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
^bb1:
br ^bb3(%arg1 : memref<2xf32>)
^bb2:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
br ^bb3(%0 : memref<2xf32>)
^bb3(%1: memref<2xf32>):
"test.crashOp"(%1, %arg2) : (memref<2xf32>, memref<2xf32>) -> ()
diff --git a/mlir/test/mlir-reduce/simple-test.mlir b/mlir/test/mlir-reduce/simple-test.mlir
index 2f5a2c0fd077..4d274e1a39fe 100644
--- a/mlir/test/mlir-reduce/simple-test.mlir
+++ b/mlir/test/mlir-reduce/simple-test.mlir
@@ -6,7 +6,7 @@ func @simple1(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) {
^bb1:
br ^bb3(%arg1 : memref<2xf32>)
^bb2:
- %0 = memref.alloc() : memref<2xf32>
+ %0 = alloc() : memref<2xf32>
br ^bb3(%0 : memref<2xf32>)
^bb3(%1: memref<2xf32>):
return
diff --git a/mlir/unittests/ExecutionEngine/Invoke.cpp b/mlir/unittests/ExecutionEngine/Invoke.cpp
index 0378543c22d5..230c9b6626e6 100644
--- a/mlir/unittests/ExecutionEngine/Invoke.cpp
+++ b/mlir/unittests/ExecutionEngine/Invoke.cpp
@@ -103,7 +103,7 @@ TEST(NativeMemRefJit, ZeroRankMemref) {
std::string moduleStr = R"mlir(
func @zero_ranked(%arg0 : memref<f32>) attributes { llvm.emit_c_interface } {
%cst42 = constant 42.0 : f32
- memref.store %cst42, %arg0[] : memref<f32>
+ store %cst42, %arg0[] : memref<f32>
return
}
)mlir";
@@ -138,7 +138,7 @@ TEST(NativeMemRefJit, RankOneMemref) {
func @one_ranked(%arg0 : memref<?xf32>) attributes { llvm.emit_c_interface } {
%cst42 = constant 42.0 : f32
%cst5 = constant 5 : index
- memref.store %cst42, %arg0[%cst5] : memref<?xf32>
+ store %cst42, %arg0[%cst5] : memref<?xf32>
return
}
)mlir";
@@ -191,8 +191,8 @@ TEST(NativeMemRefJit, BasicMemref) {
%x = constant 2 : index
%y = constant 1 : index
%cst42 = constant 42.0 : f32
- memref.store %cst42, %arg0[%y, %x] : memref<?x?xf32>
- memref.store %cst42, %arg1[%x, %y] : memref<?x?xf32>
+ store %cst42, %arg0[%y, %x] : memref<?x?xf32>
+ store %cst42, %arg1[%x, %y] : memref<?x?xf32>
return
}
)mlir";
@@ -231,9 +231,9 @@ TEST(NativeMemRefJit, JITCallback) {
elt = count++;
std::string moduleStr = R"mlir(
- func private @callback(%arg0: memref<?x?xf32>, %coefficient: i32) attributes { llvm.emit_c_interface }
+ func private @callback(%arg0: memref<?x?xf32>, %coefficient: i32) attributes { llvm.emit_c_interface }
func @caller_for_callback(%arg0: memref<?x?xf32>, %coefficient: i32) attributes { llvm.emit_c_interface } {
- %unranked = memref.cast %arg0: memref<?x?xf32> to memref<*xf32>
+ %unranked = memref_cast %arg0: memref<?x?xf32> to memref<*xf32>
call @callback(%arg0, %coefficient) : (memref<?x?xf32>, i32) -> ()
return
}
More information about the Mlir-commits
mailing list