-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Add FAQ entries. #54456
[Impeller] Add FAQ entries. #54456
Conversation
sethladd
left a comment
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.
thank you! mostly style feedback, a few content feedbacks.
|
Another pass? |
impeller/docs/faq.md
Outdated
| multiple times (on all platforms) to ensure success. Moreover, applications | ||
| that were really effective at training began to run into egregiously high | ||
| first-frame times ([some as high as 6 | ||
| seconds](http://github.com/flutter/flutter/issues/97884)). |
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.
Might be worth mentioning that this never worked at all on Android, due to the fact that skia generated different shaders based on GPU model
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.
Yeah, I remembered but got lazy and didn't want to look up the bugs to cross reference here. But flutter/flutter#102655 seems to be it. Still open! Will add.
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.
Done. Also added a ref to things we tried to reduce shader variants.
| Impeller are ready well before the Flutter application's Dart isolate is | ||
| launched. Skia can generate and compile shaders during frame workloads | ||
| leading to worse worst-frame times. | ||
| * Because the processing of shaders in Impeller happens at build time when |
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.
As a minor nit, we are still compiling shaders at runtime, and may generate new PSOs on demand. But we don't have to go through a source -> source translation or reflection step, and on iOS we can use metal achive files which load much faster.
The GPU is still jitting the shader though
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.
Sounds like a good thing to mention. Is there a general notion we can give of the relative cost between PSO generation and the source->source translation? Like is it 10x cheaper?
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.
100x maybe?
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.
on iOS in particular, it seems to be closer to "free"
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 PSO generation)
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.
And important to point out this isn't an alternative, in the old route we go source -> source -> metal compiler (source) -> PSO. now we just go metal compiler (archive) -> PSO.
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 went back and forth quite a bit on this and adding backend specific nuance made things a whole lot more complicated. On Metal, we can use either AIR files or the new Metal Binary Archives which really move everything to be at build time. But have to resort to flinging strings around with OpenGL ES. So what happens before GPU microcode is generated is quite quite messy to explain. This seemed like a fine enough bit of context to tell the story. Should I add another FAQ entry perhaps?
@zanderso From go/impeller-prototype, I found this screenshot of a trace I took where the cost of the shader library construction is separate from the PSO creation (the small pink trace at the end). I think in this version of Skia, this included source-to-source translation as well as the shader library construction we do here in Impeller. Even that last bit at the end, Impeller does before first frame (well variants are another matter I suppose).
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.
Oh, nevermind. In this case, there is an SKSL cache hit. Its even slower when there is no cached SKSL. This used to happen when the phone was rebooted and Metals caches weren't warmed up from previous runs. I was making that case that perfect SKSL caches were necessary but not sufficient for jank free operation because metalc literally had to do LLVM things and that was more than sufficient to blow our frame budgets.
Such a mess and I've blocked away so much of this context in my head.
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.
We, of course, never found this janky behavior on our benchmarks because we didn't reboot phones between runs to clear the internal metal caches.
sethladd
left a comment
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.
minor comments
LGTM thank you!
impeller/docs/faq.md
Outdated
| * How do you run `impeller_unittests` with Playgrounds enabled? | ||
| * Specify the `--enable_playground` command-line option. | ||
| * Describe Impeller in a Tweet. | ||
| * "Impeller is AOT mode for rendering." |
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.
spell out AOT. Suggest "Ahead of Time (AOT) mode ..."
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.
Shouldn't we also mention what is being AOT'ed? Like "Impeller is rendering with ahead-of-time (AOT) compilation"?
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.
Seths suggestion done. Michael, that should become clearer in the next entry. Should I add another FAQ entry perhaps?
| as development progresses. | ||
| * How do you run `impeller_unittests` with Playgrounds enabled? | ||
| * Specify the `--enable_playground` command-line option. | ||
| * Describe Impeller in a Tweet. |
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.
Suggest s/Describe Impeller in a Tweet/Describe Impeller in less than 10 words/
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.
But thats literally what Seth asked 😄 !
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.
hah yes I did, but I like @mit-mit 's suggestion here :)
impeller/docs/faq.md
Outdated
| * How do you run `impeller_unittests` with Playgrounds enabled? | ||
| * Specify the `--enable_playground` command-line option. | ||
| * Describe Impeller in a Tweet. | ||
| * "Impeller is AOT mode for rendering." |
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.
Shouldn't we also mention what is being AOT'ed? Like "Impeller is rendering with ahead-of-time (AOT) compilation"?
| with Skia after years of effort by graphics experts. The longer answer... | ||
| * Flutter applications, via their use of Skia, were susceptible to the problem | ||
| of jank (user-perceptible stuttering/choppiness in animations and | ||
| interactions) due to shader compilation. Such problems were [reported as |
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.
Maybe s/due to shader compilation/due to needing rendering shaders to be compiled on-demand before they could be executed/ or similar?
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 clarification
| * Why did the Flutter team build Impeller? | ||
| * The short answer, for consistent performance, which could not be achieved | ||
| with Skia after years of effort by graphics experts. The longer answer... | ||
| * Flutter applications, via their use of Skia, were susceptible to the problem |
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 longer form answer here reads a bit odd in bullet form. Usually bullets are separate points, but here it's just a set of paragraphs. Could it be reformatted to a single large bullet with text and line breaks?
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.
Yeah, @sethladd mentioned the same thing thing in #54456 (comment). I'm going to reformat the entire doc in a later patch.
|
One high-level question: Wouldn't it be better to add this to the official FAQ on https://docs.flutter.dev/resources/faq ? |
This FAQ contains things that are not user-facing in any way. So I'm not sure if that will just cause confusion. Specific entries maybe? I can duplicate those if you tell me which ones. |
|
I'm landing what I have. All comments have been addressed. Happy to followup with fixes and additions as necessary. |
…153191) flutter/engine@4d5b1df...2f577d8 2024-08-09 [email protected] [Impeller] Add FAQ entries. (flutter/engine#54456) 2024-08-09 [email protected] Roll Skia from f5dc4483204d to 5e190559fefd (1 revision) (flutter/engine#54472) 2024-08-09 [email protected] Roll Skia from 13b4fee1ba99 to f5dc4483204d (1 revision) (flutter/engine#54471) 2024-08-09 [email protected] [Impeller] remove scene3d support. (flutter/engine#54453) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Good call @mit-mit , I think we can add one question to the official faq [1] under "Technology" for "What rendering engine does Flutter use?" and give a quick answer there, and then link out to the fuller Impeller FAQ. Note that https://docs.flutter.dev/resources/faq does mention Impeller, which is good. WDYT? |
|
I think it might be useful to add a "But if Impeller suits Flutter's use cases more, what use cases is Skia optimized for?" question, where we can talk about how Skia's compiled shaders are shared across websites and tabs (in Chrome) and across apps (when built into Android), so the cost gets amortized and thus isn't paid by every app (the way it is for Flutter). And we can also give a shout out to Skia for having better best-cases frame times -- i.e. higher throughput vs more predictable rendering. Thoughts? |
|
It also might be worth addressing the question "Is the Graphite project Skia's answer to Impeller, and does it obviate Impeller?" |
|
Skia doesn't have better frame times on iOS though :) |
This was considered to be an acceptable tradeoff when Impeller was first prototyped. And it was the case in early 2023. But Impeller now has higher throughput as well lower memory usage in most of our benchmarks (attached below). There are obviously edge cases we keep discovering on an ongoing basis. There is a lot more work to do but we intend to beat benchmarks for those edge cases as well. I'd rather not feign modesty about Impellers throughput but acknowledge our work is not done yet. Some of the questions around Graphite are speculative but I've attempted to answer these in go/impeller-faq-followups. Happy to move these over to the FAQ when the open questions are answered. |
…lutter#153191) flutter/engine@4d5b1df...2f577d8 2024-08-09 [email protected] [Impeller] Add FAQ entries. (flutter/engine#54456) 2024-08-09 [email protected] Roll Skia from f5dc4483204d to 5e190559fefd (1 revision) (flutter/engine#54472) 2024-08-09 [email protected] Roll Skia from 13b4fee1ba99 to f5dc4483204d (1 revision) (flutter/engine#54471) 2024-08-09 [email protected] [Impeller] remove scene3d support. (flutter/engine#54453) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…lutter#153191) flutter/engine@4d5b1df...2f577d8 2024-08-09 [email protected] [Impeller] Add FAQ entries. (flutter/engine#54456) 2024-08-09 [email protected] Roll Skia from f5dc4483204d to 5e190559fefd (1 revision) (flutter/engine#54472) 2024-08-09 [email protected] Roll Skia from 13b4fee1ba99 to f5dc4483204d (1 revision) (flutter/engine#54471) 2024-08-09 [email protected] [Impeller] remove scene3d support. (flutter/engine#54453) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md


Fixes flutter/flutter#153120