Skip to content

Commit f56275b

Browse files
intbfankitm3k
authored andcommitted
Improve the condition for device=GPU and qdq stripping enabled (#705)
* make the condition stricter for gpu Signed-off-by: bfilipek <[email protected]> * corrected form * improve the condition, allow int16 types when qdq stripping enabled Signed-off-by: bfilipek <[email protected]> * revert wrongly commited file Signed-off-by: bfilipek <[email protected]> --------- Signed-off-by: bfilipek <[email protected]>
1 parent 2ae603d commit f56275b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

onnxruntime/core/providers/openvino/ov_versions/capability.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@ GetCapability::GetCapability(const EPCtxHandler& ep_ctx_handler,
3434
graph_viewer_(graph_viewer_param),
3535
device_type_(std::move(device_type_param)) {
3636
bool npu_qdq_optimizer_enabled = false;
37-
if (device_type_.find("NPU") != std::string::npos || device_type_.find("GPU") != std::string::npos) {
37+
if (device_type_.find("NPU") != std::string::npos) {
3838
device_type_ = "CPU";
3939
if (enable_qdq_optimizer) npu_qdq_optimizer_enabled = true;
40+
} else if (enable_qdq_optimizer && device_type_.find("GPU") != std::string::npos) {
41+
npu_qdq_optimizer_enabled = true; // see data_ops.cc ~615 where we check for int16 types for gpu, this may change to a better approach later
4042
}
43+
4144
#if OPENVINO_VERSION_MAJOR == 2024 && OPENVINO_VERSION_MINOR == 5
4245
data_ops_ = new DataOps(graph_viewer_, V_2024_5, device_type_, npu_qdq_optimizer_enabled);
4346
#elif OPENVINO_VERSION_MAJOR == 2024 && OPENVINO_VERSION_MINOR == 6

onnxruntime/core/providers/openvino/ov_versions/data_ops.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,9 @@ bool DataOps::type_is_supported(const NodeArg* node_arg, bool is_initializer) {
612612
(var.second == dtype)) {
613613
return true;
614614
}
615+
// experimentally for GPU and qdq stripping mode allow int16 types
616+
if (npu_qdq_optimizer_enabled_ && (dtype == ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT16 || dtype == ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT16))
617+
return true;
615618
}
616619
#ifndef NDEBUG
617620
if (openvino_ep::backend_utils::IsDebugEnabled()) {

0 commit comments

Comments
 (0)