Skip to content

Commit dbdca6b

Browse files
aobolenskMirceaDan99
authored andcommitted
Fix medium severity issues reported in CPU plugin (openvinotoolkit#28294)
### Details: - Fix medium severity coverity issues: * Division or modulo by float zero: 1565219 * Uninitialized scalar field: 1565060 * Uninitialized pointer field: 1565135 * Identical code for different branches: 1565044 ### Tickets: - [CVS-157247](https://jira.devtools.intel.com/browse/CVS-157247)
1 parent 399d3c2 commit dbdca6b

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

src/plugins/intel_cpu/src/nodes/kernels/x64/rms_kernel.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ void jit_rms_kernel<isa>::generate() {
160160
reduce_vmm_to_scalar(vmm_rsqrt, vmm_sum0, vmm_sum1, vmm_sum3, vec_size);
161161

162162
// mean(x^2)
163+
OPENVINO_ASSERT(m_jcp.data_size != 0);
163164
mov(reg_tmp.cvt32(), float2int(1.0f / m_jcp.data_size));
164165
vmovd(xmm_tmp, reg_tmp.cvt32());
165166
vmulss(xmm_rsqrt, xmm_rsqrt, xmm_tmp);

src/plugins/intel_cpu/src/nodes/llm_mlp.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ class LinearKsplit2 {
3737

3838
LinearKsplit2() {}
3939

40-
ReduceAdd2bh* p_jit_reduce2bh;
41-
4240
// weight [N, K]
4341
// Gate & Up are interleaved in N dimension: 16-gate / 16-up
4442
// and post-ops will compute silu(gate)*up in unit of 16 elements
@@ -201,7 +199,7 @@ class LinearGateUp {
201199
bool quantized_int8 = config.gate_up_quantized;
202200

203201
auto reg_blk_K_size = quantized_int8 ? REG_BLK_K_SIZE_I8 : REG_BLK_K_SIZE;
204-
auto cache_blk_k_size = quantized_int8 ? CACHE_BLK_K_SIZE : CACHE_BLK_K_SIZE;
202+
auto cache_blk_k_size = CACHE_BLK_K_SIZE;
205203
auto weight_element_size = quantized_int8 ? sizeof(int8_t) : sizeof(ov::float16);
206204

207205
// prepare weights, split N among threads

src/plugins/intel_cpu/src/nodes/qkv_proj.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ struct QKVProjection::Executor : public QKVProjection::ExecutorBase {
7575
// and activations will be dynamically per-token quantized and using AMX-INT8 to get the result
7676
bool quantized_int8 = m_node->m_config.quantized;
7777

78-
auto cache_blk_k_size = quantized_int8 ? CACHE_BLK_K_SIZE : CACHE_BLK_K_SIZE;
78+
auto cache_blk_k_size = CACHE_BLK_K_SIZE;
7979
auto weight_element_size = quantized_int8 ? sizeof(int8_t) : sizeof(ov::float16);
8080

8181
auto K = w0.size(1);

src/plugins/intel_cpu/src/nodes/scaled_attn.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ struct MHAKernel {
109109
}
110110

111111
PlainTensor causal_mask;
112-
bool select_nfltmax_at_0; // set attn_score to -FLT_MAX when causal_mask[...] equal to this
112+
bool select_nfltmax_at_0 = false; // set attn_score to -FLT_MAX when causal_mask[...] equal to this
113113
void set_causal_mask(PlainTensor mask, bool _select_nfltmax_at_0) {
114114
causal_mask = mask;
115115
select_nfltmax_at_0 = _select_nfltmax_at_0;
@@ -526,7 +526,7 @@ struct MHAKernel<ScaledDotProductAttention::KT_ACL, T> {
526526
}
527527

528528
PlainTensor causal_mask;
529-
bool select_nfltmax_at_0; // set attn_score to -FLT_MAX when causal_mask[...] equal to this
529+
bool select_nfltmax_at_0 = false; // set attn_score to -FLT_MAX when causal_mask[...] equal to this
530530
void set_causal_mask(PlainTensor mask, bool _select_nfltmax_at_0) {
531531
causal_mask = mask;
532532
select_nfltmax_at_0 = _select_nfltmax_at_0;
@@ -674,7 +674,7 @@ struct MHAKernel<ScaledDotProductAttention::KT_MLAS, float> {
674674
}
675675

676676
PlainTensor causal_mask;
677-
bool select_nfltmax_at_0; // set attn_score to -FLT_MAX when causal_mask[...] equal to this
677+
bool select_nfltmax_at_0 = false; // set attn_score to -FLT_MAX when causal_mask[...] equal to this
678678
void set_causal_mask(PlainTensor mask, bool _select_nfltmax_at_0) {
679679
causal_mask = mask;
680680
select_nfltmax_at_0 = _select_nfltmax_at_0;

0 commit comments

Comments
 (0)