Skip to content
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

synchronize inputs to onnx session on GPU #1061

Merged
merged 1 commit into from
Mar 6, 2025

Conversation

isaacrob-roboflow
Copy link
Contributor

Description

Running GPU preprocessed inference while another process used the GPU sometimes caused the ONNX model to produce unexpected output. By asking the ONNX session to ensure that its input buffer is synchronized prior to running inference, we resolve this issue. We also cause faster inference. With CPU based preprocessing, my test based on our client's use case runs in 130ms. With GPU, we get 40ms. With synchronization, we get 22ms.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How has this change been tested, please provide a testcase or example of how you tested the change?

I ran inference while training a neural network in another process. Without synchronization, the model would sometimes produce confidences that were all 0s or all 1s. With synchronization, I no longer observe that behavior.

If there's interest I could try to build a test case that covers this, but it would have to run on GPU and may randomly pass anyway.

Any specific deployment considerations

For example, documentation changes, usability, usage/costs, secrets, etc.

Docs

  • Docs updated? What were the changes:

@grzegorz-roboflow grzegorz-roboflow merged commit bf4cb5b into main Mar 6, 2025
30 checks passed
@grzegorz-roboflow grzegorz-roboflow deleted the onnx_input_synchronization branch March 6, 2025 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants