Skip to content

[Impeller] Investigate removal of waitUntilScheduled in Metal backend. #120399

Closed
flutter-team-archive/engine
#41501

Description

@jonahwilliams

This is necessary today because Impeller doesn't do resource hazard tracking across render passes. This introduces bubbles in execution on the GPU which wastes available concurrency.

Activity

  1. added
    engineflutter/engine related. See also e: labels.
    P3Issues that are less important to the Flutter project
    e: impellerImpeller rendering backend issues and features requests
    on Feb 9, 2023
  2. moved this to 🤔 Needs Triage in Impelleron Feb 9, 2023
  3. changed the title [-][impeller] Investigate removal of waitUntilScheduled in metal backend[/-] [+][Impeller] Investigate removal of `waitUntilScheduled` in Metal backend.[/+] on Feb 11, 2023
  4. moved this from 🤔 Needs Triage to ⚡ Performance in Impelleron Feb 11, 2023
  5. jonahwilliams commented on Mar 11, 2023

    @jonahwilliams
    ContributorAuthor

    I added some additional tracing so that we account for the waitUntiLScheduled in the SubmitCommands method. It appears that the vast majority of the time is spent just waiting.

    image

  6. jonahwilliams commented on Mar 11, 2023

    @jonahwilliams
    ContributorAuthor

    In the wonderous app, removing waitUntilScheduled reduces average raster time from 7-8ms down to 1-2ms.

  7. chinmaygarde commented on Mar 11, 2023

    @chinmaygarde
    Contributor

    Did you attach the wrong screenshot? That is showing the wait for the next drawable. That is the backpressure mechanism (the GPU telling us we are running ahead of its ability to render the stuff we are telling it to) and this issue isn't describing getting rid of it.

    I got rid of the need for this wait as I am wiring up the Vulkan backend and have some notes on how we can do the same for Metal. We can discuss it in the weekly or an OOB sync perhaps?

  8. jonahwilliams commented on Mar 11, 2023

    @jonahwilliams
    ContributorAuthor

    No, take a look at the command buffer upload part. It's all waitUntilScheduled

  9. jonahwilliams commented on Mar 11, 2023

    @jonahwilliams
    ContributorAuthor

    Weekly sounds fine fyi, just doing some investigating

  10. jonahwilliams commented on Mar 11, 2023

    @jonahwilliams
    ContributorAuthor

    This is what I added for tracing, I believe it should be accurate.

    @@ -164,6 +168,7 @@ bool CommandBufferMTL::OnSubmitCommands(CompletionCallback callback) {
       }
     
       [buffer_ commit];
    +  TRACE_EVENT0("impeller", "CommandBufferMTL::waitUntilScheduled");
       [buffer_ waitUntilScheduled];
       buffer_ = nil;
       return true;
  11. chinmaygarde commented on Mar 16, 2023

    @chinmaygarde
    Contributor
  12. chinmaygarde commented on Mar 31, 2023

    @chinmaygarde
    Contributor

    Fixed by @bdero in flutter-team-archive/engine#40781. We were on the wrong lines of investigation w.r.t hazard tracking.

  13. moved this from ⚡ Performance to ✅ Done in Impelleron Mar 31, 2023
  14. chinmaygarde commented on Apr 3, 2023

    @chinmaygarde
    Contributor

    The fix was reverted in flutter-team-archive/engine#40895.

  15. moved this from ✅ Done to 🤔 Needs Triage in Impelleron Apr 3, 2023
  16. added
    P2Important issues not at the top of the work list
    and removed
    P3Issues that are less important to the Flutter project
    on Apr 17, 2023
  17. moved this from 🤔 Needs Triage to ⚙️ In Progress in Impelleron Apr 17, 2023
  18. moved this from ⚙️ In Progress to ✅ Done in Impelleron Apr 26, 2023
  19. github-actions commented on May 10, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  20. locked as resolved and limited conversation to collaborators on May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work liste: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions