Skip to content

[wasm] Set flutter_runtime_mode in tools/gn to_gn_wasm_args - #193407

Merged
auto-submit[bot] merged 4 commits into
flutter:masterfrom
kevmoo:wasm-gn-runtime-mode
Oct 1, 2026
Merged

auto-submit[bot] merged 4 commits into
flutter:masterfrom
kevmoo:wasm-gn-runtime-mode

Conversation

@kevmoo

@kevmoo kevmoo commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

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 #193406

Pre-launch Checklist

This fixes an issue where Wasm builds implicitly defaulted to debug runtime mode under GN by propagating args.runtime_mode into gn_args['flutter_runtime_mode']. This correctly resolves #16PD4 where release wimp.wasm was built with IMPELLER_DEBUG=1.
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 27, 2026
@github-actions github-actions Bot added the engine flutter/engine related. See also e: labels. label Sep 27, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the GN build configuration for Web/Wasm targets to set the flutter_runtime_mode argument based on the runtime mode, and adds corresponding unit tests in gn_test.py. Feedback suggests wrapping several long lines in the test file to comply with the 80-character limit of the Google Python Style Guide.

Comment thread engine/src/flutter/tools/gn_test.py Outdated
Comment thread engine/src/flutter/tools/gn_test.py

@eyebrowsoffire eyebrowsoffire left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OMG, is this why the check framebuffer stuff is still showing up in profiles?? Let me know what the perf looks like after this change!

@kevmoo

This comment was marked as outdated.

@kevmoo kevmoo added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 30, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 30, 2026
@auto-submit

auto-submit Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/193407, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@kevmoo kevmoo added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 1, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Oct 1, 2026
Merged via the queue into flutter:master with commit bde0dad Oct 1, 2026
24 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 1, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Oct 1, 2026
…13104)

Manual roll requested by [email protected]

flutter/flutter@d649d2b...e89fd0a

2026-10-01 [email protected] Manual roll ICU from 6ebb40c59477 to 5aa526207171 (2 revisions) (flutter/flutter#193661)
2026-10-01 [email protected] fix(web): hash source maps before rewriting sourceMappingURL with --web-content-hash (flutter/flutter#193614)
2026-10-01 [email protected] [flutter_tools] Bootstrap DeviceManager in ToolDependencies (flutter/flutter#193524)
2026-10-01 [email protected] [wasm] Set flutter_runtime_mode in tools/gn to_gn_wasm_args (flutter/flutter#193407)
2026-10-01 [email protected] Remove remaining `download_jdk` references (flutter/flutter#193562)
2026-10-01 [email protected] Synchronize dart2wasm feature probes in roll script and flutter_bootstrap.js (flutter/flutter#193271)
2026-10-01 [email protected] [web] Unskip web tests that now pass in gestures, services, and widgets (flutter/flutter#193512)
2026-10-01 [email protected] Roll Fuchsia Test Scripts from whZAV1mfT-Rdc0rQ8... to fCNknap4ZI0AMcvIf... (flutter/flutter#193640)
2026-10-01 [email protected] Roll Skia from 0575a37d0619 to f2d68e0b8863 (2 revisions) (flutter/flutter#193621)
2026-10-01 [email protected] perf(widgets): use const <Never>{} in InheritedModelElement and avoid redundant casts in RenderObjectElement.update (flutter/flutter#192913)
2026-10-01 [email protected] [web] Unskip and strengthen missing glyph tofu test on Wimp (flutter/flutter#193426)
2026-10-01 [email protected] [flutter_tools] Fix `flutter drive -d chrome` hanging on web (flutter/flutter#193459)
2026-10-01 [email protected] [web] Fix hang when Chromium cannot bind remote debugging port (flutter/flutter#193461)
2026-10-01 [email protected] [flutter_tools] Bundle data assets from hooks in flutter test (flutter/flutter#193435)
2026-10-01 [email protected] Roll Packages from 0ba9a82 to d5ec6db (11 revisions) (flutter/flutter#193641)
2026-10-01 [email protected] Revert: [flutter_tools] Fix DTD "Stream already subscribed" error and wait for analysis over DTD in widget preview (flutter/flutter#193637)
2026-10-01 [email protected] Roll Skia from 6182a3cf8f98 to 0575a37d0619 (5 revisions) (flutter/flutter#193613)
2026-10-01 [email protected] [flutter_tools] Fix DTD "Stream already subscribed" error and wait for analysis over DTD in widget preview (flutter/flutter#192930)
2026-09-30 [email protected] [Impeller] Sample the render target rect in offscreen advanced blends (flutter/flutter#192988)
2026-09-30 [email protected] Roll Skia from 01524014dff5 to 6182a3cf8f98 (11 revisions) (flutter/flutter#193594)
2026-09-30 [email protected] [web] Use Xvfb -displayfd and clean up Xvfb after Firefox test suites (flutter/flutter#193510)
2026-09-30 [email protected] Fixes bug where sibling node fail to update size (flutter/flutter#191220)
2026-09-30 [email protected] Roll Skia from c7b323126bf0 to 01524014dff5 (3 revisions) (flutter/flutter#193577)
2026-09-30 [email protected] Remove some Undefined Behavior from run_customer_testing_tests.dart. (flutter/flutter#193582)
2026-09-30 [email protected] Fix pointer id/coordinate mismatch in Android platform view multi-touch (flutter/flutter#191631)
2026-09-30 [email protected] Roll Packages from 3c6ce59 to 0ba9a82 (11 revisions) (flutter/flutter#193578)
2026-09-30 [email protected] Fix unresolved doc comment references in dev/ tooling (flutter/flutter#193501)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
@kevmoo
kevmoo deleted the wasm-gn-runtime-mode branch October 2, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[wasm] Set flutter_runtime_mode in tools/gn to_gn_wasm_args

2 participants