-
Notifications
You must be signed in to change notification settings - Fork 3
Don't pin objects permanently in engine.cpp #89
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
Don't pin objects permanently in engine.cpp #89
Conversation
Should fix mmtk/mmtk-julia#246. |
7e323b1
to
388036b
Compare
388036b
to
e19c0da
Compare
Sharing some fragmentation time-series for the inference benchmark, similar to those we discussed on Slack:
|
I still wonder whether pin/unpin is the right approach here - i.e., whether we could actually move those objects. Line 769 in fb84d8f
(2) adapt your code to capture the address of these objects into objects_pinned_by_inference_engine and give those objects to the GC as roots?
|
Your suggestions might allow us to move more objects, but I'm not sure if they are necessary at the moment. If we find that my approach introduces unnecessary pinning, then we can optimize it further. But this PR is already a huge performance win, and seems "good enough" as it is. |
I agree, but I don't see the need to pin/unpin these. While pinning/unpinning is the direction we should take for conservative stack pinning since we don't know whether those references are or are not actual roots, these are roots. A simple change is to remove the code for pinning/unpinning and actually process those roots in
You might want to rename the variable |
Wait, are these |
They are indefinitely pinned AFAIK. But that was just a conservative solution that we used for all the dominated roots that are not traced by the GC. |
Ok, so here is the reasoning behind my implementation choice of pinning them, but not rooting them:
Am I missing something? |
My suggestions (untested) according to the point I've made above: https://github.com/mmtk/julia/compare/dcn-optimize-pinning-in-inference-engine...udesou:udesou-minor-refactoring?expand=1.
But that's why we had this problem in the first place right? (i.e., we have a root that is not being treated as a root because it's being kept alive by some other reference somewhere else) |
You can look at our talk (we shared a link on Slack), the second part that talks about moving GCs. We explained why the current 'rooting' in Julia is insufficient. The definition of 'rooting' in Julia is flawed. |
Yes, I understand what you are saying. I agree we should root these objects in the C++ data structure at some point, and stop relying on them getting rooted by some other part of the code. I believe that chasing the C++ data structures and other spots in the code that this may happen is a topic for another PR, though. |
Those places where we use |
Sounds good to me. |
Following the suggestion in #89 (comment), trace recently added pinned objects as roots. When we pass those objects as 'nodes' to MMTk, MMTk does not know the slots so MMTk cannot update the reference, thus MMTk will not move those objects. This is essentially the same as pinning those objects before a GC, and unpinning after a GC.
Following the suggestion in mmtk#89 (comment), trace recently added pinned objects as roots. When we pass those objects as 'nodes' to MMTk, MMTk does not know the slots so MMTk cannot update the reference, thus MMTk will not move those objects. This is essentially the same as pinning those objects before a GC, and unpinning after a GC.
Following the suggestion in mmtk#89 (comment), trace recently added pinned objects as roots. When we pass those objects as 'nodes' to MMTk, MMTk does not know the slots so MMTk cannot update the reference, thus MMTk will not move those objects. This is essentially the same as pinning those objects before a GC, and unpinning after a GC.
Following the suggestion in mmtk#89 (comment), trace recently added pinned objects as roots. When we pass those objects as 'nodes' to MMTk, MMTk does not know the slots so MMTk cannot update the reference, thus MMTk will not move those objects. This is essentially the same as pinning those objects before a GC, and unpinning after a GC.
Creates a side table of objects pinned by inference engine.
Adds/removes objects to the table at the start/end of inference.