Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[GPU] added proper index calculation for fused op in gather_ref (#30046)

Michal Miotk30ce6d051250
diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/gather/gather_kernel_ref.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/gather/gather_kernel_ref.cpp
index 25a22884976..09b8af7b01c 100644
--- a/src/plugins/intel_gpu/src/kernel_selector/kernels/gather/gather_kernel_ref.cpp
+++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/gather/gather_kernel_ref.cpp
@@ -276,8 +276,13 @@ JitConstants GatherKernelRef::GetJitConstants(const gather_params& params) const
jit.AddConstant(MakeJitConstant("GATHER_AXIS_SHAPE_INFO_INDEX", GetGatherAxisIndexInShapeInfo(params)));
if (!params.fused_ops.empty()) {
- std::vector<std::string> idx_order = GetOrder(params.inputs[0].GetDims().size());
-
+ std::vector<std::string> idx_order;
+ if (params.inputs[0].GetDims().size() == 4 && GetGatherIndexDim(params).v == 0 && !params.inputs[1].is_dynamic() &&
+ params.inputs[1].LogicalSize() == 1) {
+ idx_order = idx_order = {"(f)", "(y)", "(x)", "(1)"};
+ } else {
+ idx_order = GetOrder(params.inputs[0].GetDims().size());
+ }
FusedOpsConfiguration conf = { "", idx_order, "val", params.inputs[0].GetDType() };
jit.Merge(MakeFusedOpsJitConstants(params, {conf}));
}