Commit graph

1623 commits

Author SHA1 Message Date
Zhang Lei
04b6097db4
Cuda Clip() for op set 11. (#2411)
* Cuda Clip() for op set 11.
* make min_val and max_value input CPU memory directly.
* Remove original cu file useless "#pragma once"
* merge duplicate logic into one class.
2019-11-27 12:42:45 -08:00
Yulong Wang
ccbd778d0d optimize CPU implementation of EmbedLayerNorm (#2491)
* optimize CPU implementation of EmbedLayerNorm
* use atomic in parallelization
2019-11-27 12:34:57 -08:00
Tianlei Wu
e57b735bb9 Add a transformer to use Gelu approximation for cuda provider (#2480)
* Add Gelu Approximation Transformer to convert Gelu or AddGeluFusion to FastGelu to get better inference performance.
2019-11-27 10:15:50 -08:00
Yulong Wang
7c7d5a149c
Disable thread pool creation when enabled OpenMP (#2485) 2019-11-27 02:09:18 -08:00
Yulong Wang
e29fb5cef1
Add BatchParallelFor, TryParallelFor, TryBatchParallelFor into ThreadPool (#2476) 2019-11-27 00:32:26 -08:00
Xiang Zhang
d6c84925d5 move logSessionCreation after session is initialized (#2481) 2019-11-26 19:09:22 -08:00
Zhang Lei
ca8ff8c91c
Enable conv/conv_transpose for opset 11 in cuda execution provider. (#2401)
Enable conv/conv_transpose and existing pooling for opset 11 in cuda execution provider.

They are of spec dilates/strides change related cuda pooling ops for op set 11.
2019-11-26 11:35:28 -08:00
Changming Sun
1ca0e0866e Revert "Remove DeviceAllocatorRegistry class (#2451)"
This reverts commit 6a88d03621.
2019-11-25 23:43:10 -08:00
Scott McKay
4cac18f666
Optimize CPU Transpose for a single axis moving (#2461)
* Optimize CPU Transpose for one axis moving either inwards or outwards. We have optimizations for NCHW <-> NHWC in CUDA but not CPU. This provides a more generic optimization to the CPU implementation.

Tested performance in both directions with data sizes of 8, 16, 32 and 64 bits, size of axis being moved of 3, 16 and 32, and number of elements to move of 100x100, 300x300 and 1000x1000.

Across all tests the average improvement even with the overhead of python was 2.5x. No cases were slower. Some were 6x faster.

Binary size increase in RelWithDebInfo build is ~5K.

NOTE: See PR comments for details of performance comparison with Eigen. Eigen is slightly faster but increases binary size by 55K just for support of rank 4 input. Binary size would be further increased to support different ranks.
2019-11-26 14:05:44 +10:00
shahasad
882f28a74b
Fix NuGet end to end tests for custom op dll (#2472) 2019-11-25 15:26:09 -08:00
Tianlei Wu
5dce9be4f9
Add Attention Fusion Transformer (#2445)
Add Attention Fusion Transformer to fuse multi-head self attention subgraph to one node for optimizing Bert model inference performance.

It supports BERT model exported from PyTorch. It fuses about 20 nodes into one Attention node, and could significantly improve the inference speed of BERT model.

Support symbolic (first dimension for batch size) in input shape.
2019-11-25 14:46:37 -08:00
Ashwini Khade
4caf5c9c13
add additional test data set for nuget pipeline (#2448)
* add SAS token to download internal test data for nuget pipeline

* update azure endpoint

* fix keyvault download step

* fix variable declaration for secret group

* fix indentation

* fix yaml syntax for variables

* fix setting secrets for script

* fix env synctax

* Fix macos pipeline

* attempt to add secrets to windows download data

* fix mac and win data download

* fix windows data download

* update test data set url and location
2019-11-25 13:08:03 -08:00
KeDengMS
e0b51e4d95
Symbolic shape inference improvements: (#2460)
* Symbolic shape inference improvements:
- add a mode to guess unknown ops' output rank
- add support for GatherND
- add support for If
- fix a bug in get_int_values when then tensor rank > 1D, by treating it as no sympy data
- add symbol to literal merge when ONNX silently merges dims
- fix a bug in Concat when input dim is 0
- fix a bug in ConstantOfShape that computed dim is not updated
- add support for dynamic shape in ConstantOfShape
- fix a bug in Loop output shape that loop iterator dim is not inserted at dim 0
- add support for dynamic padding in Pad
- add support for dynamic shape in Reshape
- add support for Resize with opset > 10, by treating output dims as dynamic
- fix a bug in Slice when starts/ends are dynamic
- restrict input model to opset 7 and above
- make output model optional to avoid disk write when testing

Run model tests for symbolic shape inference

Reduce 2GB docker image size of nuphar
2019-11-25 10:31:13 -08:00
Pranav Sharma
a01816335d
Allow more than one invocation of CreateEnv in the same process. (#2467)
* Allow more than one invocation of CreateEnv in the same process.

* Fix centos build
2019-11-24 22:34:10 -08:00
Yufeng Li
b3bfc094b9
Fuse SkipLayerNorm with Bias (#2453)
Fuse SkipLayerNorm with Bias
2019-11-22 14:20:46 -08:00
Changming Sun
e7131f6d12 Pull the latest image before running docker build 2019-11-22 13:48:37 -08:00
Changming Sun
0341ee9060
Clean up build.py (#2446) 2019-11-22 12:14:03 -08:00
Yufeng Li
d49cbf6e08
Parallel Gelu with ParallelFor (#2399)
Parallel Gelu to get better performance for Gelu
2019-11-22 11:48:46 -08:00
shahasad
ca0ed96621
CSharp api and test for loading custom op shared library (#2420)
- Added C-API test for loading custom op shared lib.
- Made some changes in C++ api header and C-api implementation to get it working.
- Added C# API and corresponding test for loading custom op shared library.
2019-11-21 15:45:49 -08:00
Changming Sun
6a88d03621
Remove DeviceAllocatorRegistry class (#2451)
Remove DeviceAllocatorRegistry class
2019-11-21 13:00:25 -08:00
Yang Chen
d486481455
Correctly handle implicit inputs for fused nodes (#2390)
* Correctly handle implicit inputs for fused nodes

Previously, nuphar's partitioning function didn't include
node's implicit inputs into the inputs list of MetaDef, and hence
a crash was triggered in the onnx graph checker.

This commit fixed the issue. Furthermore, it also fixed a related
issue where we didn't add implicit inputs into
graph_inputs_excluding_initializers_ in Graph::SetGraphInputsOutputs.

the issue was that graph_inputs_including_initializers_ populated by
SetInputs (e.g. called by FunctionImpl::FunctionImpl) may contain
implicit inputs which were not of any node's initializers in the graph.
Because they were not part of any initializers, these implicit inputs
couldn't be visited by going through all nodes' inputs.
Consequently, they would *not* be added into graph_inputs_excluding_initializers_.

We fixed the issue by first copying the populated graph_inputs_including_initializers_
into graph_inputs_excluding_initalizers_, which then had both initializers and
non-initializers as its initial content. Later, we erase initializers from the
list. In this way, we can ensure all implicit inputs to remain in
graph_inputs_excluding_initializers_.

* refined comments and fixed duplicates

Address CR by revisiting comments in terms of implicit inputs

Also fixed an issue by skipping duplicates while copying inputs
from graph_inputs_including_initializers_.

* address CR

explain why we need to collect nodes' implicit inputs

* don't rely on pointer values for iterating std::set

Previously, openvino relied on iterating a set of NodeArg pointers
to construct inputs and outputs for a fused graph. It could cause
non-determinism. The reason was that although iterating std::set by
itself is stable, pointer values of NodeArgs may vary. Consequently,
we could end up visiting the set's elements in different orders for
different runs for the same test, which resulted in constructing
inputs (and outputs) with different orders to the fused graph.
For example, for the same test, we may have inputs [A, B] in some
runs but inputs[B, A] in others.

Let's use std::string as the key type to avoid such nondeterminism.

This commit also added implicit inputs into meta->inputs while returning
the capability from the openvino provider.

* Fixed another latent issue in openvino's GetCapability function

The issue was that we couldn't simply erase fused_inputs and fused_outputs
while iterating the nodes. For example, an output NodeArg may have multiple
uses, and it's wrong if we erase it from fused_outputs when we encounter only
one of its uses as input.
2019-11-21 10:27:09 -08:00
Changming Sun
6bcf95477e
Fix Windows GPU C API packaging pipeline failure (#2440)
Fix Windows GPU C API packaging pipeline failure (#2440)
2019-11-20 14:00:37 -08:00
Scott McKay
87d3794ad2
Add CUDA Scan operator. (#2403)
* Add Scan CUDA op.
Uses CPU implementation for logic.
Added some device specific functors for handling when data needs to be manipulated on a different device.
Added ability to override the materialization logic in the OrtValue slicer so DML can plugin their handling.
2019-11-21 07:59:06 +10:00
baowenlei
9b7b5e2c27
Adjust codegen vectorization width from target (#2439)
* Adjust codegen vectorization width from target
2019-11-20 13:28:15 -08:00
Tracy Sharpe
a5daa6faea
add Im2col<uint8_t> (#2438) 2019-11-19 14:57:33 -08:00
Scott McKay
3be554c2fb
Fix the type constraints on CUDA If operator to exclude strings. (#2431) 2019-11-20 06:48:14 +10:00
Edward Chen
8647201ac7 Improved documentation for onnxruntime::utils::SwapByteOrderCopy(), added precondition check. 2019-11-19 11:03:40 -08:00
Scott McKay
be12cdc73f
Add CUDA If operator. (#2377)
* Add CUDA If operator.
Uses CPU operator for implementation.
By adding a CUDA version the inputs/outputs (with the exception of the 'cond' input) stay on GPU, and no other logic is required to avoid a copy to CPU across the control flow node.
2019-11-19 12:01:46 +10:00
Patrick Foley
1cb6bdc33c Added support for Pad-2 operator in OpenVINO-EP (#2405) 2019-11-18 15:57:27 -08:00
avidiyal
95e8c3377e onnxrt server documentation update (#2396) 2019-11-18 15:31:07 -08:00
Nick Groszewski
0e947bd328 feat(treeregressor): Update TreeEnsembleRegressor for type support (#2389)
Updates the `TreeEnsembleRegressor` to allow for `double`, `float`,
`int64`, and `int32` inputs to match the upstream specification.

Signed-off-by: Nick Groszewski <nicholas.groszewski@capitalone.com>
2019-11-18 13:07:38 -08:00
Hector Li
367361fc74
Fix the issue in matmul_add_fusion (#2407)
Fix the issue in matmul_add_fusion

If Muatmul + Add has shape [K] * [K, N], reset it to [1, K] * [K, N] will make the output shape to [1, N] will also requires a reshape on the output.
Fix: just remove the shape reset to not fuse it.

Add a negative test case for matmul+add fusion
2019-11-18 10:50:44 -08:00
KeDengMS
aa7c79eac9 [NupharEP] Update notebook and docker image (#2416)
Add BERT squad in Nuphar tutorial
Enhance speed comparsion readability
2019-11-18 10:38:14 -08:00
Tianlei Wu
e1c17fd126
Add Reshape Fusion (#2395)
* Add reshape fusion

* Add some comments

* update comments

* update comment format

* update according to feedback

* update for recent logger change

* fix build error

* (1) Support both input and output edges in find path in graphutils
(2) Add a test case of only one constant initializer of Concat input.
(3) Refactor ReshapeFusion class to allow add more subgraph fusion in the future.

* fix error

* (1) loose constraint on initializer: non constant is allowed for reshape fusion.
(2) Change versions type to vector.
(3) Add logging.
(4) Return false when multiple output edges matched in FindPath. Add comments.

* only allow one direction (input or output) in FindPath
2019-11-18 10:07:10 -08:00
Pranav Sharma
f268e69c79
Minor optimization: if a node has already been placed, there's no need to find a kernel for it. (#2417) 2019-11-17 20:08:33 -08:00
baowenlei
5ab7041fa7 fix cross compile bug (#2415) 2019-11-16 01:32:57 -08:00
KeDengMS
1e03ce84eb
[NupharEP] force some low/zero cost ops to be inlined (#2409) 2019-11-15 16:03:35 -08:00
Scott McKay
c1d757a00b
Add opset 11 versions of the existing CUDA operators that had negative axis support explicitly added. (#2398)
* Add opset 11 versions of the existing CUDA operators that had negative axis support explicitly added.
2019-11-15 12:10:00 +10:00
Scott McKay
6cc57721f4
Change CUDA implementation of Transpose to support all fixed size tensor types (#2387)
* Change CUDA implementation of Transpose to not use a typed kernel so we can support more types with minimum binary size.
Add support for 8, 16, 32 and 64 bit types.
Add unit tests.
Add method so the implementation can be called directly (will be used by CUDA Scan very soon).

* Disable TensorRT for MLFloat16 and int8 unit tests.

* Address PR comment and add support for calling cublas implementation if type is mlfloat16.
2019-11-15 10:36:28 +10:00
Changming Sun
109b3cb450
Avoid using the default logger in the graph lib and optimizers (#2361)
1. Use the session logger if it is available.
2. Don't disable warning 4100 globally. We should fix the warnings instead of disabling it.
2019-11-14 13:23:28 -08:00
KeDengMS
b15e43a541
[NupharEP] Multiple optimizations (#2380)
Fuse transpose into MatMul
Implement Pow and constant scalar simplification
Vectorize ReduceMean
Improve symbolic shape inference
Minor updates for better debugging in fused function name
2019-11-14 10:40:33 -08:00
Pranav Sharma
7e164eaa6a
Fix reuse logic in allocation planner. (#2393)
* Fix reuse logic in allocation planner.

* PR comments

* Add helpful comments

* Don't allow reuse across string tensors.
2019-11-13 22:51:12 -08:00
Ilya Lavrenov
b90d55b7ea Fixed compilation with ngraph (#2388) 2019-11-13 17:49:00 -08:00
nihui
dde410e073 fix BUILD.md typo (#2375)
build.py: error: argument --config: invalid choice: 'RelWithDebugInfo' (choose from 'Debug', 'MinSizeRel', 'Release', 'RelWithDebInfo')
2019-11-13 17:48:08 -08:00
KeDengMS
51571030ef
Another try to stabilize CUDA CI (#2383)
The root cause seems to be failure in CUDA dealloc when tear down. cudaFree return code was ignored before, so should the debug check.
2019-11-13 15:58:15 -08:00
liuziyue
ffa2812587
Skip layer norm transform (#2350)
* skip layer normalization transformer
2019-11-13 13:46:09 -08:00
Yufeng Li
8ed2928dd5
Fuse Add + Gelu (#2360)
Implement the transformer to fuse add + gelu
Implement the accurate kernel
2019-11-13 09:26:00 -08:00
liuziyue
4b72fedbd5
Layer Norm Fusion Fix (#2379)
* layer norm fusion fix

* Add input shape check in code and unit tests
2019-11-12 17:19:51 -08:00
Scott McKay
8c733c8d82
Add opset 11 version of Split to CUDA ops (#2376)
Organize the CUDA ops definitions so all the opset 10 and 11 parts are together (same setup used for CPU ops)
2019-11-13 07:40:13 +10:00
Scott McKay
c0d23d5ffe
Fix bug with Slice. Need to pass in flattened input dimensions so the initial offset into the input is calculated correctly. (#2372) 2019-11-13 07:00:26 +10:00