Skip to content

metal : restore 363f0bf and fix reduce in F16_F32 kernels - #2986

Merged
ggerganov merged 1 commit into
masterfrom
fix-metal-sum
Sep 3, 2023
Merged

ggerganov merged 1 commit into
masterfrom
fix-metal-sum

Conversation

@ggerganov

Copy link
Copy Markdown
Member

This is the diff:

@@ -550,7 +552,7 @@ kernel void kernel_mul_mat_f16_f32_1row(
         }
         float all_sum = simd_sum(sumf);
         if (tiisg == 0) {
-            for (int i = 4*(ne00/4); i < ne00; ++i) sumf += (float) x[i] * y[i];
+            for (int i = 4*(ne00/4); i < ne00; ++i) all_sum += (float) x[i] * y[i];
             dst[im*ne1*ne0 + r1*ne0 + r0] = all_sum;
         }
     }
@@ -623,7 +625,7 @@ kernel void kernel_mul_mat_f16_f32(
 
             float all_sum = simd_sum(sumf);
             if (tiisg == 0) {
-                for (int i = 4*(ne00/4); i < ne00; ++i) sumf += (float) x[i] * y[i];
+                for (int i = 4*(ne00/4); i < ne00; ++i) all_sum += (float) x[i] * y[i];
                 dst[im*ne1*ne0 + r1*ne0 + r0] = all_sum;
             }
         }

@ggerganov
ggerganov requested a review from ikawrakow September 3, 2023 10:05
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Patch and project coverage have no change.

Comparison is base (d9151e6) 37.41% compared to head (8f653dd) 37.41%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2986   +/-   ##
=======================================
  Coverage   37.41%   37.41%           
=======================================
  Files          14       14           
  Lines        4175     4175           
=======================================
  Hits         1562     1562           
  Misses       2613     2613           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ikawrakow ikawrakow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also found it. So I close my PR fixing it?

@ggerganov

Copy link
Copy Markdown
Member Author

Yes, sorry - I shouldn't have reverted the commit so quickly, but wasn't sure how difficult it would be to trace it. It turn out to be very easy

@ggerganov
ggerganov merged commit b7f2aa9 into master Sep 3, 2023
@ggerganov
ggerganov deleted the fix-metal-sum branch September 3, 2023 10:23
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants