Check for overlap before fusing ssm_conv and silu (#1443)

This commit is contained in:
Kawrakow 2026-03-16 12:14:20 +01:00 committed by GitHub
parent 8075acb6cd
commit 29e6d6b4c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -22266,6 +22266,12 @@ static int ggml_compute_forward_ssm_conv_f32(
cgraph->nodes[node+2]->op == GGML_OP_UNARY && cgraph->nodes[node+2]->src[0] == cgraph->nodes[node+1] &&
(enum ggml_unary_op)cgraph->nodes[node+2]->op_params[0] == GGML_UNARY_OP_SILU) {
dst_silu = (float *)cgraph->nodes[node+2]->data;
const float * x0_begin = (const float *)src1->data;
const float * x0_end = x0_begin + src1->nb[1]*n_t/sizeof(float) - 1;
const float * dst_silu_end = dst_silu + nr*n_t - 1;
if (!(dst_silu_end < x0_begin || dst_silu > x0_end)) {
dst_silu = NULL;
}
}
if (iqk_ssm_conv4(nr, nc, n_t, src0->nb[1], src1->nb[0], src1->nb[1], src2->nb[1],
(const float *)src1->data, (const float *)src0->data, (const float *)src2->data,

View File

@ -555,7 +555,6 @@ bool iqk_ssm_conv4(int nr, int nc, int nt,
uint64_t nb01, uint64_t nb10, uint64_t nb11, uint64_t nb21,
const float * x0_in, const float * s0_in, const float * c_in,
float * dst, float * dst_silu, int ith, int nth) {
return false;
#if defined __AVX2__
if (nt <= 32 || nc != 4 || nr%16 != 0) {
return false;