Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: suspicious bugs in class LinearKsplit2 in llm_mlp.cpp #28550

Open
3 tasks done
troore opened this issue Jan 20, 2025 · 3 comments
Open
3 tasks done

[Bug]: suspicious bugs in class LinearKsplit2 in llm_mlp.cpp #28550

troore opened this issue Jan 20, 2025 · 3 comments
Assignees
Labels
bug Something isn't working support_request

Comments

@troore
Copy link

troore commented Jan 20, 2025

OpenVINO Version

Master Branch

Operating System

Ubuntu 20.04 (LTS)

Device used for inference

CPU

Framework

None

Model used

TinyLlama-1.1B-Chat-v1.0

Issue description

In file openvino/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp, and in class LinearKsplit2, there are 3 suspicious bugs in two member functions:

  1. in setup,
...
auto valid_nthr = m_threads_num / 2;
auto blkN_per_thread = (num_blk_N) / valid_nthr;
...

when m_threads_num is 1, the next line would cause division 0 exception.
Possible fixing:

auto valid_nthr = (m_threads_num+1) / 2;
  1. still in setup,
...
auto K_splits = 2;
...
    for (int ik = 0; ik < K_splits; ik++) {
        ...
        auto& work = works[ithr + ik];
        ...
    }
...

when m_threads_num is 1, works[ithr + ik] would cause memory access out of bounds.
Possible fixing:

auto K_splits = std::min(m_threads_num, 2);
  1. in run,
auto peer_ithr = (ithr & 1) ? (ithr - 1) : (ithr + 1);
auto* p_peerC = works[peer_ithr].m_C.template ptr<float>();

when ithr is 0, peer_ithr is 1, also causing works[peer_thr] access out of bounds when nthr is 1.
Possible fixing:

auto peer_ithr = (nthr == 1) ? 0 : ((ithr & 1) ? (ithr - 1) : (ithr + 1));

Step-by-step reproduction

No response

Relevant log output

Issue submission checklist

  • I'm reporting an issue. It's not a question.
  • I checked the problem with the documentation, FAQ, open issues, Stack Overflow, etc., and have not found a solution.
  • There is reproducer code and related data files such as images, videos, models, etc.
@troore troore added bug Something isn't working support_request labels Jan 20, 2025
Copy link
Contributor

Thank you for looking into this issue! Please let us know if you have any questions or require any help.

@AbhiRam162105
Copy link

.take

Copy link
Contributor

Thanks for being interested in this issue. It looks like this ticket is already assigned to a contributor. Please communicate with the assigned contributor to confirm the status of the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working support_request
Projects
None yet
Development

No branches or pull requests

2 participants