1.9.1 Cherry-Picks (#9239)

* Add full iOS job in package pipeline (#9036)

* Add full ios xcframework job

* create zip file of the xcframework

* Bump up TVM version to avoid conflict with existing one (#9159)

* Bump up tvm version

* Bump up onnxruntime-tvm version

There are some c++17 related fixes in TVM

Co-authored-by: KeDengMS <kedeng@microsoft.com>

* fix bug introduced by PR9130 (#9166)

* make uwp store apps link to statically-linked crt desktop builds (#9182)

Co-authored-by: Sheil Kumar <sheilk@microsoft.com>

* #9182 removed the `--is_store_build` option but one place where that was used was missed. (#9219)

This should fix the relevant packaging pipelines.

* DirectML.dll load fails when executable path contains Non-English characters (#9229)

* enable unicode dml

* add wide string L prefix

* Add Fail Fast back

Co-authored-by: Sheil Kumar <sheilk@microsoft.com>

* Fix Android build break after Virtual Environment update to 20210919  (#9163)

Co-authored-by: Guoyu Wang <62914304+gwang-msft@users.noreply.github.com>
Co-authored-by: ke1337 <22626095+ke1337@users.noreply.github.com>
Co-authored-by: KeDengMS <kedeng@microsoft.com>
Co-authored-by: George Wu <jywu@microsoft.com>
Co-authored-by: Sheil Kumar <sheilk@microsoft.com>
Co-authored-by: Scott McKay <skottmckay@gmail.com>
This commit is contained in:
Sheil Kumar 2021-10-01 07:35:48 -07:00 committed by GitHub
parent 4daa14bc74
commit af0001cdfd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 133 additions and 260 deletions

2
cmake/external/tvm vendored

@ -1 +1 @@
Subproject commit a1241a967ec7920310a696a6c22ae2426752e135
Subproject commit 9ec2b92d180dff8877e402018b97baa574031b8b

View file

@ -18,7 +18,6 @@ CMake creates a target to this project
<IsReleaseBuild Condition=" '$(IsReleaseBuild)' == '' ">false</IsReleaseBuild>
<IsLinuxBuild Condition=" '$(IsLinuxBuild)' == '' ">false</IsLinuxBuild>
<ExecutionProvider Condition=" '$(ExecutionProvider)' == '' ">None</ExecutionProvider>
<IsStoreBuild Condition=" '$(IsStoreBuild)' == '' ">false</IsStoreBuild>
<!--internal build related properties-->
<OnnxRuntimeSourceDirectory Condition="'$(OnnxRuntimeSourceDirectory)'==''">..</OnnxRuntimeSourceDirectory>
@ -126,7 +125,7 @@ CMake creates a target to this project
Properties="NoBuild=true;Platform=AnyCPU;PackageVersion=$(PackageVersion);OrtPackageId=$(OrtPackageId)"/>
<Message Importance="High" Text="Generating nuspec for the native Nuget package ..." />
<Exec ContinueOnError="False" Command="python $(GenerateNuspecScript) --package_version $(PackageVersion) --package_name $(OrtPackageId) --target_architecture $(TargetArchitecture) --build_config $(Configuration) --native_build_path $(NativeBuildOutputDirAbs) --packages_path $(OnnxRuntimePackagesDirectoryAbs) --ort_build_path $(OnnxRuntimeBuildDirectoryAbs) --sources_path $(OnnxRuntimeSourceDirectoryAbs) --commit_id $(GitCommitHash) --is_release_build $(IsReleaseBuild) --execution_provider $(ExecutionProvider) --is_store_build $(IsStoreBuild)" ConsoleToMSBuild="true">
<Exec ContinueOnError="False" Command="python $(GenerateNuspecScript) --package_version $(PackageVersion) --package_name $(OrtPackageId) --target_architecture $(TargetArchitecture) --build_config $(Configuration) --native_build_path $(NativeBuildOutputDirAbs) --packages_path $(OnnxRuntimePackagesDirectoryAbs) --ort_build_path $(OnnxRuntimeBuildDirectoryAbs) --sources_path $(OnnxRuntimeSourceDirectoryAbs) --commit_id $(GitCommitHash) --is_release_build $(IsReleaseBuild) --execution_provider $(ExecutionProvider)" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GenerateNuspecOutput" />
</Exec>
@ -153,7 +152,7 @@ CMake creates a target to this project
<Copy SourceFiles="@(LicenseFile)" DestinationFiles="@(LicenseFile->'$(OnnxRuntimeSourceDirectory)\%(Filename).txt')"/>
<Message Importance="High" Text="Generating nuspec for the Microsoft.AI.MachineLearning Nuget package ..." />
<Exec ContinueOnError="False" Command="python ..\tools\nuget\generate_nuspec_for_native_nuget.py --package_version $(PackageVersion) --package_name Microsoft.AI.MachineLearning --target_architecture $(TargetArchitecture) --build_config $(Configuration) --native_build_path $(NativeBuildOutputDirAbs) --packages_path $(OnnxRuntimePackagesDirectoryAbs) --ort_build_path $(OnnxRuntimeBuildDirectoryAbs) --sources_path $(OnnxRuntimeSourceDirectoryAbs) --commit_id $(GitCommitHash) --is_release_build $(IsReleaseBuild) --is_store_build $(IsStoreBuild)" ConsoleToMSBuild="true">
<Exec ContinueOnError="False" Command="python ..\tools\nuget\generate_nuspec_for_native_nuget.py --package_version $(PackageVersion) --package_name Microsoft.AI.MachineLearning --target_architecture $(TargetArchitecture) --build_config $(Configuration) --native_build_path $(NativeBuildOutputDirAbs) --packages_path $(OnnxRuntimePackagesDirectoryAbs) --ort_build_path $(OnnxRuntimeBuildDirectoryAbs) --sources_path $(OnnxRuntimeSourceDirectoryAbs) --commit_id $(GitCommitHash) --is_release_build $(IsReleaseBuild)" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GenerateNuspecOutput" />
</Exec>

View file

@ -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

View file

@ -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

View file

@ -324,8 +324,8 @@ class PlannerImpl {
const optional<std::pair<int, int>>& 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<size_t>(alias_input_index) < input_args.size()) {

View file

@ -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;
}

View file

@ -76,7 +76,7 @@ optional<std::pair<float, int>> 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<std::pair<float, int>> 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<ScaleMergeInfo> 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<ScaleMergeInfo> GetOutputNodeMerges(
output_node_merges.push_back(
{output_edge,
scale_and_index.value().first,
scale_and_index->first,
scaled_index,
output_edge->GetSrcArgIndex()});
}

View file

@ -38,7 +38,7 @@ template <typename T>
T ParseEnvironmentVariableWithDefault(const std::string& name, const T& default_value) {
const auto parsed = ParseEnvironmentVariable<T>(name);
if (parsed.has_value()) {
return parsed.value();
return *parsed;
}
return default_value;

View file

@ -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());
}

View file

@ -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<int64_t> 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

View file

@ -576,9 +576,10 @@ std::unique_ptr<IExecutionProvider> CreateExecutionProviderInstance(
}
}
}
auto p = onnxruntime::CreateExecutionProviderFactory_OpenVINO(&params)->CreateProvider();
// Reset global variables config to avoid it being accidentally passed on to the next session
openvino_device_type.clear();
return onnxruntime::CreateExecutionProviderFactory_OpenVINO(&params)->CreateProvider();
return p;
#endif
} else if (type == kNupharExecutionProvider) {
#if USE_NUPHAR

View file

@ -229,7 +229,7 @@ TEST(PathTest, Concat) {
[](const optional<std::string>& 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));

View file

@ -9,7 +9,7 @@ namespace test {
RandomValueGenerator::RandomValueGenerator(optional<RandomSeedType> seed)
: random_seed_{
seed.has_value() ? seed.value() : static_cast<RandomSeedType>(GetTestRandomSeed())},
seed.has_value() ? *seed : static_cast<RandomSeedType>(GetTestRandomSeed())},
generator_{random_seed_},
output_trace_{__FILE__, __LINE__, "ORT test random seed: " + std::to_string(random_seed_)} {
}

View file

@ -48,7 +48,7 @@ static void TestLayerNorm(const std::vector<int64_t>& 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

View file

@ -30,7 +30,7 @@ void TestBatchNorm(const unordered_map<string, vector<T>>& 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);

View file

@ -117,13 +117,13 @@ struct TensorCheck<uint8_t> {
// 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<double> {
} 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;
}

View file

@ -17,7 +17,7 @@ namespace {
Status SetEnvironmentVar(const std::string& name, const optional<std::string>& 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(

View file

@ -15,7 +15,7 @@ RandomSeedType GetTestRandomSeed() {
ParseEnvironmentVariable<RandomSeedType>(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 = []() {

View file

@ -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)

View file

@ -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"
]
}

View file

@ -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 \

View file

@ -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

View file

@ -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 }}

View file

@ -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'

View file

@ -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('<file src=' + '"' + os.path.join(args.sources_path,
@ -361,7 +357,7 @@ def generate_files(list, args):
files_list.append('<file src=' + '"' + os.path.join(args.ort_build_path, args.build_config,
'microsoft.ai.machinelearning.experimental.winmd') +
'" target="winmds\\Microsoft.AI.MachineLearning.Experimental.winmd" />')
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('<file src=' + '"' + os.path.join(args.native_build_path, interop_dll) +
@ -404,18 +400,15 @@ def generate_files(list, args):
# Process microsoft.ai.machinelearning import lib, dll, and pdb
files_list.append('<file src=' + '"' +
os.path.join(args.native_build_path, 'microsoft.ai.machinelearning.lib') +
runtimes_target + args.target_architecture + '\\' +
('lib\\uap10.0' if args.is_store_build else '_native') +
runtimes_target + args.target_architecture + '\\_native' +
'\\Microsoft.AI.MachineLearning.lib" />')
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path,
'microsoft.ai.machinelearning.dll') +
runtimes_target + args.target_architecture + '\\' +
('lib\\uap10.0' if args.is_store_build else '_native') +
runtimes_target + args.target_architecture + '\\_native' +
'\\Microsoft.AI.MachineLearning.dll" />')
files_list.append('<file src=' + '"' + os.path.join(args.native_build_path,
'microsoft.ai.machinelearning.pdb') +
runtimes_target + args.target_architecture + '\\' +
('lib\\uap10.0' if args.is_store_build else '_native') +
runtimes_target + args.target_architecture + '\\_native' +
'\\Microsoft.AI.MachineLearning.pdb" />')
# 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('<file src=' + '"' + windowsai_native_props + '" target="' + build + '" />')
# Process native targets
files_list.append('<file src=' + '"' + windowsai_native_targets + '" target="' + build + '" />')
# Process rules
files_list.append('<file src=' + '"' + windowsai_native_rules + '" target="' + build + '" />')
# 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)

View file

@ -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<IDMLDevice> 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<decltype(&DMLCreateDevice1)>(