Document _copy function protocol used in Mooncake.jl's AD system#755
Document _copy function protocol used in Mooncake.jl's AD system#755
_copy function protocol used in Mooncake.jl's AD system#755Conversation
- Added comprehensive documentation for the _copy internal protocol - Added inline comments to all _copy function implementations - Explained semantics: immutable types return same object, mutable types create copies - Documented recursive copying behavior for composite types - Added implementation guidelines and examples - Maintained existing functionality and tested basic AD operations Co-authored-by: yebai <3279477+yebai@users.noreply.github.com>
_copy function protocol and add comprehensive docstrings
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Mooncake.jl documentation for PR #755 is available at: |
|
Performance Ratio: |
Co-authored-by: yebai <3279477+yebai@users.noreply.github.com>
_copy function protocol and add comprehensive docstrings_copy function protocol and replace Stack implementation with Base.copy
Co-authored-by: yebai <3279477+yebai@users.noreply.github.com>
_copy function protocol and replace Stack implementation with Base.copy_copy function protocol used in Mooncake.jl's AD system
Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com>
|
@avik-pal, it appears that recent Lux releases break the Mooncake/Lux integration tests. Can you help take a look? |
Co-authored-by: yebai <3279477+yebai@users.noreply.github.com>
Co-authored-by: yebai <3279477+yebai@users.noreply.github.com>
Co-authored-by: yebai <3279477+yebai@users.noreply.github.com>
) * Initial plan * Document _copy function protocol and add docstrings - Added comprehensive documentation for the _copy internal protocol - Added inline comments to all _copy function implementations - Explained semantics: immutable types return same object, mutable types create copies - Documented recursive copying behavior for composite types - Added implementation guidelines and examples - Maintained existing functionality and tested basic AD operations Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Replace _copy(::Stack{T}) with Base.copy method Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Revert to use _copy(::Stack{T}) to keep PR focused on documentation only Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Update src/interpreter/reverse_mode.jl Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> * Add rule type example to _copy documentation and fix spacing Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Add examples for misty closure and tangent types to _copy documentation Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Move _copy function and documentation to src/utils.jl Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> --------- Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: yebai <3279477+yebai@users.noreply.github.com>
|
@yebai why was this merged without my review? Firstly, how can you know whether copilot has successfully captued the semantics of Please revert this PR at your earliest convenience. |
|
Did you look at the PR? No new method was added; only comments and docs were added, mostly explaining via enumerating code examples. Feel free to improve further. In addition, you were not responsive for a while, and I did try to request your review for all PRs, but no responses for a long time. As a mentor, I had to email you to get your response. |
I am perfectly happy for you to nudge me about reviewing PRs if my review isn't forthcoming, but I do ask that you follow the usual review process (ie. ask someone who is knowledgeable about whatever is being modified to review changes), rather than rushing things and merging PRs before they are ready. This has happened a couple of times recently:
In both instances, we had to fix the issues post-merge. This is not a problem if code we merged after the usual review process turns out to have some problems -- sometimes things get missed. I appreciate that you want to press ahead and resolve issues, but doing this at the expense of quality will be counterproductive.
In my quick post-merge skim of this PR it looked like a lot of methods had been added. On closer inspection, it looks like methods have just been moved around, rather than new ones having been added. I would have noticed this had I had the time to review properly prior to code being merged. There are definitely problems with the accuracy of the comments + docstring though -- this is a problem because it is better to leave something undocumented than to provide documentation which is misleading / incorrect. I will open a PR to revert the changes. |
|
I'd veto the PR (#760) and suggest improving upon it before merging. I'd suggest that you stay responsive and be considerate of your mentor's time. Since Mooncake is an ongoing research project, it will follow best engineering practices to the best of its effort, but shouldn't hinder incremental progress. |
|
I am just holding you to the same standards that all contributors to this and other open-source projects we've worked on are held to. I would likely have said something similar if anyone else who has merge rights on this project (or the others we're involved in) had merged a PR like this without review, in the same way that I would expect others to do were I to do something like this. I am entirely in favour of incremental progress. For example, we're quite stringent about continuous delivery (releasing a new version immediately after changes to For example, the comment on the method of What is needed is for someone (probably me) to take the time to figure out what purpose Prior to this PR being merged, the documentation for this function was not especially urgent, and I did not wish to devote time to it when there are other higher-priority things to look after. Now that it has been merged, I can either take the time to figure out what the correct documentation is and fix this if needed, convince you to accept that we revert the PR (since the absence of documentation is preferable to inaccurate documentation), or do nothing (and accept the regression). |
|
Isn't it true that most Mooncake PRs up to date are authored by you and directly merged without a review? It works because
The critical problem here is not about disagreeing on any engineering or open-source workflow. It is about bus factor: the bus factor for Mooncake is smaller than 2 and has to be increased. Solving the bus factor issue implies more PRs will be merged without your or my review. Whether that will do more harm or prove useful, that is a team science question. Speaking of experience, I have a great deal of trust in the Julia open-source community and would like to invite more contributions gradually. |
) * Initial plan * Document _copy function protocol and add docstrings - Added comprehensive documentation for the _copy internal protocol - Added inline comments to all _copy function implementations - Explained semantics: immutable types return same object, mutable types create copies - Documented recursive copying behavior for composite types - Added implementation guidelines and examples - Maintained existing functionality and tested basic AD operations Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Replace _copy(::Stack{T}) with Base.copy method Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Revert to use _copy(::Stack{T}) to keep PR focused on documentation only Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Update src/interpreter/reverse_mode.jl Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> * Add rule type example to _copy documentation and fix spacing Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Add examples for misty closure and tangent types to _copy documentation Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Move _copy function and documentation to src/utils.jl Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> --------- Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: yebai <3279477+yebai@users.noreply.github.com>
This PR addresses the lack of documentation for the
_copyfunction protocol used throughout Mooncake.jl's automatic differentiation system. The_copyfunction is a critical internal protocol that handles creating independent copies of data structures during AD operations, but was previously undocumented.Changes Made
Comprehensive documentation: Added detailed docstring explaining the purpose, semantics, and usage guidelines for the
_copyprotocol insrc/utils.jl. The documentation includes:_copyis used in the AD systemCode organization: Moved the main
_copydocumentation and generic implementations tosrc/utils.jlfor better discoverability, while keeping type-specific implementations in their respective files to maintain proper dependency ordering.Inline comments: Added explanatory comments to all existing
_copyimplementations across the codebase.The documentation helps maintainers and contributors understand this important internal protocol and implement it correctly for new types.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.