[Mlir-commits] [mlir] [mlir][vector] Implement speculation for vector.transferx ops (PR #111533)

Kunwar Grover llvmlistbot at llvm.org
Tue Oct 8 09:43:09 PDT 2024


Groverkss wrote:

> Not really an expert, but going over https://mlir.llvm.org/docs/Rationale/SideEffectsAndSpeculation/, it's not clear to me why these Ops fall under `ConditionallySpeculatable`? Could you expand a bit?
> 
> I just want to make sure that this is not working around limitations in the LICM logic (which I am not familiar with).

I can give an overview of my reasoning.

LICM can only hoist operations (atleast for now) that do not have any memory side effects and are speculatable (do not cause undefined behavior).

Operations working on tensors (linalg.generic, vector.transfer_*, etc.) operations have no memory side effects and don't have undefined behavior generally (atleast from my understanding of tensors having value semantics). So when operating on tensors, these operations are "Pure".

Operations working on memrefs (memref versions of linalg.generic, vector.transfer_*, etc.) operations have clearly defined memory side effects but may introduce out of bound behavior. So they are non-speculatable (atleast without any further analysis).

Since linalg.generic/vector.transfer_... ops work on both memref and tensors, they have to be "ConditionallySpeculatable", the condition being if they have memref or tensor semantics.

I don't think this is working around limitations of LICM, rather it is how LICM expects operations to give it information to work.

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


More information about the Mlir-commits mailing list