[Core] Add parallel mapping population on Windows#36586
Merged
praasz merged 26 commits intoJul 8, 2026
Conversation
…into almilosz/hint-prefetch-win
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Windows support for ov::MappedMemory::hint_prefetch by introducing a shared “page population” helper and wiring it into the Windows vm_prefetch() path, plus updates the file-load benchmark tests for portability and MiB-based sizing.
Changes:
- Implement Windows
vm_prefetch()behavior usingPrefetchVirtualMemory(async hint) and a parallel “touch pages” fallback (sync). - Consolidate cross-platform parallel page-touching into new
prefetch_pages.{hpp,cpp}and reuse it on Linux/Windows. - Update
FileLoadBenchmarkto use MiB terminology and guard Linux-only behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/core/tests/file_load_benchmark.cpp | Updates benchmark file sizing/printing and Linux-only cache eviction/mlock logic. |
| src/common/util/src/prefetch_pages.hpp | Adds internal declaration for shared parallel page population helper. |
| src/common/util/src/prefetch_pages.cpp | Implements parallel page population via multi-threaded page touching. |
| src/common/util/src/os/win/win_mmap_object.cpp | Implements MappedMemory::hint_prefetch on Windows using vm_prefetch. |
| src/common/util/src/os/win/win_memory.cpp | Implements Windows vm_prefetch using PrefetchVirtualMemory or populate_pages. |
| src/common/util/src/os/lin/lin_mmap_object.cpp | Switches hint region computation helper and uses shared one_mib. |
| src/common/util/src/os/lin/lin_memory.cpp | Removes local page-population code and reuses prefetch_pages.*. |
| src/common/util/include/openvino/util/mmap_object.hpp | Introduces one_mib constant and shared hint-region helpers. |
| src/common/util/CMakeLists.txt | Adds private include path for internal util sources (to include prefetch_pages.hpp). |
Comment on lines
+40
to
+53
| void populate_pages(void* ptr, size_t size, size_t num_threads) noexcept { | ||
| const auto page_size = static_cast<size_t>(get_system_page_size()); | ||
| const auto chunk_size = std::max<size_t>(align_size_up(size / num_threads, page_size), one_mib); | ||
|
|
||
| std::vector<std::thread> threads; | ||
| threads.reserve(ceil_div(size, chunk_size)); | ||
|
|
||
| for (auto first = reinterpret_cast<const uint8_t*>(ptr), last = first + size; first < last; first += chunk_size) { | ||
| threads.emplace_back(PageToucher{first, std::min(first + chunk_size, last), page_size}); | ||
| } | ||
| for (auto& t : threads) { | ||
| t.join(); | ||
| } | ||
| } |
praasz
reviewed
Jun 29, 2026
praasz
left a comment
Contributor
There was a problem hiding this comment.
Add unit test for new code.
praasz
reviewed
Jul 1, 2026
praasz
reviewed
Jul 2, 2026
…into almilosz/hint-prefetch-win
praasz
reviewed
Jul 3, 2026
almilosz
commented
Jul 3, 2026
almilosz
commented
Jul 3, 2026
praasz
approved these changes
Jul 6, 2026
t-jankowski
requested changes
Jul 7, 2026
t-jankowski
approved these changes
Jul 7, 2026
olpipi
reviewed
Jul 7, 2026
|
|
||
| namespace ov::util { | ||
|
|
||
| void populate_pages(void* ptr, size_t size, size_t num_threads) noexcept; |
Contributor
There was a problem hiding this comment.
It is better to put declaration into a common header. Thus we have less chances to make typos and so on.
olpipi
approved these changes
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details:
ov::MappedMemory::hint_prefetchfor Windows ospopulate_pages()to extract common code and to avoid adding it as util tool for now.hint_prefetch()are located in src\core\tests\mmap_object.cpp. Test for util::vm_prefetch was added to memory_test.cppTickets:
AI Assistance: