Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VK_EXT_external_memory_metal #2414

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

aitor-lunarg
Copy link
Contributor

No description provided.

@aitor-lunarg aitor-lunarg force-pushed the VK_EXT_external_memory_metal branch from a1ac4fa to 9d16d7e Compare August 20, 2024 08:32
@oddhack
Copy link
Contributor

oddhack commented Aug 21, 2024

@aitor-lunarg process-wise, we require that extension number and flag bits be reserved by a commit to main prior to the extension development branch actually being able to use them. I don't know where this extension stands deployment / release-wise, but we need to separate out the reservations and accept those first, to avoid a race condition (see extension 597 for a guide to what that PR would look like).

@aitor-lunarg
Copy link
Contributor Author

Before moving forward with this extension, there's one concern that we need to address. Metal does not provide all Vulkan formats, so there are times where an implementation will emulate some of them. Why is this an issue:

Implementations may decide to emulate those formats with an internal representation such that those formats are backed by multiple textures. Taking MoltenVK as an example implementation with VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM. This format is backed by 3 textures (one for each plane), so it is not possible to export all of the backing textures through a single handle unfortunately as of now.

There are 3 potential solutions that come to mind to fix this issue as we stand:

  1. Force implementation to have those multi-planar emulated implementations in a single texture if they want to export it. Unsure if there could be issues with precision when sampling that would prevent this approach.
  2. Modify the API for this extension to allow exporting more than one single handle for these cases. This would lead to a query call first to understand how many handles the user will get, and then get the handles. However, this is quite counter intuitive since we imply that a VkDeviceMemory object may not be a single handle. When importing we would also need to provide all handles as the implementation expects them. I don't really like this approach.
  3. Modify the handle to MTLHeap and force implementations to have all resources stored in those objects if they want to export them. Again, this also has issues since not all Apple hardware may support MTLHeap and there are a few known restrictions that make it ugly for non-Apple silicon GPUs.

@linyaa-kiwi would it be possible to bring this up for discussion this coming SI meeting? I would like to understand if other similar extensions have run into similar issues and how they've tackled them if so. Or just get general feedback/ideas about this issue.

cc/ @kocdemir

@linyaa-kiwi
Copy link
Contributor

@linyaa-kiwi would it be possible to bring this up for discussion this coming SI meeting? I would like to understand if other similar extensions have run into similar issues and how they've tackled them if so. Or just get general feedback/ideas about this issue.

@aitor-lunarg Would you like to discuss in today's SI meeting? If not, what week works best for you?

chapters/memory.adoc Outdated Show resolved Hide resolved
@aitor-lunarg aitor-lunarg force-pushed the VK_EXT_external_memory_metal branch from c3095fa to 44958d2 Compare December 4, 2024 18:31
@aitor-lunarg
Copy link
Contributor Author

aitor-lunarg commented Dec 4, 2024

Seems like GitHub is having some issues, would it be possible to retrigger the failed checks (failed due to a 500 error when trying to clone required repos)? Nvm, I saw I can do that myself

@aitor-lunarg aitor-lunarg force-pushed the VK_EXT_external_memory_metal branch from bf0a84a to 5eabdbb Compare December 4, 2024 21:41
Copy link
Contributor

@linyaa-kiwi linyaa-kiwi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some more points for improvement today.

appendices/VK_EXT_external_memory_metal.adoc Outdated Show resolved Hide resolved
chapters/capabilities.adoc Show resolved Hide resolved
chapters/memory.adoc Outdated Show resolved Hide resolved
proposals/VK_EXT_external_memory_metal.adoc Show resolved Hide resolved
chapters/VK_EXT_external_memory_metal/device_memory.adoc Outdated Show resolved Hide resolved
chapters/VK_EXT_external_memory_metal/device_memory.adoc Outdated Show resolved Hide resolved
chapters/memory.adoc Outdated Show resolved Hide resolved
proposals/VK_EXT_external_memory_metal.adoc Show resolved Hide resolved
@linyaa-kiwi
Copy link
Contributor

Thanks. I'll give it another review today.

@linyaa-kiwi
Copy link
Contributor

Thanks for the fixes! LGTM and I approve for merge.

@linyaa-kiwi linyaa-kiwi added this to the Signed-off to Merge milestone Jan 14, 2025
@aitor-lunarg aitor-lunarg force-pushed the VK_EXT_external_memory_metal branch from d9c1a63 to 4bfa185 Compare January 15, 2025 03:48
@aitor-lunarg
Copy link
Contributor Author

Rebased to get Vulkan 1.4 so things don't explode when I propagate to VVL and CTS for release

@oddhack
Copy link
Contributor

oddhack commented Jan 15, 2025

@linyaa-kiwi @aitor-lunarg on the maintenance call, we were unsure about where this sits for release - do we want to ratify it first? Please loop in @r-potter but I'm expecting this will not go out this week, at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants