metal : put warning in kernel_norm to not combine the loops

This commit is contained in:
Georgi Gerganov 2023-09-07 14:59:48 +03:00
parent 5e1c4089d8
commit ed92c3d4b2
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735

View File

@ -235,6 +235,12 @@ kernel void kernel_norm(
// VARIANCE
// parallel sum
//
// WARNING: combining this loop with the one above will give you wrong results for nth == 256
// I have no idea why, so for now I am keeping them separate. But this behavior is very concerning.
// Tested with:
// ./perplexity -m ./falcon-7b/ggml-model-q4_0.gguf -f wiki.test.raw -ngl 1 -t 4
//
sum[tpitg] = 0.0f;
for (int i00 = tpitg; i00 < ne00; i00 += ntg) {
sum[tpitg] += y[i00] * y[i00];