-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Update kernel matching logic: decouple from op schemas and remove kernel def hashes #12791
Merged
Merged
Changes from all commits
Commits
Show all changes
134 commits
Select commit
Hold shift + click to select a range
0db5888
Save work.
edgchen1 c346b73
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 21545be
Save work
edgchen1 0746d1b
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 983294d
save work
edgchen1 4d6ba51
Remove unused code.
edgchen1 43f6340
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 8859fbb
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 106eba9
save work
edgchen1 33a940c
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 ed0d91d
Fix to pass tests.
edgchen1 bed0a2e
save work
edgchen1 568ebbf
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 1cc880f
Update flatbuffers schema.
edgchen1 8a8e4b2
Save work
edgchen1 a3c78b2
Save work.
edgchen1 f96986c
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 9463b11
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 0753293
Update compile_schema.py to first delete generated Python files.
edgchen1 1b21a0c
save changes
edgchen1 3f9e936
build fix
edgchen1 532467c
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 31fd820
small fix
edgchen1 92436bf
Update KernelRegistry, KernelRegistryManager, KernelTypeStrResolver c…
edgchen1 b35c048
Add KernelTypeStrResolver parameter to IExecutionProvider::GetCapabil…
edgchen1 937d694
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 9a4acad
save/load kernel_type_str_resolver
edgchen1 ee010ba
remove kernel hashes from graph partitioning, other updates
edgchen1 8a2863b
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 8e6af8b
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 070e744
Merge branch 'edgchen1/kernel_matching_experiment' of github.com:micr…
edgchen1 58da3fe
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 b7ecbea
save work
edgchen1 30823d1
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 2eb888b
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 af03399
Fix build error.
edgchen1 0a5672f
Save work, moving to IKernelTypeStrResolver.
edgchen1 60c04ea
Fix allocation planner test failures.
edgchen1 b38b290
Merge remote-tracking branch 'origin/master' into edgchen1/kernel_mat…
edgchen1 3e3a037
save work, adding kernel type str resolver info for minimal build opt…
edgchen1 0cbb6ca
Merge remote-tracking branch 'origin/main' into edgchen1/kernel_match…
edgchen1 c90211d
refine utils, use only one of type constraint/io name for kernel type…
edgchen1 0bfb399
improve error message when kernel defs use an op input/output name in…
edgchen1 7774117
short term fix for kernel def hash change
edgchen1 48b0ef0
regenerate ORT models to pass tests
edgchen1 6778da1
disable OrtModelOnlyTests.TestBackwardsCompat
edgchen1 6103aa3
clean up unused container utils
edgchen1 d037585
use AutoRegisteringKernelTypeStrResolver in gradient_op_test_utils.cc
edgchen1 2c2b8f1
update flatbuffers schema to remove kernel hash usage
edgchen1 6a3536b
Remove kernel def hashes from ORT format.
edgchen1 a563dcf
Update reduce_op_kernels.py to check kernel_type_str_resolver_utils.c…
edgchen1 6271f1f
Remove kernel def hashes, change OpIdentifier to struct.
edgchen1 98bc5b5
Remove KernelDefBuilder::FixedTypeConstraintForHash().
edgchen1 419d43e
Fix regex in reduce_op_kernels.py.
edgchen1 a65eabe
Merge remote-tracking branch 'origin/main' into edgchen1/static_kerne…
edgchen1 3994bef
fix issues to compile in extended minimal build, fix issue in KernelT…
edgchen1 c104c80
save work, change ORT format to use OpIdentifier
edgchen1 b7f2412
save work - extended minimal build fixes
edgchen1 8c86a48
set fused node since version from Graph::CreateFusedSubGraphNode()
edgchen1 24a6dae
Merge remote-tracking branch 'origin/main' into edgchen1/static_kerne…
edgchen1 5823c30
save work - get minimal build compiling
edgchen1 a924f32
Refactor graph_partitioner
edgchen1 4db4fd6
add mutex to AutoRegisteringKernelTypeStrResolver
edgchen1 4b1bccc
remove unnecessary helpers from KernelTypeStrResolver
edgchen1 5a54720
Remove using common::Status
edgchen1 4638538
revert XNNPACK version update
edgchen1 480c4bc
Fix compile warnings
edgchen1 3ff00b6
fix build error in InferenceSession::AddPredefinedTransformers
edgchen1 0e04f96
fix typo in dnnl_execution_provider.cc
edgchen1 b2576b3
fix XNNPACK EP build error
edgchen1 c668f52
Fix build error in allocation_planner_test
edgchen1 42ed4d9
remove duplicate Contains in propagate_cast_ops.cc
edgchen1 82d4e8f
fix DML compile error
edgchen1 ff384be
Update docs/OperatorKernels.md
edgchen1 b327bf8
move typedef to public section
edgchen1 3927fc9
fix unused parameter
edgchen1 fe4ec03
fix nuphar build
edgchen1 af9e6b6
build fixes
edgchen1 74de408
fix nuphar build
edgchen1 1df7bfc
fix formatting
edgchen1 b41fbd0
renaming in kernel_type_str_resolver_utils_test.cc
edgchen1 5cb403d
fix nuphar test failures
edgchen1 7fd426c
Increment ORT format version.
edgchen1 ccc2e86
fix error message
edgchen1 e8e8f39
Regenerate some ORT format files, update readmes.
edgchen1 b2c4fce
Remove onnxruntime/test/testdata/ort_backwards_compat.
edgchen1 0e806a0
regenerate js/ ORT format files
edgchen1 3d5a868
Fix TVM test failure.
edgchen1 68ef87d
temporary test change to try to get useful output
edgchen1 5b1bd3a
Update dump_ort_model.py to fix import order and add version number o…
edgchen1 f7d01b1
Fix winml test code.
edgchen1 db9d3dd
Merge remote-tracking branch 'origin/main' into edgchen1/static_kerne…
edgchen1 5420406
another try to get more info from test failure
edgchen1 5cd51c0
fix java test issue
edgchen1 3c24144
Update js/node/test/testdata/test_types_x.onnx models to opset 15.
edgchen1 785565e
Regenerate js/react_native ort format models.
edgchen1 a15f607
Add since version to dump_ort_model.py output.
edgchen1 de3591c
Merge remote-tracking branch 'origin/main' into edgchen1/static_kerne…
edgchen1 f03265f
Fix test model paths.
edgchen1 caa44c2
get more test output for other failing react native tests
edgchen1 cb41680
disable react native tests using op types that are not enabled in mob…
edgchen1 0fbd6bd
Merge branch 'edgchen1/static_kernel_update_fix' into edgchen1/static…
edgchen1 1815a5a
update readme for generating test ORT models
edgchen1 5dc8ba0
update codeowners file
edgchen1 161d6fb
skip react native ios tests for unsupported op types
edgchen1 c678b17
address some PR comments
edgchen1 25564f5
Merge remote-tracking branch 'origin/main' into edgchen1/static_kerne…
edgchen1 e047701
add documentation, remove unnecessary comment, make KernelTypeStrReso…
edgchen1 3670b09
fix odd formatting
edgchen1 a50b640
add TODO to hash_combine.h
edgchen1 bfcc36c
use string for op id in ORT format
edgchen1 02ecd7d
Add TODO comments.
edgchen1 e312452
update GetCapability() to take a IKernelLookup, get CPU/NNAPI build c…
edgchen1 16073fc
convert other EP::GetCapability calls
edgchen1 1f1bc2b
Fix warning.
edgchen1 985dcbd
fix build errors
edgchen1 1996468
Fix bug keeping reference to out of scope string.
edgchen1 88c1f61
update react native e2e tests for new mnist
edgchen1 1122239
remove unnecessary include
edgchen1 8bdf586
name todo
edgchen1 d90b5d4
try to fix react native e2e tests, convert models again, update gradl…
edgchen1 6beb71d
Merge remote-tracking branch 'origin/main' into edgchen1/static_kerne…
edgchen1 9d7cbf9
Address some PR comments.
edgchen1 359ebc1
fix for non-abseil build
edgchen1 d059c83
line length
edgchen1 9ffd4e4
remove shared provider KernelRegistry::TryFindKernel
edgchen1 22071cf
Add react_native/e2e/src/mnist.onnx.
edgchen1 00f057f
address PR comments
edgchen1 5222c10
Add reference about ORT format model breaking change to version check…
edgchen1 da5c9f4
Merge remote-tracking branch 'origin/main' into edgchen1/static_kerne…
edgchen1 716b756
small fixes
edgchen1 adf351a
Merge remote-tracking branch 'origin/main' into edgchen1/static_kerne…
edgchen1 e15fbe8
more fixes
edgchen1 396a957
update comments referring to kernel def hashes
edgchen1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# ORT Format Update in 1.13 | ||
|
||
In ONNX Runtime 1.13, there was a breaking change to the | ||
[ORT format](https://onnxruntime.ai/docs/reference/ort-format-models.html) in order to enable additional execution | ||
providers with statically registered kernels in a minimal build. | ||
More details can be found [here](../onnxruntime/core/flatbuffers/schema/README.md#version-5). | ||
|
||
Unfortunately, this means that any older models (prior to ORT format version 5) will no longer work with ONNX Runtime | ||
1.13 or later and must be re-converted. | ||
Please refer | ||
[here](https://onnxruntime.ai/docs/reference/ort-format-models.html#convert-onnx-models-to-ort-format) for instructions | ||
on how to convert an ONNX model to ORT format. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#pragma once | ||
|
||
namespace onnxruntime { | ||
|
||
// Combine hash value `seed` with hash value `h`, updating `seed` in place. | ||
// TODO(edgchen1) find a better implementation? e.g., see a more recent version of boost::hash_combine() | ||
inline void HashCombineWithHashValue(size_t h, size_t& seed) { | ||
seed ^= h + 0x9e3779b9 + (seed << 6) + (seed >> 2); | ||
} | ||
|
||
// Combine hash value `seed` with the hash value of `value`, updating `seed` in place. | ||
// The hash value computation is specified by the `Hash` template parameter. | ||
template <typename T, typename Hash = std::hash<T>> | ||
inline void HashCombine(const T& value, size_t& seed) { | ||
HashCombineWithHashValue(Hash{}(value), seed); | ||
} | ||
|
||
} // namespace onnxruntime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly not. Do we use them anywhere in the new setup? We need to write the full list of types into the ORT format model don't we, as we wouldn't know which types are included in the ORT build running the model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the two were needed to preserve the hash value (which used TypeConstraints()). we don't need to store these kernel def types in the ORT format model, we only store the info needed to associate the op args with these types.
we can probably just change TypeConstraints() to return the types enabled in the current build.
one place I'm not sure about is this usage in the Python API:
onnxruntime/onnxruntime/python/onnxruntime_pybind_schema.cc
Line 107 in bc2df1b
if that were to start returning only the types enabled in the current build, would it be ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That file is only included in a build where we use the python bindings to generate the documentation of supported op schemas for the CPU/CUDA/DML EPs (
--gen_doc
flag to build.py). Not included by default.If someone did actually create a python package with a build with reduced type support AND wanted to generate schema documentation from it (highly unlikely I suspect) it's probably more correct to return only the types enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's good to know. I think I will consolidate them in another PR as that will require updating more files.