32 Commits

Author SHA1 Message Date
liyuqian
241e5108b8 Run benchmarks in Cirrus (flutter/engine#13950) 2019-12-02 16:38:03 -08:00
Jason Simmons
2edaa8c49f Updates to the engine test runner script (flutter/engine#9934)
* Use separate filters for engine executables and Dart test scripts
* Do not run the benchmarks on Cirrus
2019-07-19 17:00:18 -07:00
Chinmay Garde
3b5b7b2fc3 Convert run_tests to python, allow running on Mac/Windows and allow filters for tests. (flutter/engine#9818)
Sample usage:

To run only the embedder_unittests in the engine with the profile variant, the command would be
```
./flutter/testing/run_tests.py --variant host_profile_unopt --type engine --filter embedder_unittests
``

To run only the geometry in Dart with the debug variant, the command would be
```
./flutter/testing/run_tests.py --variant host_debug_unopt --type dart --filter geometry_test
``

Without any argument, the behavior is identical to `run_tests.sh`.

In a subsequent patch, I will enable running unit-tests on Windows in the tryjobs. The lack of compatibility of the shell script on Windows made it so that we never ran any Windows unit-tests in the tryjobs.
2019-07-15 17:46:36 -07:00
Chinmay Garde
a5799c0964 Rework image & texture management to use concurrent message queues. (flutter/engine#9486)
This patch reworks image decompression and collection in the following ways
because of misbehavior in the described edge cases.

The current flow for realizing a texture on the GPU from a blob of compressed
bytes is to first pass it to the IO thread for image decompression and then
upload to the GPU. The handle to the texture on the GPU is then passed back to
the UI thread so that it can be included in subsequent layer trees for
rendering. The GPU contexts on the Render & IO threads are in the same
sharegroup so the texture ends up being visible to the Render Thread context
during rendering. This works fine and does not block the UI thread. All
references to the image are owned on UI thread by Dart objects. When the final
reference to the image is dropped, the texture cannot be collected on the UI
thread (because it has not GPU context). Instead, it must be passed to either
the GPU or IO threads. The GPU thread is usually in the middle of a frame
workload so we redirect the same to the IO thread for eventual collection. While
texture collections are usually (comparatively) fast, texture decompression and
upload are slow (order of magnitude of frame intervals).

For application that end up creating (by not necessarily using) numerous large
textures in straight-line execution, it could be the case that texture
collection tasks are pending on the IO task runner after all the image
decompressions (and upload) are done. Put simply, the collection of the first
image could be waiting for the decompression and upload of the last image in the
queue.

This is exacerbated by two other hacks added to workaround unrelated issues.
* First, creating a codec with a single image frame immediately kicks of
  decompression and upload of that frame image (even if the frame was never
  request from the codec). This hack was added because we wanted to get rid of
  the compressed image allocation ASAP. The expectation was codecs would only be
  created with the sole purpose of getting the decompressed image bytes.
  However, for applications that only create codecs to get image sizes (but
  never actually decompress the same), we would end up replacing the compressed
  image allocation with a larger allocation (device resident no less) for no
  obvious use. This issue is particularly insidious when you consider that the
  codec is usually asked for the native image size first before the frame is
  requested at a smaller size (usually using a new codec with same data but new
  targetsize). This would cause the creation of a whole extra texture (at 1:1)
  when the caller was trying to “optimize” for memory use by requesting a
  texture of a smaller size.
* Second, all image collections we delayed in by the unref queue by 250ms
  because of observations that the calling thread (the UI thread) was being
  descheduled unnecessarily when a task with a timeout of zero was posted from
  the same (recall that a task has to be posted to the IO thread for the
  collection of that texture). 250ms is multiple frame intervals worth of
  potentially unnecessary textures.

The net result of these issues is that we may end up creating textures when all
that the application needs is to ask it’s codec for details about the same (but
not necessarily access its bytes). Texture collection could also be delayed
behind other jobs to decompress the textures on the IO thread. Also, all texture
collections are delayed for an arbitrary amount of time.

These issues cause applications to be susceptible to OOM situations. These
situations manifest in various ways. Host memory exhaustion causes the usual OOM
issues. Device memory exhaustion seems to manifest in different ways on iOS and
Android. On Android, allocation of a new texture seems to be causing an
assertion (in the driver). On iOS, the call hangs (presumably waiting for
another thread to release textures which we won’t do because those tasks are
blocked behind the current task completing).

To address peak memory usage, the following changes have been made:
* Image decompression and upload/collection no longer happen on the same thread.
  All image decompression will now be handled on a workqueue. The number of
  worker threads in this workqueue is equal to the number of processors on the
  device. These threads have a lower priority that either the UI or Render
  threads. These workers are shared between all Flutter applications in the
  process.
* Both the images and their codec now report the correct allocation size to Dart
  for GC purposes. The Dart VM uses this to pick objects for collection. Earlier
  the image allocation was assumed to 32bpp with no mipmapping overhead
  reported. Now, the correct image size is reported and the mipmapping overhead
  is accounted for. Image codec sizes were not reported to the VM earlier and
  now are. Expect “External” VM allocations to be higher than previously
  reported and the numbers in Observatory to line up more closely with actual
  memory usage (device and host).
* Decoding images to a specific size used to decode to 1:1 before performing a
  resize to the correct dimensions before texture upload. This has now been
  reworked so that images are first decompressed to a smaller size supported
  natively by the codec before final resizing to the requested target size. The
  intermediate copy is now smaller and more promptly collected. Resizing also
  happens on the workqueue worker.
* The drain interval of the unref queue is now sub-frame-interval. I am hesitant
  to remove the delay entirely because I have not been able to instrument the
  performance overhead of the same. That is next on my list. But now, multiple
  frame intervals worth of textures no longer stick around.

The following issues have been addressed:
* https://github.com/flutter/flutter/issues/34070 Since this was the first usage
  of the concurrent message loops, the number of idle wakes were determined to
  be too high and this component has been rewritten to be simpler and not use
  the existing task runner and MessageLoopImpl interface.
* Image decoding had no tests. The new `ui_unittests` harness has been added
  that sets up a GPU test harness on the host using SwiftShader. Tests have been
  added for image decompression, upload and resizing.
* The device memory exhaustion in this benchmark has been addressed. That
  benchmark is still not viable for inclusion in any harness however because it
  creates 9 million codecs in straight-line execution. Because these codecs are
  destroyed in the microtask callbacks, these are referenced till those
  callbacks are executed. So now, instead of device memory exhaustion, this will
  lead to (slower) exhaustion of host memory. This is expected and working as
  intended.

This patch only addresses peak memory use and makes collection of unused images
and textures more prompt. It does NOT address memory use by images referenced
strongly by the application or framework.
2019-07-09 14:59:34 -07:00
Chinmay Garde
8182a56965 Re-enable embedder_unittests. (flutter/engine#9482)
This was disabled in https://github.com/flutter/engine/pull/6798 waiting for
a Dart SDK patch to land e6d3a45b6a
which has long since been addressed.
2019-06-27 16:49:22 -07:00
Chinmay Garde
651c5174a5 Run benchmarks on try jobs. (flutter/engine#9493)
Fixes https://github.com/flutter/flutter/issues/35089.

These runs only ensure that the benchmark harnesses are valid. No information should be collected on the trybots because the environments are not consistent and the builds are not optimized.
2019-06-27 14:11:02 -07:00
Dan Field
c96714ac5d new lints (flutter/engine#8849)
Dart lints added:
* Avoid optional new
* Avoid optional const
* Prefer single quotes
* Prefer default assignment `=`
2019-05-07 16:10:21 -07:00
Chinmay Garde
bc51cf62bb Merge runtime lifecycle unittests into the base test target. (flutter/engine#8634)
`//flutter/runtime: runtime_lifecycle_unittests` was added because the these assumed that there was no VM already running in the process. Running other tests in the base target would mess up that assumption. Now that all test targets have been updated to make sure the VM instance does not leak, the tests in this target can be merged.

LUCI bots don’t need to be patched as these tests were only ever run on the trybots.
2019-04-18 12:15:45 -07:00
Chinmay Garde
54927647c6 Avoid manually shutting down engine managed isolates. (flutter/engine#8621)
These are now shutdown by the VM and cleanup waits for their shutdown.
2019-04-17 16:11:47 -07:00
stuartmorgan
e722bba483 Add desktop shell unittests to test script (flutter/engine#8600)
Builds the unit test on all platforms, and adds them to the aggregate test script.
2019-04-16 22:37:39 -07:00
Chinmay Garde
2b4e6ce82b Merge flutter/synchronization contents into fml. (flutter/engine#8525)
When flutter/synchronization was first authored, we did not own fml (it was called fxl then). Now we do, so use a single spot for such utilities. The pipeline was meant to be a general purpose utility that was only ever used by the animator (it even has animator specific tracing), so move that to shell instead (where the animator resides).
2019-04-09 19:18:51 -07:00
Chris Bracken
6bde234915 Cleanups to run_tests.sh script (flutter/engine#8337)
Bugfix:
* Use the `pub` from within the built Dart SDK (not whatever's on
  `$PATH`, if anything).

A few minor improvements:
* Allow running from below the src/ buildroot dir, as it's often
  convenient to work from within the flutter/engine git dir.
* Echo test name before running, for slightly better debuggability.
* Minor line-wrapping for readability.
2019-03-27 18:09:08 -07:00
Dan Field
53102bd3a2 Test profile and release build and unit tests (flutter/engine#7880)
* Test profile build and unit tests

* update googletest, skip JIT tests on non-debug builds
2019-02-20 20:13:02 -08:00
Dan Field
2eae3feaaf fix up analysis for Dart in Engine (flutter/engine#7404)
* fix up analysis for Dart in Engine, particularly for tests
2019-01-11 13:50:58 -08:00
Dan Field
c0ce728956 disable embedder_unittests (flutter/engine#6798) 2018-11-08 11:18:21 -08:00
Chinmay Garde
db31e09d15 Run all supported host unit tests on Cirrus. (flutter/engine#6575) 2018-10-17 17:44:11 -07:00
Michael Klimushyn
27cd6283b7 Fix failing test on Cirrus (flutter/engine#6469)
Updates the tests to use the `--use-test-fonts` argument.

Fixes flutter/flutter#22682
2018-10-08 15:47:53 -07:00
Michael Klimushyn
7cde96f315 Add run_tests.sh to cirrus (flutter/engine#6441)
This replaces `ci/test.sh` with `run_tests.sh`. `run_tests.sh` includes
`ci/test.sh` and multiple other tests.

Partially addresses flutter/flutter#22682. Temporarily skipped tests
should be fixed and re-enabled in a follow-up commit.
2018-10-05 11:56:13 -07:00
Jason Simmons
a7c7554259 Update engine tests for Dart 2 compilation and language changes (flutter/engine#6262) 2018-09-17 09:28:11 -07:00
Jason Simmons
d84092681b Update test and license scripts for Dart SDK 2.1.0 (flutter/engine#6254) 2018-09-14 11:29:51 -07:00
liyuqian
7357a29311 Remove travis directory (flutter/engine#5935)
This reflects that we no longer uses travis. Scripts are moved to ci folder.
2018-08-06 15:06:49 -07:00
Ben Konyi
a3b839a0bf IsolateNameServer reland (flutter/engine#5519)
* Reland "Added IsolateNameServer functionality (#5410)"

This reverts commit 1598c7ad7b830b298647c17a0c85f3648f6b737d.

* Fixed issue with isolate_name_server_test which caused test to timeout

* Disabled thread_annotations on Android as they aren't supported in the
NDK headers for std::mutex. Readded thread annotations to
IsolateNameServer.
2018-06-13 11:57:10 -07:00
Ben Konyi
1598c7ad7b Revert "Added IsolateNameServer functionality (#5410)" (flutter/engine#5516)
This reverts commit 851868ef29597ca8711f2de2e759069e26930c7d.
2018-06-12 17:03:13 -07:00
Ben Konyi
851868ef29 Added IsolateNameServer functionality (flutter/engine#5410)
* Added IsolateNameServer functionality, which allows for the association
of string names with isolate SendPort ids that can be used to establish
inter-isolate communications.
2018-06-12 15:50:48 -07:00
Chinmay Garde
bfed2f04a0 Specify the packages file path when running engine dart tests. (flutter/engine#5005) 2018-04-13 16:17:38 -07:00
Ian Hickson
73634e73bc Convert MaskFilter to pure-Dart. (flutter/engine#4534) 2018-01-11 23:25:18 -08:00
George Kulakowski
fa539e618e Rename ftl to fxl in Fuchsia specific code (flutter/engine#4090) 2017-09-11 15:58:48 -07:00
Ryan Macnak
f1085e149e Revert "Avoid spurious descheduling when posting message loop tasks. (#3812)" (flutter/engine#3862)
This reverts commit d040c59bab11ebd16522e18310e2cd33b036b78e.
2017-07-11 14:49:13 -07:00
Ryan Macnak
d040c59bab Avoid spurious descheduling when posting message loop tasks. (flutter/engine#3812)
Closes dart-lang/sdk#29971
2017-07-05 12:39:53 -07:00
Ian Hickson
f18a6da7d7 Throw exceptions rather than crashing when Canvas API is misused. (flutter/engine#3811)
This attempts to make the Canvas API and some related features more
likely to throw a Dart exception than crash when exposed to bad input.

Depends on rolling tonic to
https://fuchsia-review.googlesource.com/c/35742/ which this patch does
not yet do, but I wanted to put it up for review to see if it was even
a reasonable approach.
2017-06-22 17:06:59 -07:00
Jason Simmons
d58a818efc Update scripts for renaming of sky_shell binaries to flutter (flutter/engine#3526) 2017-03-27 15:06:39 -07:00
Jason Simmons
97b9a9d039 Script that runs engine unit tests and Dart tests of engine APIs (flutter/engine#3372)
The Dart tests were migrated from the flutter/test/engine suite in the
framework repository
2017-01-30 10:52:44 -08:00