From 8356e3b9b03d5f4dc99fc0ced80b65373daa8b08 Mon Sep 17 00:00:00 2001 From: Yi Zhang Date: Thu, 22 Sep 2022 01:02:57 +0800 Subject: [PATCH] Add onnx single node test data to tests (#12822) 1. add node test data to current model tests 2. support opset version to filter tests. 3. remove old filter based on onnx version. To avoid confusion, ONLY support opset version filter in onnxruntime_test_all 4. support read onnx test data from absolute path on Windows. --- onnxruntime/test/onnx/TestCase.cc | 2 +- onnxruntime/test/onnx/TestCase.h | 2 +- onnxruntime/test/onnx/onnx_model_info.cc | 15 +-- onnxruntime/test/onnx/onnx_model_info.h | 5 +- onnxruntime/test/providers/cpu/model_tests.cc | 108 +++++++++--------- tools/ci_build/build.py | 3 +- .../c-api-noopenmp-packaging-pipelines.yml | 20 ++-- .../nuget/templates/test_win.yml | 8 +- .../nuget/templates/win-ci-2019.yml | 12 +- .../azure-pipelines/templates/c-api-cpu.yml | 16 +-- 10 files changed, 95 insertions(+), 96 deletions(-) diff --git a/onnxruntime/test/onnx/TestCase.cc b/onnxruntime/test/onnx/TestCase.cc index 18d187485a..b532f6a9bb 100644 --- a/onnxruntime/test/onnx/TestCase.cc +++ b/onnxruntime/test/onnx/TestCase.cc @@ -343,7 +343,7 @@ class OnnxTestCase : public ITestCase { const std::string& GetNodeName() const override { return model_info_->GetNodeName(); } const PATH_CHAR_TYPE* GetModelUrl() const override { return model_info_->GetModelUrl(); } const std::string& GetTestCaseName() const override { return test_case_name_; } - std::string GetTestCaseVersion() const override { return model_info_->GetModelVersion(); } + std::string GetTestCaseVersion() const override { return model_info_->GetNominalOpsetVersion(); } void LoadTestData(size_t id, onnxruntime::test::HeapBuffer& b, std::unordered_map&, bool is_input) const override; diff --git a/onnxruntime/test/onnx/TestCase.h b/onnxruntime/test/onnx/TestCase.h index 2366f11bbb..0e3e7852f5 100644 --- a/onnxruntime/test/onnx/TestCase.h +++ b/onnxruntime/test/onnx/TestCase.h @@ -66,7 +66,7 @@ class TestModelInfo { virtual int GetOutputCount() const = 0; virtual const std::string& GetInputName(size_t i) const = 0; virtual const std::string& GetOutputName(size_t i) const = 0; - virtual std::string GetModelVersion() const { return ""; } + virtual std::string GetNominalOpsetVersion() const { return ""; } virtual ~TestModelInfo() = default; #if !defined(ORT_MINIMAL_BUILD) diff --git a/onnxruntime/test/onnx/onnx_model_info.cc b/onnxruntime/test/onnx/onnx_model_info.cc index e82ed6bb43..a762686a4a 100644 --- a/onnxruntime/test/onnx/onnx_model_info.cc +++ b/onnxruntime/test/onnx/onnx_model_info.cc @@ -58,15 +58,13 @@ void OnnxModelInfo::InitOnnxModelInfo(_In_ const PATH_CHAR_TYPE* model_url) { / const std::string model_url_string = ToUTF8String(model_url); re2::StringPiece text(model_url_string); re2::StringPiece submatch; - re2::RE2 regex("onnx[0-9a-z]{3}", re2::RE2::Options()); //e.g. onnx141, onnx150, onnxtip - if (!regex.ok()) { - ORT_THROW("Failed to parse regex: onnx[0-9a-z]{3}"); - } - bool match = regex.Match(text, 0, text.length(), re2_anchor, &submatch, 1); + re2::RE2 regex_op("opset[0-9a-z]{1,2}", re2::RE2::Options()); // e.g. opset14, opset15 + + bool match = regex_op.Match(text, 0, text.length(), re2_anchor, &submatch, 1); if (match) { - onnx_commit_tag_.assign(submatch.data(), submatch.length()); + onnx_nominal_opset_vesion_.assign(submatch.data(), submatch.length()); } else { - onnx_commit_tag_ = TestModelInfo::unknown_version; + onnx_nominal_opset_vesion_ = TestModelInfo::unknown_version; } } for (const auto& opset : model_pb.opset_import()) { @@ -102,9 +100,6 @@ void OnnxModelInfo::InitOrtModelInfo(_In_ const PATH_CHAR_TYPE* model_url) { std::ifstream bytes_stream(model_location, std::ifstream::in | std::ifstream::binary); bytes_stream.read(reinterpret_cast(bytes.data()), num_bytes); - // TODO use ort format version here? - onnx_commit_tag_ = TestModelInfo::unknown_version; - // TODO, verify it is a valid ort format // TODO, version matches the ORT version const auto* fbs_session = fbs::GetInferenceSession(bytes.data()); diff --git a/onnxruntime/test/onnx/onnx_model_info.h b/onnxruntime/test/onnx/onnx_model_info.h index b4a1b9bd00..d951db3e29 100644 --- a/onnxruntime/test/onnx/onnx_model_info.h +++ b/onnxruntime/test/onnx/onnx_model_info.h @@ -8,7 +8,8 @@ class OnnxModelInfo : public TestModelInfo { private: std::string node_name_; - std::string onnx_commit_tag_; + // Due to performance, the opset version is get from directory name, so it's nominal + std::string onnx_nominal_opset_vesion_; std::vector input_value_info_; std::vector output_value_info_; std::unordered_map domain_to_version_; @@ -32,7 +33,7 @@ class OnnxModelInfo : public TestModelInfo { } const PATH_CHAR_TYPE* GetModelUrl() const override { return model_url_.c_str(); } - std::string GetModelVersion() const override { return onnx_commit_tag_; } + std::string GetNominalOpsetVersion() const override { return onnx_nominal_opset_vesion_; } const std::string& GetNodeName() const override { return node_name_; } diff --git a/onnxruntime/test/providers/cpu/model_tests.cc b/onnxruntime/test/providers/cpu/model_tests.cc index 5cc273c73e..a090b3833f 100644 --- a/onnxruntime/test/providers/cpu/model_tests.cc +++ b/onnxruntime/test/providers/cpu/model_tests.cc @@ -65,12 +65,12 @@ namespace { struct BrokenTest { std::string test_name_; std::string reason_; - std::set broken_versions_ = {}; // apply to all versions if empty + std::set broken_opset_versions_ = {}; // apply to all versions if empty BrokenTest(std::string name, std::string reason) : test_name_(std::move(name)), reason_(std::move(reason)) { } - BrokenTest(std::string name, std::string reason, const std::initializer_list& versions) - : test_name_(std::move(name)), reason_(std::move(reason)), broken_versions_(versions) { + BrokenTest(std::string name, std::string reason, const std::initializer_list& opversions) + : test_name_(std::move(name)), reason_(std::move(reason)), broken_opset_versions_(opversions) { } bool operator<(const struct BrokenTest& test) const { @@ -123,7 +123,6 @@ TEST_P(ModelTest, Run) { return; } #endif - // TODO: filter model based on opset std::set broken_tests = { {"slice_neg_steps", "Type parameter (Tind) bound to different types (tensor(int64) and tensor(int32) in node ()."}, @@ -133,9 +132,9 @@ TEST_P(ModelTest, Run) { {"cast_FLOAT_to_BFLOAT16", "expect uint16 got bfloat16"}, {"mnist", "Input data isn't in valid range"}, {"BERT_Squad", "test data bug"}, - {"constantofshape_float_ones", "test data bug", {"onnx141", "onnx150"}}, - {"constantofshape_int_zeros", "test data bug", {"onnx141", "onnx150"}}, - {"cast_STRING_to_FLOAT", "Linux CI has old ONNX python package with bad test data", {"onnx141"}}, + {"constantofshape_float_ones", "test data bug", {"opset9", "opset10"}}, + {"constantofshape_int_zeros", "test data bug", {"opset9", "opset10"}}, + {"cast_STRING_to_FLOAT", "Linux CI has old ONNX python package with bad test data", {"opset9", "opset10"}}, // Numpy float to string has unexpected rounding for some results given numpy default precision is meant to be 8. // "e.g. 0.296140194 -> '0.2961402' not '0.29614019'. ORT produces the latter with precision set to 8, // which doesn't match the expected output that was generated with numpy. @@ -143,7 +142,7 @@ TEST_P(ModelTest, Run) { {"tf_nasnet_large", "disable temporarily"}, {"tf_nasnet_mobile", "disable temporarily"}, {"tf_pnasnet_large", "disable temporarily"}, - {"shrink", "test case is wrong", {"onnx141"}}, + {"shrink", "test case is wrong", {"opset9"}}, {"maxpool_with_argmax_2d_precomputed_strides", "ShapeInferenceError"}, {"tf_inception_v2", "result mismatch"}, {"tf_resnet_v1_50", "result mismatch when Conv BN Fusion is applied"}, @@ -181,7 +180,7 @@ TEST_P(ModelTest, Run) { {"castlike_FLOAT_to_BFLOAT16_expanded", "type error", {}}, {"castlike_FLOAT_to_STRING", "type error", {}}, {"castlike_FLOAT_to_STRING_expanded", "type error", {}}, - {"convtranspose_autopad_same", "Test data has been corrected in ONNX 1.10.", {"onnx180", "onnx181", "onnx190"}}, + {"convtranspose_autopad_same", "Test data has been corrected in ONNX 1.10.", {"opset13", "opset14"}}, {"gru_batchwise", "type error", {}}, {"lstm_batchwise", "type error", {}}, {"optional_get_element", "type error", {}}, @@ -195,6 +194,7 @@ TEST_P(ModelTest, Run) { {"shape_start_1_end_negative_1", "type error", {}}, {"shape_start_negative_1", "type error", {}}, {"simple_rnn_batchwise", "type error", {}}, + {"mod_float_mixed_sign_example", "fmod attribute must be true for floating point types", {}}, #ifdef ENABLE_TRAINING {"adagrad", "not a registered function/op", {}}, // Op not registered. {"adagrad_multiple", "not a registered function/op", {}}, // Op not registered. @@ -205,46 +205,46 @@ TEST_P(ModelTest, Run) { {"momentum", "not a registered function/op", {}}, // Op not registered. {"momentum_multiple", "not a registered function/op", {}}, // Op not registered. {"nesterov_momentum", "not a registered function/op", {}}, // Op not registered. - {"softmax_cross_entropy_input_shape_is_NCd1d2d3d4d5_none_no_weight", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean_weight_ignore_index_log_prob", "type error", {"onnx170"}}, + {"softmax_cross_entropy_input_shape_is_NCd1d2d3d4d5_none_no_weight", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean_weight_ignore_index_log_prob", "type error", {"opset12"}}, {"softmax_cross_entropy_input_shape_is_NCd1_mean_weight_negative_ignore_index_log_prob", "type error", - {"onnx170"}}, - {"softmax_cross_entropy_mean_weight_log_prob", "type error", {"onnx170"}}, - {"softmax_cross_entropy_input_shape_is_NCd1d2d3d4d5_mean_weight_log_prob", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean_weight_ignore_index_3d", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean_weight_ignore_index_4d_log_prob", "type error", {"onnx170"}}, - {"softmax_cross_entropy_input_shape_is_NCd1d2d3d4d5_none_no_weight_log_prob", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean_weight_ignore_index_4d", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean_log_prob", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean_no_weight_ignore_index", "type error", {"onnx170"}}, + {"opset12"}}, + {"softmax_cross_entropy_mean_weight_log_prob", "type error", {"opset12"}}, + {"softmax_cross_entropy_input_shape_is_NCd1d2d3d4d5_mean_weight_log_prob", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean_weight_ignore_index_3d", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean_weight_ignore_index_4d_log_prob", "type error", {"opset12"}}, + {"softmax_cross_entropy_input_shape_is_NCd1d2d3d4d5_none_no_weight_log_prob", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean_weight_ignore_index_4d", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean_log_prob", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean_no_weight_ignore_index", "type error", {"opset12"}}, {"softmax_cross_entropy_input_shape_is_NCd1d2d3_sum_weight_high_ignore_index_log_prob", "type error", - {"onnx170"}}, - {"softmax_cross_entropy_mean_3d_log_prob", "type error", {"onnx170"}}, - {"softmax_cross_entropy_none_log_prob", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean_3d", "type error", {"onnx170"}}, - {"softmax_cross_entropy_input_shape_is_NCd1d2d3_none_no_weight_negative_ignore_index", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean_weight_ignore_index_3d_log_prob", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean_no_weight_ignore_index_3d_log_prob", "type error", {"onnx170"}}, - {"softmax_cross_entropy_none_weights_log_prob", "type error", {"onnx170"}}, - {"softmax_cross_entropy_sum_log_prob", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean_weight_ignore_index", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean_no_weight_ignore_index_log_prob", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean_no_weight_ignore_index_3d", "type error", {"onnx170"}}, - {"softmax_cross_entropy_input_shape_is_NCd1d2d3_sum_weight_high_ignore_index", "type error", {"onnx170"}}, - {"softmax_cross_entropy_sum", "type error", {"onnx170"}}, + {"opset12"}}, + {"softmax_cross_entropy_mean_3d_log_prob", "type error", {"opset12"}}, + {"softmax_cross_entropy_none_log_prob", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean_3d", "type error", {"opset12"}}, + {"softmax_cross_entropy_input_shape_is_NCd1d2d3_none_no_weight_negative_ignore_index", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean_weight_ignore_index_3d_log_prob", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean_no_weight_ignore_index_3d_log_prob", "type error", {"opset12"}}, + {"softmax_cross_entropy_none_weights_log_prob", "type error", {"opset12"}}, + {"softmax_cross_entropy_sum_log_prob", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean_weight_ignore_index", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean_no_weight_ignore_index_log_prob", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean_no_weight_ignore_index_3d", "type error", {"opset12"}}, + {"softmax_cross_entropy_input_shape_is_NCd1d2d3_sum_weight_high_ignore_index", "type error", {"opset12"}}, + {"softmax_cross_entropy_sum", "type error", {"opset12"}}, {"softmax_cross_entropy_input_shape_is_NCd1d2d3_none_no_weight_negative_ignore_index_log_prob", "type error", - {"onnx170"}}, - {"softmax_cross_entropy_none_weights", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean_no_weight_ignore_index_4d_log_prob", "type error", {"onnx170"}}, - {"softmax_cross_entropy_none", "type error", {"onnx170"}}, - {"softmax_cross_entropy_input_shape_is_NCd1_mean_weight_negative_ignore_index", "type error", {"onnx170"}}, - {"softmax_cross_entropy_input_shape_is_NCd1d2d3d4d5_mean_weight", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean_weight", "type error", {"onnx170"}}, - {"softmax_cross_entropy_mean_no_weight_ignore_index_4d", "type error", {"onnx170"}}, + {"opset12"}}, + {"softmax_cross_entropy_none_weights", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean_no_weight_ignore_index_4d_log_prob", "type error", {"opset12"}}, + {"softmax_cross_entropy_none", "type error", {"opset12"}}, + {"softmax_cross_entropy_input_shape_is_NCd1_mean_weight_negative_ignore_index", "type error", {"opset12"}}, + {"softmax_cross_entropy_input_shape_is_NCd1d2d3d4d5_mean_weight", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean_weight", "type error", {"opset12"}}, + {"softmax_cross_entropy_mean_no_weight_ignore_index_4d", "type error", {"opset12"}}, #endif {"mask_rcnn_keras", "this model currently has an invalid contrib op version set to 10", {}}}; @@ -593,10 +593,10 @@ TEST_P(ModelTest, Run) { { BrokenTest t = {ToUTF8String(test_case_name), ""}; auto iter = broken_tests.find(t); - auto model_version = model_info->GetModelVersion(); - if (iter != broken_tests.end() && - (model_version == TestModelInfo::unknown_version || iter->broken_versions_.empty() || - iter->broken_versions_.find(model_version) != iter->broken_versions_.end())) { + auto opset_version = model_info->GetNominalOpsetVersion(); + if (iter != broken_tests.end() && + (opset_version == TestModelInfo::unknown_version || iter->broken_opset_versions_.empty() || + iter->broken_opset_versions_.find(opset_version) != iter->broken_opset_versions_.end() )) { SkipTest(); return; } @@ -1055,9 +1055,14 @@ TEST_P(ModelTest, Run) { #endif // TENSORRT/OpenVino has too many test failures in the single node tests -#if !defined(_WIN32) && !defined(USE_OPENVINO) - paths.push_back("/data/onnx"); +#if !defined(USE_OPENVINO) +#if !defined(_WIN32) + paths.push_back(ORT_TSTR("/data/onnx")); +#else + paths.push_back(ORT_TSTR("c:\\local\\data\\onnx")); #endif +#endif + while (!paths.empty()) { std::basic_string node_data_root_path = paths.back(); paths.pop_back(); @@ -1074,7 +1079,6 @@ TEST_P(ModelTest, Run) { std::basic_string filename_str = filename; if (!HasExtensionOf(filename_str, ORT_TSTR("onnx"))) return true; - std::basic_string test_case_name = my_dir_name; if (test_case_name.compare(0, 5, ORT_TSTR("test_")) == 0) test_case_name = test_case_name.substr(5); @@ -1125,8 +1129,8 @@ auto ExpandModelName = [](const ::testing::TestParamInfo& std::replace(name.begin(), name.end(), '\\', '_'); // Note: test name only accepts '_' and alphanumeric - // remove '.' and '-' - char chars[] = ".-"; + // remove '.', '-', ':' + char chars[] = ".-:"; for (unsigned int i = 0; i < strlen(chars); ++i) { name.erase(std::remove(name.begin(), name.end(), chars[i]), name.end()); } diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index 79314f3451..3f52859d9e 100644 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -2694,8 +2694,7 @@ def main(): if args.test: if args.enable_onnx_tests: source_onnx_model_dir = "C:\\local\\models" if is_windows() else "/data/models" - dest_model_dir_name = "models" - setup_test_data(source_onnx_model_dir, dest_model_dir_name, build_dir, configs) + setup_test_data(source_onnx_model_dir, "models", build_dir, configs) run_onnxruntime_tests(args, source_dir, ctest_path, build_dir, configs) diff --git a/tools/ci_build/github/azure-pipelines/c-api-noopenmp-packaging-pipelines.yml b/tools/ci_build/github/azure-pipelines/c-api-noopenmp-packaging-pipelines.yml index c644452b01..912e6a741a 100644 --- a/tools/ci_build/github/azure-pipelines/c-api-noopenmp-packaging-pipelines.yml +++ b/tools/ci_build/github/azure-pipelines/c-api-noopenmp-packaging-pipelines.yml @@ -23,7 +23,7 @@ resources: repositories: - repository: onnxruntime-inference-examples # The name used to reference this repository in the checkout step type: github - endpoint: ort-examples + endpoint: ort-examples name: microsoft/onnxruntime-inference-examples - repository: manylinux type: Github @@ -287,7 +287,7 @@ jobs: set -e -x cd $(Build.SourcesDirectory) mv manylinux onnxruntime - ls + ls - template: templates/with-container-registry-steps.yml parameters: @@ -352,7 +352,7 @@ jobs: script: | docker run --gpus all -e CC=/opt/rh/devtoolset-10/root/usr/bin/cc -e CXX=/opt/rh/devtoolset-10/root/usr/bin/c++ -e CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection -fcf-protection -O3 -Wl,--strip-all" -e CXXFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection -fcf-protection -O3 -Wl,--strip-all" -e NVIDIA_VISIBLE_DEVICES=all --rm --volume $(Build.SourcesDirectory):/src_dir \ --volume $(Build.ArtifactStagingDirectory):/artifact_src -e NIGHTLY_BUILD onnxruntimecuda116xtrt84build \ - /src_dir/onnxruntime-inference-examples/c_cxx/squeezenet/run_capi_application.sh -o /src_dir/onnxruntime -p /artifact_src/onnxruntime-linux-x64-gpu-$(OnnxRuntimeVersion).tgz -w /src_dir/onnxruntime-inference-examples/c_cxx/squeezenet + /src_dir/onnxruntime-inference-examples/c_cxx/squeezenet/run_capi_application.sh -o /src_dir/onnxruntime -p /artifact_src/onnxruntime-linux-x64-gpu-$(OnnxRuntimeVersion).tgz -w /src_dir/onnxruntime-inference-examples/c_cxx/squeezenet workingDirectory: '$(Build.ArtifactStagingDirectory)' - task: PublishPipelineArtifact@1 @@ -433,8 +433,8 @@ jobs: displayName: 'Test C API application for GPU package' inputs: filename: $(Build.SourcesDirectory)\onnxruntime-inference-examples\c_cxx\squeezenet\run_capi_application.bat - arguments: $(Build.SourcesDirectory)\onnxruntime $(Build.ArtifactStagingDirectory)\onnxruntime-win-x64-gpu-$(OnnxRuntimeVersion).zip $(Build.SourcesDirectory)\onnxruntime-inference-examples\c_cxx\squeezenet - workingFolder: '$(Build.ArtifactStagingDirectory)' + arguments: $(Build.SourcesDirectory)\onnxruntime $(Build.ArtifactStagingDirectory)\onnxruntime-win-x64-gpu-$(OnnxRuntimeVersion).zip $(Build.SourcesDirectory)\onnxruntime-inference-examples\c_cxx\squeezenet + workingFolder: '$(Build.ArtifactStagingDirectory)' - task: PublishPipelineArtifact@0 displayName: 'Publish Pipeline Combined GPU Package Artifact' @@ -518,17 +518,17 @@ jobs: script: | dotnet workload install android ios macos workingDirectory: '$(Build.SourcesDirectory)\csharp' - + - task: PowerShell@2 displayName: Build .NET 6 targets using dotnet inputs: targetType: 'inline' # we don't specify 'Any CPU' as the platform here because if we do it gets added to the output path - # e.g. csharp\src\Microsoft.ML.OnnxRuntime\bin\Any CPU\RelWithDebInfo\net6.0-ios\ - # which is inconsistent with the msbuild output path for the pre-.net6 targets + # e.g. csharp\src\Microsoft.ML.OnnxRuntime\bin\Any CPU\RelWithDebInfo\net6.0-ios\ + # which is inconsistent with the msbuild output path for the pre-.net6 targets # e.g. csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\monoandroid11.0 # and makes it harder to do the packing - # + # # 'Any CPU' is the default (first 'mixed' platform specified in the csproj) so this should be fine. script: | dotnet build .\src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj -p:SelectedTargets=Net6 -p:Configuration=RelWithDebInfo -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId="Microsoft.ML.OnnxRuntime.Gpu" -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} @@ -855,4 +855,4 @@ jobs: artifactName: 'drop-signed-nuget-dml' targetPath: '$(Build.ArtifactStagingDirectory)' -- template: templates/publish-nuget.yml \ No newline at end of file +- template: templates/publish-nuget.yml diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/test_win.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/test_win.yml index 195da14012..f4e0508741 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/test_win.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/test_win.yml @@ -22,9 +22,9 @@ jobs: steps: - task: UsePythonVersion@0 - inputs: - versionSpec: '3.7' - addToPath: true + inputs: + versionSpec: '3.7' + addToPath: true architecture: x64 - task: NuGetToolInstaller@0 @@ -45,7 +45,7 @@ jobs: filename: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat' arguments: 'amd64' modifyEnvironment: true - + - task: DownloadPipelineArtifact@0 displayName: 'Download Pipeline Artifact' inputs: diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/win-ci-2019.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/win-ci-2019.yml index 8827cb8457..c965c47023 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/win-ci-2019.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/win-ci-2019.yml @@ -71,9 +71,9 @@ jobs: versionSpec: '16.x' - task: UsePythonVersion@0 - inputs: - versionSpec: '3.7' - addToPath: true + inputs: + versionSpec: '3.7' + addToPath: true architecture: ${{ parameters.BuildArch }} - task: BatchScript@1 @@ -94,10 +94,10 @@ jobs: $Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{ parameters.BuildArch }}-windows-static" python setup.py bdist_wheel python -m pip uninstall -y onnx -qq - Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname} + Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname} workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx' displayName: 'Install ONNX' - + - task: PythonScript@0 displayName: 'Generate cmake config' inputs: @@ -160,7 +160,7 @@ jobs: workingDirectory: '$(Build.BinariesDirectory)' displayName: 'Create models link' - - ${{ if in(parameters['sln_platform'], 'Win32', 'x64') }}: + - ${{ if in(parameters['sln_platform'], 'Win32', 'x64') }}: - ${{ if eq(parameters.BuildCSharp, true) }}: - task: DotNetCoreCLI@2 displayName: 'Test C#' 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 16cbae5df1..ad8e36b7ee 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 @@ -40,7 +40,7 @@ parameters: jobs: - template: c-api-linux-cpu.yml - parameters: + parameters: AdditionalBuildFlags: ${{ parameters.AdditionalBuildFlags }} BaseImage: 'centos:7' OnnxruntimeArch: 'x64' @@ -50,7 +50,7 @@ jobs: PoolName: 'Linux-CPU' - template: c-api-linux-cpu.yml - parameters: + parameters: AdditionalBuildFlags: ${{ parameters.AdditionalBuildFlags }} BaseImage: 'arm64v8/centos:7' OnnxruntimeArch: 'aarch64' @@ -431,17 +431,17 @@ jobs: script: | dotnet workload install android ios macos workingDirectory: '$(Build.SourcesDirectory)\csharp' - - - task: PowerShell@2 + + - task: PowerShell@2 displayName: Build Microsoft.ML.OnnxRuntime .NET 6 targets using dotnet inputs: targetType: 'inline' # we don't specify 'Any CPU' as the platform here because if we do it gets added to the output path - # e.g. csharp\src\Microsoft.ML.OnnxRuntime\bin\Any CPU\RelWithDebInfo\net6.0-ios\ - # which is inconsistent with the msbuild output path for the pre-.net6 targets + # e.g. csharp\src\Microsoft.ML.OnnxRuntime\bin\Any CPU\RelWithDebInfo\net6.0-ios\ + # which is inconsistent with the msbuild output path for the pre-.net6 targets # e.g. csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo\monoandroid11.0 # and makes it harder to do the packing - # + # # 'Any CPU' is the default (first 'mixed' platform specified in the csproj) so this should be fine. script: | dotnet build .\src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj -p:SelectedTargets=Net6 -p:Configuration=RelWithDebInfo -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) -p:IsReleaseBuild=${{ parameters.IsReleaseBuild }} @@ -583,7 +583,7 @@ jobs: git checkout -- js/** git checkout -- .gitattributes workingDirectory: '$(Build.SourcesDirectory)' - displayName: 'Testing: force EOL to lf on windows for /js/**' + displayName: 'Testing: force EOL to lf on windows for /js/**' - task: DownloadPipelineArtifact@0 displayName: 'Download Pipeline Artifact - NuGet (Win x64)'