onnxruntime icon indicating copy to clipboard operation
onnxruntime copied to clipboard

[java] Adding ability to load a model from a memory mapped byte buffer

Open Craigacp opened this issue 1 year ago • 2 comments
trafficstars

Description

Adds support for constructing an OrtSession from a java.nio.ByteBuffer. These buffers can be memory mapped from files which means there doesn't need to be copies of the model protobuf held in Java, reducing peak memory usage during session construction.

Motivation and Context

Reduces memory usage on model construction by not requiring as many copies on the Java side. Should help with #19599.

Craigacp avatar Mar 25 '24 16:03 Craigacp

Hello, are there any updates on this PR? This would be a very valuable addition to the Java integration of ORT.

demq avatar May 17 '24 04:05 demq

@yuslepukhin please could you review this after the 1.18 release? And #18998 which is also a small straightforward improvement.

Craigacp avatar May 17 '24 13:05 Craigacp

/azp run Windows ARM64 QNN CI Pipeline,Windows x64 QNN CI Pipeline,Windows CPU CI Pipeline,Windows GPU CUDA CI Pipeline,Windows GPU DML CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline

skottmckay avatar Sep 12 '24 23:09 skottmckay

/azp run Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux OpenVINO CI Pipeline,Linux QNN CI Pipeline,MacOS CI Pipeline,orttraining-amd-gpu-ci-pipeline,orttraining-linux-ci-pipeline,orttraining-linux-gpu-ci-pipeline,orttraining-ortmodule-distributed,onnxruntime-binary-size-checks-ci-pipeline

skottmckay avatar Sep 12 '24 23:09 skottmckay

/azp run Big Models,Linux Android Emulator QNN CI Pipeline,Android CI Pipeline,iOS CI Pipeline,ONNX Runtime React Native CI Pipeline

skottmckay avatar Sep 12 '24 23:09 skottmckay

Azure Pipelines successfully started running 5 pipeline(s).

azure-pipelines[bot] avatar Sep 12 '24 23:09 azure-pipelines[bot]

Azure Pipelines successfully started running 8 pipeline(s).

azure-pipelines[bot] avatar Sep 12 '24 23:09 azure-pipelines[bot]

Azure Pipelines successfully started running 10 pipeline(s).

azure-pipelines[bot] avatar Sep 12 '24 23:09 azure-pipelines[bot]

@craigacp this might need a merge with main due to the pipeline definitions being updated. I can't run the 'Python format' CI with the current set of changes and it's required to be able to checkin.

skottmckay avatar Sep 13 '24 02:09 skottmckay

@Craigacp this might need a merge with main due to the pipeline definitions being updated. I can't run the 'Python format' CI with the current set of changes and it's required to be able to checkin.

Ok, I've rebased the branch on main, should be good now.

Craigacp avatar Sep 13 '24 14:09 Craigacp

/azp run Windows ARM64 QNN CI Pipeline,Windows x64 QNN CI Pipeline,Windows CPU CI Pipeline,Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline

skottmckay avatar Sep 13 '24 21:09 skottmckay

/azp run Linux OpenVINO CI Pipeline,Linux QNN CI Pipeline,MacOS CI Pipeline,orttraining-amd-gpu-ci-pipeline,orttraining-linux-ci-pipeline,orttraining-linux-gpu-ci-pipeline,orttraining-ortmodule-distributed,onnxruntime-binary-size-checks-ci-pipeline,Big Models,Linux Android Emulator QNN CI Pipeline

skottmckay avatar Sep 13 '24 21:09 skottmckay

/azp run Android CI Pipeline,iOS CI Pipeline,ONNX Runtime React Native CI Pipeline

skottmckay avatar Sep 13 '24 21:09 skottmckay

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Sep 13 '24 21:09 azure-pipelines[bot]

Azure Pipelines successfully started running 8 pipeline(s).

azure-pipelines[bot] avatar Sep 13 '24 21:09 azure-pipelines[bot]

Azure Pipelines successfully started running 9 pipeline(s).

azure-pipelines[bot] avatar Sep 13 '24 21:09 azure-pipelines[bot]

/azp run Windows GPU CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,orttraining-amd-gpu-ci-pipeline,orttraining-linux-ci-pipeline,orttraining-linux-gpu-ci-pipeline,orttraining-ortmodule-distributed,Android CI Pipeline,iOS CI Pipeline,ONNX Runtime React Native CI Pipeline

skottmckay avatar Sep 14 '24 05:09 skottmckay

Azure Pipelines successfully started running 7 pipeline(s).

azure-pipelines[bot] avatar Sep 14 '24 05:09 azure-pipelines[bot]

/azp run Windows GPU CI Pipeline,orttraining-amd-gpu-ci-pipeline,orttraining-ortmodule-distributed,Android CI Pipeline,iOS CI Pipeline,ONNX Runtime React Native CI Pipeline

skottmckay avatar Sep 15 '24 02:09 skottmckay

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Sep 15 '24 02:09 azure-pipelines[bot]

/azp run Windows GPU CI Pipeline,orttraining-amd-gpu-ci-pipeline,orttraining-ortmodule-distributed,Android CI Pipeline,iOS CI Pipeline,ONNX Runtime React Native CI Pipeline

skottmckay avatar Sep 15 '24 02:09 skottmckay

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Sep 15 '24 02:09 azure-pipelines[bot]