Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUse rayon to drive parallel layout and styling. #13641
Conversation
highfive
commented
Oct 7, 2016
|
Heads up! This PR modifies the following files:
|
highfive
commented
Oct 7, 2016
|
@pcwalton, could you take a look at this and see if it makes sense to you? Also, cc @bholley, @SimonSapin, and @Manishearth. |
| } | ||
| } | ||
|
|
||
| if i > SPINS_UNTIL_BACKOFF { |
This comment has been minimized.
This comment has been minimized.
larsbergstrom
Oct 7, 2016
Contributor
I'd like to see benchmarks of Rayon against our threadpool, as a lot of the backoff stuff was pretty highly tuned for the work item sizes of style and layout. These sorts of things are really easy to kill performance on small-sized work items if you move to locks/condvars/signals/etc.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
emilio
Oct 7, 2016
Author
Member
After spending a few minutes studying Servo profiler dumps, I can't really draw a strong conclusion about this. Sometimes slower, sometimes faster, but always on the same order...
|
|
||
| if self.should_record_thread_ids() { | ||
| flow::mut_base(flow).thread_id = proxy.worker_index(); | ||
| // flow::mut_base(flow).thread_id = proxy.worker_index(); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
emilio
Oct 7, 2016
Author
Member
That was for the layout tinting debug mode, I'm not sure it still works now.
|
FYI, I think I only check for all-uppercase WIP/TODO in homu: servo/homu@1187df0. Might want to file an issue for having it work with lowercase as well. |
|
I've been wanting to do this for quite a while! This is great! It's always nice when we can move over to community solutions. I second wanting to get solid numbers on this. If you can profile a few pages and make sure our parallel gains are the same as before (check ARM too), then I'm cool with it. |
|
|
6e393f2
to
83bc2f9
|
|
317d116
to
4c4a387
|
The status of this is the following: I've benchmarked rayon and I think this is going to be good enough, and maybe better with low workloads given the rayon API executes the first call in the current thread and moves subsequent calls to worker threads. Also, there's no unsafe code now there, only the |
|
@emilio What numbers are we talking about? Within 10% or...? |
|
I'd say the difference is way lower, less than 5% in my previous |
|
Are these synthetic benchmarks? Would be good to know what the impact is on stylo (i.e. redoing the measurements in http://people.mozilla.org/~bholley/stylo-london-2016/wikipedia-annotated.png and http://people.mozilla.org/~bholley/stylo-london-2016/spec-annotated.png |
|
Nope, they're done basically browsing with servo, trusting a bit the profiler and a bit more |
|
If it's under 5% that's more than good enough for me. We may well make up way more than that with parallel display list construction, which rayon could reenable. |
|
I'm generally optimistic here, but would like to see the numbers on stylo. |
|
|
|
It seems likely we can get back this performance by optimizing Rayon. I agree with Patrick that this change seems worthwhile even at a minor performance cost. |
Update rayon. I need this for servo/servo#13641 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/532) <!-- Reviewable:end -->
|
|
|
@bors-servo try |
Use rayon to drive parallel layout and styling. <!-- Please describe your changes on the following line: --> The current work queue had a really annoying constraint: The size of the node had to be the size of the work unit data. This makes it impractical for the new restyling model where we plan to pass down a bunch of data. Rayon by default makes you wait for the result of the work unit, which makes it impractical for the current model (it's mostly sequential). I added an API to rayon that allows us to push work to the queue without waiting (https://github.com/nikomatsakis/rayon/pull/103). This still needs some work (for example, we're loosing the memory reporting functionality), but I wanted feedback on this. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13641) <!-- Reviewable:end -->
|
|
|
|
|
@bors-servo r=pcwalton There we go. |
|
|
Use rayon to drive parallel layout and styling. <!-- Please describe your changes on the following line: --> The current work queue had a really annoying constraint: The size of the node had to be the size of the work unit data. This makes it impractical for the new restyling model where we plan to pass down a bunch of data. Rayon by default makes you wait for the result of the work unit, which makes it impractical for the current model (it's mostly sequential). I added an API to rayon that allows us to push work to the queue without waiting (https://github.com/nikomatsakis/rayon/pull/103). This still needs some work (for example, we're loosing the memory reporting functionality), but I wanted feedback on this. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13641) <!-- Reviewable:end -->
|
|
emilio commentedOct 7, 2016
•
edited by larsbergstrom
The current work queue had a really annoying constraint: The size of the node had to be the size of the work unit data.
This makes it impractical for the new restyling model where we plan to pass down a bunch of data.
Rayon by default makes you wait for the result of the work unit, which makes it impractical for the current model (it's mostly sequential).
I added an API to rayon that allows us to push work to the queue without waiting (https://github.com/nikomatsakis/rayon/pull/103).
This still needs some work (for example, we're loosing the memory reporting functionality), but I wanted feedback on this.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is