Skip to content

discover VK_EXT_external_memory_host, vkhostallocator and use_weights_in_host_memory option#6531

Merged
nihui merged 5 commits intoTencent:masterfrom
nihui:VK_EXT_external_memory_host
Feb 2, 2026
Merged

discover VK_EXT_external_memory_host, vkhostallocator and use_weights_in_host_memory option#6531
nihui merged 5 commits intoTencent:masterfrom
nihui:VK_EXT_external_memory_host

Conversation

@nihui
Copy link
Member

@nihui nihui commented Feb 2, 2026

No description provided.

@github-actions github-actions bot added the core label Feb 2, 2026
@tencent-adm
Copy link
Member

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov-commenter
Copy link

codecov-commenter commented Feb 2, 2026

Codecov Report

❌ Patch coverage is 6.69145% with 251 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.95%. Comparing base (4ea7bfc) to head (93a5fef).

Files with missing lines Patch % Lines
src/allocator.cpp 0.00% 248 Missing ⚠️
src/gpu.cpp 88.23% 2 Missing ⚠️
src/net.cpp 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6531      +/-   ##
==========================================
- Coverage   93.04%   92.95%   -0.10%     
==========================================
  Files         809      809              
  Lines      256244   256458     +214     
==========================================
- Hits       238430   238394      -36     
- Misses      17814    18064     +250     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nihui nihui changed the title discover VK_EXT_external_memory_host discover VK_EXT_external_memory_host, vkhostallocator and use_weights_in_host_memory option Feb 2, 2026
@nihui nihui requested a review from Copilot February 2, 2026 08:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for the Vulkan extension VK_EXT_external_memory_host, introduces a new VkHostAllocator class that can import host-allocated memory into Vulkan device memory, and adds a new option use_weights_in_host_memory to control whether to use this allocator for weight storage.

Changes:

  • Added Vulkan extension definition for VK_EXT_external_memory_host in header fix file
  • Renamed reserved option field to use_weights_in_host_memory to enable host memory usage for weights
  • Implemented VkHostAllocator that uses external memory import when the extension is available

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/vulkan_header_fix.h Adds structures and constants for VK_EXT_external_memory_host extension
src/option.h Renames use_reserved_2 to use_weights_in_host_memory
src/option.cpp Initializes use_weights_in_host_memory to false
src/net.cpp Uses VkHostAllocator when use_weights_in_host_memory is enabled
src/gpu.h Adds support query and function pointer for VK_EXT_external_memory_host
src/gpu.cpp Implements extension detection and initialization for VK_EXT_external_memory_host
src/allocator.h Declares VkHostAllocator class and allocate_import_host_memory method
src/allocator.cpp Implements VkHostAllocator with external host memory import support and fixes Android Hardware Buffer mapped_ptr initialization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nihui nihui merged commit bdac11b into Tencent:master Feb 2, 2026
107 of 111 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants