-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[CPU] Add interface to release compiled model internal memory #26262
Merged
dmitry-gorokhov
merged 42 commits into
openvinotoolkit:master
from
maxnick:release_interface
Sep 5, 2024
Merged
Changes from 33 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
f211b01
Rename mem manager to mem block
maxnick f723360
Remove isAllocated check from the memory class
maxnick 5ced5f4
Fix tests build
maxnick e2440df
Remove incorrect checs from Input
maxnick d1b544e
Remove incorrect isDefined checks
maxnick 0bf53b8
Redefine Split createPrimitive method
maxnick e20e7f2
Memory subsytem refactoring
maxnick 3db1617
Merge remote-tracking branch 'origin/master' into flush_interim_tensors
maxnick bbbcdf4
Avoid using key word
maxnick 692c02f
Bug fixes
maxnick ece559e
Fix linear offset calculation in static block
maxnick b9da47a
Fix output edges processing
maxnick 8304f77
Add allocate and free actions
maxnick e58f01a
Add flushing intermediate tensors
maxnick 334b757
Linter fixes
maxnick b0d0964
Avoid calling getData to not allocated memory
maxnick bfe54a0
Merge remote-tracking branch 'origin/master' into flush_interim_tensors
maxnick f6a8dee
Reallocate only defined mem
maxnick 01bb93c
Refactor the Reorder node
maxnick 1adc24c
Refactor set output default ptr
maxnick fd3b99a
Adapt FC executor
maxnick 548e2d7
Fix dynamic memory allocation
maxnick 2722aeb
Adapt Multimodal node
maxnick 906d649
Skip memory refresh for inPlace up
maxnick 5c41e7c
Skip string tensors in memory refresh
maxnick f570550
Avoid reading uninit data in Loop initialization
maxnick 5b9d05a
Merge remote-tracking branch 'origin/master' into flush_interim_tensors
maxnick da1f184
Fix loop trip count reading in Loop
maxnick adeeb02
Introduce memory block stub
maxnick e4dbf00
WA in the Pad node to prevent reading uninit data
maxnick 8ad88fb
Introduce network level memory control unit
maxnick 4f38db6
Fix Loop for dynamic shape applications
maxnick 8704e61
Add an interface call releasing intermediate memory
maxnick 18795a1
Merge commit '98188ad2efa74d3b73ec6d2e5bd6ac80c4fdb570' into release_…
maxnick ba03485
Code cleanup
maxnick 8fa7847
Merge remote-tracking branch 'origin/master' into release_interface
maxnick 7cbffb4
Rename release_buffers to release_memory
maxnick 5177db5
Trivial behavior test
maxnick af6e6eb
Fix clang format
maxnick 8f71310
Modify behavior test to avoid recompilation
maxnick 18485db
Fix mem size calculation for half byte types
maxnick 92b7244
Merge remote-tracking branch 'origin/master' into release_interface
maxnick 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
There are no files selected for viewing
This file contains 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 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 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 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 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 |
---|---|---|
|
@@ -342,5 +342,13 @@ void CompiledModel::export_model(std::ostream& modelStream) const { | |
serializer << m_model; | ||
} | ||
|
||
void CompiledModel::release_buffers() { | ||
for (auto&& graph : m_graphs) { | ||
GraphGuard::Lock graph_lock{graph}; | ||
auto ctx = graph_lock._graph.getGraphContext(); | ||
ctx->getNetworkMemoryControl()->releaseMemory(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add releasing the oneDNN caches here? |
||
} | ||
|
||
} // namespace intel_cpu | ||
} // namespace ov |
This file contains 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 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think about a better name. This one doens't really clarify which buffers are really implied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if several requests are still running and I will call this method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a really good question. This is merely a POC to evaluate the memory footprint in a specific application. So the exact interface level solution is a subject of an arch review.