[Mlir-commits] [mlir] Remove Pure attribute from Linalg::IndexOp. (PR #68894)

Sanjoy Das llvmlistbot at llvm.org
Sun Dec 10 20:46:12 PST 2023


sanjoy wrote:

@makslevental I don't think we want `CSEable` here, we want `CSEableButOnlyWithinABlock` which is pretty weird.  For instance, it means we can CSE in situation A but not situation B when they are actually equivalent.

```
// A
block0:
  %a = linalg.index 0
  %b = linalg.index 0

// B
block0:
  %a = linalg.index 0
  br ^block1

block1:
  %b = linalg.index 0
```



@joker-eph 's suggestion makes sense to me -- model these operations as "reading" from some location that the `lining.generic` "writes" to before each iteration.  Perhaps these can be modeled using a "loop index" `Resource`, but I'm not sure.

Sending the indices in as a basic block argument seems cleanest of all if that's a viable path.

https://github.com/llvm/llvm-project/pull/68894


More information about the Mlir-commits mailing list