readonly mappedfile wrapper class, use_mapped_model_loading option - #6537
Conversation
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6537 +/- ##
==========================================
+ Coverage 92.94% 93.06% +0.11%
==========================================
Files 809 847 +38
Lines 256714 266763 +10049
==========================================
+ Hits 238613 248268 +9655
- Misses 18101 18495 +394 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR introduces an optional memory-mapped (“mmap”) path for loading model weights to reduce load time and memory copying, along with a new Option::use_mapped_model_loading toggle and updated in-memory load APIs to return size_t bytes consumed.
Changes:
- Add
MappedFilewrapper and ause_mapped_model_loadingOptionto enable mapped model loading on supported platforms. - Switch
Net::load_param(const unsigned char*)/Net::load_model(const unsigned char*)return types frominttosize_t. - Update the squeezenet test configuration and docs to use/reflect the new option and signatures.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_squeezenet.cpp | Enables mapped model loading and related options for one benchmark/test configuration. |
| src/platform.h.in | Adds cross-platform MappedFile implementation and required includes for mmap/Windows mapping. |
| src/option.h | Adds use_mapped_model_loading and adjusts option field layout/types. |
| src/option.cpp | Initializes the newly added Option fields. |
| src/net.h | Updates in-memory load APIs to return size_t. |
| src/net.cpp | Implements mapped-file loading path in Net::load_model(path) and updates in-memory load implementations. |
| docs/how-to-use-and-FAQ/ncnn-load-model.md | Updates documentation to reflect size_t return types for in-memory loading. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
z-image-ncnn 1024x1024