Skip to content

[Metal] Track resource residency using MTL::ResidencySet instead of useResource.#1340

Draft
manon-traverse wants to merge 22 commits into
llvm:mainfrom
Traverse-Research:metal-residency-sets
Draft

[Metal] Track resource residency using MTL::ResidencySet instead of useResource.#1340
manon-traverse wants to merge 22 commits into
llvm:mainfrom
Traverse-Research:metal-residency-sets

Conversation

@manon-traverse

Copy link
Copy Markdown
Contributor

Based on #1331, #1332, #1333, and #1337

The metal backend requires these annoying loops and direct metal calls for managing residency and hazard tracking using useResource. To get behaviour closer to DX12 and Vulkan we can track residency instead with residency sets.

This does mean we also need to track hazards between encoders using a MTL::Fence, which this PR also does.

On top of that some drive-by changes were made

  • Remove incorrect usage of PendingScope on the blit encoder, no need for memoryBarrier there
  • Lazily create the actual compute encoder, user may only want to blit
  • Add the acceleration structure encoder to getActiveEncoder
  • Only clear the PendingScope instead of placing a redundant barrier when closing a compute encoder

…code.

Most tests pass on VK with migration code :D

Get vulkan in a working state, apart from features not supported on dx12.
@manon-traverse manon-traverse changed the title [MTL] Track resource residency using MTL::ResidencySet instead of useResource. [Metal] Track resource residency using MTL::ResidencySet instead of useResource. Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant