-
Notifications
You must be signed in to change notification settings - Fork 13.7k
vulkan: add LOG operation support for F32 and F16 #17183
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
base: master
Are you sure you want to change the base?
Conversation
| } | ||
| return nullptr; | ||
| case GGML_OP_LOG: | ||
| if ((src0->type == GGML_TYPE_F32 || src0->type == GGML_TYPE_F16) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should check that src and dst types match.
| @@ -0,0 +1,19 @@ | |||
| #version 450 | |||
|
|
|||
| #extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line, not all devices support it and it shouldn't be needed.
| return; | ||
| } | ||
|
|
||
| const float val = float(data_a[get_aoffset() + src0_idx(idx)]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest using FLOAT_TYPE rather than float.
| string_to_spv("cos_f32", "cos.comp", {{"A_TYPE", "float"}, {"D_TYPE", "float"}, {"FLOAT_TYPE", "float"}}); | ||
|
|
||
| string_to_spv("log_f32", "log.comp", {{"A_TYPE", "float"}, {"D_TYPE", "float"}, {"FLOAT_TYPE", "float"}}); | ||
| string_to_spv("log_f16", "log.comp", {{"A_TYPE", "float16_t"}, {"D_TYPE", "float16_t"}, {"FLOAT_TYPE", "float16_t"}}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| string_to_spv("log_f16", "log.comp", {{"A_TYPE", "float16_t"}, {"D_TYPE", "float16_t"}, {"FLOAT_TYPE", "float16_t"}}); | |
| string_to_spv("log_f16", "log.comp", {{"A_TYPE", "float16_t"}, {"D_TYPE", "float16_t"}, {"FLOAT_TYPE", "float16"}}); |
Summary
Implements LOG operation for the Vulkan backend with F32 and F16 support.
Part of #14909.
Testing