microsoft / microsoft/onnxruntime
[Feature Request] Memory map .ort files by default
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 179
Description
Describe the feature request
.ort files - being flat buffer-based - are more amenable to being memory mapped and consumed in-place. But - by default - the OnnxRuntime loads an .ort file by reading it into memory. This forces the entire file to be accessed up-front, and loads the file into private memory pages. Memory mapping the file would defer accesses and allow for the opportunity of memory pages to be shared should the model be used by multiple sessions or processes.
Describe scenario use case
Using OnnxRuntime to run inferencing using large models, allowing for the opportunity of lazily loading the model and sharing memory pages of constant tensor data.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source files, tests, or entry points are named. Start by locating the default .ort model-loading path and its existing loading tests, then determine how memory mapping would affect lazy access and sharing. Done means .ort models are memory mapped by default without breaking existing inference behavior, with coverage for the new loading path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- machine-learning, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100