Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable POWER9 fp32 and fp16 SIMD code #366

Closed
wants to merge 3 commits into from

Conversation

fitzsim
Copy link
Contributor

@fitzsim fitzsim commented Jan 3, 2023

With the FP32 base model and this patch set, the jfk example takes about 3.2 seconds to transcribe. This is another data point for #300, and it is about one second faster than the current FP16 SIMD code.

Comment on lines +544 to +553
#define GGML_F32x4_REDUCE(sumf, sum) \
sum[0] = vec_add(sum[0], sum[1]); \
sum[2] = vec_add(sum[2], sum[3]); \
sum[4] = vec_add(sum[4], sum[5]); \
sum[6] = vec_add(sum[6], sum[7]); \
sum[0] = vec_add(sum[0], sum[2]); \
sum[4] = vec_add(sum[4], sum[6]); \
sum[0] = vec_add(sum[0], sum[4]); \
sumf = vec_extract(sum[0], 0) + vec_extract(sum[0], 1) \
+ vec_extract(sum[0], 2) + vec_extract(sum[0], 3);
Copy link
Owner

Choose a reason for hiding this comment

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

Is there a reason to use this version instead of the for-based version?
The advantage of the latter is that it will work for GGML_F32_ARR == 1, 2, 4, 8, 16, while doing it like this it will only work for GGML_F32_ARR == 8

@fitzsim
Copy link
Contributor Author

fitzsim commented Jan 3, 2023

I'll try reverting that and compare speed. Also, I think I can get rid of the load/store argument changes, but it'll take some more work. And the F32 implementation seems to still use some F16 operations, so I'll investigate that. I'll make a new pull request for all this later. For now I'll close this one.

@fitzsim fitzsim closed this Jan 3, 2023
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.

2 participants