Skip to content

Commit 8541b25

Browse files
author
Chip Kerchner
committed
Special case beta is one.
1 parent 76227e2 commit 8541b25

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

kernel/power/sbgemv_common.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,11 @@ FORCEINLINE void copy_y_beta(BLASLONG n, FLOAT *src, FLOAT *dest, BLASLONG inc_s
252252
{
253253
if (beta == 0) {
254254
memset(dest, 0, sizeof(FLOAT) * n);
255+
} else if (beta == 1) {
256+
for (BLASLONG i = 0; i < n; i++) {
257+
*dest++ = *src;
258+
src += inc_src;
259+
}
255260
} else {
256261
for (BLASLONG i = 0; i < n; i++) {
257262
*dest++ = *src * beta;
@@ -267,6 +272,11 @@ FORCEINLINE void copy_y(BLASLONG n, FLOAT *src, FLOAT *dest, BLASLONG inc_src, F
267272
*dest = *src++;
268273
dest += inc_src;
269274
}
275+
} else if (beta == 1) {
276+
for (BLASLONG i = 0; i < n; i++) {
277+
*dest += *src++;
278+
dest += inc_src;
279+
}
270280
} else {
271281
for (BLASLONG i = 0; i < n; i++) {
272282
*dest = *src++ + (beta * *dest);

kernel/power/sbgemv_n.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ static void BF16GEMV_N_beta(BLASLONG n, FLOAT *output_vector, FLOAT *input_vecto
3131
{
3232
if (beta == 0) {
3333
memset(output_vector, 0, sizeof(FLOAT) * n);
34+
} else if ((output_vector != input_vector) && (beta == 1)) {
35+
memcpy(output_vector, input_vector, sizeof(FLOAT) * n);
3436
} else {
3537
vec_f32 b = { beta, beta, beta, beta };
3638

0 commit comments

Comments
 (0)