Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/plugins/intel_cpu/src/emitters/snippets/x64/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <algorithm>
#include <cpu/x64/jit_generator.hpp>
#include <cstddef>
#include <exception>
#include <iostream>
Comment thread
chenhu-wang marked this conversation as resolved.
#include <unordered_set>
#include <vector>

Expand Down Expand Up @@ -75,10 +77,16 @@ jit_aux_gpr_holder::jit_aux_gpr_holder(dnnl::impl::cpu::x64::jit_generator_t* ho
}

jit_aux_gpr_holder::~jit_aux_gpr_holder() {
if (m_is_preserved) {
m_h->pop(m_aux_gpr_idx);
} else {
m_pool_gpr_idxs.push_back(m_aux_gpr_idx.getIdx());
try {
if (m_is_preserved) {
m_h->pop(m_aux_gpr_idx);
} else {
m_pool_gpr_idxs.push_back(m_aux_gpr_idx.getIdx());
}
} catch (const std::exception& e) {
std::cerr << "jit_aux_gpr_holder::~jit_aux_gpr_holder() caught exception: " << e.what() << '\n';
} catch (...) {
std::cerr << "jit_aux_gpr_holder::~jit_aux_gpr_holder() caught unknown exception" << '\n';
}
Comment thread
chenhu-wang marked this conversation as resolved.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ void GatherMatmulDnnlExecutor::execute(const MemoryArgs& memory) {
auto* input_ptr = m_tmpInpBuffer->getDataAs<uint8_t>();
auto* output_ptr = input_ptr + rnd_up(m_tmpInputDesc->getCurrentMemSize(), 64);

Memory tmpInput(m_context->getEngine(), m_tmpInputDesc, input_ptr);
Memory tmpInput(m_context->getEngine(), m_tmpInputDesc, m_tmpInpBuffer->getMemoryBlock());
Memory tmpOutput(m_context->getEngine(), m_tmpOutputDesc, output_ptr);
Comment thread
chenhu-wang marked this conversation as resolved.

auto tmp_input_offset = OffsetHelper::createOffsetHelper(tmpInput);
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/intel_cpu/src/nodes/executors/interpolate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ float ov::intel_cpu::InterpolateExecutor::coordTransToInput(int outCoord,
float scale,
int inShape,
int outShape) const {
if (inShape == 0) {
OPENVINO_THROW("Interpolate executor: inShape must not be zero in coordTransToInput");
}
Comment thread
chenhu-wang marked this conversation as resolved.
if (scale == 1.0F || (inShape == outShape)) {
return static_cast<float>(outCoord);
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_cpu/src/nodes/fullyconnected.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ static bool useSparseWeightsDecompression(const NodePtr& weightsInput,
", nnzCount = ",
elementsCount - zerosCount);

auto sparseRate = static_cast<float>(zerosCount) / static_cast<float>(elementsCount);
auto sparseRate = (elementsCount > 0) ? (static_cast<float>(zerosCount) / static_cast<float>(elementsCount)) : 0.0F;

DEBUG_LOG("Sparse rate = ",
sparseRate * 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ inline void attn_softmax_kernel<float>(float* a,
sum += std::exp(*sink - max);
}
// divide sum
float scalar = 1.0F / sum;
float scalar = (sum != 0.0F) ? (1.0F / sum) : 0.0F;
if (dst_precision == ov::element::f32) {
multiply_scalar(a, reinterpret_cast<float*>(a_dst), scalar, len);
// apply causual mask to final result instead of attn_score
Expand Down
26 changes: 23 additions & 3 deletions src/plugins/intel_cpu/src/nodes/kernels/x64/registers_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

#include <cpu/x64/cpu_isa_traits.hpp>
#include <cstddef>
#include <exception>
#include <initializer_list>
#include <iostream>
Comment thread
chenhu-wang marked this conversation as resolved.
#include <memory>
#include <type_traits>
#include <utility>
Expand Down Expand Up @@ -59,10 +61,22 @@ class RegistersPool {
initialize(regPool, requestedIdx);
}
~Reg() {
release();
try {
release();
} catch (const std::exception& e) {
std::cerr << "RegistersPool::Reg::~Reg() caught exception: " << e.what() << '\n';
} catch (...) {
std::cerr << "RegistersPool::Reg::~Reg() caught unknown exception" << '\n';
}
}
Reg& operator=(Reg&& other) noexcept {
release();
try {
release();
} catch (const std::exception& e) {
std::cerr << "RegistersPool::Reg::operator=(Reg&&) caught exception: " << e.what() << '\n';
} catch (...) {
std::cerr << "RegistersPool::Reg::operator=(Reg&&) caught unknown exception" << '\n';
}
Comment thread
chenhu-wang marked this conversation as resolved.
reg = other.reg;
regPool = std::move(other.regPool);
return *this;
Expand Down Expand Up @@ -126,7 +140,13 @@ class RegistersPool {
};

virtual ~RegistersPool() {
checkUniqueAndUpdate(false);
try {
checkUniqueAndUpdate(false);
} catch (const std::exception& e) {
std::cerr << "RegistersPool::~RegistersPool() caught exception: " << e.what() << '\n';
} catch (...) {
std::cerr << "RegistersPool::~RegistersPool() caught unknown exception" << '\n';
}
Comment thread
chenhu-wang marked this conversation as resolved.
}

template <dnnl::impl::cpu::x64::cpu_isa_t isa>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_cpu/src/nodes/scaled_attn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ struct MHAKernel {
if (sink != nullptr) {
sum += std::exp((*sink) - max);
}
float scale = 1.0F / sum;
float scale = (sum != 0.0F) ? (1.0F / sum) : 0.0F;
for (int i = 0; i < len; i++) {
a[i] *= scale;
}
Expand Down
Loading