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

[Impeller] add a configuration option that allows defering all PSO construction until needed. #165261

Merged
merged 21 commits into from
Mar 20, 2025

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Mar 15, 2025

The cost of bootstapping the initial PSOs can regress cold startup time for customer money. As an experiment, attempt to defer PSO construction to skia like.

@github-actions github-actions bot added platform-android Android applications specifically engine flutter/engine repository. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Mar 15, 2025
@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems a: desktop Running on desktop platform-macos labels Mar 16, 2025
@jonahwilliams jonahwilliams changed the title [Impeller] add a configuration option that allows defering all PSO construction to runtime. [Impeller] add a configuration option that allows defering all PSO construction until needed. Mar 16, 2025
@github-actions github-actions bot added the platform-ios iOS applications specifically label Mar 16, 2025
@jonahwilliams jonahwilliams marked this pull request as ready for review March 17, 2025 16:17
Comment on lines 296 to 298
struct Settings {
bool lazy_shader_mode = false;
};
Copy link
Member

Choose a reason for hiding this comment

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

I'm working on a flags system for impeller right now. I think we're better off with a holistic flags system for all of impeller instead of these different settings distributed across the codebase and sometimes living as parameter arguments.

I planned on migrating the wifeframe option to this system too.

It will be something like this:

namespace impeller {
class Flags {
  public:
    void Init(std::set<std::string_view> names);
    bool HasFlag(std::string_view name) const;
};
}

Copy link
Member Author

Choose a reason for hiding this comment

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

slightly related, I'd actually like us to remove wireframe as its a debugging option we no longer use.

better flags SGTM tho. Barring other feedback, I'd like to land this first to unblock the customer money tests. If there are things I can change to make it work better with your flag proposal that would be fine too.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, here's the changes I propose:

  1. Get rid of ContentContext::Settings
  2. Get rid of AiksContext::Settings
  3. Add a new class, impeller::Flags that has one flag enable_lazy_shader_mode.
  4. Make impeller::Context have an impeller::Flags, that way people can get flags from the Context directly, or from ContentContext->GetContext()
  5. Any place that you are passing an argument that is like bool lazy instead pass a const reference to impeller::Flags.

This has the benefits of:

  1. One singular place for added flags, it's easier to add more flags in the future
  2. Settings isn't overloaded
  3. Signatures like the ContentContext constructor won't change

Lay it out however is easiest for you, I can tweak it later if need be. I can also do the patch for you in this pr, or author a different pr you can rebase on if you want.

Copy link
Member Author

Choose a reason for hiding this comment

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

That SGTM

Copy link
Member

Choose a reason for hiding this comment

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

Okay, I refactored it to use impeller::Flags. I also uncommented out that function call like we discussed in the other PR. Let's try getting this through together, if it gets too weird I can rip out the flags stuff into a new pr and we can rebase this pr on it.

@github-actions github-actions bot removed the platform-ios iOS applications specifically label Mar 19, 2025
Copy link
Member Author

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

lgtm

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 20, 2025
Copy link
Contributor

auto-submit bot commented Mar 20, 2025

autosubmit label was removed for flutter/flutter/165261, because - The status or check suite Linux linux_clang_tidy has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 20, 2025
@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 20, 2025
Copy link
Contributor

auto-submit bot commented Mar 20, 2025

autosubmit label was removed for flutter/flutter/165261, because - The status or check suite CI Caught Failure has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 20, 2025
@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 20, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 20, 2025
Copy link
Contributor

auto-submit bot commented Mar 20, 2025

autosubmit label was removed for flutter/flutter/165261, because - The status or check suite Linux linux_unopt has failed. Please fix the issues identified (or deflake) before re-applying this label.

@gaaclarke gaaclarke added this pull request to the merge queue Mar 20, 2025
Merged via the queue into flutter:master with commit cab4fe3 Mar 20, 2025
173 of 174 checks passed
@jonahwilliams jonahwilliams deleted the defer_construction branch March 20, 2025 21:45
@jonahwilliams
Copy link
Member Author

reason for revert: bork the tree

@jonahwilliams jonahwilliams added the revert Autorevert PR (with "Reason for revert:" comment) label Mar 21, 2025
auto-submit bot pushed a commit that referenced this pull request Mar 21, 2025
…l PSO construction until needed. (#165261)"

This reverts commit cab4fe3.
@auto-submit auto-submit bot removed the revert Autorevert PR (with "Reason for revert:" comment) label Mar 21, 2025
github-merge-queue bot pushed a commit that referenced this pull request Mar 21, 2025
…ll PSO construction until needed. (#165261)" (#165619)

<!-- start_original_pr_link -->
Reverts: #165261
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: jonahwilliams
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: bork the tree
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: jonahwilliams
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {gaaclarke}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
The cost of bootstapping the initial PSOs can regress cold startup time
for customer money. As an experiment, attempt to defer PSO construction
to skia like.
<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
@jonahwilliams jonahwilliams restored the defer_construction branch March 21, 2025 01:19
@gaaclarke
Copy link
Member

reason for revert: bork the tree

Aw man, I needed the flags work for antialias lines. Should I split that into a different PR or do you see us relanding this today?

@jonahwilliams
Copy link
Member Author

We can reland the bork was unrelated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems e: impeller Impeller rendering backend issues and features requests engine flutter/engine repository. See also e: labels. platform-android Android applications specifically platform-macos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants