Commit graph

38 commits

Author SHA1 Message Date
Edward Chen
269be2fe63
Remove unnecessary option from convert_onnx_models_to_ort.py, fix old instructions. (#11088)
Remove unnecessary --nnapi_partitioning_stop_ops option from convert_onnx_models_to_ort.py, fix old instructions.
2022-04-11 11:19:21 -07:00
Edward Chen
9371401746
Move node EP assignment for ORT format into SessionState::FinalizeSessionState() (#10944)
Follow up to #10904.
- Move node EP assignment for ORT format into SessionState::FinalizeSessionState().
- Add unit test for #10904.
- Make convert_onnx_models_to_ort.py optimization level configurable via environment variable.
2022-03-28 10:37:22 -07:00
Scott McKay
91722e2bc4
Fix typos (#10935) 2022-03-20 08:27:35 +10:00
Scott McKay
f385c73058
Fix a couple of issues with the python package tools (#10858)
* Tweaks to the model utils
  * Add handling for a dim_value of -1 when replacing the entire input shape. This occurs in models exported from PaddlePaddle
  * make pytorch helpers accessible in package
  * make QDQ helpers accessible in package
2022-03-15 15:52:12 +10:00
Edward Chen
e53422c6d0
Update convert_onnx_models_to_ort.py to support runtime optimizations. (#10765)
Add runtime optimization support to ONNX -> ORT format conversion script.
Replace `--optimization_level`, `--use_nnapi`, and `--use_coreml` with a new `--optimization_style` option.
2022-03-14 16:50:41 -07:00
Scott McKay
6072c6b65e
Simplify QLinearConv registration so type reduction works with it. (#10747)
* Simplify QLinearConv registration so type reduction works with it.
* Update QLinearMatMul registration to be a standard typed registration
2022-03-04 14:06:04 +10:00
Rachel Guo
a9dc50ba8b
Add option to force QDQIsInt8Allowed to return true when exporting to ORT format (#10719)
* wip

* save

* minor update

* fix

* fix

* Revert "fix"

This reverts commit a76f364b2d.

* revert

* revert

* revert submodule removal

* address pr comments

* minor fix

* address cr comments

* fix format

Co-authored-by: rachguo <rachguo@rachguos-Mini.attlocal.net>
2022-03-02 23:26:14 -08:00
Scott McKay
4d3cd2f685
Add helper for optimizing a QDQ format model for usage with ORT. (#10595)
* Add initial helper for optimizing a QDQ format model for usage with ORT.

If a DQ node has multiple consumers it will end up in multiple QDQ node units. This is complicated to handle as each qdq unit could end up being handled by different execution providers. By duplicating the DQ node we simplify this logic.

Generally the duplicate nodes will disappear when the qdq node unit is converted to a single node with a quantized operator. If there are qdq node units that are not able to be converted to use a quantized operator the ORT cleanup (pending) to drop remaining Q->DQ pairs between fp32 nodes can remove any remaining DQ nodes.

* Fix pep8 warning

Co-authored-by: Guoyu Wang <wanggy@outlook.com>
2022-02-21 09:26:19 +10:00
Scott McKay
2ca9566994
Add range of helpers for making usage of ORT Mobile easier. (#10458)
* Add range of helpers for making usage of ORT Mobile easier.
2022-02-18 07:35:25 +10:00
Scott McKay
6545e24b60
Update mobile prebuilt package ops to add support for opset 14 and 15 (#9717)
* Update required operators for prebuilt package to add opsets 14 and 15.
Add helper script to check if the prebuilt package will support the model and if not why not.

* Add support for multiple opsets being specified on a single line in the required operators config. This makes it easier to update the pre-built package config.

It's also required for validation tools to work as they only have a single opset from the model and not per-operator opsets. If we only list the incremental ops we could merge in the ops from the previous opset, but that wouldn't give a way to drop an operator from being supported.

Left the info on which ops changed though so we have a better feel for the cost of supporting each opset.
2021-11-18 10:44:39 +10:00
Guoyu Wang
5ad6dbb314
Remove experimental from ORT format namespace (#9729)
* schema change

* cc channges

* remove temp debug code

* Adding fbs namespace to session_state_flatbuffers_utils.h

* Add fbs namepsace to all ort format utils
2021-11-11 19:46:30 -08:00
Edward Chen
011cb8fd48
Fix Where op type reduction processing (#9033)
* Update type reduction script to track Where Op's second input type.

* Clean up op_kernel_type_control.h includes.

* Use more maintainable include.
2021-09-13 08:37:58 -07:00
Scott McKay
858989293d
Reduce binary size of strided copy used by Concat (#8913)
* Change the strided copy to switch on data size not data type.
Move to header so we can reduce on the enabled types.
Setup type reduction for Concat now that it's using this implementation.
2021-09-02 08:19:20 +10:00
Edward Chen
94c3e2048b
[convert_onnx_models_to_ort.py] Add option to specify NNAPI EP partitioning stop ops. (#8668)
Add option to specify NNAPI EP partitioning stop ops from the ORT format model conversion script.
2021-08-19 13:02:28 -07:00
Rachel Guo
78759059f1
[CoreML EP]Make coreml ep build on non-macOS platform (#8677)
* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* clean

* remove unused defs

* correct typo

* remove onnxruntime_coreml_proto

* cr comments

* enablie nnapi/coreml in minimal build

* enable nnapi/coreml in one build

* refine dependencies

* fix nnapi build failure and remove onnxruntime_coreml_proto dependencies in unit tests cmake files

* small fix

* fix

* fix build

* revert

* fix build

Co-authored-by: rachguo <rachguo@rachguos-Mini.attlocal.net>
2021-08-18 09:35:32 -07:00
Edward Chen
dda9f53bed
Build script logging updates (#8618)
Log build.py command line arguments.
Update subprocess logging to format arguments in way that is easier to copy.
2021-08-05 09:41:17 -07:00
Edward Chen
e09321f4db
Update ORT format model conversion utility to optionally fail fast on model conversion failure. (#8589) 2021-08-03 11:12:56 -07:00
Rachel Guo
0cf2ed029b
Add python binding for CoreML EP (#8472)
* add pybind binding for coreml ep

* update merged files

* address comments

* format

* remove lines for non-macOS platform

Co-authored-by: rachguo <rachguo@rachguos-Mini.attlocal.net>
2021-07-29 10:06:47 -07:00
Edward Chen
c254c3c355
Fix issue with ONNX to ORT format model conversion script when given single model file as input. (#8323) 2021-07-07 14:08:47 -07:00
Scott McKay
57782b3463
Add supported operators/types documentation for the ORT Mobile package (#7807)
* Add ability to generate documentation for the ORT Mobile package using the build configuration as input.
2021-05-26 15:57:40 +10:00
Scott McKay
d6df5764d7
Android package infrastructure (#7430)
* Include ORT format model conversion scripts and infrastructure in ORT python package.
  - tweak existing script setup so it can be easily run directly and from the ORT python package
Add config file and readme for Android minimal build package
Update ORT Mobile doco
Disable warning if 'all' optimizations are enabled but NCHWc transformer is excluded (device specific optimizations don't apply in this scenario so the warning is moot).

* Address PR comments
2021-04-30 14:23:54 +10:00
Scott McKay
329fd03bb4
Add int32_t as required type to some operators (#7192)
* Updates to some operators to always support int32 and int64 based on testing of Android package build config with a minimal build.

If an operator can be used for shape manipulation (int64) it is frequently used for indices manipulation (int32), so we enable both types for that set of ops.
  - e.g. BERT models take indices as input
  - Scatter/Gather ops utilize indices

Misc. fix to python bindings to exclude call that fails in a minimal build.
2021-04-01 19:32:34 +10:00
Edward Chen
0ccfe6c86a
Enable type reduction for Scatter/ScatterElements CPU kernels (#7171)
Enable type reduction for Scatter/ScatterElements CPU kernels. Some refactoring to reduce binary size.
Add MLTypeCallDispatcher methods.
Minor cleanup for Pad CPU kernel.
2021-03-30 11:02:24 -07:00
Edward Chen
53392664d3
Enable type reduction for Shrink, Sign, SplitToSequence CPU kernels (#7090)
Enable type reduction for Shrink, Sign, SplitToSequence CPU kernels.
Some other type reduction changes including refactoring to specify element types in a single place.
2021-03-23 09:57:33 -07:00
Edward Chen
4cbb8e166a
Update kernel def hashing (#7019)
Update the kernel def hashing in ORT format models. The new hashing logic ignores the ordering of type constraint types.
This is a backward compatibility breaking change, but we don't guarantee backward compatibility yet.
2021-03-22 09:28:27 -07:00
Edward Chen
aa60a8368f
Update type reduction operator type usage processors set. (#6976) 2021-03-11 09:22:53 -08:00
Edward Chen
b6c4a7ac54
Support required types when excluding typed registrations (#6871) 2021-03-08 08:22:07 -08:00
jingyanwangms
f22f04a109
Add comment (#6860)
Co-authored-by: Jingyan Wang <jingywa@OrtTrainingDev3.af05slrtruoetgaxwwjv5nsq5e.px.internal.cloudapp.net>
2021-03-02 18:54:25 -08:00
Edward Chen
ee35be0129
Support specifying globally allowed types from build script (#6677)
Add initial support for constraining operator kernel implementations (which support this type-granularity) to a set of allowed types from scripts.
2021-02-22 14:05:00 -08:00
Scott McKay
02c7873b0e
Update ORT model conversion script to support custom ops (#6701)
* Add support for custom ops library to the ORT model conversion script
Simplify model conversion now that we read ops from the ORT format model.
Enable custom ops in the python bindings if custom ops are turned on in a minimal build.
* Add test of model conversion involving custom ops.
2021-02-17 12:52:39 +10:00
Scott McKay
c5d2538314
Add more kernels that have typed registrations to the operators we track type usage for. (#6565) 2021-02-05 15:10:54 +10:00
Scott McKay
c49d1dbc4b
Add type reduction support to Slice and Transpose (#6547)
* Add type reduction support to Slice and Transpose
2021-02-05 11:08:23 +10:00
Scott McKay
6cb8f8c812
Support disabling a typed kernel registration that uses the output type (#6530)
* Update infrastructure to support disabling a typed kernel registration that uses output 0 for the type (vs. the normal use case of input 0).
2021-02-03 14:22:32 +10:00
Scott McKay
8d53ef69e5
Add type reduction support to Min, Max and Pow (#6519)
* Add type reduction support to Min, Max and Pow
Update the C++ type reduction infrastructure to allow specifying an opset for the supported types list, as those can change across opset versions.
Minor updates to the type usage tracking script
* Add 'all opsets' macros and constant
2021-02-03 06:51:35 +10:00
Scott McKay
c84bb9df9f
Add ability to track per operator types in reduced build config. (#6428)
* Add ability to generate configuration that includes required types for individual operators, to allow build size reduction based on that.
  - Add python bindings for ORT format models
    - Add script to update bindings and help info
  - Add parsing of ORT format models
  - Add ability to enable type reduction to config generation
  - Update build.py to only allow operator/type reduction via config
    - simpler to require config to be generated first
    - can't mix a type aware (ORT format model only) and non-type aware config as that may result in insufficient types being enabled
  - Add script to create reduced build config
  - Update CIs
2021-01-29 07:59:51 +10:00
Edward Chen
042053c55e
Add support for running Android emulator from build.py on Windows. (#6317) 2021-01-13 19:21:49 -08:00
Edward Chen
bef06dac93
Automatically clean up build docker image cache. (#5843)
Follow up to #5811 to automate cleanup of the build docker image cache.
Added a script and build definition to clean up docker images that haven't been accessed recently.
2020-11-20 11:56:26 -08:00
Edward Chen
71e7c2b423
Cache build docker images in container registry. (#5811)
This PR adds infrastructure to automatically cache docker images used in CI builds in a container registry.

Currently, build images are pulled from a container registry for some builds and built every time for others. The container registry requires maintenance to keep the images up to date and building images every time wastes build agent resources.

With this change, a given build image can be looked up in a cache container registry and if present, pulled, and otherwise, built and pushed. The uniqueness of a build image is determined by a hash digest of the dockerfile, docker build context directory, and certain "docker build" options. This digest is part of the image tag in the cache container repository.

The cache container registry will need to be cleaned up periodically. This is not automated yet.
2020-11-17 17:02:24 -08:00