KULeuven-MICAS / snax-mlir

Driving Snax with MLIR
https://kuleuven-micas.github.io/snax-mlir/
Other
12 stars 3 forks source link

assertion is triggered when using `snax-copy-to-dma` #247

Open JosseVanDelm opened 2 weeks ago

JosseVanDelm commented 2 weeks ago

I found that the following code will trigger an assertion when using snax-copy-to-dma

builtin.module {
  builtin.module {
    func.func public @simple_mult(%arg0 : memref<?x?xi8, "L3">, %arg1 : memref<?x?xi8, "L1">) {
      "memref.copy"(%arg0, %arg1) : (memref<?x?xi8, "L3">, memref<?x?xi8, "L1">) -> ()
      func.return
    }
  }
  builtin.module {
    func.func public @simple_mult(%arg0 : memref<?x?xi8, strided<[1, 16]>, "L3">, %arg1 : memref<?x?xi8, strided<[1, 16]>, "L1">) {
      "memref.copy"(%arg0, %arg1) : (memref<?x?xi8, strided<[1, 16]>, "L3">, memref<?x?xi8, strided<[1, 16]>, "L1">) -> ()
      func.return
    }
  }
}

Will give the error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/xdsl/pattern_rewriter.py", line 802, in _process_worklist
    self.pattern.match_and_rewrite(op, rewriter)
  File "/usr/local/lib/python3.10/dist-packages/xdsl/pattern_rewriter.py", line 431, in impl
    func(self, op, rewriter)
  File "/repo/compiler/transforms/snax_copy_to_dma.py", line 369, in match_and_rewrite
    assert lcb[-1].bound is not None
AssertionError

Checked on 75f31930c4fb4604d4a7aa18960c7fcd16dc091b