Skip to content

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

[GPU] Fix OOB access in reorder (#26522)

Pavel Durandinf513f2927cf0
diff --git a/src/plugins/intel_gpu/src/kernel_selector/jitter.cpp b/src/plugins/intel_gpu/src/kernel_selector/jitter.cpp
index f6cc3acfd1c..480282b6060 100644
--- a/src/plugins/intel_gpu/src/kernel_selector/jitter.cpp
+++ b/src/plugins/intel_gpu/src/kernel_selector/jitter.cpp
@@ -692,12 +692,12 @@ class WeightTensorJitConstant : public TensorBaseTJitConstant<WeightsType, Weigh
this->macroName = MacroName(tensor_name, layout_name, macroNameArgs);
this->macroBody = R"V0G0N( \
CAT(prefix, _OFFSET) + \
- (x)*CAT(prefix, _X_PITCH) + \
- (y)*CAT(prefix, _Y_PITCH) + \
- (z)*CAT(prefix, _Z_PITCH) + \
- (i)*CAT(prefix, _IFM_PITCH) + \
- (o)*CAT(prefix, _OFM_PITCH) + \
- (g)*CAT(prefix, _GROUPS_PITCH)
+ ((x) % CAT(prefix, _SIZE_X)) * CAT(prefix, _X_PITCH) + \
+ ((y) % CAT(prefix, _SIZE_Y)) * CAT(prefix, _Y_PITCH) + \
+ ((z) % CAT(prefix, _SIZE_Z)) * CAT(prefix, _Z_PITCH) + \
+ ((i) % CAT(prefix, _IFM_NUM)) *CAT(prefix, _IFM_PITCH) + \
+ ((o) % CAT(prefix, _OFM_NUM)) * CAT(prefix, _OFM_PITCH) + \
+ ((g) % CAT(prefix, _GROUPS_NUM)) * CAT(prefix, _GROUPS_PITCH)
)V0G0N";
} else if (l == WeightsLayout::os_is_yx_isv16_osv16 || l == WeightsLayout::os_is_zyx_isv16_osv16 ||
l == WeightsLayout::g_os_is_yx_isv16_osv16 || l == WeightsLayout::g_os_is_zyx_isv16_osv16) {