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] attempt to get validation errors from CI unittests. #51341

Merged
merged 41 commits into from
Mar 13, 2024

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Mar 11, 2024

Enables Vulkan validation layers for macOS and linux builds, enables macOS validation for macOS builds.

Fixes flutter/flutter#144967

There may still be remaining issues with macOS validation, I need to verify I can reproduce flutter/flutter#143324 . I plan to do that separately

@@ -116,6 +116,8 @@ template("aiks_unittests_component") {
"//flutter/impeller/typographer/backends/stb:typographer_stb_backend",
"//flutter/testing:testing_lib",
"//flutter/third_party/txt",
"//third_party/vulkan_validation_layers",
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: remove

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@jonahwilliams jonahwilliams changed the title testing. [Impeller] attempt to get validation errors from CI unittests. Mar 12, 2024
@@ -543,7 +546,8 @@ def make_test(name, flags=None, extra_env=None):
shuffle_flags + [
'--enable_vulkan_validation',
# TODO(https://github.com/flutter/flutter/issues/142642): Remove this.
'--gtest_filter=-*OpenGLES',
# TODO EVEN MORE
'--gtest_filter=*Metal',
Copy link
Member Author

Choose a reason for hiding this comment

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

The vulkan variants crash, I think this is because they weren't running before? I'd need to double check. Either that or they are just hitting validation checks that are fatal in a way the test harness can't handle

@@ -2267,7 +2277,7 @@ TEST_P(EntityTest, RuntimeEffectCanSuccessfullyRender) {
.has_value());
}

TEST_P(EntityTest, RuntimeEffectSetsRightSizeWhenUniformIsStruct) {
TEST_P(EntityTest, DISABLED_RuntimeEffectSetsRightSizeWhenUniformIsStruct) {
Copy link
Member

Choose a reason for hiding this comment

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

Please add an issue for a disabled test.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not disabling it here anymore, i filled one generic skip test issue

@@ -69,7 +69,26 @@ static const std::vector<std::string> kSkipTests = {
"impeller_Play_AiksTest_CanRenderClippedRuntimeEffects_Vulkan",
};

static const std::vector<std::string> kVulkanDenyValidationTests = {};
static const std::vector<std::string> kVulkanDenyValidationTests = {
"impeller_Play_GaussianBlurFilterContentsTest_" //
Copy link
Member

Choose a reason for hiding this comment

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

nit: turn off clang format so these are all on one line

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -60,16 +60,7 @@ void PlaygroundImplVK::DestroyWindowHandle(WindowHandle handle) {

PlaygroundImplVK::PlaygroundImplVK(PlaygroundSwitches switches)
Copy link
Member

Choose a reason for hiding this comment

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

Ideally this would be a static function that returns StatusOr<std::unique_ptr<PlaygroundImplVK>> instead of short circuiting a constructor, leaving a half initialized object.

https://google.github.io/styleguide/cppguide.html#Doing_Work_in_Constructors

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we can just lift the check out of the constructor, since its a static method. I made this an FML_CHECK

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -19,6 +20,50 @@
#include "impeller/playground/backend/vulkan/playground_impl_vk.h"
#endif // IMPELLER_ENABLE_VULKAN

namespace {
static const std::vector<std::string> kVulkanDenyValidationTests = {
Copy link
Member

Choose a reason for hiding this comment

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

Let's share this instead of duplicating it twice.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -41,7 +41,7 @@ CapabilitiesVK::CapabilitiesVK(bool enable_validations) {
validations_enabled_ =
enable_validations && HasLayer("VK_LAYER_KHRONOS_validation");
if (enable_validations && !validations_enabled_) {
FML_LOG(ERROR)
FML_LOG(FATAL)
Copy link
Member

Choose a reason for hiding this comment

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

I think the safer thing is to add a test that makes sure this doesn't get printed out. I'm concerned about sending users down this path on accident.

Copy link
Member Author

Choose a reason for hiding this comment

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

For now I'm keeping this fatal for testing.

So we have two approaches here:

  1. Keep the existing behavior but add checks that it is running as expected on CI.
  2. Make it fatal but do more work to make sure users don't fall down the path.

Copy link
Member

Choose a reason for hiding this comment

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

What I'm doing for impeller validations is that it is off by default (existing behavior) but I swap it on in the main() for the test runner and adding a test to make sure it it is on.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm moving this back to error, as a follow up we need to make sure accidentally turning off validations causes a test somewhere to fail - ideally once for each shard.

Copy link
Member Author

Choose a reason for hiding this comment

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

return extra_env


def metal_validation_env(build_dir):
Copy link
Member

Choose a reason for hiding this comment

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

This contains both Metal and Vulkan configuration variables.

Rename this to metal_and_vulkan_validation_env?

Or have the caller create a merged dictionary from metal_validation_env and vulkan_validation_env?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

tools/gn Outdated
@@ -788,15 +788,9 @@ def to_gn_args(args):
if args.enable_impeller_trace_canvas:
gn_args['impeller_trace_canvas'] = True

if args.enable_impeller_vulkan:
gn_args['impeller_enable_vulkan'] = True

if args.enable_impeller_vulkan_playgrounds:
gn_args['impeller_enable_vulkan_playgrounds'] = True
Copy link
Member

Choose a reason for hiding this comment

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

Remove impeller_enable_vulkan_playgrounds from tools/gn now that it no longer exists in the GN scripts

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

Changes reported for pull request #51341 at sha c53ff77

action='store_true',
help='Enable the Impeller Vulkan Playgrounds. ' +
'The Impeller Vulkan backend needs to be enabled.'
)

parser.add_argument(
'--enable-impeller-opengles',
default=False,
default=True,
Copy link
Member

Choose a reason for hiding this comment

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

Should the default value for --enable-impeller-vulkan also be switched?

Copy link
Member Author

Choose a reason for hiding this comment

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

Lets try it


# Whether the Vulkan backend is enabled.
impeller_enable_vulkan = (is_linux || is_win || is_android ||
impeller_enable_vulkan = (is_linux || is_win || is_android || is_mac ||
Copy link
Member

Choose a reason for hiding this comment

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

Why does this one have enable_unittests but the opengles one doesn't?

Copy link
Member Author

Choose a reason for hiding this comment

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

Lets try it

@@ -1253,15 +1246,15 @@ def parse_args(args):

parser.add_argument(
'--enable-impeller-vulkan-playgrounds',
default=False,
default=True,
Copy link
Member

Choose a reason for hiding this comment

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

The GN invocations all live in this repo, so if this flag is a no-op now, and is no longer passed in the json files, then it can be safely removed from here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@matanlurey matanlurey left a comment

Choose a reason for hiding this comment

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

Looks a lot better! Thanks for pushing on this!

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 13, 2024
@auto-submit auto-submit bot merged commit 67e6328 into flutter:main Mar 13, 2024
28 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 13, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 13, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Mar 13, 2024
…145106)

flutter/engine@6ceccf8...9551b49

2024-03-13 jonahwilliams@google.com [Impeller] fix heap selection process for YUV textures. (flutter/engine#51262)
2024-03-13 6844906+zijiehe-google-com@users.noreply.github.com [Fuchsia] Enable sound null safety everywhere (flutter/engine#51355)
2024-03-13 30870216+gaaclarke@users.noreply.github.com [Impeller] added missing golden test for DrawScaledTextWithPerspectiveSaveLayer (flutter/engine#51368)
2024-03-13 skia-flutter-autoroll@skia.org Roll Skia from dc7443fa4d88 to 1ad0d0fabe7a (1 revision) (flutter/engine#51373)
2024-03-13 tugorez@users.noreply.github.com Implement PlatformDispatcher.requestViewFocusChange on web.  (flutter/engine#50535)
2024-03-13 jonahwilliams@google.com [Impeller] attempt to get validation errors from CI unittests. (flutter/engine#51341)
2024-03-13 skia-flutter-autoroll@skia.org Roll Dart SDK from b19e0995f317 to 18ec60df0774 (1 revision) (flutter/engine#51374)
2024-03-13 jonahwilliams@google.com [scenario app] make image matching fuzzier. (flutter/engine#51376)
2024-03-13 skia-flutter-autoroll@skia.org Roll Skia from bbe453e3525d to dc7443fa4d88 (1 revision) (flutter/engine#51371)

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 bdero@google.com,rmistry@google.com,zra@google.com 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 will affect goldens
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Impeller] Vulkan playground tests aren't running on CI (with validations)
5 participants