iree-org / iree

A retargetable MLIR-based machine learning compiler and runtime toolkit.
http://iree.dev/
Apache License 2.0
2.86k stars 622 forks source link

Crash in `PadDynamicAllocPass` #19136

Open IanWood1 opened 1 week ago

IanWood1 commented 1 week ago

What happened?

When investigating https://github.com/iree-org/iree/issues/19131, I ran the input IR on the gpu backend (vs cpu) and it ended up causing a crash in PadDynamicAllocPass.

Here (https://gist.github.com/IanWood1/c2a3ac9cc3801faedead58a958a20b88) is the stacktrace as well as the IR before the failing pass (https://gist.github.com/IanWood1/b8ca10625ffb5efdc1ce1780fab71847).

Steps to reproduce your issue

  1. Grab https://gist.github.com/IanWood1/4b3885614cd81e5ba95b9e63586bf678
  2. Run iree-compile --iree-hal-target-device=hip --iree-hip-target=gfx1100 --iree-dispatch-creation-enable-aggressive-fusion=true quantmm.mlir

Version information

2311e0458bfe47a9f9a681c5e1da5dc0dedd7129

Additional context

Looks like the upper bound is just below INT64_MAX, so it attempts to create a large memref subview

  %21:2 = util.assume.int 
      %10<udiv = 4096>, 
      %20<umin = 0, umax = 9007199254740991>
    : index, index

https://github.com/iree-org/iree/blob/3bb7fd2384e522638994e768c816f39d9af99906/compiler/src/iree/compiler/Codegen/Common/PadDynamicAlloc.cpp#L49-L54