Skip to content

test(ci): #1925 injected Activity slowdown red run (do not merge) - #2554

Closed
inureyes wants to merge 7 commits into
mainfrom
ci/issue-1925-inject-red-run
Closed

inureyes wants to merge 7 commits into
mainfrom
ci/issue-1925-inject-red-run

Conversation

@inureyes

Copy link
Copy Markdown
Member

Do not merge. Throwaway acceptance run for #1925 (PR #2553).

This branch is PR #2553's head plus one commit that makes every ui_runtime poll spin 4 threads per CPU for 120 ms. The WebUI installed artifact job here is expected to fail with the per-mode verdict investigate. The run ID and the reported median and interval go into PR #2553's body, then this PR is closed and its branch deleted.

The Activity performance gate failed at random on changes that cannot touch decode: five alternating pairs scored by a bare median against a 2 percent budget, plus a baseline CV limit that mostly measured slow drift the alternation already cancels, cannot resolve 2 percent against a per-pair spread of several points.

Each mode now samples alternating off/on pairs from 12 in steps of 2 up to 40 and judges the paired degradations by their median and a distribution-free 98% sign-test interval: investigate when the interval lies wholly above the 2 percent budget, within-target when it does not and its upper bound is at most 4 percent, otherwise more pairs, and inconclusive (measurement noise, not a slowdown) at the cap. Baseline CV and the paired range stay in the summary as diagnostics only. No leading pairs are discarded: 636 recorded runs show no first-pair or order bias.

The constants live in webui/scripts/activity-performance-policy.json. The verifier re-derives every mode's verdict from the raw samples with a Python port and derives sample and preflight counts from paired_runs; the evidence summarizer checks each summary's internal consistency under the same policy. Both languages reproduce webui/scripts/activity-performance-fixtures.json bit for bit, seeded from the recorded logs of the runs named in the issue and its comments.

Refs #1925
Throwaway acceptance commit for #1925, never to be merged. Every ui_runtime poll spins 4 threads per CPU for 120 ms so decode slows only while Activity pages are visible; the WebUI installed artifact job on this draft PR must end with investigate.
Attempt 1 (run 39856236242) measured no effect because the Activity page reads /ui-api/v1/runtime only when a model is selected, so the burst never ran. The operations list is read on every 2 s poll. The spin window is also raised from 120 ms to 200 ms.
Run 39862888632 showed the CPU burst ran (46 to 87 runnable tasks in the visible arms) but decode stayed at 152 tok/s in both arms, so CPU contention does not reach decode on this host. Each operations poll now stamps a marker file and the decode tick sleeps 70 ms once per stamp younger than 100 ms. Expected effect: about 0.8 polls per 1.6 s request in one-visible (about 3.5 percent) and 1.6 in two-visible (about 7 percent).
Run 39866915190 again measured no effect. The marker now lives at a fixed /tmp path so TMPDIR differences between router and worker drop out, and both ends log through tracing (poll stamp with pid, decode-tick marker state every 512 ticks, and every sleep), so server.log shows which link breaks.
Run 39868894929's instrumentation showed router and decode share one process and the marker was visible, but no operations poll ever landed inside a decode window: each poll arrived the instant a request completed, so a poll-keyed delay can never overlap decode. The Activity page holds /ui-api/v1/events open exactly while visible, so each decode tick now sleeps 400 us per open stream (about 6 percent per visible page). Also fixes the clippy manual_is_multiple_of failure.
@inureyes

Copy link
Copy Markdown
Member Author

Done. Run 39870659579 failed WebUI installed artifact with investigate in both modes (one-visible median 4.58%, 98% interval [3.89%, 5.68%]; two-visible 8.05%, [7.11%, 9.62%]). The run IDs are recorded in #2553. Closing without merge and deleting the branch.

@inureyes inureyes closed this Oct 22, 2026
@inureyes
inureyes deleted the ci/issue-1925-inject-red-run branch October 22, 2026 23:30
inureyes added a commit that referenced this pull request Oct 23, 2026
The Activity performance gate judged five alternating pairs by a bare median against the 2% budget and also failed any mode whose baseline CV exceeded 5%. On `lablup-dgxspark21` the per-pair noise (SD 3.6 points, kurtosis 12 to 25) makes both rules fire on unchanged code. Each mode now samples until an interval decides, and a mode that cannot be decided fails as noise, not as a slowdown.

## The rule

- Per pair: `(off - on) / off * 100`, alternating order as before. Point estimate: the median. Interval: the distribution-free sign-test interval `[x(k), x(n+1-k)]` at 1% per tail (98% two-sided). It needs no variance estimate and no random bootstrap, so JavaScript and Python agree bit for bit.
- `investigate` (slowdown): the interval lies wholly above the 2% budget.
- `within-target`: it does not, and its upper bound is at most 4%.
- Otherwise add 2 pairs, from 12 up to 40; still undecided at 40 is `inconclusive`, which fails with a message naming measurement noise.
- Baseline CV and the paired range stay in the summary as diagnostics and decide nothing. The 2% budget is unchanged.
- The 4% bound is the precision a pass must reach, not a looser budget: a 4% bound gives 0.15% null inconclusive per mode, while 3% gives 2.4%, which breaks the 1% false-failure target (table below).
- All constants live in `webui/scripts/activity-performance-policy.json`. The verifier re-derives every mode from the raw samples with a Python port (`scripts/webui/activity_performance_verdict.py`) and derives the sample and preflight counts from `paired_runs`. The summarizer has no samples, so it checks each summary's internal consistency under the same policy. Both languages are tested against `webui/scripts/activity-performance-fixtures.json`.

