-
Notifications
You must be signed in to change notification settings - Fork 4.1k
[QNN-EP] Implement file mapped weights feature #26952
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
Merged
edgchen1
merged 19 commits into
microsoft:main
from
CodeLinaro:dev/calvnguy/file_mapped_weights
Jan 27, 2026
Merged
Changes from 11 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
ff2d8d5
[QNN-EP] Implement file mapped weights feature
5a25c35
Address PR comments
2e451ae
Remove unnecessary underscore
8bb49a3
Adderss PR comments
d606a95
Added unit tests with feature disabled
b52e987
Merge remote-tracking branch 'code_linaro/master' into dev/calvnguy/f…
4a9d1cb
Use smart pointers and wil library to close
b59b045
ran lintrunner, separated retrieval of file size from reading context
716b02d
Return empty result on GetCapability() call if
ed85fa5
Update logic surrounding rpc mem library initialization
fbbe148
spacing for error message
134d6fc
Resolve pointer issues with CreateContextFromListAsyncWithCallback()
9a7b4f0
Addrses minor PR comments
5b9a73e
Decouple DMA mapping of weights and file mapping of context bin
2026635
Merge remote-tracking branch 'code_linaro/master' into dev/calvnguy/f…
b507234
linting
f9d3731
Mark enable_file_mapped_weights as unused in
3abe5a9
Ensure dma mapping offset + size do not exceed file memory space
ebf245c
Remove state changes to QnnBackendManager::file_mapped_weights_enabled_
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
309 changes: 272 additions & 37 deletions
309
onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
37 changes: 37 additions & 0 deletions
37
onnxruntime/core/providers/qnn/builder/qnn_file_mapping_callback_interface.h
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <string> | ||
|
|
||
| #include <QnnContext.h> | ||
|
|
||
| #include "core/providers/qnn/ort_api.h" | ||
| #include "core/providers/qnn/builder/qnn_def.h" | ||
|
|
||
| namespace onnxruntime { | ||
| namespace qnn { | ||
|
|
||
| class FileMappingCallbackInterface { | ||
| public: | ||
| virtual ~FileMappingCallbackInterface() = default; | ||
|
|
||
| virtual Status GetContextBinMappedMemoryPtr(const std::string& bin_filepath, | ||
| void** mapped_data_ptr) = 0; | ||
|
|
||
| virtual Qnn_ErrorHandle_t MapDmaData(Qnn_ContextBinaryDataRequest_t request, | ||
| Qnn_ContextBinaryDmaDataResponse_t* response, | ||
| void* mapped_data_ptr) = 0; | ||
| virtual Qnn_ErrorHandle_t ReleaseDmaData(Qnn_ContextBinaryDmaDataMem_t data_mem, | ||
| void* mapped_data_ptr) = 0; | ||
|
|
||
| virtual Qnn_ErrorHandle_t MapRawData(Qnn_ContextBinaryDataRequest_t request, | ||
| Qnn_ContextBinaryRawDataResponse_t* response, | ||
| void* mapped_data_ptr) = 0; | ||
| virtual Qnn_ErrorHandle_t ReleaseRawData(Qnn_ContextBinaryRawDataMem_t data_mem, | ||
| void* mapped_data_ptr) = 0; | ||
| }; | ||
|
|
||
| } // namespace qnn | ||
| } // namespace onnxruntime |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.