Skip to content
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

Add a visualization of thread activity #443

Merged
merged 3 commits into from
Sep 26, 2023
Merged

Add a visualization of thread activity #443

merged 3 commits into from
Sep 26, 2023

Conversation

rsheeter
Copy link
Contributor

@rsheeter rsheeter commented Sep 17, 2023

How might we understand what our threads are up to? - it's hard to tell from most profiles. By visualizing it ourselves of course! First hacky draft:

image

Above each row is a thread and time goes left to right. The pink area (color/label strategy tbd) shows very fine grained FE glyph work being distributed among threads, this is what we want. Next we see a period where nothing can be done until we have final glyph order, understandable but not what we want. We can see any speedup to glyph order production is a big win as it's delaying everything. Next we see a lot of per-glyph BE work in light blue, then a period where fea-rs is the long pole as we push toward completion.

We can see that kern, which is executable as soon as glyph order is done and blocks backend fea, doesn't start for a quite a while which can work out poorly:

image

https://github.com/rayon-rs/rfcs/blob/master/accepted/rfc0001-scope-scheduling.md#current-behavior-per-thread-lifo suggests the order you submit to rayon can matter a lot. When I test with Oswald it seems kern is submitted with a large batch of backend glyph work and often sits in spot 600+ in the batch. If I hack to move it to the front it executes almost immediately after glyph order:

image

^ is significantly better; we will want to land some sort of prioritization. However, while this works for kern because it becomes executable at the same time as a large set of things that block on glyph order it doesn't work for fea so we still end up with fea not starting until all the be glyphs are done and then spending time as the only active task; if it had started as soon as kern finished we'd be in better shape:

image

Plenty of room for refinement but already seems useful so I will try to prepare a less hacky version to land.

@rsheeter rsheeter force-pushed the time branch 2 times, most recently from c3f696b to 3959266 Compare September 22, 2023 20:50
@rsheeter
Copy link
Contributor Author

Impact of long poles is more significant the more cores you have, on a 72-way system:

image

@rsheeter rsheeter changed the title [WIP] Add a visualization of thread activity Add a visualization of thread activity Sep 25, 2023
@rsheeter rsheeter marked this pull request as ready for review September 25, 2023 18:10
Copy link
Member

@anthrotype anthrotype left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! 👍

fontc/src/args.rs Outdated Show resolved Hide resolved
@rsheeter rsheeter added this pull request to the merge queue Sep 26, 2023
Merged via the queue into main with commit 4e2724f Sep 26, 2023
8 checks passed
@rsheeter rsheeter deleted the time branch September 26, 2023 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants