-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Fix compiler warning in Vulkan code #15768
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
Conversation
suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] Signed-off-by: Eric Curtin <[email protected]>
6cc3e8b
to
7cff721
Compare
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.
Pull Request Overview
This PR fixes a compiler warning about operator precedence in Vulkan code by adding parentheses around the &&
operation within an ||
expression to clarify the intended order of operations.
- Adds parentheses to disambiguate logical operator precedence in a boolean expression
(!device->subgroup_size_control && device->subgroup_size >= 16 || | ||
device->subgroup_size_control && device->subgroup_min_size <= 16 && device->subgroup_max_size >= 16); | ||
((!device->subgroup_size_control && device->subgroup_size >= 16) || | ||
(device->subgroup_size_control && device->subgroup_min_size <= 16 && device->subgroup_max_size >= 16)); |
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.
I screwed up the condition again, same thing as with mmid.
It should just be
const bool use_subgroups16 = use_subgroups && subgroup_min_size_16;
Up to you if you want me to open a PR with that fix and close this PR, or you could update this PR. I haven't tested it yet.
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.
I'll let you do it, you can poke me for a review if you want. I was tempted to look at refactoring:
ggml_vk_load_shaders
function in general, looks like there are some de-duplication opportunities. Or it could at least be split into smaller functions, it's over 1000 lines long.
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.
Sometimes I don't like lambda expressions because it promotes these long functions. The lambda's could be short static functions with descriptive names (makes for more detailed stack traces too).
suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]