## Resampling estimate

Noise model: all 636 complete diagnostics artifacts on this runner (2026-09-15 to 2026-10-22, 6,360 pairs), centred on a true 0% change, iid pairs drawn from that pool plus a per-run shift N(0, 0.83^2). 0.83 is the between-run SD estimated from the post-#2119 runs; one-visible and two-visible means in the same run are uncorrelated (r = -0.07). 20,000 simulated runs per row, sequential looks included:

| True degradation | investigate | inconclusive | within-target | mean pairs |
|---|---|---|---|---|
| 0% | 0.06% | 0.15% | 99.79% | 13.5 |
| 2% | 11.4% | 7.0% | 81.6% | 20.4 |
| 4% | 78.6% | 8.5% | 12.9% | 21.6 |
| 5% | 96.0% | 2.3% | 1.6% | 17.1 |
| 6% | 99.67% | 0.27% | 0.07% | 14.1 |
| 8% | 100% | 0% | 0% | 12.4 |

- False failure on a true 0% change: 0.21% per mode, about 0.4% per CI job (two modes), about 0.6% in `full` mode. With iid pairs and no run shift it is below 0.01%.
- Detection: at least 95% for true effects of 5% and above, 99.7% at 6%. At 4% it is only 79%, so the injected slowdown for acceptance is sized at about 6%.
- Rejected alternatives: a 3% upper bound (2.4% null inconclusive); passing only when the interval lies wholly below 2% (far more pairs); mean with a t-interval and Hodges-Lehmann (similar power, but the mean is hurt by the heavy tails and HL assumes a symmetry the data lacks, skew -0.7).
- Assumption: the guarantee holds while run-level shifts stay near the measured 0.8 points. A shift SD of 1.5 gives 2.4% false `investigate`; keeping such shifts out is the job of the #1949 host-quiet precheck.
- Warmup: there is no first-pair bias (pair 0 mean -0.50 vs -0.48 overall, and no order effect), so no leading pairs are discarded. The existing warmup request runs 1.6% slower than the first baseline, and that request is already excluded.

## Wall time

Measured per pair on 153 recent runs: one-visible 7.2 s median (7.7 s max), two-visible 8.4 s (9.2 s max), plus about 34 s before the first pair. In CI (visible-only-headed), the worst case at 40 pairs per mode is about 12 minutes, and the expected null run is about 4 minutes (about 2 today). `full` mode adds a hidden block, so its worst case is about 20 minutes, inside the 1800 s activity timeout. `ci.yml` timeouts are unchanged.

## Fixture provenance

The fixture copies the per-sample logs of the `webui-activity-performance-diagnostics-Linux` artifacts, none of which had expired: 35423171315 a1, 35425297407 a1/a2/a3, 35425050365 a1, 35421166203 a1, 35567777700 a1 (#1944), 35588958676 a1 (#1946) and 38265665905 a1/a2 (#2279). At their recorded five pairs, every one of them returns `continue` (no verdict), never `investigate`. Their concatenated pairs decide `within-target` at 12 pairs in both modes. The same pairs with the Activity arm 6% slower decide `investigate`, and spread-amplified or drifting (CV 12%) variants exercise `inconclusive` and CV-only cases.

## Test plan

- [x] `pnpm --dir webui run unit` and `pnpm --dir webui run lint`
- [x] `make verify-webui-helper-tests`, including the new `activity_performance_verdict_tests.py`
- [x] `python3 scripts/webui/verify_activity_performance_tests.py` and `summarize_activity_evidence_tests.py`
- [x] `make verify-versions verify-env-var-docs verify-python-tooling`
- [x] The new gate inside the real `WebUI installed artifact` job on this PR, run [39853154267](https://github.com/lablup/mlxcel/actions/runs/39853154267): one-visible within-target (median -0.15%, 98% interval [-1.83%, 1.25%]) and two-visible within-target (median -0.76%, [-2.64%, 0.47%]), both at 12 pairs, with the verifier and summarizer accepting the evidence; the verifier took 3 min 42 s.

## Acceptance runs on `lablup-dgxspark21`

- Five consecutive green `WebUI installed artifact` runs of this tree (head a7cc03f): run [39853154267](https://github.com/lablup/mlxcel/actions/runs/39853154267) attempts 1 to 5 (jobs 120084449655, 120097378392, 120110916929, 120116442394, 120121248222).
- Injected slowdown, red with `investigate` in both modes: run [39870659579](https://github.com/lablup/mlxcel/actions/runs/39870659579) on throwaway draft PR #2554 (closed, never merged). one-visible median 4.58%, 98% interval [3.89%, 5.68%]; two-visible median 8.05%, interval [7.11%, 9.62%]; 12 pairs each. The injection sleeps 400 us per decode tick for each open `/ui-api/v1/events` stream, which the Activity page holds open exactly while visible.
- The true effect was not measured beforehand on a separate harness (a local build on the shared CI host was not permitted); it is characterised only by the gate's own median and interval above, both inside the 4 to 8% target for one-visible.
- The issue's suggested injection does not work on GB10. A per-poll CPU burst of 80 spinning threads (run 39862888632) raised the runnable tasks to 46 to 87 in the visible arms, but decode stayed at 152 tok/s in both arms. A delay keyed on Activity polls (runs 39866915190 and 39868894929) also measured 0%: the instrumented run showed that no operations poll ever landed inside a decode window, because each poll was answered the moment a request finished.

Closes #1925
@inureyes inureyes added priority:low Low priority status:done Completed type:test Test related changes labels Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:low Low priority status:done Completed type:test Test related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant