Skip to content

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

[CPU] Fix Tensor Parallel with compress weights (#30549)

Egor Duplenskii4b94496cfdf1
diff --git a/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp b/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp
index f1789fe2e36..8c076a7947f 100644
--- a/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp
+++ b/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp
@@ -633,25 +633,21 @@ void FullyConnected::needSplitMemoryForTensorParallel() {
tp_cfg.cached_dst = split_horizontal(context->getEngine(), dst, -1, tp_cfg.w_rank, tp_cfg.w_size, false);
if (auto it = memory.find(ARG_DST | ARG_ATTR_SCALES); it != memory.end()) {
- memory[ARG_DST | ARG_ATTR_SCALES] =
- split_horizontal(context->getEngine(), it->second, 0, tp_cfg.w_rank, tp_cfg.w_size);
+ it->second = split_horizontal(context->getEngine(), it->second, 0, tp_cfg.w_rank, tp_cfg.w_size);
}
if (auto it = memory.find(ARG_WEI | ARG_ATTR_SCALES); it != memory.end()) {
auto scale_mem = std::const_pointer_cast<IMemory>(it->second);
- memory[ARG_WEI | ARG_ATTR_SCALES] =
- attrs.weightsNonTransposed
- ? split_vertical(context->getEngine(), scale_mem, 0, tp_cfg.w_rank, tp_cfg.w_size)
- : split_horizontal(context->getEngine(), scale_mem, 0, tp_cfg.w_rank, tp_cfg.w_size);
+ it->second = attrs.weightsNonTransposed
+ ? split_vertical(context->getEngine(), scale_mem, 0, tp_cfg.w_rank, tp_cfg.w_size)
+ : split_horizontal(context->getEngine(), scale_mem, 0, tp_cfg.w_rank, tp_cfg.w_size);
}
if (auto it = memory.find(ARG_WEI | ARG_ATTR_ZERO_POINTS); it != memory.end()) {
auto zeropoint_mem = std::const_pointer_cast<IMemory>(it->second);
auto element_num = zeropoint_mem->getSize() / zeropoint_mem->getPrecision().size();
- if (element_num == 1) {
- tp_cfg.cached_zeropoint = zeropoint_mem;
- } else {
- tp_cfg.cached_zeropoint =
+ if (element_num != 1) {
+ it->second =
attrs.weightsNonTransposed
? split_vertical(context->getEngine(), zeropoint_mem, 0, tp_cfg.w_rank, tp_cfg.w_size)
: split_horizontal(context->getEngine(), zeropoint_mem, 0, tp_cfg.w_rank, tp_cfg.w_size);
@@ -707,4 +703,4 @@ ov::element::Type FullyConnected::getRuntimePrecision() const {
return getMaxPrecision(srcTypes);
}
-} // namespace ov::intel_cpu::node
\ No newline at end of file
+} // namespace ov::intel_cpu::node