Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions onnxruntime/core/providers/openvino/ov_versions/data_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -752,16 +752,33 @@ bool DataOps::node_is_supported(const NodeIndex node_idx, bool& has_external_wei
if (op_is_supported(optype, no_dimension_supported_)) {
return;
}
if (npu_qdq_optimizer_enabled_) {
// Pad Op with DQ inputs will be optimized out in the qdq optimization pass, so mark those no dim Pad ops
// supported here
if (optype == "Pad") {
for (Node::NodeConstIterator it_dq = node->InputNodesBegin(); it_dq != node->InputNodesEnd(); ++it_dq) {
const auto& DQ = &*it_dq;
if (DQ->OpType() == "DequantizeLinear") return;
// Special handling for the "Pad" operator
if (optype == "Pad") {
bool is_quantized = false;
// Detect a quantized model by checking for a DequantizeLinear input
for (Node::NodeConstIterator it_dq = node->InputNodesBegin(); it_dq != node->InputNodesEnd(); ++it_dq) {
const auto& DQ = &*it_dq;
if (DQ->OpType() == "DequantizeLinear") {
is_quantized = true;
break;
}
}
if (is_quantized) {
// For quantized Pad ops when the QDQ optimizer is disabled,
// bypass the unsupported dimension check to ensure 'pad_value' is constant
if (!npu_qdq_optimizer_enabled_) {
#ifndef NDEBUG
if (openvino_ep::backend_utils::IsDebugEnabled()) {
// Pad Op with DQ inputs gets optimized in the downstream,
// so mark those no dim quantized Pad ops supported here
std::cout << "QDQ optimizer disabled; quantized Pad op detected (DequantizeLinear present), so marking those no dim quantized Pad ops as supported" << std::endl;
}
#endif
}
return;
}
}
// For ops that haven't been handled above, mark as unsupported dim
has_unsupported_dimension = true;
return;
} else {
Expand Down