mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-11 11:26:34 +00:00
feat: add configurable Qwen cache types and early cache scheduling (#2045)
This commit is contained in:
1 parent
4dfe8f5d45
commit
740c7ae193
11 files changed
+185
-61
No files matched your search
@@ -623,7 +623,11 @@ ggml_tensor* ggml_ext_attention_ext(ggml_context* ctx,
|
||||
bool skip_reshape,
|
||||
bool flash_attn,
|
||||
float kv_scale,
|
||||
bool sage_attn) { // avoid overflow
|
||||
bool sage_attn,
|
||||
bool* used_flash_attn) { // avoid overflow
|
||||
if (used_flash_attn != nullptr) {
|
||||
*used_flash_attn = false;
|
||||
}
|
||||
int64_t L_q;
|
||||
int64_t L_k;
|
||||
int64_t C;
|
||||
@@ -755,6 +759,9 @@ ggml_tensor* ggml_ext_attention_ext(ggml_context* ctx,
|
||||
if (can_use_flash_attn) {
|
||||
kqv = build_kqv(q, k, v, mask);
|
||||
if (kqv != nullptr) {
|
||||
if (used_flash_attn != nullptr) {
|
||||
*used_flash_attn = true;
|
||||
}
|
||||
kqv = ggml_view_4d(ctx,
|
||||
kqv,
|
||||
d_head,
|
||||
|
||||
Reference in new issue
Block a user