From 2d00c20ee73ce227bc6900fa5c13819c4fefba10 Mon Sep 17 00:00:00 2001 From: Jingyan Wang Date: Sat, 27 Jul 2024 08:23:19 -0700 Subject: [PATCH 01/12] Security fuzz address sanitizer fix Bug #2 and #3 --- onnxruntime/contrib_ops/cpu/transformers/subgraph_gpt.cc | 2 ++ onnxruntime/core/optimizer/attention_fusion.cc | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/onnxruntime/contrib_ops/cpu/transformers/subgraph_gpt.cc b/onnxruntime/contrib_ops/cpu/transformers/subgraph_gpt.cc index 34a1da99316a2..030cdb1e1b17f 100644 --- a/onnxruntime/contrib_ops/cpu/transformers/subgraph_gpt.cc +++ b/onnxruntime/contrib_ops/cpu/transformers/subgraph_gpt.cc @@ -143,6 +143,8 @@ Status GptSubgraph::Validate(const std::vector& subgraph_inputs, // Past state shape is like (2, batch_size, num_heads, past_seq_len, hidden_size/num_heads). const ONNX_NAMESPACE::TensorShapeProto* past_shape = subgraph_inputs[3]->Shape(); + ORT_RETURN_IF(past_shape == nullptr, + "subgraph past state cannot be nullptr"); ORT_RETURN_IF(past_shape->dim_size() != 5, "subgraph past state is expected to have 5 dimension, got ", past_shape->dim_size()); diff --git a/onnxruntime/core/optimizer/attention_fusion.cc b/onnxruntime/core/optimizer/attention_fusion.cc index 08066f030a381..64a38214caff0 100644 --- a/onnxruntime/core/optimizer/attention_fusion.cc +++ b/onnxruntime/core/optimizer/attention_fusion.cc @@ -210,7 +210,7 @@ Status AttentionFusion::ApplyImpl(Graph& graph, bool& modified, int graph_level, if ((node.GetOutputEdgesCount() >= 2 && node.GetOutputEdgesCount() <= 6) && // Add node.GetOutputEdgesCount() == 5/6 for distilbert graph_utils::IsSupportedOptypeVersionAndDomain(node, "LayerNormalization", {1, 17}, kOnnxDomain) && - graph_utils::IsSupportedProvider(node, GetCompatibleExecutionProviders())) { + graph_utils::IsSupportedProvider(node, GetCompatibleExecutionProviders()) && node.InputDefs().size() > 2) { // Get hidden size from layer norm bias tensor shape. const NodeArg& layer_norm_bias = *(node.InputDefs()[2]); if (!optimizer_utils::IsShapeKnownOnAllDims(layer_norm_bias, 1)) { From 8427465a1a235f954e6206b83bfc27c52530a058 Mon Sep 17 00:00:00 2001 From: Jingyan Wang Date: Fri, 2 Aug 2024 20:38:08 -0700 Subject: [PATCH 02/12] Fix Bug 1, 4, 5, 7 found in security fuzz test --- onnxruntime/core/framework/tensorprotoutils.cc | 1 + onnxruntime/core/optimizer/attention_fusion.cc | 10 +++++----- onnxruntime/core/optimizer/unsqueeze_elimination.cc | 12 ++++++++---- .../core/providers/cpu/quantization/qlinearconv.cc | 4 ++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/onnxruntime/core/framework/tensorprotoutils.cc b/onnxruntime/core/framework/tensorprotoutils.cc index 4ecd61962d797..ce33ba68a7421 100644 --- a/onnxruntime/core/framework/tensorprotoutils.cc +++ b/onnxruntime/core/framework/tensorprotoutils.cc @@ -1328,6 +1328,7 @@ common::Status ConstantNodeProtoToTensorProto(const ONNX_NAMESPACE::NodeProto& n common::Status ConstantNodeProtoToTensorProto(const ONNX_NAMESPACE::NodeProto& node, const std::filesystem::path& model_path, ONNX_NAMESPACE::TensorProto& tensor) { + ORT_ENFORCE(node.output_size() == 1, "NodeProto for Constant should have 1 output. Got:", node.output_size()); return ConstantNodeProtoToTensorProto(node, model_path, tensor, node.output(0)); } diff --git a/onnxruntime/core/optimizer/attention_fusion.cc b/onnxruntime/core/optimizer/attention_fusion.cc index 64a38214caff0..4f788551e945b 100644 --- a/onnxruntime/core/optimizer/attention_fusion.cc +++ b/onnxruntime/core/optimizer/attention_fusion.cc @@ -211,13 +211,13 @@ Status AttentionFusion::ApplyImpl(Graph& graph, bool& modified, int graph_level, if ((node.GetOutputEdgesCount() >= 2 && node.GetOutputEdgesCount() <= 6) && // Add node.GetOutputEdgesCount() == 5/6 for distilbert graph_utils::IsSupportedOptypeVersionAndDomain(node, "LayerNormalization", {1, 17}, kOnnxDomain) && graph_utils::IsSupportedProvider(node, GetCompatibleExecutionProviders()) && node.InputDefs().size() > 2) { - // Get hidden size from layer norm bias tensor shape. - const NodeArg& layer_norm_bias = *(node.InputDefs()[2]); - if (!optimizer_utils::IsShapeKnownOnAllDims(layer_norm_bias, 1)) { - DEBUG_LOG("shape of layer norm bias tensor not expected"); + // Get hidden size from layer norm scale tensor shape. `bias` is an optional input and may not exist. + const NodeArg& layer_norm_scale = *(node.InputDefs()[1]); + if (!optimizer_utils::IsShapeKnownOnAllDims(layer_norm_scale, 1)) { + DEBUG_LOG("shape of layer norm scale tensor not expected"); continue; } - int64_t hidden_size = layer_norm_bias.Shape()->dim(0).dim_value(); + int64_t hidden_size = layer_norm_scale.Shape()->dim(0).dim_value(); const Node* add_node = nullptr; unsigned int add_count = 0; diff --git a/onnxruntime/core/optimizer/unsqueeze_elimination.cc b/onnxruntime/core/optimizer/unsqueeze_elimination.cc index 4efc8018f0217..3c08963f0894a 100644 --- a/onnxruntime/core/optimizer/unsqueeze_elimination.cc +++ b/onnxruntime/core/optimizer/unsqueeze_elimination.cc @@ -40,13 +40,17 @@ Status UnsqueezeElimination::Apply(Graph& graph, Node& node, RewriteRuleEffect& // Generate new dims. InlinedVector new_dims(output_rank, 0); for (int64_t axis : axes) { - new_dims[static_cast(axis)] = 1; + if (static_cast(axis) < new_dims.size()) { + new_dims[static_cast(axis)] = 1; + } } auto begin = tensor_proto.dims().cbegin(); - for (auto& axis : new_dims) { - if (axis == 0) { - axis = *begin++; + if (begin != tensor_proto.dims().cend()) { + for (auto& axis : new_dims) { + if (axis == 0) { + axis = *begin++; + } } } diff --git a/onnxruntime/core/providers/cpu/quantization/qlinearconv.cc b/onnxruntime/core/providers/cpu/quantization/qlinearconv.cc index 21a256eee6f14..7797cbe678bd4 100644 --- a/onnxruntime/core/providers/cpu/quantization/qlinearconv.cc +++ b/onnxruntime/core/providers/cpu/quantization/qlinearconv.cc @@ -380,8 +380,8 @@ Status QLinearConv::PrePack(const Tensor& tensor, int input_idx, Alloca const int64_t M = shape[0]; const int64_t C = shape[1]; - // Verify that the total number of output channels is a multiple of the group count. - if (M % conv_attrs_.group != 0) { + // Verify that conv_attrs_.group is not 0 and the total number of output channels is a multiple of the group count. + if (conv_attrs_.group == 0 || M % conv_attrs_.group != 0) { return Status::OK(); } From 5f052789bc0c313bacdb9df1c74d57f1dd2a928f Mon Sep 17 00:00:00 2001 From: Jingyan Wang Date: Tue, 6 Aug 2024 16:39:41 -0700 Subject: [PATCH 03/12] Fix bug 8 --- onnxruntime/core/optimizer/attention_fusion.cc | 2 +- .../core/providers/cpu/ml/tree_ensemble_common.h | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/onnxruntime/core/optimizer/attention_fusion.cc b/onnxruntime/core/optimizer/attention_fusion.cc index dc50c8935bc5b..ff8943de79679 100644 --- a/onnxruntime/core/optimizer/attention_fusion.cc +++ b/onnxruntime/core/optimizer/attention_fusion.cc @@ -221,7 +221,7 @@ Status AttentionFusion::ApplyImpl(Graph& graph, bool& modified, int graph_level, DEBUG_LOG("shape of layer norm bias tensor not expected"); continue; } - int64_t hidden_size = layer_norm_scale.Shape()->dim(0).dim_value(); + int64_t hidden_size = layer_norm_bias.Shape()->dim(0).dim_value(); const Node* add_node = nullptr; unsigned int add_count = 0; diff --git a/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h b/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h index 8f847fe66aa73..3fa6f32202413 100644 --- a/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h +++ b/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h @@ -172,7 +172,6 @@ Status TreeEnsembleCommon::Init( nodes_falsenodeids.size() == nodes_values_as_tensor.size()); ORT_ENFORCE(target_class_ids.size() == target_class_nodeids.size()); ORT_ENFORCE(target_class_ids.size() == target_class_treeids.size()); - ORT_ENFORCE(target_class_ids.size() == target_class_treeids.size()); ORT_ENFORCE(base_values.empty() || base_values_as_tensor.empty()); ORT_ENFORCE(nodes_hitrates.empty() || nodes_hitrates_as_tensor.empty()); ORT_ENFORCE(nodes_values.empty() || nodes_values_as_tensor.empty()); @@ -319,10 +318,17 @@ Status TreeEnsembleCommon::Init( // ORT_THROW("Node ", ind.tree_id, "-", ind.node_id, " is not a leaf."); continue; } - w.i = target_class_ids[i]; - w.value = target_class_weights_as_tensor.empty() ? static_cast(target_class_weights[i]) - : target_class_weights_as_tensor[i]; - if (leaf.truenode_or_weight.weight_data.n_weights == 0) { + if (i >= target_class_ids.size()) { + ORT_THROW("Index ", i, " is out of bounds for target_class_ids."); + } + if (i >= target_class_weights.size() && i >= target_class_weights_as_tensor.size()) { + ORT_THROW("Index ", i, " is out of bounds for both target_class_weights and target_class_weights_as_tensor."); + } + + w.i = target_class_ids.at(i); + w.value = target_class_weights_as_tensor.empty() ? static_cast(target_class_weights.at(i)) + : target_class_weights_as_tensor.at(i); + if (leaf.truenode_or_weight.weight_data.n_weights == 0) { leaf.truenode_or_weight.weight_data.weight = static_cast(weights_.size()); leaf.value_or_unique_weight = w.value; } From 22103fa22b40393d29b65556d6ff52fb65850ec5 Mon Sep 17 00:00:00 2001 From: Jingyan Wang Date: Wed, 7 Aug 2024 09:57:58 -0700 Subject: [PATCH 04/12] Check target_class_weights.size() instead --- .../core/providers/cpu/ml/tree_ensemble_common.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h b/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h index 3fa6f32202413..a2c88aa603c13 100644 --- a/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h +++ b/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h @@ -172,6 +172,7 @@ Status TreeEnsembleCommon::Init( nodes_falsenodeids.size() == nodes_values_as_tensor.size()); ORT_ENFORCE(target_class_ids.size() == target_class_nodeids.size()); ORT_ENFORCE(target_class_ids.size() == target_class_treeids.size()); + ORT_ENFORCE(target_class_ids.size() == target_class_weights.size()); ORT_ENFORCE(base_values.empty() || base_values_as_tensor.empty()); ORT_ENFORCE(nodes_hitrates.empty() || nodes_hitrates_as_tensor.empty()); ORT_ENFORCE(nodes_values.empty() || nodes_values_as_tensor.empty()); @@ -318,16 +319,9 @@ Status TreeEnsembleCommon::Init( // ORT_THROW("Node ", ind.tree_id, "-", ind.node_id, " is not a leaf."); continue; } - if (i >= target_class_ids.size()) { - ORT_THROW("Index ", i, " is out of bounds for target_class_ids."); - } - if (i >= target_class_weights.size() && i >= target_class_weights_as_tensor.size()) { - ORT_THROW("Index ", i, " is out of bounds for both target_class_weights and target_class_weights_as_tensor."); - } - - w.i = target_class_ids.at(i); - w.value = target_class_weights_as_tensor.empty() ? static_cast(target_class_weights.at(i)) - : target_class_weights_as_tensor.at(i); + w.i = target_class_ids[i]; + w.value = target_class_weights_as_tensor.empty() ? static_cast(target_class_weights[i]) + : target_class_weights_as_tensor[i]; if (leaf.truenode_or_weight.weight_data.n_weights == 0) { leaf.truenode_or_weight.weight_data.weight = static_cast(weights_.size()); leaf.value_or_unique_weight = w.value; From 4a31714d4f42efb33658e47d67b63698ca9af76a Mon Sep 17 00:00:00 2001 From: Jingyan Wang Date: Wed, 7 Aug 2024 10:20:26 -0700 Subject: [PATCH 05/12] Remove whitespace at the end of line --- onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h b/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h index a2c88aa603c13..f0d74c4fe9cd6 100644 --- a/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h +++ b/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h @@ -322,7 +322,7 @@ Status TreeEnsembleCommon::Init( w.i = target_class_ids[i]; w.value = target_class_weights_as_tensor.empty() ? static_cast(target_class_weights[i]) : target_class_weights_as_tensor[i]; - if (leaf.truenode_or_weight.weight_data.n_weights == 0) { + if (leaf.truenode_or_weight.weight_data.n_weights == 0) { leaf.truenode_or_weight.weight_data.weight = static_cast(weights_.size()); leaf.value_or_unique_weight = w.value; } From 42168f5c17c61a772ce03091de7bb6a7f0b39654 Mon Sep 17 00:00:00 2001 From: Jingyan Wang Date: Wed, 7 Aug 2024 15:12:11 -0700 Subject: [PATCH 06/12] Check index bound due to unit test error --- onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h b/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h index f0d74c4fe9cd6..be5d2ce5e41f2 100644 --- a/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h +++ b/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h @@ -172,7 +172,6 @@ Status TreeEnsembleCommon::Init( nodes_falsenodeids.size() == nodes_values_as_tensor.size()); ORT_ENFORCE(target_class_ids.size() == target_class_nodeids.size()); ORT_ENFORCE(target_class_ids.size() == target_class_treeids.size()); - ORT_ENFORCE(target_class_ids.size() == target_class_weights.size()); ORT_ENFORCE(base_values.empty() || base_values_as_tensor.empty()); ORT_ENFORCE(nodes_hitrates.empty() || nodes_hitrates_as_tensor.empty()); ORT_ENFORCE(nodes_values.empty() || nodes_values_as_tensor.empty()); @@ -319,6 +318,12 @@ Status TreeEnsembleCommon::Init( // ORT_THROW("Node ", ind.tree_id, "-", ind.node_id, " is not a leaf."); continue; } + if (i >= target_class_ids.size()) { + ORT_THROW("Index ", i, " is out of bounds for target_class_ids."); + } + if (i >= target_class_weights.size() && i >= target_class_weights_as_tensor.size()) { + ORT_THROW("Index ", i, " is out of bounds for both target_class_weights and target_class_weights_as_tensor."); + } w.i = target_class_ids[i]; w.value = target_class_weights_as_tensor.empty() ? static_cast(target_class_weights[i]) : target_class_weights_as_tensor[i]; From 1a2a74b659717e90f9fa2018436f67429f622478 Mon Sep 17 00:00:00 2001 From: Jingyan Wang Date: Thu, 8 Aug 2024 23:17:07 -0700 Subject: [PATCH 07/12] Merge with main --- .gitignore | 11 +++++++++++ build.bat | 2 +- onnxruntime/test/fuzzing/src/test.cpp | 25 ++++++++++++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4d0a1205b7c19..76ac850f4b3e6 100644 --- a/.gitignore +++ b/.gitignore @@ -196,3 +196,14 @@ Package.resolved .build/ .swiftpm/ repros/ + +b\ +build\ +b/ +build/ +build*\ + +build2/ +build3/ + +b3/ \ No newline at end of file diff --git a/build.bat b/build.bat index d0c6cbcddd669..2fe6d8160d721 100644 --- a/build.bat +++ b/build.bat @@ -7,4 +7,4 @@ setlocal set PATH=C:\Program Files\Git\usr\bin;%PATH% rem Requires a Python install to be available in your PATH -python "%~dp0\tools\ci_build\build.py" --build_dir "%~dp0\build\Windows" %* +python "%~dp0\tools\ci_build\build.py" --build_dir "%~dp0\build2\Windows" %* diff --git a/onnxruntime/test/fuzzing/src/test.cpp b/onnxruntime/test/fuzzing/src/test.cpp index 490f7dd4d37a3..b9bf9e300e25d 100644 --- a/onnxruntime/test/fuzzing/src/test.cpp +++ b/onnxruntime/test/fuzzing/src/test.cpp @@ -44,7 +44,30 @@ void mutateModelTest(onnx::ModelProto& model_proto, // std::wstring modelPrefix = L"/ReproMutateModel_"; if (seed == 0) { - seed = static_cast(std::chrono::system_clock::now().time_since_epoch().count()); + // seed = static_cast(std::chrono::system_clock::now().time_since_epoch().count()); + // Bug 1 - fixed in attention_fusion.cc + // attention_past_no_unidir.onnx + // seed = 2161642583; // Bug 1 + // seed = 2647017145; // Bug 2 - fixed + // seed = 2913110292; // Bug 3 - fixed + // Bug 4 - fixed with bug 7 + // /r "C:\Users\jingywa\source\onnxruntime\build\Windows\RelWithDebInfo\RelWithDebInfo\testdata\transform\bert_toy_opset14.onnx" 548860496 + // Call stack starts from asan_win.cpp + // seed = 548860496; // Bug 4 + // Bug 5 - fixed in unsqueeze_elimination.cc + // /r "C:\Users\jingywa\source\onnxruntime\build\Windows\RelWithDebInfo\RelWithDebInfo\testdata\transform\fusion\fuse-conv-add-no-bias.onnx" 3412260231 + // /t /v "C:\Users\jingywa\source\onnxruntime\build\Windows\RelWithDebInfo\RelWithDebInfo\testdata\transform\fusion\fuse-conv-add-no-bias.onnx" 10 m + // Call stack starts from asan_win.cpp + // Assertion failed: false && "i < size()", file C:\Users\jingywa\source\onnxruntime\build\Windows\Debug\_deps\abseil_cpp-src\absl/container/inlined_vector.h, line 363 + seed = 3412260231; // Bug 5 + // seed = 191684599; // Bug 6 - fixed in qlinearconv.cc? + // Bug 7 - fixed in tensorprotoutils.cc + // /r "C:\Users\jingywa\source\onnxruntime\build\Windows\RelWithDebInfo\RelWithDebInfo\testdata\leconv_Opset17.onnx 1858054927 + // seed = 1858054927; // Bug 7 + + // Bug 8 - Need to fix unit test error. + // /r "C:\Users\jingywa\source\onnxruntime\build\Windows\RelWithDebInfo\RelWithDebInfo\testdata\pipeline_vectorize.onnx" 1332387938 + // seed = 1332387938; modelPrefix = L"/MutateModel_"; } From 178fb5c459592b6a17b3fcc5c4578c96d1693641 Mon Sep 17 00:00:00 2001 From: Jingyan Wang Date: Fri, 9 Aug 2024 13:16:51 -0700 Subject: [PATCH 08/12] Return from unsqueeze elimination with invalid axes. Index chek in tree_ensemble_common.h is no longer necessary after a merged fix --- .../core/optimizer/unsqueeze_elimination.cc | 14 +++++++------- .../core/providers/cpu/ml/tree_ensemble_common.h | 6 ------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/onnxruntime/core/optimizer/unsqueeze_elimination.cc b/onnxruntime/core/optimizer/unsqueeze_elimination.cc index 3c08963f0894a..9fba50f890539 100644 --- a/onnxruntime/core/optimizer/unsqueeze_elimination.cc +++ b/onnxruntime/core/optimizer/unsqueeze_elimination.cc @@ -40,17 +40,17 @@ Status UnsqueezeElimination::Apply(Graph& graph, Node& node, RewriteRuleEffect& // Generate new dims. InlinedVector new_dims(output_rank, 0); for (int64_t axis : axes) { - if (static_cast(axis) < new_dims.size()) { - new_dims[static_cast(axis)] = 1; + if (static_cast(axis) >= new_dims.size() || static_cast(axis) < 0) { + LOGS(logger, WARNING) << "UnsqueezeElimination cannot remove node due to invalid axes" << node.Name(); + return Status::OK(); } + new_dims[static_cast(axis)] = 1; } auto begin = tensor_proto.dims().cbegin(); - if (begin != tensor_proto.dims().cend()) { - for (auto& axis : new_dims) { - if (axis == 0) { - axis = *begin++; - } + for (auto& axis : new_dims) { + if (axis == 0) { + axis = *begin++; } } diff --git a/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h b/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h index 4c7eb08ec16f2..df27f888bb0af 100644 --- a/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h +++ b/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h @@ -319,12 +319,6 @@ Status TreeEnsembleCommon::Init( // ORT_THROW("Node ", ind.tree_id, "-", ind.node_id, " is not a leaf."); continue; } - if (i >= target_class_ids.size()) { - ORT_THROW("Index ", i, " is out of bounds for target_class_ids."); - } - if (i >= target_class_weights.size() && i >= target_class_weights_as_tensor.size()) { - ORT_THROW("Index ", i, " is out of bounds for both target_class_weights and target_class_weights_as_tensor."); - } w.i = target_class_ids[i]; w.value = target_class_weights_as_tensor.empty() ? static_cast(target_class_weights[i]) : target_class_weights_as_tensor[i]; From c4fcd0007126fc929f6dc5f2c1326e3afa6e3719 Mon Sep 17 00:00:00 2001 From: Jingyan Wang Date: Sat, 10 Aug 2024 06:39:09 -0700 Subject: [PATCH 09/12] Fix pipelien error and revert unintended changes --- .gitignore | 5 +---- build.bat | 2 +- onnxruntime/core/optimizer/unsqueeze_elimination.cc | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 76ac850f4b3e6..3ca37e01b715c 100644 --- a/.gitignore +++ b/.gitignore @@ -203,7 +203,4 @@ b/ build/ build*\ -build2/ -build3/ - -b3/ \ No newline at end of file +b2 \ No newline at end of file diff --git a/build.bat b/build.bat index 2fe6d8160d721..d0c6cbcddd669 100644 --- a/build.bat +++ b/build.bat @@ -7,4 +7,4 @@ setlocal set PATH=C:\Program Files\Git\usr\bin;%PATH% rem Requires a Python install to be available in your PATH -python "%~dp0\tools\ci_build\build.py" --build_dir "%~dp0\build2\Windows" %* +python "%~dp0\tools\ci_build\build.py" --build_dir "%~dp0\build\Windows" %* diff --git a/onnxruntime/core/optimizer/unsqueeze_elimination.cc b/onnxruntime/core/optimizer/unsqueeze_elimination.cc index 9fba50f890539..d52cc82af02bb 100644 --- a/onnxruntime/core/optimizer/unsqueeze_elimination.cc +++ b/onnxruntime/core/optimizer/unsqueeze_elimination.cc @@ -40,7 +40,7 @@ Status UnsqueezeElimination::Apply(Graph& graph, Node& node, RewriteRuleEffect& // Generate new dims. InlinedVector new_dims(output_rank, 0); for (int64_t axis : axes) { - if (static_cast(axis) >= new_dims.size() || static_cast(axis) < 0) { + if (static_cast(axis) >= new_dims.size()) { LOGS(logger, WARNING) << "UnsqueezeElimination cannot remove node due to invalid axes" << node.Name(); return Status::OK(); } From 5049b0cf150632ab193264d79b3f816ecf3194ca Mon Sep 17 00:00:00 2001 From: Jingyan Wang Date: Sat, 10 Aug 2024 06:40:14 -0700 Subject: [PATCH 10/12] Revert unintented changes --- onnxruntime/test/fuzzing/src/test.cpp | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/onnxruntime/test/fuzzing/src/test.cpp b/onnxruntime/test/fuzzing/src/test.cpp index b9bf9e300e25d..882f6f945f8d0 100644 --- a/onnxruntime/test/fuzzing/src/test.cpp +++ b/onnxruntime/test/fuzzing/src/test.cpp @@ -44,30 +44,7 @@ void mutateModelTest(onnx::ModelProto& model_proto, // std::wstring modelPrefix = L"/ReproMutateModel_"; if (seed == 0) { - // seed = static_cast(std::chrono::system_clock::now().time_since_epoch().count()); - // Bug 1 - fixed in attention_fusion.cc - // attention_past_no_unidir.onnx - // seed = 2161642583; // Bug 1 - // seed = 2647017145; // Bug 2 - fixed - // seed = 2913110292; // Bug 3 - fixed - // Bug 4 - fixed with bug 7 - // /r "C:\Users\jingywa\source\onnxruntime\build\Windows\RelWithDebInfo\RelWithDebInfo\testdata\transform\bert_toy_opset14.onnx" 548860496 - // Call stack starts from asan_win.cpp - // seed = 548860496; // Bug 4 - // Bug 5 - fixed in unsqueeze_elimination.cc - // /r "C:\Users\jingywa\source\onnxruntime\build\Windows\RelWithDebInfo\RelWithDebInfo\testdata\transform\fusion\fuse-conv-add-no-bias.onnx" 3412260231 - // /t /v "C:\Users\jingywa\source\onnxruntime\build\Windows\RelWithDebInfo\RelWithDebInfo\testdata\transform\fusion\fuse-conv-add-no-bias.onnx" 10 m - // Call stack starts from asan_win.cpp - // Assertion failed: false && "i < size()", file C:\Users\jingywa\source\onnxruntime\build\Windows\Debug\_deps\abseil_cpp-src\absl/container/inlined_vector.h, line 363 - seed = 3412260231; // Bug 5 - // seed = 191684599; // Bug 6 - fixed in qlinearconv.cc? - // Bug 7 - fixed in tensorprotoutils.cc - // /r "C:\Users\jingywa\source\onnxruntime\build\Windows\RelWithDebInfo\RelWithDebInfo\testdata\leconv_Opset17.onnx 1858054927 - // seed = 1858054927; // Bug 7 - - // Bug 8 - Need to fix unit test error. - // /r "C:\Users\jingywa\source\onnxruntime\build\Windows\RelWithDebInfo\RelWithDebInfo\testdata\pipeline_vectorize.onnx" 1332387938 - // seed = 1332387938; + seed = static_cast(std::chrono::system_clock::now().time_since_epoch().count()); modelPrefix = L"/MutateModel_"; } From 5642edebc10a09976f797bd7b717050eda66535e Mon Sep 17 00:00:00 2001 From: Jingyan Wang Date: Sat, 10 Aug 2024 06:46:23 -0700 Subject: [PATCH 11/12] Revert .gitignore changes and whitespace --- .gitignore | 10 +--------- onnxruntime/test/fuzzing/src/test.cpp | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 3ca37e01b715c..53af0019a7b5f 100644 --- a/.gitignore +++ b/.gitignore @@ -195,12 +195,4 @@ Package.pins Package.resolved .build/ .swiftpm/ -repros/ - -b\ -build\ -b/ -build/ -build*\ - -b2 \ No newline at end of file +repros/ \ No newline at end of file diff --git a/onnxruntime/test/fuzzing/src/test.cpp b/onnxruntime/test/fuzzing/src/test.cpp index 882f6f945f8d0..490f7dd4d37a3 100644 --- a/onnxruntime/test/fuzzing/src/test.cpp +++ b/onnxruntime/test/fuzzing/src/test.cpp @@ -44,7 +44,7 @@ void mutateModelTest(onnx::ModelProto& model_proto, // std::wstring modelPrefix = L"/ReproMutateModel_"; if (seed == 0) { - seed = static_cast(std::chrono::system_clock::now().time_since_epoch().count()); + seed = static_cast(std::chrono::system_clock::now().time_since_epoch().count()); modelPrefix = L"/MutateModel_"; } From 6270dfa5563447472fbf88c41206de5a31040cce Mon Sep 17 00:00:00 2001 From: Jingyan Wang Date: Sat, 10 Aug 2024 06:47:29 -0700 Subject: [PATCH 12/12] Whitespace --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 53af0019a7b5f..4d0a1205b7c19 100644 --- a/.gitignore +++ b/.gitignore @@ -195,4 +195,4 @@ Package.pins Package.resolved .build/ .swiftpm/ -repros/ \ No newline at end of file +repros/