<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64073>64073</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [mlir] `lower-affine` pass error: Reduction operation type not supported
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Colloportus0
      </td>
    </tr>
</table>

<pre>
    MLIR built at commit  585cbe3f
Reproduced with:  
`mlir-opt -lower-affine temp.mlir`

temp.mlir:
``` milr 
%170 = affine.parallel (%arg3, %arg4) = (0, 0) to (11, 6) reduce ("assign") -> (memref<11x6xf32>) {
  %alloc_39 = memref.alloc() : memref<11x6xf32>
  affine.yield %alloc_39 : memref<11x6xf32>
}

```
 
trace:
```console
temp.mlir:1:14: error: Reduction operation type not supported
      %170 = affine.parallel (%arg3, %arg4) = (0, 0) to (11, 6) reduce ("assign") -> (memref<11x6xf32>) {
             ^
LLVM ERROR: Failed to infer result type(s).
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: mlir-opt -lower-affine temp.mlir
 #0 0x0000000104710f18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/workspace/build/bin/mlir-opt+0x1002f8f18)
 #1 0x000000010470f1b4 llvm::sys::RunSignalHandlers() (/workspace/build/bin/mlir-opt+0x1002f71b4)
 #2 0x00000001047115c4 SignalHandler(int) (/workspace/build/bin/mlir-opt+0x1002f95c4)
 #3 0x00000001be7894c4 (/usr/lib/system/libsystem_platform.dylib+0x1803414c4)
 #4 0x00000001be771ee0 (/usr/lib/system/libsystem_pthread.dylib+0x180329ee0)
 #5 0x00000001be6ac340 (/usr/lib/system/libsystem_c.dylib+0x180264340)
 #6 0x000000010467bd74 llvm::report_fatal_error(llvm::Twine const&, bool) (/workspace/build/bin/mlir-opt+0x100263d74)
 #7 0x000000010467bba0 llvm::report_fatal_error(llvm::Twine const&, bool) (/workspace/build/bin/mlir-opt+0x100263ba0)
 #8 0x00000001048adb28 mlir::arith::ConstantOp::build(mlir::OpBuilder&, mlir::OperationState&, mlir::TypedAttr) (/workspace/build/bin/mlir-opt+0x100495b28)
 #9 0x00000001051a347c mlir::arith::ConstantOp mlir::OpBuilder::create<mlir::arith::ConstantOp, mlir::TypedAttr&>(mlir::Location, mlir::TypedAttr&) (/workspace/build/bin/mlir-opt+0x100d8b47c)
#10 0x000000010489e924 mlir::arith::getIdentityValue(mlir::arith::AtomicRMWKind, mlir::Type, mlir::OpBuilder&, mlir::Location) (/workspace/build/bin/mlir-opt+0x100486924)
#11 0x0000000106529534 (anonymous namespace)::AffineParallelLowering::matchAndRewrite(mlir::affine::AffineParallelOp, mlir::PatternRewriter&) const (/workspace/build/bin/mlir-opt+0x102111534)
#12 0x00000001083930f0 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>)::$_2::operator()() const (/workspace/build/bin/mlir-opt+0x103f7b0f0)
#13 0x00000001083903ec mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>) (/workspace/build/bin/mlir-opt+0x103f783ec)
#14 0x0000000106db0c5c (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) (/workspace/build/bin/mlir-opt+0x102998c5c)
#15 0x0000000106da915c (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) (/workspace/build/bin/mlir-opt+0x10299115c)
#16 0x0000000106dab2a4 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>*) (/workspace/build/bin/mlir-opt+0x1029932a4)
#17 0x000000010652ecf4 (anonymous namespace)::LowerAffinePass::runOnOperation() (/workspace/build/bin/mlir-opt+0x102116cf4)
#18 0x0000000106d602a8 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/workspace/build/bin/mlir-opt+0x1029482a8)
#19 0x0000000106d60998 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/workspace/build/bin/mlir-opt+0x102948998)
#20 0x0000000106d6282c mlir::PassManager::run(mlir::Operation*) (/workspace/build/bin/mlir-opt+0x10294a82c)
#21 0x0000000106d5ad14 performActions(llvm::raw_ostream&, std::__1::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) (/workspace/build/bin/mlir-opt+0x102942d14)
#22 0x0000000106d5a368 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_1>(long, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) (/workspace/build/bin/mlir-opt+0x102942368)
#23 0x0000000106dd834c mlir::splitAndProcessBuffer(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/workspace/build/bin/mlir-opt+0x1029c034c)
#24 0x0000000106d54d1c mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/workspace/build/bin/mlir-opt+0x10293cd1c)
#25 0x0000000106d5518c mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/workspace/build/bin/mlir-opt+0x10293d18c)
#26 0x000000010441b510 main (/workspace/build/bin/mlir-opt+0x100003510)
#27 0x000000010faa5088 

``` 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWU1v4zjS_jXMheiAIiVZOuTgTmK8jTdBAqcxezQokrK5TZFakurE8-sXlOTYlPPR9ix2BoM1ZjoSP6rqeapYVZKoc3KthbgC2VeQ3VzQzm-Mvbo2SpnWWN85dFEZvr26v_u2hFUnlYfUQ2aaRnoIsyJjlSA1QDcAzZeitYZ3THD4LP0GkDmEwwzIUaOk_WJaD78o8yzsF1rXUgvoRdNehjmQo3Ft_-9-nMxfZQz_wUYquxOMs2SGICA3cBB42VJLlRIKAlwAnFG7JgBfw-EyBbjsFwNcoDCMwoA34T5JwkAeBqwIKAYJeKAIYBxmvgByG8Yb0VhRA3KdJC_5S00wILe97NnXwTDYa1TKsBUZVA5bLvuxXnIYnsM3JY0iRkhbKRSfyPtoI5jdHFL5StwodiTYUiaOyWVGO6PEsROS8H8aFAtrTRiBy0CTl0ZD0wpL-yu_bQXUxkPXtSGABN-BCb-_sLsOfiAbiby7--0e3i6XD8sAd0GlEjyol7oWFlrhOuV7xAAXDuDyctj2eHc7f7qFrqvCIaGw6tbQisBG2LzxvnWBeLwAeLGWftNVl8w0AC-U-rn786W15p-CeYAX0rlOOIAXkGoOpWaq4wL6jYDMUreBF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