Skip to content

Commit

Permalink
[Snippets] Fixed coverity <Division or modulo by zero>
Browse files Browse the repository at this point in the history
  • Loading branch information
a-sidorova committed Aug 14, 2024
1 parent 42ac61b commit 2fa5206
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jit_brgemm_copy_b_emitter::jit_brgemm_copy_b_emitter(jit_generator* h, cpu_isa_t
m_inner_N_tail = m_N_blk % m_inner_N_block;
m_brgemmVNNIFactor = compute_vnni_factor(m_brg_weight_etype);

OV_CPU_JIT_EMITTER_ASSERT(m_brgemmVNNIFactor > 0, "brgemmVNNIFactor value must be positive.");
OV_CPU_JIT_EMITTER_ASSERT(m_K_blk == m_K || m_K_blk % m_brgemmVNNIFactor == 0,
"K Block size (", m_K_blk, "), which is not divisible by brgemmVNNIFactor (",
m_brgemmVNNIFactor, ") and not equal to K dimension (", m_K,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ size_t get_repacking_buffer_size(const ov::snippets::lowered::ExpressionPtr& cop
// Low precision repacking writes the result by m_brgemmVNNIFactor * m_inner_n_block blocks
// despite the actual size of the input data. Because of that we have to round-up the allocation shape to always have enough memory allocated.
// For the details, please see 'copy_4x64' and 'copy_2x32' implementations and usage in onednn/src/cpu/x64/matmul/brgemm_matmul_copy_utils.cpp
return N_dim * rnd_up(k_blk, brgemm_utils::compute_vnni_factor(precision));
const auto brgemmVNNIFactor = brgemm_utils::compute_vnni_factor(precision);
OPENVINO_ASSERT(brgemmVNNIFactor > 0, "brgemmVNNIFactor value must be positive.");
return N_dim * rnd_up(k_blk, brgemmVNNIFactor);
}
}

Expand Down

0 comments on commit 2fa5206

Please sign in to comment.