Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented Sep 28, 2023

This patch does the following:

  • Updates flutter_tester to set up an Impeller rendering context and surface if --enable-impeller is set to true, using the Vulkan backend with Swiftshader.
  • Updates run_tests.py to run all tests except the smoke test (that one really has no rendering impact whatsoever) with and without --enable-impeller.
  • Updates a few tests to work that were trivial:
    • A couple tests needed updated goldens for very minor rendering differences. Filed //testing/dart/*.dart should use Skia gold instead of hand rolled golden testing. flutter#135684 to track using Skia gold for this instead.
    • Disabled SKP screenshotting if Impeller is enabled, and updated the test checking that to verify an error is thrown if an SKP is requested.
    • The Dart GPU based test now asserts that the gpu context is available if Impeller is enabled, and does not deadlock if run in a single threaded mode.
    • We were missing some trace events around Canvas::SaveLayer for Impeller as compared to Skia.
    • A couple other tests had strict checks about exception messages that are slightly different between Skia and Impeller.
  • I've filed bugs for other tests that may require a little more work, and skipped them for now. For FragmentProgram on Vulkan I reused an existing bug.
  • Decouples whether playgrounds run with Vulkan from whether Impeller was built with Vulkan. This means a new GN argument must be set to run the playgrounds with Vulkan (impeller_enable_vulkan_playgrounds), and avoids any messy logic around whether we fallback to swiftshader or not.

This is part of my attempt to address flutter/flutter#135693, although @chinmaygarde and I had slightly different ideas about how to do this.

The goals here are:

  • Run the Dart unit tests we already have with Impeller enabled.
  • Enable running more of the framework tests (including gold tests) with Impeller enabled.
  • Run all of these tests via public dart:ui API rather than mucking around in C++ internals in the engine.

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, just nits!

} else if (is_mac) {
libs += [ "$root_out_dir/libvk_swiftshader.dylib" ]
} else if (is_linux) {
libs += [ "$root_out_dir/libvk_swiftshader.so" ]
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I think we have these swiftshader lib names copied around in 3 or 4 places at this point (including in some source files). Not sure if there's one good place we could consolidate them.

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 ended up moving this to //flutter/vulkan/swiftshader_path.h

if (res != impeller::vk::Result::eSuccess) {
VALIDATION_LOG << "Could not create surface for tester "
<< impeller::vk::to_string(res);
return -1;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return -1;
return EXIT_FAILURE;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done here and elsewhere

impeller_surface_context = impeller_context->CreateSurfaceContext();
if (!impeller_surface_context->SetWindowSurface(std::move(surface))) {
VALIDATION_LOG << "Could not set up surface for context.";
return -1;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return -1;
return EXIT_FAILURE;

impeller_context = impeller::ContextVK::Create(std::move(context_settings));
if (!impeller_context || !impeller_context->IsValid()) {
VALIDATION_LOG << "Could not create Vulkan context.";
return -1;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return -1;
return EXIT_FAILURE;

impeller_modern_shaders_vk_data, impeller_modern_shaders_vk_length),
#if IMPELLER_ENABLE_3D
std::make_shared<fml::NonOwnedMapping>(
impeller_scene_shaders_vk_data, impeller_scene_shaders_vk_length),
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for taking care of Scene. 🙏


typedef CanvasCallback = void Function(Canvas canvas);

bool get impellerEnabled => Platform.executableArguments.contains('--enable-impeller');
Copy link
Member

Choose a reason for hiding this comment

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

Consider factoring this definition out into a .dart file under testing/dart, and importing it where needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

)
yield gather_dart_test(build_dir, dart_test_file, True, True)
yield gather_dart_test(build_dir, dart_test_file, False, True)
yield gather_dart_test(build_dir, dart_test_file, True, False, True)
Copy link
Member

Choose a reason for hiding this comment

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

This probably should have been done earlier, but 4 unnamed boolean flags seems like too many. Maybe the simplest thing is just to always pass the arguments as named and always pass them all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@zanderso
Copy link
Member

Many tests appear to be segfaulting. Maybe the tests that are failing under asan are a good starting point?

@dnfield
Copy link
Contributor Author

dnfield commented Oct 11, 2023

Many tests appear to be segfaulting. Maybe the tests that are failing under asan are a good starting point?

Most of those were an issue where the swiftshader dylib was getting loaded and unloaded too quickly. There's still one ASAN issue I'm looking at.

@dnfield
Copy link
Contributor Author

dnfield commented Oct 11, 2023

I'm not seeing segfaults anymore. I do see some flaky failures that seem unrelated to this patch, filed some bugs. Looks like this will be g2g now.

@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 11, 2023
@auto-submit auto-submit bot merged commit 791e90a into flutter:main Oct 11, 2023
@dnfield dnfield deleted the test_imp_swift branch October 11, 2023 21:44
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 11, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Oct 11, 2023
…136422)

flutter/engine@8bf1460...05e26c1

2023-10-11 [email protected] Run the binary size treemap script from the buildroot directory (flutter/engine#46740)
2023-10-11 [email protected] [Impeller] flutter_tester --enable-impeller (flutter/engine#46389)
2023-10-11 [email protected] Switch to Chrome For Testing instead of Chromium (flutter/engine#46683)

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
auto-submit bot pushed a commit that referenced this pull request Oct 13, 2023
#46895)

Follows up on #46389 

That patch was too permissive in cases where a build system enables impeller but not vulkan. This change makes the build succeed in such systems.
XilaiZhang pushed a commit to XilaiZhang/engine that referenced this pull request Oct 13, 2023
flutter#46895)

Follows up on flutter#46389 

That patch was too permissive in cases where a build system enables impeller but not vulkan. This change makes the build succeed in such systems.
harryterkelsen pushed a commit that referenced this pull request Oct 23, 2023
This patch does the following:

- Updates `flutter_tester` to set up an Impeller rendering context and surface if `--enable-impeller` is set to true, using the Vulkan backend with Swiftshader.
- Updates `run_tests.py` to run all tests except the smoke test (that one really has no rendering impact whatsoever) with and without `--enable-impeller`.
- Updates a few tests to work that were trivial:
  - A couple tests needed updated goldens for very minor rendering differences. Filed flutter/flutter#135684 to track using Skia gold for this instead.
  - Disabled SKP screenshotting if Impeller is enabled, and updated the test checking that to verify an error is thrown if an SKP is requested.
  - The Dart GPU based test now asserts that the gpu context is available if Impeller is enabled, and does not deadlock if run in a single threaded mode.
  - We were missing some trace events around `Canvas::SaveLayer` for Impeller as compared to Skia.
  - A couple other tests had strict checks about exception messages that are slightly different between Skia and Impeller.
- I've filed bugs for other tests that may require a little more work, and skipped them for now. For FragmentProgram on Vulkan I reused an existing bug.

This is part of my attempt to address flutter/flutter#135693, although @chinmaygarde and I had slightly different ideas about how to do this.

The goals here are:

- Run the Dart unit tests we already have with Impeller enabled.
- Enable running more of the framework tests (including gold tests) with Impeller enabled.
- Run all of these tests via public `dart:ui` API rather than mucking around in C++ internals in the engine.
harryterkelsen pushed a commit that referenced this pull request Oct 23, 2023
#46895)

Follows up on #46389 

That patch was too permissive in cases where a build system enables impeller but not vulkan. This change makes the build succeed in such systems.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants