diff --git a/cmake/external/tvm b/cmake/external/tvm index a1241a967e..9ec2b92d18 160000 --- a/cmake/external/tvm +++ b/cmake/external/tvm @@ -1 +1 @@ -Subproject commit a1241a967ec7920310a696a6c22ae2426752e135 +Subproject commit 9ec2b92d180dff8877e402018b97baa574031b8b diff --git a/csharp/OnnxRuntime.CSharp.proj b/csharp/OnnxRuntime.CSharp.proj index 537250e81f..c2e099b486 100644 --- a/csharp/OnnxRuntime.CSharp.proj +++ b/csharp/OnnxRuntime.CSharp.proj @@ -18,7 +18,6 @@ CMake creates a target to this project false false None - false .. @@ -126,7 +125,7 @@ CMake creates a target to this project Properties="NoBuild=true;Platform=AnyCPU;PackageVersion=$(PackageVersion);OrtPackageId=$(OrtPackageId)"/> - + @@ -153,7 +152,7 @@ CMake creates a target to this project - + diff --git a/java/build-android.gradle b/java/build-android.gradle index 1d1d874db6..bfbb6f4596 100644 --- a/java/build-android.gradle +++ b/java/build-android.gradle @@ -32,7 +32,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.3' + classpath 'com.android.tools.build:gradle:4.0.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/java/src/test/android/build.gradle b/java/src/test/android/build.gradle index 0f448b3f1e..daa964ea22 100644 --- a/java/src/test/android/build.gradle +++ b/java/src/test/android/build.gradle @@ -7,7 +7,7 @@ buildscript { mavenCentral() } dependencies { - classpath "com.android.tools.build:gradle:3.5.3" + classpath "com.android.tools.build:gradle:4.0.1" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/onnxruntime/core/framework/allocation_planner.cc b/onnxruntime/core/framework/allocation_planner.cc index 79be05b612..1db4f9aa0c 100644 --- a/onnxruntime/core/framework/allocation_planner.cc +++ b/onnxruntime/core/framework/allocation_planner.cc @@ -324,8 +324,8 @@ class PlannerImpl { const optional>& variadic_alias_offsets = ci.kernel_def->VariadicAlias(); if (variadic_alias_offsets.has_value()) { - int input_offset = variadic_alias_offsets.value().first; - int output_offset = variadic_alias_offsets.value().second; + int input_offset = variadic_alias_offsets->first; + int output_offset = variadic_alias_offsets->second; // we _must_ reuse this input to satisfy aliasing requirement: (e.g., for AllReduce) int alias_input_index = output_arg_num - output_offset + input_offset; if (alias_input_index >= 0 && static_cast(alias_input_index) < input_args.size()) { diff --git a/onnxruntime/core/framework/config_options.cc b/onnxruntime/core/framework/config_options.cc index f080dc15cf..05ab8627dd 100644 --- a/onnxruntime/core/framework/config_options.cc +++ b/onnxruntime/core/framework/config_options.cc @@ -17,7 +17,7 @@ bool ConfigOptions::TryGetConfigEntry(const std::string& config_key, std::string auto entry = GetConfigEntry(config_key); const bool found = entry.has_value(); if (found) { - config_value = std::move(entry.value()); + config_value = std::move(*entry); } return found; } diff --git a/onnxruntime/core/optimizer/matmul_scale_fusion.cc b/onnxruntime/core/optimizer/matmul_scale_fusion.cc index 36affcba9b..88d6ef615c 100644 --- a/onnxruntime/core/optimizer/matmul_scale_fusion.cc +++ b/onnxruntime/core/optimizer/matmul_scale_fusion.cc @@ -76,7 +76,7 @@ optional> GetScaleFromNode( if (!divisor.has_value()) return {}; - return {std::make_pair(1.0f / divisor.value(), scale_reciprocal_arg_index)}; + return {std::make_pair(1.0f / *divisor, scale_reciprocal_arg_index)}; } if (graph_utils::IsSupportedOptypeVersionAndDomain(scale_node, "Mul", {7, 13, 14})) { @@ -93,7 +93,7 @@ optional> GetScaleFromNode( if (!multiplier.has_value()) continue; - return {std::make_pair(multiplier.value(), scale_arg_index)}; + return {std::make_pair(*multiplier, scale_arg_index)}; } return {}; @@ -128,12 +128,12 @@ std::vector GetInputNodeMerges( if (!scale_and_index.has_value()) continue; // assume scale nodes have 2 input defs, so to_scale_index == 1 - scale_index - ORT_ENFORCE(input_node.InputDefs().size() == 2 && scale_and_index.value().second < 2); - const int to_scale_index = 1 - scale_and_index.value().second; + ORT_ENFORCE(input_node.InputDefs().size() == 2 && scale_and_index->second < 2); + const int to_scale_index = 1 - scale_and_index->second; input_node_merges.push_back( {input_edge, - scale_and_index.value().first, + scale_and_index->first, to_scale_index, input_edge->GetDstArgIndex()}); } @@ -160,7 +160,7 @@ std::vector GetOutputNodeMerges( output_node_merges.push_back( {output_edge, - scale_and_index.value().first, + scale_and_index->first, scaled_index, output_edge->GetSrcArgIndex()}); } diff --git a/onnxruntime/core/platform/env_var_utils.h b/onnxruntime/core/platform/env_var_utils.h index 61d086a28a..d58f6029bf 100644 --- a/onnxruntime/core/platform/env_var_utils.h +++ b/onnxruntime/core/platform/env_var_utils.h @@ -38,7 +38,7 @@ template T ParseEnvironmentVariableWithDefault(const std::string& name, const T& default_value) { const auto parsed = ParseEnvironmentVariable(name); if (parsed.has_value()) { - return parsed.value(); + return *parsed; } return default_value; diff --git a/onnxruntime/core/providers/cpu/reduction/reduction_ops.h b/onnxruntime/core/providers/cpu/reduction/reduction_ops.h index ffc28f9e88..156bf648d2 100644 --- a/onnxruntime/core/providers/cpu/reduction/reduction_ops.h +++ b/onnxruntime/core/providers/cpu/reduction/reduction_ops.h @@ -43,13 +43,13 @@ TensorOpCost ParallelReduceFastCost(int64_t n_row, int64_t n_col, int64_t elemen This only improves reduce function when reduced axes are contiguous: if len(shape) == 4, any single axis is ok, axes=(0, 1) or (1, 2) or (2, 3) is ok, axes=(0, 2) is not covered by this change, former implementation prevails. - In that case, the shape can be compressed into three cases: + In that case, the shape can be compressed into three cases: (K = axis not reduced, R = reduced axis): * KR - reduction on the last dimensions * RK - reduction on the first dimensions * KRK - reduction on the middle dimensions. - + For these three configuration, the reduction may be optimized with vectors operations. Method WhichFastReduce() returns which case case be optimized for which aggregator. @@ -630,7 +630,7 @@ class ReduceKernelBase { } int64_t keepdims = 1; if (keepdims_override.has_value()) { - keepdims = keepdims_override.value(); + keepdims = *keepdims_override; } else { ORT_ENFORCE(info.GetAttr("keepdims", &keepdims).IsOK()); } diff --git a/onnxruntime/core/providers/cuda/reduction/reduction_functions.cc b/onnxruntime/core/providers/cuda/reduction/reduction_functions.cc index d756bd4501..26ba679356 100644 --- a/onnxruntime/core/providers/cuda/reduction/reduction_functions.cc +++ b/onnxruntime/core/providers/cuda/reduction/reduction_functions.cc @@ -96,7 +96,6 @@ ApplicableMatrixReduction get_applicable_matrix_reduction( return ApplicableMatrixReduction::None; } - // Remove all dims with value 1. This can help to optimize case like: // dims=[2,3,1,4,1,5] and axes=[0,2,4], which is same as dims=[2,3,4,5] and axes=[0]. std::vector new_dims; @@ -136,8 +135,8 @@ ApplicableMatrixReduction get_applicable_matrix_reduction( return ApplicableMatrixReduction::None; } - const auto& min_axis = min_and_max_axes.value().first; - const auto& max_axis = min_and_max_axes.value().second; + const auto& min_axis = min_and_max_axes->first; + const auto& max_axis = min_and_max_axes->second; // axes from beginning means row reduction, axes to end means column reduction // for axes from beginning to end, either works and we do row reduction diff --git a/onnxruntime/python/onnxruntime_pybind_state.cc b/onnxruntime/python/onnxruntime_pybind_state.cc index eb9b944666..bae9a1f5e2 100644 --- a/onnxruntime/python/onnxruntime_pybind_state.cc +++ b/onnxruntime/python/onnxruntime_pybind_state.cc @@ -576,9 +576,10 @@ std::unique_ptr CreateExecutionProviderInstance( } } } + auto p = onnxruntime::CreateExecutionProviderFactory_OpenVINO(¶ms)->CreateProvider(); // Reset global variables config to avoid it being accidentally passed on to the next session openvino_device_type.clear(); - return onnxruntime::CreateExecutionProviderFactory_OpenVINO(¶ms)->CreateProvider(); + return p; #endif } else if (type == kNupharExecutionProvider) { #if USE_NUPHAR diff --git a/onnxruntime/test/common/path_test.cc b/onnxruntime/test/common/path_test.cc index 955c83a87d..d097705773 100644 --- a/onnxruntime/test/common/path_test.cc +++ b/onnxruntime/test/common/path_test.cc @@ -229,7 +229,7 @@ TEST(PathTest, Concat) { [](const optional& a, const std::string& b, const std::string& expected_a, bool expect_throw = false) { Path p_a{}, p_expected_a{}; if (a.has_value()) { - ASSERT_STATUS_OK(Path::Parse(ToPathString(a.value()), p_a)); + ASSERT_STATUS_OK(Path::Parse(ToPathString(*a), p_a)); } ASSERT_STATUS_OK(Path::Parse(ToPathString(expected_a), p_expected_a)); diff --git a/onnxruntime/test/common/tensor_op_test_utils.cc b/onnxruntime/test/common/tensor_op_test_utils.cc index ddbd7b77cd..c47f98b9a7 100644 --- a/onnxruntime/test/common/tensor_op_test_utils.cc +++ b/onnxruntime/test/common/tensor_op_test_utils.cc @@ -9,7 +9,7 @@ namespace test { RandomValueGenerator::RandomValueGenerator(optional seed) : random_seed_{ - seed.has_value() ? seed.value() : static_cast(GetTestRandomSeed())}, + seed.has_value() ? *seed : static_cast(GetTestRandomSeed())}, generator_{random_seed_}, output_trace_{__FILE__, __LINE__, "ORT test random seed: " + std::to_string(random_seed_)} { } diff --git a/onnxruntime/test/contrib_ops/layer_norm_test.cc b/onnxruntime/test/contrib_ops/layer_norm_test.cc index 1b3ab0d091..1e2203d520 100644 --- a/onnxruntime/test/contrib_ops/layer_norm_test.cc +++ b/onnxruntime/test/contrib_ops/layer_norm_test.cc @@ -48,7 +48,7 @@ static void TestLayerNorm(const std::vector& x_dims, test.AddAttribute("axis", axis); test.AddAttribute("keep_dims", keep_dims); if (epsilon.has_value()) { - test.AddAttribute("epsilon", epsilon.value()); + test.AddAttribute("epsilon", *epsilon); } // create rand inputs diff --git a/onnxruntime/test/providers/cpu/nn/batch_norm_op_test.cc b/onnxruntime/test/providers/cpu/nn/batch_norm_op_test.cc index a4642b9d6b..88b6ca2518 100644 --- a/onnxruntime/test/providers/cpu/nn/batch_norm_op_test.cc +++ b/onnxruntime/test/providers/cpu/nn/batch_norm_op_test.cc @@ -30,7 +30,7 @@ void TestBatchNorm(const unordered_map>& input_data_map, int opset_version = 9) { OpTester test("BatchNormalization", opset_version); if (epsilon.has_value()) { - test.AddAttribute("epsilon", epsilon.value()); + test.AddAttribute("epsilon", *epsilon); } if (opset_version < 9) { // spatial is only defined for opset-8 and below in the spec test.AddAttribute("spatial", spatial_mode); diff --git a/onnxruntime/test/providers/provider_test_utils.cc b/onnxruntime/test/providers/provider_test_utils.cc index a9933c4e1e..57ab770ae0 100644 --- a/onnxruntime/test/providers/provider_test_utils.cc +++ b/onnxruntime/test/providers/provider_test_utils.cc @@ -117,13 +117,13 @@ struct TensorCheck { // For any other EPs, we still expect an exact match for the results if (provider_type == kNnapiExecutionProvider && (has_abs_err || has_rel_err)) { double threshold = has_abs_err - ? params.absolute_error_.value() + ? *(params.absolute_error_) : 0.0; for (int i = 0; i < size; ++i) { if (has_rel_err) { EXPECT_NEAR(expected[i], output[i], - params.relative_error_.value() * expected[i]) // expected[i] is unsigned, can't be negative + *(params.relative_error_) * expected[i]) // expected[i] is unsigned, can't be negative << "i:" << i << ", provider_type: " << provider_type; } else { // has_abs_err EXPECT_NEAR(expected[i], output[i], threshold) @@ -184,12 +184,12 @@ struct TensorCheck { } else { if (has_abs_err) { ASSERT_NEAR(expected[i], output[i], - params.absolute_error_.value()) + *(params.absolute_error_)) << "i:" << i << ", provider_type: " << provider_type; } if (has_rel_err) { ASSERT_NEAR(expected[i], output[i], - params.relative_error_.value() * + *(params.relative_error_) * std::abs(expected[i])) << "i:" << i << ", provider_type: " << provider_type; } @@ -243,12 +243,12 @@ void InternalNumericalCheck(const Tensor& expected_tensor, } else { if (has_abs_err) { ASSERT_NEAR(expected[i], output[i], - params.absolute_error_.value()) + *(params.absolute_error_)) << "i:" << i << ", provider_type: " << provider_type; } if (has_rel_err) { ASSERT_NEAR(expected[i], output[i], - params.relative_error_.value() * + *(params.relative_error_) * std::abs(expected[i])) << "i:" << i << ", provider_type: " << provider_type; } diff --git a/onnxruntime/test/util/scoped_env_vars.cc b/onnxruntime/test/util/scoped_env_vars.cc index 0f42314bad..0dd22a8373 100644 --- a/onnxruntime/test/util/scoped_env_vars.cc +++ b/onnxruntime/test/util/scoped_env_vars.cc @@ -17,7 +17,7 @@ namespace { Status SetEnvironmentVar(const std::string& name, const optional& value) { if (value.has_value()) { ORT_RETURN_IF_NOT( - setenv(name.c_str(), value.value().c_str(), 1) == 0, + setenv(name.c_str(), value->c_str(), 1) == 0, "setenv() failed: ", errno); } else { ORT_RETURN_IF_NOT( diff --git a/onnxruntime/test/util/test_random_seed.cc b/onnxruntime/test/util/test_random_seed.cc index 5d37b743a3..bc0e3ffd4f 100644 --- a/onnxruntime/test/util/test_random_seed.cc +++ b/onnxruntime/test/util/test_random_seed.cc @@ -15,7 +15,7 @@ RandomSeedType GetTestRandomSeed() { ParseEnvironmentVariable(test_random_seed_env_vars::kValue); if (fixed_random_seed.has_value()) { // use fixed value - return fixed_random_seed.value(); + return *fixed_random_seed; } auto generate_from_time = []() { diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index b44902f7c1..f6236f7a45 100644 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -1170,6 +1170,7 @@ def build_targets(args, cmake_path, build_dir, configs, num_parallel_jobs, targe env = {} if args.android: env['ANDROID_SDK_ROOT'] = args.android_sdk_path + env['ANDROID_NDK_HOME'] = args.android_ndk_path run_subprocess(cmd_args, env=env) diff --git a/tools/ci_build/github/apple/default_full_ios_framework_build_settings.json b/tools/ci_build/github/apple/default_full_ios_framework_build_settings.json new file mode 100644 index 0000000000..e31f3cabf0 --- /dev/null +++ b/tools/ci_build/github/apple/default_full_ios_framework_build_settings.json @@ -0,0 +1,20 @@ +{ + "build_osx_archs": { + "iphoneos": [ + "arm64" + ], + "iphonesimulator": [ + "arm64", + "x86_64" + ] + }, + "build_params": [ + "--ios", + "--parallel", + "--use_xcode", + "--build_apple_framework", + "--use_coreml", + "--skip_tests", + "--apple_deploy_target=11.0" + ] +} \ No newline at end of file diff --git a/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml index ff024c5f1e..0c90ad541e 100644 --- a/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml @@ -12,7 +12,7 @@ jobs: --ios \ --ios_sysroot iphonesimulator \ --osx_arch x86_64 \ - --apple_deploy_target 12.1 \ + --apple_deploy_target 11.0 \ --use_xcode \ --config RelWithDebInfo \ --build_apple_framework \ @@ -25,7 +25,7 @@ jobs: --ios \ --ios_sysroot iphonesimulator \ --osx_arch x86_64 \ - --apple_deploy_target 12.1 \ + --apple_deploy_target 11.0 \ --use_xcode \ --config RelWithDebInfo \ --build_apple_framework \ diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/windowsai.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/windowsai.yml index 8332188c26..292b75f442 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/windowsai.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/windowsai.yml @@ -99,58 +99,6 @@ jobs: BuildArch: 'arm' Runtime: 'static' -- job: WindowsAI_CPU_X64_Store - timeoutInMinutes: 120 - workspace: - clean: all - pool: - name: 'Win-CPU-2021' - demands: [] - steps: - - template: ../../templates/windowsai-nuget-build.yml - parameters: - BuildArch: 'x64' - BuildForStore: 'true' - -- job: WindowsAI_CPU_X86_Store - timeoutInMinutes: 120 - workspace: - clean: all - pool: - name: 'Win-CPU-2021' - demands: [] - steps: - - template: ../../templates/windowsai-nuget-build.yml - parameters: - BuildArch: 'x86' - BuildForStore: 'true' - -- job: WindowsAI_CPU_ARM64_Store - timeoutInMinutes: 120 - workspace: - clean: all - pool: - name: 'Win-CPU-2021' - demands: [] - steps: - - template: ../../templates/windowsai-nuget-build.yml - parameters: - BuildArch: 'arm64' - BuildForStore: 'true' - -- job: WindowsAI_CPU_ARM_Store - timeoutInMinutes: 120 - workspace: - clean: all - pool: - name: 'Win-CPU-2021' - demands: [] - steps: - - template: ../../templates/windowsai-nuget-build.yml - parameters: - BuildArch: 'arm' - BuildForStore: 'true' - - job: NuGet_Packaging workspace: clean: all @@ -160,10 +108,6 @@ jobs: - WindowsAI_DirectML_X86 - WindowsAI_DirectML_ARM64 - WindowsAI_DirectML_ARM - - WindowsAI_CPU_X64_Store - - WindowsAI_CPU_X86_Store - - WindowsAI_CPU_ARM64_Store - - WindowsAI_CPU_ARM_Store - WindowsAI_DirectML_X64_StaticRuntime - WindowsAI_DirectML_X86_StaticRuntime - WindowsAI_DirectML_ARM64_StaticRuntime @@ -194,30 +138,6 @@ jobs: artifactName: 'Microsoft.AI.MachineLearning.arm' targetPath: '$(Build.BinariesDirectory)/nuget-artifact-arm' - - task: DownloadPipelineArtifact@0 - displayName: 'Download Pipeline Artifact - NuGet CPU x64 Store' - inputs: - artifactName: 'Microsoft.AI.MachineLearning.x64.Store' - targetPath: '$(Build.BinariesDirectory)/nuget-artifact-x64-store' - - - task: DownloadPipelineArtifact@0 - displayName: 'Download Pipeline Artifact - NuGet CPU x86 Store' - inputs: - artifactName: 'Microsoft.AI.MachineLearning.x86.Store' - targetPath: '$(Build.BinariesDirectory)/nuget-artifact-x86-store' - - - task: DownloadPipelineArtifact@0 - displayName: 'Download Pipeline Artifact - NuGet CPU ARM64 Store' - inputs: - artifactName: 'Microsoft.AI.MachineLearning.arm64.Store' - targetPath: '$(Build.BinariesDirectory)/nuget-artifact-arm64-store' - - - task: DownloadPipelineArtifact@0 - displayName: 'Download Pipeline Artifact - NuGet CPU ARM Store' - inputs: - artifactName: 'Microsoft.AI.MachineLearning.arm.Store' - targetPath: '$(Build.BinariesDirectory)/nuget-artifact-arm-store' - - task: DownloadPipelineArtifact@0 displayName: 'Download Pipeline Artifact - NuGet DirectML x64 StaticRuntime' inputs: @@ -256,12 +176,6 @@ jobs: $x64_nupkg_unzipped_directory = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($x64_nuget_package)) [System.IO.Compression.ZipFile]::ExtractToDirectory($x64_nuget_package, $x64_nupkg_unzipped_directory) - $nupkgs = (Get-ChildItem ..\nuget-artifact-x64-store -Filter Microsoft.AI.MachineLearning*.nupkg -Recurse) - $x64_store_nuget_package = $nupkgs[0].FullName - $x64_store_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName - $x64_store_nupkg_unzipped_directory = [System.IO.Path]::Combine($x64_store_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($x64_store_nuget_package)) - [System.IO.Compression.ZipFile]::ExtractToDirectory($x64_store_nuget_package, $x64_store_nupkg_unzipped_directory) - $nupkgs = (Get-ChildItem ..\nuget-artifact-x64-static-runtime -Filter Microsoft.AI.MachineLearning*.nupkg -Recurse) $x64_static_runtime_nuget_package = $nupkgs[0].FullName $x64_static_runtime_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName @@ -274,12 +188,6 @@ jobs: $x86_nupkg_unzipped_directory = [System.IO.Path]::Combine($x86_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($x86_nuget_package)) [System.IO.Compression.ZipFile]::ExtractToDirectory($x86_nuget_package, $x86_nupkg_unzipped_directory) - $nupkgs = (Get-ChildItem ..\nuget-artifact-x86-store -Filter Microsoft.AI.MachineLearning*.nupkg -Recurse) - $x86_store_nuget_package = $nupkgs[0].FullName - $x86_store_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName - $x86_store_nupkg_unzipped_directory = [System.IO.Path]::Combine($x86_store_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($x86_store_nuget_package)) - [System.IO.Compression.ZipFile]::ExtractToDirectory($x86_store_nuget_package, $x86_store_nupkg_unzipped_directory) - $nupkgs = (Get-ChildItem ..\nuget-artifact-x86-static-runtime -Filter Microsoft.AI.MachineLearning*.nupkg -Recurse) $x86_static_runtime_nuget_package = $nupkgs[0].FullName $x86_static_runtime_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName @@ -292,12 +200,6 @@ jobs: $arm64_nupkg_unzipped_directory = [System.IO.Path]::Combine($arm64_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($arm64_nuget_package)) [System.IO.Compression.ZipFile]::ExtractToDirectory($arm64_nuget_package, $arm64_nupkg_unzipped_directory) - $nupkgs = (Get-ChildItem ..\nuget-artifact-arm64-store -Filter Microsoft.AI.MachineLearning*.nupkg -Recurse) - $arm64_store_nuget_package = $nupkgs[0].FullName - $arm64_store_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName - $arm64_store_nupkg_unzipped_directory = [System.IO.Path]::Combine($arm64_store_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($arm64_store_nuget_package)) - [System.IO.Compression.ZipFile]::ExtractToDirectory($arm64_store_nuget_package, $arm64_store_nupkg_unzipped_directory) - $nupkgs = (Get-ChildItem ..\nuget-artifact-arm64-static-runtime -Filter Microsoft.AI.MachineLearning*.nupkg -Recurse) $arm64_static_runtime_nuget_package = $nupkgs[0].FullName $arm64_static_runtime_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName @@ -310,41 +212,35 @@ jobs: $arm_nupkg_unzipped_directory = [System.IO.Path]::Combine($arm_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($arm_nuget_package)) [System.IO.Compression.ZipFile]::ExtractToDirectory($arm_nuget_package, $arm_nupkg_unzipped_directory) - $nupkgs = (Get-ChildItem ..\nuget-artifact-arm-store -Filter Microsoft.AI.MachineLearning*.nupkg -Recurse) - $arm_store_nuget_package = $nupkgs[0].FullName - $arm_store_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName - $arm_store_nupkg_unzipped_directory = [System.IO.Path]::Combine($arm_store_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($arm_store_nuget_package)) - [System.IO.Compression.ZipFile]::ExtractToDirectory($arm_store_nuget_package, $arm_store_nupkg_unzipped_directory) - $nupkgs = (Get-ChildItem ..\nuget-artifact-arm-static-runtime -Filter Microsoft.AI.MachineLearning*.nupkg -Recurse) $arm_static_runtime_nuget_package = $nupkgs[0].FullName $arm_static_runtime_nupkg_unzipped_directory_root = $nupkgs[0].Directory.FullName $arm_static_runtime_nupkg_unzipped_directory = [System.IO.Path]::Combine($arm_static_runtime_nupkg_unzipped_directory_root, 'binaries', [System.IO.Path]::GetFileNameWithoutExtension($arm_static_runtime_nuget_package)) [System.IO.Compression.ZipFile]::ExtractToDirectory($arm_static_runtime_nuget_package, $arm_static_runtime_nupkg_unzipped_directory) - $x64_store_runtime_path_old = [System.IO.Path]::Combine($x64_store_nupkg_unzipped_directory, 'runtimes', 'win-x64', 'lib\\uap10.0') + $x64_store_runtime_path_old = [System.IO.Path]::Combine($x64_static_runtime_nupkg_unzipped_directory, 'runtimes', 'win-x64', '_native') $x64_store_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-x64', 'lib\\uap10.0') $x64_static_runtime_path_old = [System.IO.Path]::Combine($x64_static_runtime_nupkg_unzipped_directory, 'runtimes', 'win-x64', '_native') $x64_static_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-x64', '_native', 'static') $x86_runtime_path_old = [System.IO.Path]::Combine($x86_nupkg_unzipped_directory, 'runtimes', 'win-x86', '_native') $x86_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-x86', '_native') - $x86_store_runtime_path_old = [System.IO.Path]::Combine($x86_store_nupkg_unzipped_directory, 'runtimes', 'win-x86', 'lib\\uap10.0') + $x86_store_runtime_path_old = [System.IO.Path]::Combine($x86_static_runtime_nupkg_unzipped_directory, 'runtimes', 'win-x86', '_native') $x86_store_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-x86', 'lib\\uap10.0') $x86_static_runtime_path_old = [System.IO.Path]::Combine($x86_static_runtime_nupkg_unzipped_directory, 'runtimes', 'win-x86', '_native') $x86_static_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-x86', '_native', 'static') $arm64_runtime_path_old = [System.IO.Path]::Combine($arm64_nupkg_unzipped_directory, 'runtimes', 'win-arm64', '_native') $arm64_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-arm64', '_native') - $arm64_store_runtime_path_old = [System.IO.Path]::Combine($arm64_store_nupkg_unzipped_directory, 'runtimes', 'win-arm64', 'lib\\uap10.0') + $arm64_store_runtime_path_old = [System.IO.Path]::Combine($arm64_static_runtime_nupkg_unzipped_directory, 'runtimes', 'win-arm64', '_native') $arm64_store_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-arm64', 'lib\\uap10.0') $arm64_static_runtime_path_old = [System.IO.Path]::Combine($arm64_static_runtime_nupkg_unzipped_directory, 'runtimes', 'win-arm64', '_native') $arm64_static_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-arm64', '_native', 'static') $arm_runtime_path_old = [System.IO.Path]::Combine($arm_nupkg_unzipped_directory, 'runtimes', 'win-arm', '_native') $arm_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-arm', '_native') - $arm_store_runtime_path_old = [System.IO.Path]::Combine($arm_store_nupkg_unzipped_directory, 'runtimes', 'win-arm', 'lib\\uap10.0') + $arm_store_runtime_path_old = [System.IO.Path]::Combine($arm_static_runtime_nupkg_unzipped_directory, 'runtimes', 'win-arm', '_native') $arm_store_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-arm', 'lib\\uap10.0') $arm_static_runtime_path_old = [System.IO.Path]::Combine($arm_static_runtime_nupkg_unzipped_directory, 'runtimes', 'win-arm', '_native') $arm_static_runtime_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'runtimes', 'win-arm', '_native', 'static') - $uap_build_path_old = [System.IO.Path]::Combine($x64_store_nupkg_unzipped_directory, 'build', 'uap10.0') + $uap_build_path_old = [System.IO.Path]::Combine($x64_static_runtime_nupkg_unzipped_directory, 'build', 'native') $uap_build_path_new = [System.IO.Path]::Combine($x64_nupkg_unzipped_directory, 'build', 'uap10.0') New-Item -Path $x64_store_runtime_path_new -ItemType Directory diff --git a/tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml index f3e2facb74..e1dff799a5 100644 --- a/tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml +++ b/tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml @@ -172,6 +172,36 @@ jobs: parameters: buildConfig: 'Release' +- job: iOS_Full_xcframework + workspace: + clean: all + pool: + vmImage: 'macOS-10.15' + timeoutInMinutes: 180 + steps: + - script: | + set -e -x + python3 tools/ci_build/github/apple/build_ios_framework.py \ + --build_dir "$(Build.BinariesDirectory)/ios_framework" \ + tools/ci_build/github/apple/default_full_ios_framework_build_settings.json + mkdir $(Build.BinariesDirectory)/artifacts + pushd $(Build.BinariesDirectory)/ios_framework/framework_out/ + zip -vr $(Build.BinariesDirectory)/artifacts/onnxruntime_xcframework.zip onnxruntime.xcframework + popd + displayName: "Build iOS xcframework" + + - script: | + python3 tools/ci_build/github/apple/test_ios_packages.py \ + --fail_if_cocoapods_missing \ + --framework_info_file "$(Build.BinariesDirectory)/ios_framework/framework_info.json" \ + --c_framework_dir "$(Build.BinariesDirectory)/ios_framework/framework_out" + displayName: "Test iOS framework" + + - task: PublishBuildArtifacts@1 + inputs: + pathtoPublish: '$(Build.BinariesDirectory)/artifacts' + artifactName: 'onnxruntime-ios-full-xcframework' + - template: win-ci.yml parameters: DoCompliance: ${{ parameters.DoCompliance }} diff --git a/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml b/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml index d5a56fde69..1a4e3032d9 100644 --- a/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml +++ b/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml @@ -1,7 +1,6 @@ parameters: BuildArch: 'x64' RunTests : 'true' - BuildForStore: 'false' Runtime: 'dynamic' steps: @@ -47,13 +46,6 @@ steps: - powershell: | Write-Host "##vso[task.setvariable variable=BuildFlags]$(BuildFlags) --enable_wcos" displayName: Add OneCore flags - condition: eq('${{ parameters.BuildForStore }}', 'false') - - - powershell: | - Write-Host "##vso[task.setvariable variable=BuildFlags]$(BuildFlags) --enable_windows_store" - Write-Host "##vso[task.setvariable variable=ArtifactName]$(ArtifactName).Store" - displayName: Add Microsoft Store flags - condition: eq('${{ parameters.BuildForStore }}', 'true') - powershell: | Write-Host "##vso[task.setvariable variable=BuildFlags]$(BuildFlags) --enable_msvc_static_runtime" @@ -68,59 +60,22 @@ steps: arguments: '--build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --enable_onnx_tests $(TelemetryOption) --ms_experimental --use_dml --use_winml --cmake_generator "Visual Studio 16 2019" --update --config RelWithDebInfo --enable_lto --disable_rtti $(BuildFlags)' workingDirectory: '$(Build.BinariesDirectory)' - - ${{ if or(notIn(parameters['sln_platform'], 'Win32', 'x64'), eq(parameters.BuildForStore, 'true')) }}: - # Use cross-compiled protoc - - script: | - @echo ##vso[task.setvariable variable=ProtocDirectory]$(Build.BinariesDirectory)\host_protoc\Release + - task: VSBuild@1 + displayName: 'Build' + inputs: + solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln' + ${{ if ne(parameters.BuildArch, 'x86') }}: + platform: ${{ parameters.BuildArch }} + ${{ if eq(parameters.BuildArch, 'x86') }}: + platform: 'Win32' + configuration: RelWithDebInfo + msbuildArchitecture: ${{ parameters.BuildArch }} + maximumCpuCount: true + logProjectEvents: true + workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo' + createLogFile: true - - ${{ if eq(parameters.BuildForStore, 'false') }}: - - task: VSBuild@1 - displayName: 'Build' - inputs: - solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln' - ${{ if ne(parameters.BuildArch, 'x86') }}: - platform: ${{ parameters.BuildArch }} - ${{ if eq(parameters.BuildArch, 'x86') }}: - platform: 'Win32' - configuration: RelWithDebInfo - msbuildArchitecture: ${{ parameters.BuildArch }} - maximumCpuCount: true - logProjectEvents: true - workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo' - createLogFile: true - - - ${{ if eq(parameters.BuildForStore, 'true') }}: - - task: VSBuild@1 - displayName: 'Build' - inputs: - solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.vcxproj' - ${{ if ne(parameters.BuildArch, 'x86') }}: - platform: ${{ parameters.BuildArch }} - ${{ if eq(parameters.BuildArch, 'x86') }}: - platform: 'Win32' - configuration: RelWithDebInfo - msbuildArchitecture: ${{ parameters.BuildArch }} - maximumCpuCount: true - logProjectEvents: true - workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo' - createLogFile: true - - - task: VSBuild@1 - displayName: 'Build' - inputs: - solution: '$(Build.BinariesDirectory)\RelWithDebInfo\winml_dll.vcxproj' - ${{ if ne(parameters.BuildArch, 'x86') }}: - platform: ${{ parameters.BuildArch }} - ${{ if eq(parameters.BuildArch, 'x86') }}: - platform: 'Win32' - configuration: RelWithDebInfo - msbuildArchitecture: ${{ parameters.BuildArch }} - maximumCpuCount: true - logProjectEvents: true - workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo' - createLogFile: true - - - ${{ if and(eq(parameters.BuildArch, 'x64'), eq(parameters.BuildForStore, 'false'), eq(parameters.Runtime, 'dynamic')) }}: + - ${{ if and(eq(parameters.BuildArch, 'x64'), eq(parameters.Runtime, 'dynamic')) }}: - script: | mklink /D /J $(Build.BinariesDirectory)\RelWithDebInfo\models $(Build.BinariesDirectory)\models DIR dist\ /S /B > wheel_filename_file @@ -146,7 +101,7 @@ steps: testRunTitle: 'Unit Test Run' condition: succeededOrFailed() - - ${{ if and(eq(parameters.BuildForStore, 'false'), eq(parameters.Runtime, 'dynamic')) }}: + - ${{ if eq(parameters.Runtime, 'dynamic') }}: - script: | xcopy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\winml_test_api.exe $(Build.ArtifactStagingDirectory)\test_artifact\ copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\winml_test_scenario.exe $(Build.ArtifactStagingDirectory)\test_artifact\ @@ -181,7 +136,7 @@ steps: arguments: 'x64' modifyEnvironment: true - - ${{ if and(eq(parameters.BuildArch, 'x64'), eq(parameters.BuildForStore, 'false')) }}: + - ${{ if eq(parameters.BuildArch, 'x64') }}: - script: msbuild Microsoft.AI.MachineLearning.Interop.csproj /p:Configuration=RelWithDebInfo /p:Platform="Any CPU" /p:OnnxRuntimeBuildDirectory=$(Build.BinariesDirectory) -restore workingDirectory: '$(Build.SourcesDirectory)\csharp\src\Microsoft.AI.MachineLearning.Interop' displayName: 'Build Microsoft.AI.MachineLearning.Interop.dll' @@ -194,7 +149,7 @@ steps: DoEsrp: 'true' - - ${{ if and(eq(parameters.BuildArch, 'x64'), eq(parameters.BuildForStore, 'false')) }}: + - ${{ if eq(parameters.BuildArch, 'x64') }}: - script: | msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreateWindowsAIPackage /p:OnnxRuntimeBuildDirectory=$(Build.BinariesDirectory) /p:OnnxRuntimeSourceDirectory=$(Build.SourcesDirectory) copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory) @@ -202,7 +157,7 @@ steps: workingDirectory: '$(Build.SourcesDirectory)\csharp' displayName: 'Create NuGet Package' - - ${{ if and(eq(parameters.BuildArch, 'x86'), eq(parameters.BuildForStore, 'false')) }}: + - ${{ if eq(parameters.BuildArch, 'x86') }}: - script: | msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreateWindowsAIPackage /p:OnnxRuntimeBuildDirectory=$(Build.BinariesDirectory) /p:OnnxRuntimeSourceDirectory=$(Build.SourcesDirectory) /p:TargetArchitecture=x86 copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory) @@ -210,25 +165,9 @@ steps: workingDirectory: '$(Build.SourcesDirectory)\csharp' displayName: 'Create NuGet Package' - - ${{ if and(eq(parameters.BuildArch, 'x64'), eq(parameters.BuildForStore, 'true')) }}: - - script: | - msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreateWindowsAIPackage /p:OnnxRuntimeBuildDirectory=$(Build.BinariesDirectory) /p:OnnxRuntimeSourceDirectory=$(Build.SourcesDirectory) /p:IsStoreBuild=True /p:ProtocDirectory=$(Build.BinariesDirectory)\host_protoc\Release - copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory) - copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.snupkg $(Build.ArtifactStagingDirectory) - workingDirectory: '$(Build.SourcesDirectory)\csharp' - displayName: 'Create NuGet Package' - - - ${{ if and(eq(parameters.BuildArch, 'x86'), eq(parameters.BuildForStore, 'true')) }}: - - script: | - msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreateWindowsAIPackage /p:OnnxRuntimeBuildDirectory=$(Build.BinariesDirectory) /p:OnnxRuntimeSourceDirectory=$(Build.SourcesDirectory) /p:TargetArchitecture=x86 /p:IsStoreBuild=True /p:ProtocDirectory=$(Build.BinariesDirectory)\host_protoc\Release - copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory) - copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.snupkg $(Build.ArtifactStagingDirectory) - workingDirectory: '$(Build.SourcesDirectory)\csharp' - displayName: 'Create NuGet Package' - - ${{ if eq(parameters.BuildArch, 'arm64') }}: - script: | - msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreateWindowsAIPackage /p:OnnxRuntimeBuildDirectory=$(Build.BinariesDirectory) /p:OnnxRuntimeSourceDirectory=$(Build.SourcesDirectory) /p:TargetArchitecture=arm64 /p:IsStoreBuild=${{ parameters.BuildForStore }} /p:ProtocDirectory=$(Build.BinariesDirectory)\host_protoc\Release + msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreateWindowsAIPackage /p:OnnxRuntimeBuildDirectory=$(Build.BinariesDirectory) /p:OnnxRuntimeSourceDirectory=$(Build.SourcesDirectory) /p:TargetArchitecture=arm64 /p:ProtocDirectory=$(Build.BinariesDirectory)\host_protoc\Release copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory) copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.snupkg $(Build.ArtifactStagingDirectory) workingDirectory: '$(Build.SourcesDirectory)\csharp' @@ -236,7 +175,7 @@ steps: - ${{ if eq(parameters.BuildArch, 'arm') }}: - script: | - msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreateWindowsAIPackage /p:OnnxRuntimeBuildDirectory=$(Build.BinariesDirectory) /p:OnnxRuntimeSourceDirectory=$(Build.SourcesDirectory) /p:TargetArchitecture=arm /p:IsStoreBuild=${{ parameters.BuildForStore }} /p:ProtocDirectory=$(Build.BinariesDirectory)\host_protoc\Release + msbuild $(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj /p:Configuration=RelWithDebInfo /t:CreateWindowsAIPackage /p:OnnxRuntimeBuildDirectory=$(Build.BinariesDirectory) /p:OnnxRuntimeSourceDirectory=$(Build.SourcesDirectory) /p:TargetArchitecture=arm /p:ProtocDirectory=$(Build.BinariesDirectory)\host_protoc\Release copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.nupkg $(Build.ArtifactStagingDirectory) copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\*.snupkg $(Build.ArtifactStagingDirectory) workingDirectory: '$(Build.SourcesDirectory)\csharp' diff --git a/tools/nuget/generate_nuspec_for_native_nuget.py b/tools/nuget/generate_nuspec_for_native_nuget.py index da4c9c3daa..0ea980830e 100644 --- a/tools/nuget/generate_nuspec_for_native_nuget.py +++ b/tools/nuget/generate_nuspec_for_native_nuget.py @@ -89,8 +89,6 @@ def parse_arguments(): parser.add_argument("--packages_path", required=True, help="Nuget packages output directory.") parser.add_argument("--sources_path", required=True, help="OnnxRuntime source code root.") parser.add_argument("--commit_id", required=True, help="The last commit id included in this package.") - parser.add_argument("--is_store_build", default=False, type=lambda x: x.lower() == 'true', - help="Build for the Microsoft Store") parser.add_argument("--is_release_build", required=False, default=None, type=str, help="Flag indicating if the build is a release build. Accepted values: true/false.") parser.add_argument("--execution_provider", required=False, default='None', type=str, @@ -254,7 +252,7 @@ def generate_files(list, args): is_windowsai_package = args.package_name == 'Microsoft.AI.MachineLearning' includes_winml = is_windowsai_package - includes_directml = (is_dml_package or is_windowsai_package) and not args.is_store_build and ( + includes_directml = (is_dml_package or is_windowsai_package) and ( args.target_architecture == 'x64' or args.target_architecture == 'x86') is_windows_build = is_windows() @@ -298,9 +296,7 @@ def generate_files(list, args): else: runtimes_native_folder = 'native' - runtimes = '{}{}\\{}"'.format(runtimes_target, - args.target_architecture, - 'lib\\uap10.0' if args.is_store_build else runtimes_native_folder) + runtimes = '{}{}\\{}"'.format(runtimes_target, args.target_architecture, runtimes_native_folder) # Process headers files_list.append('') - if args.target_architecture == 'x64' and not args.is_store_build: + if args.target_architecture == 'x64': interop_dll_path = 'Microsoft.AI.MachineLearning.Interop\\net5.0-windows10.0.17763.0' interop_dll = interop_dll_path + '\\Microsoft.AI.MachineLearning.Interop.dll' files_list.append('') files_list.append('') files_list.append('') # Process execution providers which are built as shared libs if args.execution_provider == "tensorrt" and not is_ado_packaging_build: @@ -502,14 +495,14 @@ def generate_files(list, args): windowsai_rules = 'Microsoft.AI.MachineLearning.Rules.Project.xml' windowsai_native_rules = os.path.join(args.sources_path, 'csharp', 'src', windowsai_src, windowsai_rules) windowsai_native_targets = os.path.join(args.sources_path, 'csharp', 'src', windowsai_src, windowsai_targets) - build = 'build\\{}'.format('uap10.0' if args.is_store_build else 'native') + build = 'build\\native' files_list.append('') # Process native targets files_list.append('') # Process rules files_list.append('') # Process .net5.0 targets - if args.target_architecture == 'x64' and not args.is_store_build: + if args.target_architecture == 'x64': interop_src = 'Microsoft.AI.MachineLearning.Interop' interop_targets = 'Microsoft.AI.MachineLearning.targets' windowsai_net50_targets = os.path.join(args.sources_path, 'csharp', 'src', interop_src, interop_targets) diff --git a/winml/adapter/winml_adapter_dml.cpp b/winml/adapter/winml_adapter_dml.cpp index b59df6ef91..1f1740236d 100644 --- a/winml/adapter/winml_adapter_dml.cpp +++ b/winml/adapter/winml_adapter_dml.cpp @@ -22,30 +22,25 @@ namespace winmla = Windows::AI::MachineLearning::Adapter; EXTERN_C IMAGE_DOS_HEADER __ImageBase; -static std::string CurrentModulePath() { - char path[MAX_PATH]; - FAIL_FAST_IF(0 == GetModuleFileNameA((HINSTANCE)&__ImageBase, path, _countof(path))); +static std::wstring CurrentModulePath() { + WCHAR path[MAX_PATH]; + FAIL_FAST_IF(0 == GetModuleFileNameW((HINSTANCE)&__ImageBase, path, _countof(path))); - char absolute_path[MAX_PATH]; - char* name; - FAIL_FAST_IF(0 == GetFullPathNameA(path, _countof(path), absolute_path, &name)); + WCHAR absolute_path[MAX_PATH]; + WCHAR* name; + FAIL_FAST_IF(0 == GetFullPathNameW(path, _countof(path), absolute_path, &name)); - auto idx = std::distance(absolute_path, name); - auto out_path = std::string(absolute_path); - out_path.resize(idx); + auto idx = std::distance(absolute_path, name); + auto out_path = std::wstring(absolute_path); + out_path.resize(idx); - return out_path; + return out_path; } Microsoft::WRL::ComPtr CreateDmlDevice(ID3D12Device* d3d12Device) { -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) // Dynamically load DML to avoid WinML taking a static dependency on DirectML.dll - auto directml_dll = CurrentModulePath() + "\\DirectML.dll"; - wil::unique_hmodule dmlDll(LoadLibraryExA(directml_dll.c_str(), nullptr, 0)); -#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PC_APP) - wil::unique_hmodule dmlDll(LoadPackagedLibrary(L"DirectML.dll", 0)); -#endif - + auto directml_dll = CurrentModulePath() + L"DirectML.dll"; + wil::unique_hmodule dmlDll(LoadLibraryExW(directml_dll.c_str(), nullptr, 0)); THROW_LAST_ERROR_IF(!dmlDll); auto dmlCreateDevice1Fn = reinterpret_cast(