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

Fix ordering of value info in GraphProto creation #20691

Merged
merged 3 commits into from
May 24, 2024

Conversation

sspintel
Copy link
Contributor

@sspintel sspintel commented May 16, 2024

Description

Graph member value_info_ (unordered_set) is ordered before its values are added to the graph proto.

Motivation and Context

  • Without this ordering, the model proto used by the OpenVINO EP is not deterministic and varies across runs.
  • Since the model proto varies, it affects caching attempts by OpenVINO.

Q: If creating a vector to have ordered elements is costly, should we make value_info_ a std::set that is sorted according to NodeArg names?

Related PR about ordering initializers: #14631

@sspintel sspintel marked this pull request as ready for review May 21, 2024 13:28
@adrianlizarraga
Copy link
Contributor

/azp run Linux CPU CI Pipeline, Linux CPU Minimal Build E2E CI Pipeline, Linux GPU CI Pipeline, Linux GPU TensorRT CI Pipeline, Linux OpenVINO CI Pipeline, MacOS CI Pipeline, ONNX Runtime Web CI Pipeline, onnxruntime-binary-size-checks-ci-pipeline, Linux QNN CI Pipeline

Copy link

Azure Pipelines successfully started running 9 pipeline(s).

@adrianlizarraga
Copy link
Contributor

/azp run Windows CPU CI Pipeline, Windows GPU CI Pipeline, Windows GPU TensorRT CI Pipeline, Windows ARM64 QNN CI Pipeline, orttraining-linux-ci-pipeline, orttraining-linux-gpu-ci-pipeline, orttraining-ortmodule-distributed, Windows x64 QNN CI Pipeline, Linux MIGraphX CI Pipeline, Big Models

Copy link

Azure Pipelines successfully started running 10 pipeline(s).

@adrianlizarraga
Copy link
Contributor

/azp run ONNX Runtime React Native CI Pipeline, orttraining-amd-gpu-ci-pipeline

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@adrianlizarraga
Copy link
Contributor

/azp run Linux Android Emulator QNN CI Pipeline

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jywu-msft
Copy link
Member

@skottmckay this is a similar issue as an issue discussed previously at #14631 (comment)
any objections to this?

@skottmckay
Copy link
Contributor

@skottmckay this is a similar issue as an issue discussed previously at #14631 (comment) any objections to this?

I think it should be fine. Typical inferencing usage doesn't involve calling ToGraphProto so it will have limited effect elsewhere, so maybe not worth adding a param to ToGraphProto to control whether they are sorted or not

Please add comments to the code explaining why it is necessary to sort the values. Without context it seems like an unnecessary thing to do, and if I saw that my first temptation would be to delete it if the reason was not captured in a comment.

@sspintel
Copy link
Contributor Author

sspintel commented May 22, 2024

Please add comments to the code explaining why it is necessary to sort the values. Without context it seems like an unnecessary thing to do, and if I saw that my first temptation would be to delete it if the reason was not captured in a comment.

@skottmckay Added comment that clarifies why this sorting is necessary

@adrianlizarraga
Copy link
Contributor

/azp run Windows ARM64 QNN CI Pipeline, Windows CPU CI Pipeline, Windows GPU CI Pipeline, Windows GPU TensorRT CI Pipeline, Windows x64 QNN CI Pipeline, onnxruntime-binary-size-checks-ci-pipeline, orttraining-linux-ci-pipeline, orttraining-linux-gpu-ci-pipeline, orttraining-ortmodule-distributed

Copy link

Azure Pipelines successfully started running 9 pipeline(s).

@adrianlizarraga
Copy link
Contributor

/azp run Big Models, Linux Android Emulator QNN CI Pipeline, Linux CPU CI Pipeline, Linux CPU Minimal Build E2E CI Pipeline, Linux GPU CI Pipeline, Linux GPU TensorRT CI Pipeline, Linux OpenVINO CI Pipeline, Linux QNN CI Pipeline, MacOS CI Pipeline

Copy link

Azure Pipelines successfully started running 9 pipeline(s).

@adrianlizarraga
Copy link
Contributor

/azp run Linux CPU CI Pipeline, Linux CPU Minimal Build E2E CI Pipeline, Linux GPU CI Pipeline, Linux GPU TensorRT CI Pipeline, Linux OpenVINO CI Pipeline, MacOS CI Pipeline, ONNX Runtime Web CI Pipeline, onnxruntime-binary-size-checks-ci-pipeline, Linux QNN CI Pipeline

@adrianlizarraga
Copy link
Contributor

/azp run Windows CPU CI Pipeline, Windows GPU CI Pipeline, Windows GPU TensorRT CI Pipeline, Windows ARM64 QNN CI Pipeline, orttraining-linux-ci-pipeline, orttraining-linux-gpu-ci-pipeline, orttraining-ortmodule-distributed, Windows x64 QNN CI Pipeline, Linux MIGraphX CI Pipeline, Big Models

Copy link

Azure Pipelines successfully started running 9 pipeline(s).

@adrianlizarraga
Copy link
Contributor

/azp run ONNX Runtime React Native CI Pipeline, orttraining-amd-gpu-ci-pipeline, Linux Android Emulator QNN CI Pipeline

Copy link

Azure Pipelines successfully started running 10 pipeline(s).

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@adrianlizarraga
Copy link
Contributor

/azp run Big Models

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@adrianlizarraga adrianlizarraga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adrianlizarraga
Copy link
Contributor

/azp run ONNX Runtime React Native CI Pipeline

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@adrianlizarraga adrianlizarraga merged commit 76e1a06 into microsoft:main May 24, 2024
83 checks passed
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.

None yet

4 participants