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 support for specialization constants redux. #47678

Merged
merged 23 commits into from
Nov 7, 2023

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Nov 4, 2023

Reland of #47432

Also includes:

Fixes the performance on iOS by removing blocking on compilation of shaders. From local testing this has identical before/after numbers. Additional, ensures that we don't unecessarily specialize vertex shaders and notes this restriction in the documentation.


Adds support for Specialization constants to Impeller for our usage in the engine. A motivating example has been added in the impeller markdown docs.

Fixes flutter/flutter#136210
Fixes flutter/flutter#119357

@@ -59,7 +52,31 @@
descriptor.stencilAttachmentPixelFormat =
ToMTLPixelFormat(desc.GetStencilPixelFormat());

return descriptor;
const auto& constants = desc.GetSpecializationConstants();
Copy link
Member Author

Choose a reason for hiding this comment

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

This is still a bit iffy, but we improve performance by not blocking on the specialization, it all goes into the same pipeline future which is only blocking once we actually trry to use it.

Since the compilation is out of process anyway, blocking on it is pointless and only serves to park the thread.

Copy link
Member

Choose a reason for hiding this comment

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

Feels like we're writing javascript here with this chain of nested completion callbacks. ;) Looks safe to me, though.

@@ -133,19 +150,12 @@
));
promise->set_value(new_pipeline);
};
auto mtl_descriptor = GetMTLRenderPipelineDescriptor(descriptor);
#if FML_OS_IOS
Copy link
Member Author

Choose a reason for hiding this comment

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

Todo: add back

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, i see this issue is closed. Is this intended to be removed now?

@jonahwilliams jonahwilliams changed the title Add specialization support redux [Impeller] Add support for specialization constants redux. Nov 4, 2023
@jonahwilliams jonahwilliams marked this pull request as ready for review November 4, 2023 14:53
Copy link
Member

@bdero bdero left a comment

Choose a reason for hiding this comment

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

LGTM modulo latch question. Crasher fix & new changes make sense.

@@ -59,7 +52,31 @@
descriptor.stencilAttachmentPixelFormat =
ToMTLPixelFormat(desc.GetStencilPixelFormat());

return descriptor;
const auto& constants = desc.GetSpecializationConstants();
Copy link
Member

Choose a reason for hiding this comment

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

Feels like we're writing javascript here with this chain of nested completion callbacks. ;) Looks safe to me, though.

return descriptor;
// This latch is used to ensure that GetMTLFunctionSpecialized does not finish
// before the descriptor is completely set up.
auto latch = std::make_shared<fml::CountDownLatch>(1u);
Copy link
Member

Choose a reason for hiding this comment

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

Nothing appears to be waiting on this latch, and I'm not sure why we'd need one. It looks like the descriptor is already done being set up by the time we call GetMTLFunctionSpecialized.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed. This was left over from an earlier iteration.

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 7, 2023
@auto-submit auto-submit bot merged commit be43db3 into flutter:main Nov 7, 2023
28 checks passed
@jonahwilliams jonahwilliams added the revert Label used to revert changes in a closed and merged pull request. label Nov 7, 2023
auto-submit bot pushed a commit that referenced this pull request Nov 7, 2023
@auto-submit auto-submit bot removed the revert Label used to revert changes in a closed and merged pull request. label Nov 7, 2023
auto-submit bot added a commit that referenced this pull request Nov 7, 2023
…47762)

Reverts #47678
Initiated by: jonahwilliams
This change reverts the following previous change:
Original Description:
Reland of #47432

Also includes:
  * #47617
  * #47637
  
Fixes the performance on iOS by removing blocking on compilation of shaders. From local testing this has identical before/after numbers. Additional, ensures that we don't unecessarily specialize vertex shaders and notes this restriction in the documentation.

----

Adds support for Specialization constants to Impeller for our usage in the engine. A motivating example has been added in the impeller markdown docs.

Fixes flutter/flutter#136210
Fixes flutter/flutter#119357
fluttermirroringbot pushed a commit to flutter/flutter that referenced this pull request Nov 7, 2023
…138034)

flutter/engine@1b20752...f8961d2

2023-11-07 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Impeller] Add support for specialization constants redux." (flutter/engine#47762)
2023-11-07 [email protected] [Impeller] added tests for matrices (flutter/engine#47754)
2023-11-07 [email protected] Roll Skia from 62fc1374cc5d to 030e21befbc9 (2 revisions) (flutter/engine#47756)
2023-11-07 [email protected] [ios] making objective-C smart pointers support ARC (flutter/engine#47612)
2023-11-07 [email protected] Don't use Skia BUILD.gn files (flutter/engine#47677)
2023-11-07 [email protected] [Impeller] Add support for specialization constants redux. (flutter/engine#47678)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller
Projects
No open projects
Archived in project
2 participants