Repository navigation
Description
Context
The Linux PR unit workflow currently invokes ./test --clang --no-parallel --unit --verbose --debug (workflow); the example workflow's full run also uses --debug (workflow). In the native Meson build, debug mode applies -Og -g3 -fsanitize=address,undefined to the FastLED library, runner, precompiled headers, and every test/example module (flags, test DLLs). The unit suite builds 310 separate shared test libraries.
On the #4533 Linux unit run, C++ compilation took 1046.52s versus 61.27s executing tests; all 310 passed. The 26m25s whole-job time includes earlier Python/lint steps. Local build directories measured ~1012 MB debug versus ~224 MB quick, but are not identical builds: this is evidence of a large combined debug/sanitizer footprint, not proof of ASan's isolated cost or a guaranteed speedup. See the broader performance investigation #4529 and its follow-up run report.
FastLED is already built as one shared library (fastled.so on Linux, fastled.dll on Windows) that the consumer DLLs link against (Meson target). This permits a cheaper, deliberately partial ASan configuration: instrument the core library while compiling the many test/example consumer modules without ASan.
Proposal
- Add a distinct Linux
debug-thincore-ASan preset without changing the existing full--debugsemantics or quick mode. Split native Meson compile/link flags so FastLED core sources (includingplatforms_shared_files) use ASan, with appropriate symbols (benchmark-gline-tables-onlyversus-g3); test and example DLL sources, shared test objects, and their PCH use unsanitized quick-style flags. Keep ABI-affecting defines/settings consistent across core and consumers. - Link/load the ASan runtime correctly in the runner process, with only the minimal runner instrumentation needed. Preserve DLL lifetime through leak reporting: the current POSIX runner skips
dlclosebased on its own ASan compile flag, which would otherwise change under a mixed build. Validate symbolized reports and avoid runtime-order/linker errors. Audit sanitizer-conditional code such asFL_HAS_SANITIZER_LSANfor mixed-mode behavior. - Switch Linux PR unit and example jobs to
--debug-thin, leaving their test/example code unsanitized. Retain a full ASan+UBSan--debugsuite on a scheduled/manual path (coordinate with the separate CI split so it is not lost); keep local--debugavailable. Do not extend this mode to embedded/platform builds in this issue. - Benchmark cold builds of the same revision on comparable Linux runners: setup, core/PCH compile, consumer compile, link, test execution, total wall time, build-directory bytes, and report quality. Do not infer savings solely from local quick/debug directory sizes.
Partial instrumentation is intentional. Clang/ASan supports sanitizing only part of a program, but code instantiated from FastLED headers/templates inside unsanitized test/example DLLs will not receive ASan checks. The full scheduled build remains the coverage backstop.
CLI contract: --debug-thin
Use a named build preset, consistent with this repo's existing quick / debug / release / profile modes. ./test --debug-thin --unit and ./test --debug-thin --examples should be shorthand for ./test --build-mode debug-thin ...; both must resolve to the same Meson configuration. --debug keeps its existing full-sanitizer meaning. In help/docs, describe debug-thin as “ASan (and retained UBSan) on FastLED core, lean symbols, unsanitized test/example consumer code, ASan-capable runner.” It is a preset that may encompass several internal settings, not a literal alias for one low-level flag.
For an explicit scope control, prefer a single valued option over a boolean such as --asan-core-only: --asan=core|full|off is idiomatic and clearly contrasts core-only with full instrumentation. However, the present debug mode enables both ASan and UBSan; --asan would specify only one sanitizer and cannot by itself express the complete debug-thin recipe. Therefore make --debug-thin the required public preset in this issue and model sanitizer scope (core/full/off), symbol level, consumer optimization/debug level, and runner-runtime policy separately inside the build. If a genuinely independent public scope override is needed, prefer --sanitizer-scope=core|full|off for the bundled ASan+UBSan policy; reserve --asan=core|full|off for a future design that lets ASan vary independently from UBSan. Do not add both public selectors without a demonstrated use case. Fail clearly for conflicting --debug-thin with --debug or any --build-mode, and for unsupported targets rather than silently selecting another mode. Give debug-thin its own .build/meson-debug-thin directory and fingerprint/cache namespace so it cannot reuse incompatible PCH or objects from quick/full debug. Update the top-level parser, Meson option choices and all build-mode propagation paths; add CLI tests for shorthand/canonical equivalence, conflicts, help text, and target guards.
Acceptance criteria
- RED: Record the current cold PR debug baseline (including the 1046.52s compile / 61.27s execution repeat run), build size, and a focused test-only fixture/repro that performs an invalid memory access inside core-compiled code. Confirm the fixture reports under existing full debug mode.
- GREEN: The same fixture reports under core-ASan mode with a useful symbolized FastLED stack; a normal complete unit run passes all 310 tests. Verify via compile-command inspection that core code is instrumented, consumer DLLs/PCH are not, and the runner loads the runtime and does not unload modules before leak reporting.
- GREEN: Linux examples still pass their intended coverage under the new PR mode. The existing full
--debugunit/example path remains functional and is runnable on schedule/manually; explicitly document the header/template coverage gap of core-only ASan. - GREEN: Report before/after cold phase timings and disk footprint on the same revision. Aim for at least 25% reduction in the Linux C++ unit step wall time; if the measured benefit is smaller, document why and re-evaluate the mode before switching the PR gate.
- GREEN: Add focused build-mode/flag-selection regression tests so future changes cannot silently re-enable sanitizer flags on every consumer DLL or drop ASan from core. Verify
--debug-thinand--build-mode debug-thinproduce the same isolated build configuration.
Decisions
- Scope Linux first: it is the intended fast PR gate, and mixed-runtime behavior can be proven there before considering macOS/Windows.
- Keep full debug semantics: existing
--debugis a diagnostic contract; introduce the separate--debug-thinpreset rather than quietly weakening it. This follows the repo's existing named build-mode pattern and leaves room for the preset's internal recipe to evolve. - Scope naming: a value-based
--asan=core|full|offis preferable to--asan-core-onlyif ASan becomes independently configurable, but the first implementation should not imply UBSan or symbol-level changes are controlled by--asan. Keep the preset authoritative until independent overrides are justified. - Instrument core, not every consumer: core memory safety is the priority; example/test module coverage is lower priority for PR latency and is recovered by the full scheduled/manual run.
- Measure before promising savings:
-g3, ASan, UBSan, and 310 links are currently bundled, so present logs do not isolate which dominates. - Track under FastLED, related to perf(ci): investigate 20-minute Linux unit job, cold_skip misses, and example runtime #4529: the implementation is in FastLED's Meson/test runner/workflows; perf(ci): investigate 20-minute Linux unit job, cold_skip misses, and example runtime #4529 remains the broader CI performance investigation.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Sep 23, 2026
Implementation is in #4541. Same-revision cold Linux CI comparison (both 310/310): debug-thin 736.68s C++ unit step and 255,448,878 build bytes (run); full debug 1710.62s and 543,022,574 bytes (run). That is a 56.9% step-time and 53.0% build-size reduction, above the 25% target. A temporary core out-of-bounds probe produced symbolized ASan+UBSan reports in both modes and was removed; Linux examples passed. Final PR checks are still in progress.