Memref Prefetch Op has no memory side effects decoration in the def td file

The Memref Prefetch operation has no memory side effects, which is a problem because some MLIR passes requires Memory Sideffects.

E.g. we have an optimization that fails because of OwnershipBasedBufferDeallocation’s

  if (!isa<MemoryEffectOpInterface>(op) &&
      !op->hasTrait<OpTrait::HasRecursiveMemoryEffects>() &&
      !isa<CallOpInterface>(op)) {

Is there any plan to add this interface to prefetch? Memref load/store have memory side effects, e.g. LoadOp

  let arguments = (ins Arg<AnyMemRef, "the reference to load from",
                           [MemRead]>:$memref,

We got good improvement by adding prefetch, so it would be great to continue having this option.

Thanks

Nobody needed it enough to contribute a patch™

Suggestion on what the patch would look like. Happy to contribute if no expert can quickly whip out a solution

You can add a getEffects implementation like so llvm-project/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td at eb0c863c447bf2ad4d35cfde39925a655c060fa5 · llvm/llvm-project · GitHub

I have a PR implementing a fix, if anyone is interested in reviewing it