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

fix: NPU affect CPU #182

Merged
merged 1 commit into from
Nov 9, 2024
Merged
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
2 changes: 1 addition & 1 deletion src/Layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class Layer {
do_init = !inited_loaded;
if (op_ == nullptr) {
#ifdef USE_QNN
if (param_["type"] == KVCACHE || param_["type"] == KVCACHENPU) {
if ((param_["type"] == KVCACHE || param_["type"] == KVCACHENPU) && (Backend::global_backends.find(MLLM_QNN) != Backend::global_backends.end())) {
if (kv_cache_map.find(name_) == kv_cache_map.end()) {
// for the prefill part, we need to create a new op
param_["type"] = KVCACHENPU;
Expand Down
4 changes: 2 additions & 2 deletions src/backends/cpu/CPUKVCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include "Types.hpp"

int n_pack = 16;
#ifndef USE_QNN
// #ifndef USE_QNN
#define KVCache_TYPE_16
#endif
// #endif
namespace mllm {
CPUKVCache::CPUKVCache(Backend *bn, string opName, int n_rep, int cache_max, int threadCount) :
thread_count(threadCount), Op(bn, opName) {
Expand Down
Loading