[llvm] [DirectX] Add Resource uses to Resource Handle map in DXILResourceMap (PR #112798)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 29 10:31:31 PST 2024


bogner wrote:

This approach feels fragile to me. There are a couple of things that make it awkward:
- It seems more generic than it is - we aren't actually interested in the uses of the handle creation call in general, we just want to look through `dx.op.annotateHandle` type calls
- Needing to keep the list of uses up to date makes it too easy to accidentally invalidate the analysis

I think if we need a mapping from an arbitrary instance of a handle to the resource info, we can probably do this more directly by having a helper that walks through defs and specifically recognizes the annotateHandle op as a special case. However, this has a few of its own problems (knowing about dx.op here is a break in abstraction, we currently can have intermediate loads and stores, etc).

Stepping back from this for a second though, for the purpose of issue #106188 (and the PR in #116845) I guess we don't actually really need access to the binding information, we're mostly just interested in the resource type. This should be accessible from the handle itself regardless of source, so I think what we actually want to do here is break out some of the logic in `ResourceMapper::mapBufferType` so we can access information about a resource type from a TargetExtType directly, and then use that rather than the DXILResourceMap when we don't actually care about the binding info.

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


More information about the llvm-commits mailing list