-
Notifications
You must be signed in to change notification settings - Fork 68
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
Node-enqueuing tracing. #628
Conversation
57716df
to
365f49a
Compare
NOTE: At the time I did this experiment, I did not add I ran lusearch on bobcat.moma. build1 is master, and build2 is this PR. 20 invocations. From the data, the mean and median STW times are improved for SemiSpace, Immix, GenCopy and GenImmix. Although performance improvement is a good thing, I don't understand why, because this PR does not reduce the amount of work when not using node-enqueuing tracing (OpenJDK never uses node-enqueuing tracing). I am running a more comprehensive benchmark on bobcat.moma and shrew.moma, with all benchmarks in DaCapo Chopin.
|
365f49a
to
8f73a78
Compare
I ran a micro benchmark that creates a 22-layer binary tree, and executes |
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.
LGTM. Just some minor comments.
} | ||
|
||
/// Callback trait of scanning functions that directly trace through edges. | ||
pub trait ObjectTracer { |
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 just name this as ObjectVisitor
with visit_object()
? This would be consistent with the EdgeVisitor
above.
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.
Good idea. This even makes it possible to reuse this trait in other places where it needs to visit objects.
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.
After a second thought, I think I'll keep it as ObjectTracer
. The semantics of this trait includes the logic of tracing. The trace_object
method not only visits the object, but also returns the updated reference if the object is moved.
src/vm/scanning.rs
Outdated
_object: ObjectReference, | ||
_object_tracer: &mut OT, | ||
) { | ||
unimplemented!(); |
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.
unimplemented!(); | |
unreachable!("scan_object_and_trace_edges() will not be called when support_edge_enqueue() is always true.") |
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 add this message.
src/vm/scanning.rs
Outdated
/// - Otherwise, MMTk core will call `scan_object_and_trace_edges` on the object. | ||
/// | ||
/// For maximum performance, the VM should support edge-enqueuing for as many objects as | ||
/// practical. |
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.
It is worth mentioning in the comment that this method is called for every object. So a binding should avoid expensive checks and keep it as efficient as possible.
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. I'll add a comment about performance.
fn create_process_node_roots_work(&mut self, _nodes: Vec<ObjectReference>) { | ||
todo!() | ||
fn create_process_node_roots_work(&mut self, nodes: Vec<ObjectReference>) { | ||
// We want to use E::create_scan_work. |
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.
You can put an assertion here to check if the plan moves objects. So if a binding tries to use this method in a moving plan, they will get a panic immediately.
mmtk-core/src/plan/plan_constraints.rs
Line 11 in 9a3ebff
pub moves_objects: bool, |
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 add this assertion for now. In the future, when we start to support object pinning, some moving plans, such as Immix, can support node roots, too.
src/scheduler/gc_work.rs
Outdated
/// object work (it won't call `scan_object()` in [`policy::gc_work::PolicytraceObject`]). | ||
/// It should be used only for policies that do not have policy-specific scan_object(). | ||
/// Trait for a work packet that scans objects | ||
pub trait AbstractScanObjects<VM: VMBinding>: GCWork<VM> + Sized { |
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.
The trait name is clear, but it is inconsistent with the name ProcessEdgesWork
. I would suggest renaming it to ScanObjectsWork
just to be consistent.
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. That makes sense.
This commit implements node-enqueuing tracing. This is mainly for supporting VMs that does not support edge-enqueuing for some or all objects.
8f73a78
to
8c22d04
Compare
The following are the results from shrew.moma. The command is In the following plots, build1 is the master and build2 is this PR. The distribution of STW times for all plans, with outliers removed: The distribution of STW times for all plans, with all data points. The distribution of the numbers of GC for all plans (not removing outliers): From the histograms, we see that the impact on STW time is very small for most benchmarks, except a few benchmarks that have abnormally high values of mean STW time. Those with high mean STW time also have high variances. The high variance is the results of two factors.
|
This commit implements node-enqueuing tracing. This is mainly for
supporting VMs that does not support edge-enqueuing for some or all
objects.
I made minimum change to the overall structure of the current tracing framework. I reused the
ScanObjects
work packet as the node-processing work packet, and added logic for processing the edges of objects that do not support edge enqueuing.Existing VMs which do not use node-enqueuing tracing should still work, and the performance impact should be negligible. I'll do experiments to compare the performance.