Skip to content

vk: support VK_EXT_external_memory_host#348

Merged
kvark merged 1 commit intomainfrom
vk-external-memory-host
Apr 24, 2026
Merged

vk: support VK_EXT_external_memory_host#348
kvark merged 1 commit intomainfrom
vk-external-memory-host

Conversation

@kvark
Copy link
Copy Markdown
Owner

@kvark kvark commented Apr 24, 2026

No description provided.

Importing `Memory::External(ExternalMemorySource::HostAllocation(ptr))`
used to crash with `ERROR_INVALID_EXTERNAL_HANDLE` because:

1. The extension wasn't being enabled on the device — the
   `VkImportMemoryHostPointerInfoEXT` struct chained into
   `vkAllocateMemory` was unknown to the driver.
2. The memory type index was picked by `memory_type_bits.ilog2()`,
   which doesn't account for the host-pointer compatibility set the
   driver advertises via `vkGetMemoryHostPointerPropertiesEXT`.
3. `allocationSize` wasn't rounded up to
   `minImportedHostPointerAlignment`.

Fix all three. When the extension is unsupported the capability stays
off and attempts to import a host allocation now panic with a clear
message pointing at `Capabilities::external_memory_host` rather than
going into `vkAllocateMemory` and getting rejected.

Verified end-to-end with meganeura's `external_buffer` example on
AMD Radeon 780M / RADV PHOENIX (input bytes traverse producer-GPU →
meganeura-GPU with no CPU roundtrip; GPU-vs-CPU max error 2.4e-7).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@kvark kvark enabled auto-merge (rebase) April 24, 2026 00:38
@kvark kvark merged commit 72c30c1 into main Apr 24, 2026
12 checks passed
@kvark kvark deleted the vk-external-memory-host branch April 24, 2026 00:44
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