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

Pull main branch #3

Merged
merged 34 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
fc1f463
[ios] Enable training package in packaging pipeline (#16683)
edgchen1 Jul 20, 2023
8b86606
Comment out ORT-Nightly feed in test app NuGet.config (#16762)
skottmckay Jul 20, 2023
c314d77
Update dml gpu pool to onnxruntime-Win2022-GPU-dml-A10 (#16765)
mszhanyi Jul 20, 2023
2bc9fbb
Fix url in the code documentation (graph optimizations) (#16770)
xadupre Jul 20, 2023
0e40049
[WebNN EP] Add support for Op Pad. (#16732)
Jul 20, 2023
bb136f8
[ROCm][MIGraphX] for googletest dep, set OVERRIDE_FIND_PACKAGE (#16715)
jeffdaily Jul 20, 2023
eaea34f
[WebNN EP] Support PRelu op (#16756)
Honry Jul 20, 2023
a8c263f
[QNN EP] Update QNN SDK to 2.12 (#16750)
adrianlizarraga Jul 20, 2023
538d241
Objective-C Add Support to Create and Query String ORTValues (#16764)
baijumeswani Jul 21, 2023
0f9883f
Fix Mac M1 build (#16763)
edgchen1 Jul 21, 2023
b7176f9
Fix bug with saving model optimized by inference session (#16716)
kunal-vaishnavi Jul 21, 2023
b508c72
Replace call to deprecated torch.norm (#16758)
xadupre Jul 21, 2023
4d569f6
[QNN EP] Op support: LayerNorm, Asin, Sign (#16740)
HectorSVC Jul 21, 2023
1e18efa
[C#] Add ML Sequences and Maps Create and Process APIs (#16648)
yuslepukhin Jul 21, 2023
a8e776b
[java] Adds support for fp16 and bf16 tensors (#16703)
Craigacp Jul 21, 2023
d3295f4
[Better Engineering] Fix N802 lint errors in tests (#16788)
justinchuby Jul 21, 2023
d795150
[Better Engineering] Bump ruff to 0.0.278 and fix new lint errors (#1…
justinchuby Jul 21, 2023
193415a
[js/webgpu] reuse buffer for GpuDataManager (#16746)
qjia7 Jul 21, 2023
210d29b
Allow --build_wasm on a mac system (#16761)
dakenf Jul 21, 2023
488544b
[MIGraphX EP] Fix CopyTensorAsync and add guards for stream sync Copy…
TedThemistokleous Jul 22, 2023
dafe118
Bump word-wrap from 1.2.3 to 1.2.4 in /js (#16754)
dependabot[bot] Jul 22, 2023
b92f02a
Bump word-wrap from 1.2.3 to 1.2.4 in /js/react_native (#16755)
dependabot[bot] Jul 22, 2023
3252ff2
Change DML GPU pool in Windows GPU workflow use Visual Studio 2022 (#…
mszhanyi Jul 23, 2023
40277b7
Fix orttraining-linux-gpu-ci-pipeline - LargeSizeTensorUInt64Index te…
pengwa Jul 23, 2023
21ef144
Bug fix for nested control flow ops for TRT EP (#16343)
chilo-ms Jul 23, 2023
8ede2f1
[ROCm] Optimize ROCm CI pipeline 2 (#16691)
PeixuanZuo Jul 24, 2023
5d17bcd
[WebNN EP] Support Greater and Less ops (#16782)
Honry Jul 24, 2023
d8d8349
fix: add missing nullptr of SessionOptions V2 (#16794)
gedoensmax Jul 24, 2023
4b6d9fa
Bump actions/deploy-pages from 1 to 2 (#16402)
dependabot[bot] Jul 24, 2023
b0279b1
[DORT] Enable Dynamic Shape in DORT and Use Different InferenceSessio…
wschin Jul 24, 2023
f2c0470
Fix slice upstream - Incompatible dimensions (#16818)
pengwa Jul 25, 2023
2e214d6
Workaround to upgrade VS2022 for Windows ARM build (#16826)
mszhanyi Jul 25, 2023
8b30dc1
Update run_CIs_for_external_pr.py to skip passed checks (#16808)
fs-eire Jul 25, 2023
f88f0d8
Upgrade 4 stages in nuget pipeline to VS2022 (#16825)
mszhanyi Jul 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v2
2 changes: 1 addition & 1 deletion .pipelines/windowsai-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
7z x cmake-3.26.3-windows-x86_64.zip
set PYTHONHOME=$(Build.BinariesDirectory)\${{ parameters.PythonPackageName }}.3.9.7\tools
set PYTHONPATH=$(Build.BinariesDirectory)\${{ parameters.PythonPackageName }}.3.9.7\tools
$(Build.BinariesDirectory)\${{ parameters.PythonPackageName }}.3.9.7\tools\python.exe "$(Build.SourcesDirectory)\tools\ci_build\build.py" --build_dir $(Build.BinariesDirectory) --build_shared_lib --enable_onnx_tests --ms_experimental --use_dml --use_winml --cmake_generator "Visual Studio 16 2019" --update --config RelWithDebInfo --enable_lto --use_telemetry --disable_rtti --enable_wcos $(BuildFlags) --cmake_extra_defines CMAKE_SYSTEM_VERSION=10.0.19041.0 --cmake_path $(Build.BinariesDirectory)\cmake-3.26.3-windows-x86_64\bin\cmake.exe --ctest_path $(Build.BinariesDirectory)\cmake-3.26.3-windows-x86_64\bin\ctest.exe
$(Build.BinariesDirectory)\${{ parameters.PythonPackageName }}.3.9.7\tools\python.exe "$(Build.SourcesDirectory)\tools\ci_build\build.py" --build_dir $(Build.BinariesDirectory) --build_shared_lib --enable_onnx_tests --ms_experimental --use_dml --use_winml --cmake_generator "Visual Studio 17 2022" --update --config RelWithDebInfo --enable_lto --use_telemetry --disable_rtti --enable_wcos $(BuildFlags) --cmake_extra_defines CMAKE_SYSTEM_VERSION=10.0.19041.0 --cmake_path $(Build.BinariesDirectory)\cmake-3.26.3-windows-x86_64\bin\cmake.exe --ctest_path $(Build.BinariesDirectory)\cmake-3.26.3-windows-x86_64\bin\ctest.exe
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Generate cmake config'

Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import class Foundation.ProcessInfo

let package = Package(
name: "onnxruntime",
platforms: [.iOS(.v11)],
platforms: [.iOS(.v12)],
products: [
.library(name: "onnxruntime",
type: .static,
Expand Down
1 change: 1 addition & 0 deletions cmake/deps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ protoc_win32;https://github.com/protocolbuffers/protobuf/releases/download/v21.1
protoc_linux_x64;https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-x86_64.zip;338462004aa5be9fba45b35b5b4be43f69b47a90
protoc_linux_x86;https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-x86_32.zip;61fdbe7d6360e065ec6fea23bca2cca673115fb8
protoc_linux_aarch64;https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-aarch_64.zip;df9d45470b0b8cf939dd2f0ec6b88e9cafc4d617
protoc_mac_universal;https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-osx-universal_binary.zip;23710c3d1c2036d8d65a6a22234372fa2d7af9ef
psimd;https://github.com/Maratyszcza/psimd/archive/072586a71b55b7f8c584153d223e95687148a900.zip;1f5454b01f06f9656b77e4a5e2e31d7422487013
pthreadpool;https://github.com/Maratyszcza/pthreadpool/archive/1787867f6183f056420e532eec640cba25efafea.zip;e43e80781560c5ab404a4da20f34d846f5f5d101
pybind11;https://github.com/pybind/pybind11/archive/refs/tags/v2.10.1.zip;769b6aa67a77f17a770960f604b727645b6f6a13
Expand Down
12 changes: 10 additions & 2 deletions cmake/external/onnxruntime_external_deps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ if (onnxruntime_BUILD_UNIT_TESTS)
FetchContent_Declare(
googletest
URL ${DEP_URL_googletest}
FIND_PACKAGE_ARGS NAMES GTest
URL_HASH SHA1=${DEP_SHA1_googletest}
OVERRIDE_FIND_PACKAGE
)
endif()

Expand Down Expand Up @@ -107,7 +107,7 @@ FetchContent_Declare(
)

# Download a protoc binary from Internet if needed
if(CMAKE_CROSSCOMPILING AND NOT ONNX_CUSTOM_PROTOC_EXECUTABLE AND NOT CMAKE_OSX_ARCHITECTURES)
if(CMAKE_CROSSCOMPILING AND NOT ONNX_CUSTOM_PROTOC_EXECUTABLE)
# This part of code is only for users' convenience. The code couldn't handle all cases. Users always can manually
# download protoc from Protobuf's Github release page and pass the local path to the ONNX_CUSTOM_PROTOC_EXECUTABLE
# variable.
Expand Down Expand Up @@ -141,6 +141,14 @@ if(CMAKE_CROSSCOMPILING AND NOT ONNX_CUSTOM_PROTOC_EXECUTABLE AND NOT CMAKE_OSX_
set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${protoc_binary_SOURCE_DIR}/bin/protoc)
set(PROTOC_EXECUTABLE ${ONNX_CUSTOM_PROTOC_EXECUTABLE})
endif()
elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten" AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
FetchContent_Declare(protoc_binary URL ${DEP_URL_protoc_mac_universal} URL_HASH SHA1=${DEP_SHA1_protoc_mac_universal})
FetchContent_Populate(protoc_binary)
if(protoc_binary_SOURCE_DIR)
message("Use prebuilt protoc")
set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${protoc_binary_SOURCE_DIR}/bin/protoc)
set(PROTOC_EXECUTABLE ${ONNX_CUSTOM_PROTOC_EXECUTABLE})
endif()
endif()
endif()

Expand Down
4 changes: 4 additions & 0 deletions cmake/onnxruntime_mlas.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ function(setup_mlas_source_for_windows)
target_sources(onnxruntime_mlas PRIVATE
${MLAS_SRC_DIR}/arm/sgemmc.cpp
)
# it should be removed after Visual Stuio is upgraded to 17.7
if (MSVC)
add_compile_options("-d2SSAOptimizer-")
endif()
elseif(onnxruntime_target_platform STREQUAL "x64")

file(GLOB_RECURSE mlas_platform_srcs_avx CONFIGURE_DEPENDS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Memory" Version="4.5.3" IncludeAssets="None" />
<PackageReference Include="System.Memory" Version="4.5.5" IncludeAssets="None" />
<AndroidNativeLibrary Condition=" Exists('..\..\..\..\build\Android\arm64-v8a\Release\libonnxruntime.so') " Include="..\..\..\..\build\Android\arm64-v8a\Release\libonnxruntime.so">
<Link>libs\arm64-v8a\libonnxruntime.so</Link>
</AndroidNativeLibrary>
Expand All @@ -115,4 +115,4 @@
</AndroidNativeLibrary>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Memory" Version="4.5.3" IncludeAssets="None" />
<PackageReference Include="System.Memory" Version="4.5.5" IncludeAssets="None" />
<NativeReference Condition=" '$(Platform)' == 'iPhoneSimulator' And Exists('$(OnnxNativeFrameworkPathSimulator)') " Include="$(OnnxNativeFrameworkPathSimulator)">
<Kind>Framework</Kind>
<ForceLoad>True</ForceLoad>
Expand All @@ -160,4 +160,4 @@
</NativeReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public interface IDisposableReadOnlyCollection<T> : IReadOnlyCollection<T>, IRea
internal class DisposableList<T> : List<T>, IDisposableReadOnlyCollection<T>
where T : IDisposable
{
private bool _disposed;
public DisposableList() { }
public DisposableList(int count) : base(count) { }

Expand All @@ -30,6 +31,11 @@ public DisposableList(IEnumerable<T> collection) : base(collection) { }

protected virtual void Dispose(bool disposing)
{
if (_disposed)
{
return;
}

if (disposing)
{
// Dispose in the reverse order.
Expand All @@ -43,6 +49,7 @@ protected virtual void Dispose(bool disposing)
this[i]?.Dispose();
}
this.Clear();
_disposed = true;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static FixedBufferOnnxValue CreateFromTensor<T>(Tensor<T> value)
/// \endcode
/// </example>
public static FixedBufferOnnxValue CreateFromMemory<T>(OrtMemoryInfo memoryInfo, Memory<T> memory,
TensorElementType elementType, long[] shape, long bytesSize)
TensorElementType elementType, long[] shape, long bytesSize) where T : unmanaged
{
if(elementType == TensorElementType.String)
{
Expand Down
56 changes: 32 additions & 24 deletions csharp/src/Microsoft.ML.OnnxRuntime/ManagedProjections.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace Microsoft.ML.OnnxRuntime
{
Expand All @@ -24,8 +25,7 @@ internal class ManagedTypeProjection
/// </summary>
/// <param name="namedOnnxValue"></param>
/// <param name="metadata"></param>
/// <param name="disposables"></param>
/// <returns></returns>
/// <returns>OrtValye created accoding to the metadata</returns>
internal static OrtValue CreateProjection(NamedOnnxValue namedOnnxValue, NodeMetadata metadata)
{
OrtValue result;
Expand Down Expand Up @@ -67,8 +67,7 @@ internal static OrtValue CreateProjection(NamedOnnxValue namedOnnxValue, NodeMet
/// </summary>
/// <param name="namedOnnxValue">NamedOnnxValue containing a IEnumerable<NameOnnValue></param>
/// <param name="metadata">sequence metadata</param>
/// <param name="disposables">cleanup list</param>
/// <returns></returns>
/// <returns>OrtValue that represents a sequence</returns>
/// <exception cref="OnnxRuntimeException"></exception>
private static OrtValue CreateSequenceProjection(NamedOnnxValue namedOnnxValue, NodeMetadata metadata)
{
Expand All @@ -84,8 +83,8 @@ private static OrtValue CreateSequenceProjection(NamedOnnxValue namedOnnxValue,
capacity = collection.Count;
}

// Record all the ortValues belonging to the sequence locally
using (var sequenceOrtValues = new DisposableList<OrtValue>(capacity))
DisposableList<OrtValue> sequenceOrtValues = new(capacity);
try
{
foreach (var element in seqContainer)
{
Expand All @@ -97,7 +96,12 @@ private static OrtValue CreateSequenceProjection(NamedOnnxValue namedOnnxValue,

sequenceOrtValues.Add(CreateProjection(element, elementMeta));
}
return OrtValue.CreateSequence(sequenceOrtValues);
return OrtValue.CreateSequence(ref sequenceOrtValues);
}
catch(Exception)
{
sequenceOrtValues?.Dispose();
throw;
}
}

Expand All @@ -107,7 +111,6 @@ private static OrtValue CreateSequenceProjection(NamedOnnxValue namedOnnxValue,
/// </summary>
/// <param name="node"></param>
/// <param name="elementMeta"></param>
/// <param name="disposables"></param>
/// <returns>OrtValue</returns>
/// <exception cref="OnnxRuntimeException"></exception>
private static OrtValue CreateMapProjection(NamedOnnxValue node, NodeMetadata elementMeta)
Expand All @@ -123,57 +126,62 @@ private static OrtValue CreateMapProjection(NamedOnnxValue node, NodeMetadata el
$"Node: {node.Name} onnxruntime only supports maps with primitive types values");
}

TensorBase keys = node.GetDictionaryKeys();
using (OrtValue ortValueKeys = OrtValue.CreateFromTensorObject(keys, out TensorElementType elementTypeKeys))
Span<OrtValue> ortValues = new OrtValue[2];
var disposableGuard = new DisposableArray<OrtValue>(ortValues);
try
{
TensorBase keys = node.GetDictionaryKeys();
ortValues[0] = OrtValue.CreateFromTensorObject(keys, out TensorElementType elementTypeKeys);

if (elementTypeKeys != mapMeta.KeyDataType)
{
throw new OnnxRuntimeException(ErrorCode.InvalidArgument,
$"Map key data type supplied: {elementTypeKeys} metadata expected: {mapMeta.KeyDataType}");
}

TensorBase values = node.GetDictionaryValues();
using (OrtValue ortValueValues = OrtValue.CreateFromTensorObject(values, out TensorElementType elementTypeValues))
ortValues[1] = OrtValue.CreateFromTensorObject(values, out TensorElementType elementTypeValues);
if (elementTypeValues != mapValuesMeta.ElementDataType)
{
if (elementTypeValues != mapValuesMeta.ElementDataType)
{
throw new OnnxRuntimeException(ErrorCode.InvalidArgument,
$"Map value data type supplied: {elementTypeValues} metadata expected: {mapValuesMeta.ElementDataType}");
}

// Create Map OrtValue
return OrtValue.CreateMap(ortValueKeys, ortValueValues);
throw new OnnxRuntimeException(ErrorCode.InvalidArgument,
$"Map value data type supplied: {elementTypeValues} metadata expected: {mapValuesMeta.ElementDataType}");
}

// Create Map OrtValue
return OrtValue.CreateMap(ref ortValues[0], ref ortValues[1]);
}
catch (Exception)
{
disposableGuard.Dispose();
throw;
}
}


/// <summary>
/// This pins memory that is contained within DenseTensor.
/// </summary>
/// <param name="node">NodeOnnxValue containing DenseTensor</param>
/// <param name="elementMeta"></param>
/// <param name="disposables">cleanup list</param>
/// <returns></returns>
/// <exception cref="OnnxRuntimeException"></exception>
private static OrtValue CreateTensorProjection(NamedOnnxValue node, NodeMetadata elementMeta)
{
if (!(node.Value is TensorBase))
if (node.Value is not TensorBase)
{
throw new OnnxRuntimeException(ErrorCode.InvalidArgument,
$"NamedOnnxValue contains: {node.Value.GetType()}, expecting a Tensor<T>");
}

OrtValue ortValue = OrtValue.CreateFromTensorObject(node.Value as TensorBase, out TensorElementType elementType);
try
try
{
if (elementType != elementMeta.ElementDataType)
{
throw new OnnxRuntimeException(ErrorCode.InvalidArgument,
$"Tensor element data type discovered: {elementType} metadata expected: {elementMeta.ElementDataType}");
}
}
catch(Exception)
catch (Exception)
{
ortValue.Dispose();
throw;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

<PropertyGroup>
<Platforms>AnyCPU;x86</Platforms>
<LangVersion>7.3</LangVersion>
<LangVersion>default</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\OnnxRuntime.snk</AssemblyOriginatorKeyFile>
Expand Down Expand Up @@ -331,13 +331,13 @@
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard'))">
<PackageReference Include="System.Memory" Version="4.5.3" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<Compile Include="**\*.netstandard.cs" Link="platform\netstandard\%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net')) AND !$(TargetFramework.StartsWith('netstandard')) ">
<PackageReference Include="System.Memory" Version="4.5.3" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<Compile Include="**\*.net.cs" Link="platform\net\%(Filename)%(Extension)" />
</ItemGroup>
Expand Down
Loading