Skip to content

use const auto &kv instead of auto &kv, statements into braces - #2012

Closed
mendax0110 wants to merge 4 commits into
ggml-org:masterfrom
mendax0110:master
Closed

mendax0110 wants to merge 4 commits into
ggml-org:masterfrom
mendax0110:master

Conversation

@mendax0110

Copy link
Copy Markdown
Contributor

Replacing auto &kv with const auto &kv: By using const auto &kv instead of auto &kv, we explicitly communicate our intention to treat kv as a constant reference. This helps prevent accidental modifications and promotes safer code.

Enclosing statements in braces: By enclosing statements within braces, we ensure clear scoping and minimize the risk of errors caused by unintended code execution. This practice also enhances code maintainability and reduces ambiguity.

@SlyEcho

SlyEcho commented Jun 27, 2023

Copy link
Copy Markdown
Contributor

The formatting is terrible on those changes with the braces.

Not sure what the const gives even if it may be technically correct.

Did you make these changes yourself or is it made by an analyzer?

@mendax0110

Copy link
Copy Markdown
Contributor Author

The formatting with the braces was from an analyzer, thought that looks better. The const is not from an analyzer.

@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.

Please remove the k-quants related changes.

Comment thread llama.cpp Outdated
use_more_bits(i_attention_wv, n_attention_wv)) new_type = GGML_TYPE_Q6_K;
else if (QK_K == 64 && (ftype == LLAMA_FTYPE_MOSTLY_Q4_K_S || ftype == LLAMA_FTYPE_MOSTLY_Q3_K_S) &&
(i_attention_wv < n_attention_wv/8 || i_attention_wv >= 7*n_attention_wv/8)) new_type = GGML_TYPE_Q6_K;
if (ftype == LLAMA_FTYPE_MOSTLY_Q3_K_M || ftype == LLAMA_FTYPE_MOSTLY_Q2_K) { new_type = GGML_TYPE_Q4_K;

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.

I have written it like this on purpose, not because I didn't know better, and I strongly object against this change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

all right, I will do that.

Comment thread llama.cpp

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.

I'm not sure why you're trying to revert changes to already merged code with this commit: 6e7f15d

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I apologize for the confusion. It seems there was an issue with my work in VScode and source control, resulting in this unintended mistake.

@mendax0110
mendax0110 requested a review from ikawrakow June 27, 2023 21:03
@ggerganov

Copy link
Copy Markdown
Member

Hey @mendax0110, thanks for the contribution!

I think it will be better to start this PR from scratch. The const auto & changes are fine - maybe start with just them.
I'm not familiar with codacy - maybe submit a separate PR and explain why it is important

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.

4 participants