-
Notifications
You must be signed in to change notification settings - Fork 124
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
fix sumcheck transcript-config copy rather than move #799
Conversation
4dba784
to
5077034
Compare
@@ -82,7 +82,7 @@ namespace icicle { | |||
|
|||
// Move Constructor | |||
SumcheckTranscriptConfig(SumcheckTranscriptConfig&& other) noexcept | |||
: m_hasher(other.m_hasher), m_domain_separator_label(std::move(other.m_domain_separator_label)), | |||
: m_hasher(std::move(other.m_hasher)), m_domain_separator_label(std::move(other.m_domain_separator_label)), |
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.
do we have move for hasher?
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 think it's more correct for a move constructor. In this case copy is cheap but still.
const bool m_little_endian = true; ///< Encoding endianness (default: little-endian). | ||
F m_seed_rng; ///< Seed for initializing the RNG. | ||
Hash m_hasher; ///< Hash function used for randomness generation. | ||
std::vector<std::byte> m_domain_separator_label; ///< Label for the domain separator in the transcript. |
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.
why not const?
doesn't it work with the move?
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.
Yes it makes the move copy instead. Now I test it in one test. I tried different things to make it const but failed
5077034
to
45cafa0
Compare
This PR addresses a critical issue in the SumcheckTranscript API where move semantics are improperly implemented due to the use of const rvalue references. This misuse leads to unintended copying of objects instead of moving them, which contradicts the original design intentions and can lead to performance degradation, especially since some of the data structures involved (like labels and public data) are potentially large.
Issues Addressed:
const SumcheckTranscriptConfig<S>&&
). This approach mistakenly assumes that objects can be moved efficiently, but due to their constness, they are actually copied. This undermines the efficiency of move semantics.cuda-backend-branch: yshekel/fix_sumcheck_transcript