onnxruntime icon indicating copy to clipboard operation
onnxruntime copied to clipboard

[Java] JNI refactor for OrtSession

Open Craigacp opened this issue 3 years ago • 13 comments

Description:

Following on from #12281 and #12013 this PR fixes the JNI error handling in OrtSession. OrtJniUtil is the remaining bit of unfixed JNI code, and that will probably ripple a little into the Java side bits to add some additional constructors to make things simpler.

This change is independent of #12281.

Motivation and Context

  • Why is this change required? What problem does it solve? The error handling and exception throwing in the JNI code doesn't handle repeated errors very well. See #11451.
  • If it fixes an open issue, please link to the issue here. Partial fix for #11451.

Craigacp avatar Aug 05 '22 20:08 Craigacp

This pull request introduces 5 alerts when merging 633c0b9475121a1be8402e7f31c14bfccabc7c9c into 0c6037b5abe571fc43a55ef7a9d2f846820fbe5d - view on LGTM.com

new alerts:

  • 5 for Uncontrolled data used in path expression

lgtm-com[bot] avatar Aug 10 '22 03:08 lgtm-com[bot]

This pull request introduces 5 alerts when merging 633c0b9 into 0c6037b - view on LGTM.com

new alerts:

  • 5 for Uncontrolled data used in path expression

Couple of issues remain plus LGTM warnings. They look strange, perhaps you need to merge the master.

yuslepukhin avatar Aug 10 '22 21:08 yuslepukhin

This pull request introduces 5 alerts when merging 633c0b9 into 0c6037b - view on LGTM.com new alerts:

  • 5 for Uncontrolled data used in path expression

Couple of issues remain plus LGTM warnings. They look strange, perhaps you need to merge the master.

The LGTM warnings seem to be from unrelated bits of code in flatbuffers? When I view this link - https://lgtm.com/projects/g/microsoft/onnxruntime/rev/pr-f6192b6c34d254dc8eb2561c99185bdf5290189a there's nothing related to any of my code. Am I looking in the wrong place?

Craigacp avatar Aug 10 '22 21:08 Craigacp

Oh, looks like the main branch was renamed from master to main so the target got a bit confused. I'll try to fix it.

Craigacp avatar Aug 10 '22 22:08 Craigacp

I rebased on the new main and hopefully that fixed it.

Craigacp avatar Aug 10 '22 22:08 Craigacp

/azp run MacOS CI Pipeline,Windows CPU CI Pipeline,Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,onnxruntime-python-checks-ci-pipeline

yuslepukhin avatar Aug 11 '22 21:08 yuslepukhin

/azp run Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux Nuphar CI Pipeline,Linux OpenVINO CI Pipeline

yuslepukhin avatar Aug 11 '22 21:08 yuslepukhin

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Aug 11 '22 21:08 azure-pipelines[bot]

/azp run orttraining-amd-gpu-ci-pipeline,orttraining-linux-ci-pipeline,orttraining-linux-gpu-ci-pipeline,orttraining-ortmodule-distributed onnxruntime-binary-size-checks-ci-pipeline

yuslepukhin avatar Aug 11 '22 21:08 yuslepukhin

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Aug 11 '22 21:08 azure-pipelines[bot]

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Aug 11 '22 21:08 azure-pipelines[bot]

/azp run orttraining-amd-gpu-ci-pipeline,orttraining-linux-ci-pipeline orttraining-linux-gpu-ci-pipeline orttraining-ortmodule-distributed onnxruntime-binary-size-checks-ci-pipeline

yuslepukhin avatar Aug 11 '22 21:08 yuslepukhin

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Aug 11 '22 21:08 azure-pipelines[bot]

I refactored the logic a little around where MSVC was complaining. Now it checks to see if there are too many inputs/outputs, if so it throws an exception, otherwise it downcasts to int32_t and then uses that as the loop variable.

Craigacp avatar Aug 12 '22 00:08 Craigacp

Please, rebase against the latest before I restart the CI builds.

yuslepukhin avatar Aug 12 '22 16:08 yuslepukhin

Please, rebase against the latest before I restart the CI builds.

Done.

Craigacp avatar Aug 12 '22 17:08 Craigacp

/azp run MacOS CI Pipeline,Windows CPU CI Pipeline,Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,onnxruntime-python-checks-ci-pipeline

yuslepukhin avatar Aug 12 '22 17:08 yuslepukhin

/azp run Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux Nuphar CI Pipeline,Linux OpenVINO CI Pipeline

yuslepukhin avatar Aug 12 '22 17:08 yuslepukhin

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Aug 12 '22 17:08 azure-pipelines[bot]

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Aug 12 '22 17:08 azure-pipelines[bot]

/azp run orttraining-amd-gpu-ci-pipeline orttraining-linux-ci-pipeline orttraining-linux-gpu-ci-pipeline

yuslepukhin avatar Aug 12 '22 17:08 yuslepukhin

No pipelines are associated with this pull request.

azure-pipelines[bot] avatar Aug 12 '22 17:08 azure-pipelines[bot]

/azp run MacOS CI Pipeline,Windows CPU CI Pipeline,Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,onnxruntime-python-checks-ci-pipeline

yuslepukhin avatar Aug 12 '22 22:08 yuslepukhin

/azp run Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux Nuphar CI Pipeline,Linux OpenVINO CI Pipeline

yuslepukhin avatar Aug 12 '22 22:08 yuslepukhin

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Aug 12 '22 22:08 azure-pipelines[bot]

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Aug 12 '22 22:08 azure-pipelines[bot]

azp run MacOS CI Pipeline,Windows CPU CI Pipeline,Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,onnxruntime-python-checks-ci-pipeline

yuslepukhin avatar Aug 15 '22 17:08 yuslepukhin

/azp run Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux Nuphar CI Pipeline,Linux OpenVINO CI Pipeline

yuslepukhin avatar Aug 15 '22 17:08 yuslepukhin

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Aug 15 '22 17:08 azure-pipelines[bot]

/azp run MacOS CI Pipeline,Windows CPU CI Pipeline,Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,ONNX Runtime Web CI Pipeline,onnxruntime-python-checks-ci-pipeline

yuslepukhin avatar Aug 15 '22 17:08 yuslepukhin