# Resource in MemoryEffects

**URL:** <https://discourse.llvm.org/t/resource-in-memoryeffects/89048>\
**Category:** MLIR\
**Created:** [December 4, 2025, 9:11am UTC](https://discourse.llvm.org/t/resource-in-memoryeffects/89048 "2025-12-04T09:11:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![superlopuh](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/superlopuh/32/18416_2.png) [@superlopuh](https://discourse.llvm.org/u/superlopuh)\
**Post date:** [December 4, 2025, 9:11am UTC](https://discourse.llvm.org/t/resource-in-memoryeffects/89048/1 "2025-12-04T09:11:33Z")

</div>

Hi all, is there any documentation other than comments in the code about the design of `MemoryEffect`s? I’m curious specifically about `Resource`, which is a relatively generic name, and yields quite a lot of irrelevant results when searching in the codebase, and nothing when searching the web.

I’m working on representing register reads and writes as memory effects, to leverage generic transformations safely. It seems that leveraging `Resource` is the right approach, I just wanted to check that this is the case, and whether it would make sense to carry the specific register written to/from in the `Resource` subclass or not.

---

<div class="post-metadata">

**Author:** ![ftynse](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/ftynse/32/18644_2.png) [@ftynse](https://discourse.llvm.org/u/ftynse)\
**Post date:** [December 4, 2025, 9:50am UTC](https://discourse.llvm.org/t/resource-in-memoryeffects/89048/2 "2025-12-04T09:50:45Z")

</div>

There isn’t much documentation, potentially in some old mailing list archives. You can create new resources rather easily [llvm-project/mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td at 52113cf14f8f8163d921e2ed7be9378be2b1a857 · llvm/llvm-project · GitHub](https://github.com/llvm/llvm-project/blob/52113cf14f8f8163d921e2ed7be9378be2b1a857/mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td#L20-L39) but at this point I expect most of the code to assume there is only the default resource.

Separately, documenting and cleaning this up would be nice, in particular we have a whole `SideEffect` interface that doesn’t seem actively used upstream unless through `MemoryEffects`…
