metal : handle ggml_scale for n%4 != 0 (close #3754)

ggml-ci
This commit is contained in:
Georgi Gerganov 2023-10-24 09:46:50 +03:00
parent e3932593d4
commit 469c9addef
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
2 changed files with 22 additions and 6 deletions

View file

@ -125,9 +125,17 @@ kernel void kernel_mul_row(
}
kernel void kernel_scale(
device const float * src0,
device float * dst,
constant float & scale,
uint tpig[[thread_position_in_grid]]) {
dst[tpig] = src0[tpig] * scale;
}
kernel void kernel_scale_4(
device const float4 * src0,
device float4 * dst,
constant float & scale,
constant float & scale,
uint tpig[[thread_position_in_grid]]) {
dst[tpig] = src0[tpig] * scale;
}