Commit graph

767 commits

Author SHA1 Message Date
Vincent Wang
39dc6ea8a3
Fix to_dlpack Failure on PyTorch-1.10 (#9151)
* workaround to_dlpack fail in new pt version

* add torch code link
2021-09-24 09:48:07 +08:00
Thiago Crepaldi
153767bab4
Add internal determinism flag configuration for ORTModule (#9074) 2021-09-21 15:11:41 -04:00
Ryan Hill
b876e5675b
C API Enum Name Fixes (#9092) 2021-09-17 15:11:26 -07:00
Ryan Hill
26509465f0
Add default C++ initialization to OrtCUDAProviderOptions (#9064)
* Add default C++ initialization to OrtCUDAProviderOptions
2021-09-16 15:03:58 -07:00
Suffian Khan
e758870b18
Upgrade ROCm CI pipeline for ROCm 4.3.1 and permit run inside container (#9070)
* try to run inside 4.3.1 container

* no \ in container run command

* remove networking options

* try with adding video render groups

* add job to build docker image

* try without 1st stage

* change alpha, beta to float

* try adding service connection

* retain huggingface directory

* static video and render gid

* use runtime expression for variables

* install torch-ort

* pin sacrebleu==1.5.1

* update curves for rocm 4.3.1

* try again

* disable determinism and only check tail of loss curve and with a much larger threshold of 0.05

* disable RoBERTa due to high run variablity on ROCm 4.3.1

* put reduction unit tests back in
2021-09-15 12:32:02 -07:00
ashbhandare
98ac341c5b
Filter nones from ctx saved tensors (#9063)
Co-authored-by: Aishwarya Bhandare <aibhanda@5cb7a9c3931a4b19a66ae028b49221a6000001.ahkw4qp232huflxlm4gmpq4nbh.jx.internal.cloudapp.net>
2021-09-15 10:13:45 -07:00
G. Ramalingam
7d28b596f4
Add function-body to opschema of FastGeluGrad (#9028)
* Add function body to FastGeluGrad

* Add test case
2021-09-14 12:27:55 -07:00
Sherlock
9174cbe3d5
Optimize CUDA Kernel for 3D and 4D Transpose (#8928)
* Optimize Transpose120 and Transpose102

* Generalize Transpose0123 for more input shapes

* Add Transpose3D test cases

* update rocm kernel
2021-09-13 23:00:53 -07:00
baijumeswani
34f37d2920
Disable fallback for ortmodule api tests (#9018) 2021-09-13 16:00:13 -07:00
mindest
a1021a1cf4
Add BatchNorm kernel for ROCm (#9014)
* Add BatchNorm kernel for ROCm, update BN test

* correct epsilon_ setting; limit min epsilon
2021-09-13 15:15:05 +08:00
Ryan Hill
c3321b1778
Fix NVTX profiling so it can run in the shared CUDA provider (#9035)
* Move NVTX profiling so it can run in the shared provider properly
2021-09-11 00:35:54 -07:00
Tang, Cheng
8eb6546e8e
enable eager mode with ortmodule (#8961)
* initial change for eager/ortmodule integration

* pdate to latest pytorch api

* add test model;fix torch version issue

* fix comments in pr

* fix python test break

* fix api change

* fix comments in PR

* pass device into the fw function
2021-09-10 15:09:23 -07:00
satyajandhyala
ce7b12bf5d
Added new fp16 allow/safe opcodes in PropagateCastOps (#8964)
* Removed RemoveInputOutputUpDownCasts strategy in PropagatCastOps.

* Added Expand, Squeeze and Unsqueeze ops to fp16 allow ops

* Added onnx models for squeeze/unsqueeze tests.
2021-09-10 11:53:26 -07:00
Bowen Bao
31af88c0bc
Update cross_entropy_loss symbolic for new argument from upstream torch (#9007)
In torch 1.10, `label_smoothing` is added as additional input to `cross_entropy_loss`. Update the symbolic function to handle this change.
2021-09-10 10:32:59 -07:00
baijumeswani
d78e90d1af
Adding preprocessor checks for torch version during torch cpp extensions compilation (#8989) 2021-09-09 10:26:38 -07:00
pengwa
d209fe29b9
custom autograd func memory refinement (#8993)
* Release torch tensor referenced by torch gradient graph (created in PythonOp)

* Update orttraining/orttraining/python/training/ortmodule/torch_cpp_extensions/torch_interop_utils/torch_interop_utils.cc

* refine with comments

Co-authored-by: Wei-Sheng Chin <wschin@outlook.com>
2021-09-09 18:37:24 +08:00
Ashwini Khade
ec63d10303
add model local function support (#8540)
* updates for picking pnnx commit

* add tests filter to c# tests

* plus test fixes

* fix versioning for contrib ops

* fix tests

* test filter for optional ops

* more versioning related updates

* fix test

* fix layernorm spec

* more updates

* update docs

* add more test filters

* more filters

* update binary size threshold

* update docs

* draft - enable model local function

* enable model local functions in ORT

* update to latest rel onnx commit

* plus tests

* plus more updates

* plus updates

* test updates

* Fix for nested functions + shape inference

* plus bug fix and updates per review

* plus fixes per review

* plus test updates

* plus updates per review

* plus fixes

* fix a test
2021-09-08 11:47:01 -07:00
baijumeswani
0cc2909573
Auto forward non method attribute lookups to the user's model and bind custom methods to ORTModule (#8798) 2021-09-03 08:25:44 -07:00
Vincent Wang
c343f7cb43
Add Algorithm Search for ConvGrad (#8613)
* algo search for conv grad

* global cache, bigger workspace size

* fix build error

* refactor

* refactor

* resolve comments

* fix rocm

* change lock places

* rename variable

* remove setting for inference

* resolve comments
2021-09-03 11:25:17 +08:00
Gary Miguel
47435311f4
Include pytorch_export_contrib_ops in inference builds (#8878)
* Include pytorch_export_contrib_ops in inference builds

Rename / move it from tools/python/register_custom_ops_pytorch_exporter
to onnxruntime/python/tools/pytorch_export_contrib_ops.

Rationale for inclusion in inference builds:
This code is potentially useful for anyone using ORT, not just training.

Rationale for new name:
"Contrib op" is the nomenclature used within ORT to refer to the set of
ops that are not in the standard op set but are included by default with
ORT. This is more specific than "custom op", which is what the PyTorch
exporter uses to refer to any non-standard op.

Step 1 of addressing #8818. After this is merged I will update the docs.

* Enable test_pytorch_export_contrib_ops.py in CI

Fixes AB#1342330
2021-09-02 14:26:58 -07:00
Thiago Crepaldi
fe7f30aa14
Enable all-or-nothing fallback by default (#8911) 2021-09-02 10:45:14 -07:00
satyajandhyala
4570d85f20
Move setdlopenflags calls into _pybind_state.py (#8916)
* Use PROTOBUF_LIB instead of protobuf::libprotbuf

* Moved setdlopenflags to _pybind_state.py

* Copy the generated _pybind_state.py to required location for Windows.
2021-09-02 09:54:32 -07:00
Suffian Khan
225439193e
Optimize Concat and Split on CUDA to eliminate host-to-device copies when sizes are all the same (#8833)
* special case concat and split when sizes are equal

* add tests for 16 and 32 inputs with same dim

* add tests for 16/64 inputs on concat or 16/64 outputs on split

* try eliminate windows warning

* outter => outer
2021-09-01 15:25:45 -07:00
Suffian Khan
00b0a9c127
Add hugging-face models loss curve and performance guards to ROCm CI pipeline. (#8915)
* test running hf bert-large

* try again

* try again

* include other models

* correct names

* disable deberta-v2-xxlarge

* avoid torch.distributed

* add compare json loss and perf for bert-large to test

* fix sed expression

* remove pytest

* add more models

* move unit tests u

* display samples/sec
2021-09-01 09:03:10 -07:00
Tang, Cheng
4dc0ddf606
support register external ep lib information (#8897)
* support register external ep lib inforation; make eager mode share the same ep pools with training workloads

* fix inference code

* fix build break

* fix the message
2021-08-31 20:51:22 -07:00
pengwa
3eb08d4dc7
custom autograd func memory (#8901)
* remove PythonOpGrad control dependency && avoid segement fault

* comment alignment

* fix bugs
2021-09-01 09:29:26 +08:00
baijumeswani
70ca03d491
Correctly set the skip check flags for ORTModule (#8891) 2021-08-31 15:28:04 -07:00
George Nash
dc75a135c8
Add elementwise operators to DNNL execution provider (#8899)
The following ops have been added to the DNNL execution provider
Abs, Elu, Exp, Log, *Relu, Round, Sigmoid, Softplus, Sqrt, and Tanh

*Relu op was moved from its individual file to the elementwise operators

The error tolerance for the LogGrad unit test had to be decreased slightly
when using OneDNN.  Still investigating why a differet tolerance value is
needed.

DnnlSubgraph::AddKernels() member function was moved to the top of the file
since this is eddited every time a new operator is added to the the execution
provider this places the code at the top which mean less scrooling when
adding new kernels.

Signed-off-by: George Nash <george.nash@intel.com>
2021-08-31 12:20:49 -07:00
satyajandhyala
84f9271a8d
Enable registering external custom op schemas on Linux (#8889)
* Use manylinux instead of Ubuntu to run external custom ops build pipeline.
2021-08-30 10:13:47 -07:00
pengwa
36fa0de8b7
fix regression and enable custom autograd func tests in CIs (#8868)
* fix regression and enable tests in CIs

* Update orttraining/orttraining/python/training/ortmodule/_custom_autograd_function.py

Co-authored-by: Wei-Sheng Chin <wschin@outlook.com>

* fix

Co-authored-by: Wei-Sheng Chin <wschin@outlook.com>
2021-08-30 09:34:18 +08:00
Sherlock
6e20eb7eb3
Stop gradient for Multinomial, RandomNormalLike, RandomUniformLike and EyeLike (#8836) 2021-08-28 16:21:34 -07:00
baijumeswani
df9438192a
Re-introduce saving of optimized onnx model (#8860)
* Re-introduce saving of optimized onnx model
2021-08-28 14:27:25 -07:00
satyajandhyala
31926176ac
Support external custom operator schemas on Ubuntu (#8807)
* Expose symbols in onnx and protobuf namespaces in python when building with --enable_external_custom_op_schemas

* Add external onnx and protobuf files to wheel

* Added an example to demonstrate external custom ops use-case

* Added a Linux build pipeline to test external custom ops
2021-08-28 11:05:21 -07:00
Tang, Cheng
ae7f2d824d
Share the execution provider instance for training (#8719)
* seperate the training python module; share the execution proivder instance

* fix build break

* fix cuda test crash; reorg the python module code base

* se correct env

* use provider customized hash func

* fixbuild break

* fix rocm break

* use const ref in argument

* rename the file

* move hash func to trainiing module
2021-08-27 16:23:35 -07:00
Sherlock
c325207f7a
Optimize MatmulGrad (#8846)
Optimize two special cases of MatmulGrad using FusedMatMul.
2021-08-25 23:36:40 -07:00
Hariharan Seshadri
cee79526fd
Add opset 15 kernels for Pow, BatchNorm, and Shape (#8442) 2021-08-25 12:04:20 -07:00
Sherlock
73fe7bfa0f
Add ATenOp at::diagonal (#8838)
* Register at::diagonal for ATenOp
2021-08-25 09:45:53 -07:00
Chandru Ramakrishnan
98ed235fc7
Removed MSNPU code from eager. (#8832) 2021-08-25 09:40:25 -04:00
ashari4
4251e04eae
Removed assert (#8779) 2021-08-24 20:26:08 -07:00
ashari4
7f1e880649
Reorder ORT eager headers (#8813) 2021-08-24 14:48:43 -07:00
Changming Sun
4bfff45859
Downgrade Eigen (#8817) 2021-08-23 18:06:23 -07:00
Chandru Ramakrishnan
2693af9799
Ported changes / bug fixes from torch/ort. (#8784)
* Ported changes / bug fixes from torch/ort.

* Fixed formatting

* Renamed function

* Renamed module_ to module.

* Revert "Renamed module_ to module."

This reverts commit b17fc114b3db20d174283811d90592b5b8154c19.

* Include pybind common header to fix linker errors on windows debug.

* Fix to generation of > 1 custom op.

Co-authored-by: Ashwin Hari <ashari@microsoft.com>
2021-08-23 17:45:40 -04:00
George Nash
d4a88cfe3f
Add Gemm op to DNNL Exectution provider (#8799)
* Implement Gemm op for DNNL execution provider

Signed-off-by: George Nash <george.nash@intel.com>

* Remove KernelRegistry and Gemm op for dnnl ep

The KernelRegistry for the dnnl execution provider only
registered a Gemm op that as best we can tell was never
actually used and also was not using the dnnl library.

We have implemented a Gemm op in the DNNL execution provider
subgraph code and thus are removing the unused Gemm op that
was in the dnnl KernelRegistry.

Signed-off-by: George Nash <george.nash@intel.com>

* Fix duplicated output and kernelshape inference

fix getcapability to make sure subgraph outputs do not have duplicates

fix kernelshape inference in pool

Signed-off-by: Wang <zhaoyang.wang@intel.com>

* Removed most dnnl specialized ifdefs from gradient_ops_test code

Re-enable GlobalAveragePoolGrad test for dnnl ep

The bugs that were exposed by the GlobalAveragePoolGrad test have
been fixed and this test no longer needs to be disabled for DNNL.

Removed the ReluGradDnnl test. We are getting the testing from the
already existing ReluGrad test.

MaxPoolGrad test no longer has specialized execution provider
enabling for DNNL execution provider. It will now run without
the extra enabling.

ConvGrad is the only test that still has dnnl specialized ifdefs
However, the ConvGrad code was not being executed by the code
unless it was listed first in the list of execution providers.

Signed-off-by: George Nash <george.nash@intel.com>

* Fix transpose issue on Gemm

On transposing square matrices, getmemoryandreshape will fail to reshape

fix by adding a bool

Signed-off-by: Wang <zhaoyang.wang@intel.com>

* Save memory space by reusing internal tensor for output

The intermediat matmul output tensor can be used as the output
tensor for the binary calculation.

Remove the unused IsAttributeSupported from the
DnnlGemmNodeCapability class since we now support all of the
Gemm attributes in our implementation.

Signed-off-by: George Nash <george.nash@intel.com>

Co-authored-by: Wang <zhaoyang.wang@intel.com>
2021-08-23 08:45:34 -07:00
Suffian Khan
9fa0d8392a
Extend node debugging utilities to push tensors and node placement to SQL database (#8672)
* adding support for tracing to sqldb instead of files

* use compiled statements

* script to pull tensors from db

* link sqlite3

* remove node info redundant with onnx graph

* addressing PR comments

* address PR comments and include program counter

* third party notice

* use find_pacakge

* add to cgmanifests.json

* address thread safety and add pid suffix

* build fi

* python script to select on devicetype

* remove unpopulated and redundant Shape and Type fields

* comment

* comment

* PR comments

* add graph execution counter to session state

* move increment to inference session

* std::endl to \n

* ifdef on graph execution counter

* add ifdef to inference session

* move DEBUG_NODE_INPUTS_OUTPUTS to CMakeLists.txt
2021-08-21 00:40:12 -07:00
Sherlock
81889a1cf6
Invertible ReluGrad (#8773)
* Invertible Relu Grad
2021-08-19 11:29:05 -07:00
Aaron Bockover
b2813656f5
eager: fix build against latest PyTorch master (#8745)
Improve README as well.
2021-08-18 14:27:21 -04:00
pengwa
0983d61969
refine glue code and tests (#8510) 2021-08-18 11:38:00 +08:00
ashbhandare
cc275e7529
Gradient Accumulation optimization verified for correctness (#8273)
* Fetching frontier tensors to frontend

* Move before session initialize call

* Fetch tensor and add to cache

* Rest of the changes for using cache

* Review comments

* Review changes

* Review comments

* switch to shared_ptr

* Fix bug after rebase

* FE docstring change
2021-08-17 16:24:44 -07:00
baijumeswani
871eeb4dbd
Support dicts as inputs to ORTModule (#8718) 2021-08-17 13:40:55 -07:00
Thiago Crepaldi
ed254c283f
Add support for experimental json config for fallback (#8759) 2021-08-17 13:35:42 -07:00