Repository navigation
Commit bde0dad
authored
[wasm] Set flutter_runtime_mode in tools/gn to_gn_wasm_args (flutter#193407)
### Rationale
In `engine/src/flutter/tools/gn`, `to_gn_args()` checks `if
args.target_os == 'wasm' or args.web:`, delegates to
`to_gn_wasm_args()`, and returns early before reaching the line
`gn_args['flutter_runtime_mode'] = runtime_mode`.
Because `to_gn_wasm_args()` never mapped the argument back into
`gn_args`, `flutter_runtime_mode` falls back to `"debug"` during GN
evaluation for all `--web` engine targets. This evaluates
`impeller_debug = true` (`IMPELLER_DEBUG=1` macro) globally in C++ for
Web Impeller release builds. This defect was driving 50+ synchronous
`glCheckFramebufferStatus()` calls per frame on `bouncy@128` (and 500+
calls per frame on multi-pass blur/filter workloads) during Web Impeller
benchmarking.
### Summary of Changes
- Propagates `args.runtime_mode` into `gn_args['flutter_runtime_mode']`
inside `to_gn_wasm_args()` in `tools/gn`.
- Adds explicit unit tests in `tools/gn_test.py` (`test_get_out_dir` and
`test_to_gn_args`) verifying `flutter_runtime_mode` and output
directories across `debug`, `profile`, and `release` for `--web` and
`--target-os=wasm`.
### Verification & Empirical Performance Delta (`wimp.wasm`
`wasm_release`)
- Executed `tools/gn_test.py` with 100% pass on all 5 test cases.
- Built `wimp.wasm` (`wasm_release`) locally before and after this
change and benchmarked both single-pass and multi-pass offscreen
workloads (`?effects=multipass`, wrapping each leaf node in
`ColorFiltered` + `ClipRect` + `BackdropFilter` 5px Gaussian blur +
`Opacity`):
| Workload & Metric | Before (`IMPELLER_DEBUG=1`) | After
(`IMPELLER_DEBUG=0`) | Delta | Speedup |
| :--- | :---: | :---: | :---: | :---: |
| **`wimp.wasm` Uncompressed / Gzipped Size** | `3,608,411 B` /
`1,463,726 B` | `3,599,401 B` / `1,457,944 B` | `-9,010 B` / `-5,782 B`
| `-0.25%` / `-0.40%` |
| **`bouncy@128` (single-pass) `glCheckFramebufferStatus` / frame** |
`58` (`2.83%` worker CPU) | `0` | **`-100.0%`** | Eliminated |
| **`bouncy_multipass@16` (`wimp_st`) `glCheckFramebufferStatus` /
frame** | `148` | `0` | **`-100.0%`** | Eliminated |
| **`bouncy_multipass@16` (`wimp_st`) Raster Time (`ms/frame`)** |
`273.40 ms` | `210.28 ms` | **`-63.12 ms` (`-23.1%`)** | **`1.30x`
faster** |
| **`bouncy_multipass@32` (`wimp_st`) `glCheckFramebufferStatus` /
frame** | `268` | `0` | **`-100.0%`** | Eliminated |
| **`bouncy_multipass@32` (`wimp_st`) Raster Time (`ms/frame`)** |
`286.61 ms` | `203.44 ms` | **`-83.16 ms` (`-29.0%`)** | **`1.41x`
faster** |
| **`bouncy_multipass@64` (`wimp_st`) `glCheckFramebufferStatus` /
frame** | `502` | `0` | **`-100.0%`** | Eliminated |
| **`bouncy_multipass@64` (`wimp_st`) Raster Time (`ms/frame`)** |
`364.64 ms` | `246.61 ms` | **`-118.03 ms` (`-32.4%`)** | **`1.48x`
faster** |
| **`bouncy_multipass@64` (`wimp_mt`) `glCheckFramebufferStatus` /
frame** | `503` | `0` | **`-100.0%`** | Eliminated |
| **`bouncy_multipass@64` (`wimp_mt`) Raster Time (`ms/frame`)** |
`380.41 ms` | `256.95 ms` | **`-123.46 ms` (`-32.5%`)** | **`1.48x`
faster** |
| **`bouncy_multipass@64` (`--disable-gl-drawing-for-tests`,
`wimp_st`)** | `228.21 ms` | `42.31 ms` | **`-185.90 ms` (`-81.5%`)** |
**`5.39x` faster** |
Fixes flutter#193406
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant in-code documentation (doc comments with
`///`).
- [x] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[flutter/website]: https://github.com/flutter/website
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md1 parent 569d975 commit bde0dad
2 files changed
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
891 | 891 | | |
892 | 892 | | |
893 | 893 | | |
| 894 | + | |
894 | 895 | | |
895 | 896 | | |
896 | 897 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| |||
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
43 | 59 | | |
44 | 60 | | |
45 | 61 | | |
| |||
0 commit comments