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

Conversation

@gaaclarke
Copy link
Member

fixes flutter/flutter#121017

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@gaaclarke
Copy link
Member Author

I patched in jonahs change to verify it fixes the problem (i don't have an x86_64 machine to test locally). I'll revert it after the test.

@jonahwilliams
Copy link
Contributor

You'll need one more cmmit to make it work (I messed up the mipmap setting)

@jonahwilliams
Copy link
Contributor

I rebased after the upload to private patch landed. If these all pass we should land it this week

@chinmaygarde
Copy link
Member

Does this need another rebase?

@gaaclarke
Copy link
Member Author

Does this need another rebase?

Ahh no I don't think so. It looks like our tests genuinely fail with validation turned on. I can take a look at this later today or next week. I thought this passed locally and didn't follow up with the CI results.

@gaaclarke
Copy link
Member Author

On ci GlyphAtlasTextureIsRecreatedIfTypeChanges failed, but locally it passed for me. I will try rebasing.

@gaaclarke gaaclarke force-pushed the validate-impeller-tests branch from c1aade8 to c23cdeb Compare April 27, 2023 22:10
@gaaclarke
Copy link
Member Author

Looks like the tests pass on debug builds, but on profile builds and release builds there are validation errors.

@gaaclarke
Copy link
Member Author

gaaclarke commented Apr 27, 2023

I've tried to reproduce the failure in the profile build locally 3 times, but it runs fine locally. I'll attempt a rerun to see if we get the same failure or a different failure. For reference the previous failure was:

[ RUN      ] Play/RendererTest.TheImpeller/Metal

STDERR: 
[INFO:test_timeout_listener.cc(76)] Test timeout of 120 seconds per test case will be enforced.
2023-04-27 15:17:25.839 impeller_unittests[82338:468259] Metal API Validation Enabled
-[MTLDebugDevice newTextureWithDescriptor:]:1008: failed assertion `Texture Descriptor Validation
MTLStorageModeShared not allowed for textures
'

link: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8782624655967358433/+/u/test:_Impeller-golden__dart_and_engine_tests_for_host_release__3_/stdout

reproductions steps

./flutter/tools/gn --runtime-mode=profile --goma --unoptimized --no-lto --mac-cpu=x64
cd flutter/testing
./run_tests.py --type=engine --variant host_profile_unopt

@gaaclarke
Copy link
Member Author

This is jonah's fix to the validation problem: #41001

There is no obvious reason why that change would behave differently on debug and profile builds.

@gaaclarke
Copy link
Member Author

Weird, on "Mac mac_host_engine" the debug build passes, on "Linux mac_unopt" it doesn't pass so we can just run with validation for debug builds.

@jonahwilliams Do you have any theories why we are still running into this issue, even after a rebase and why we seem to be seeing different results locally?

@jonahwilliams
Copy link
Contributor

WTF is "Linux mac_unopt" 🤔

@zanderso
Copy link
Member

WTF is "Linux mac_unopt" 🤔

The orchestrator is Linux and the actual build is on a mac. It's an engine v2 thing because we have more Linux capacity.

@jonahwilliams
Copy link
Contributor

Do we know which tests are failing? There is a lot more usage of StorageMode::kHostVisible than the one I removed

@gaaclarke
Copy link
Member Author

I've seen these fail:

  • Play/RendererTest.TheImpeller/Metal
  • Play/SceneTest.FlutterLogo/Metal

Do we have bots that run on arm64? Maybe we could just turn off x86_64 validation for now.

@gaaclarke
Copy link
Member Author

Oh you know what, you probably need a discrete graphics card to actually get the failure locally. Running through rosetta probably isn't enough. I can simulate this failure with conditional compilation possibly.

In the meantime I've asked godofredo if we can possibly just turn this on for arm64 bots. I'm not sure if we are guaranteed an execution on an arm64 bot.

@gaaclarke
Copy link
Member Author

I can reproduce the problem with the following patch:

--- a/impeller/renderer/backend/metal/texture_mtl.mm
+++ b/impeller/renderer/backend/metal/texture_mtl.mm
@@ -15,6 +15,10 @@ TextureMTL::TextureMTL(TextureDescriptor p_desc,
     : Texture(p_desc), texture_(texture) {
   const auto& desc = GetTextureDescriptor();
 
+#if __x86_64__
+  FML_DCHECK(desc.storage_mode == impeller::StorageMode::kDevicePrivate);
+#endif
+
   if (!desc.IsValid() || !texture_) {
     return;
   }

Naively switching to kDevicePrivate doesn't work since the assumption of kHostVisible is built into TextureMTL::OnSetContents. The apple documentation says we'll have to forego the replaceRegion call and do the following instead:

Don't use this method for textures with a private storage mode. To copy data to a private texture, copy that
data to a texture that has a non-private storage mode, and then use a
[MTLBlitCommandEncoder](https://developer.apple.com/documentation/metal/mtlblitcommandencoder) to copy
the data to the private texture.

@jonahwilliams
Copy link
Contributor

Lets revert the patched I added to upload to device private then. We can deal with x86_64 when we get to it

@gaaclarke gaaclarke force-pushed the validate-impeller-tests branch from c30e8d5 to bb986f5 Compare May 1, 2023 18:05
@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label May 1, 2023
@auto-submit auto-submit bot merged commit e3127f3 into flutter:main May 1, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 1, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 1, 2023
…125833)

flutter/engine@687f4c7...58cc541

2023-05-01 [email protected] Roll Fuchsia Mac SDK from NBgD7NzOpwnAULR_g... to u7iIoiSX4y8WV6Of1... (flutter/engine#41641)
2023-05-01 [email protected] Add the verify exported symbols to linux builds. (flutter/engine#41635)
2023-05-01 [email protected] [Impeller] Turns on the Metal validator for impeller_unittests. (flutter/engine#40998)
2023-05-01 [email protected] [Impeller] Remove duplicate component in path.h (flutter/engine#41639)
2023-05-01 [email protected] Forward fix for roll of Dart SDK to version with new checked-in SDK (flutter/engine#41634)
2023-05-01 [email protected] Roll Skia from 1a6a1e905518 to 82d1ef7a833e (5 revisions) (flutter/engine#41637)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from NBgD7NzOpwnA to u7iIoiSX4y8W

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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
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.

[Impeller] Use API validation for tests.

4 participants