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

Perform no shader warm-up by default #87126

Merged
merged 5 commits into from Jul 27, 2021

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented Jul 27, 2021

Fixes #87085

Before flutter/engine#27629, on Android, the shader warm-up routine did not actually produce any shaders (!). This is because the backend ended up going down a raster path that doesn't use GPU shaders. It is completely wasted time.

Now that a GPU baacked surface is available in the background, it does produce shaders - however, those shaders do not seem to be significantly improving benchmarks, and are regressing startup time and memory usage.

We can consider re-applying a default routine if we can find one that actually improves metrics. In the mean time, we should remove this.

The internal customer this logic was written for has their own routine(s) that will not be affected by this change.

@flutter-dashboard flutter-dashboard bot added d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels. team Infra upgrades, team productivity, code health, technical debt. See also team: labels. labels Jul 27, 2021
@google-cla google-cla bot added the cla: yes label Jul 27, 2021
@chinmaygarde
Copy link
Member

however, those shaders do not seem to be significantly improving benchmarks, and are regressing startup time and memory usage.

TBH, I didn't know we were doing this by default! And that it was not doing anything useful (when it actually works) is not entirely unexpected as it requires constant upkeep, expertise in determining the triggers that generate the specific shader variants, context about the applications needs, and, is platform and rendering backend specific to boot.

BTW, why provide the default at all?

@@ -33,3 +33,141 @@ Future<void> main() async {
ui.window.onBeginFrame = beginFrame;
ui.window.scheduleFrame();
}

/// Default way of warming up Skia shader compilations.
Copy link
Member

Choose a reason for hiding this comment

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

Should this just be deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I'll just remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to just delete the whole example. Filed #87132 to track just removing this API entirely

@dnfield
Copy link
Contributor Author

dnfield commented Jul 27, 2021

Image tracing expectations had to be updated because a counter that used to be 1 is now 0 - due to no shader warmup creating an image.

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

@fluttergithubbot fluttergithubbot merged commit 32c2e2b into flutter:master Jul 27, 2021
@dnfield dnfield deleted the no_default_sw branch July 28, 2021 03:52
@dnfield
Copy link
Contributor Author

dnfield commented Jul 28, 2021

So far it looks like this may be saving somewhere between 10-30ms on time to first frame. Will have to see if that's just noise in the benchmark or not.

@dnfield
Copy link
Contributor Author

dnfield commented Jul 28, 2021

@flar
Copy link
Contributor

flar commented Jul 29, 2021

flar added a commit that referenced this pull request Jul 29, 2021
flar added a commit that referenced this pull request Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels. team Infra upgrades, team productivity, code health, technical debt. See also team: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in timeToFirstFrameRasterizedMicros on Mac_android_complex_layout__start_up
6 participants