[PR #4952] [CLOSED] [Engine] Windows: disable EcoQoS background throttling for engine and benchmark processes #5262

Closed
opened 2026-11-07 16:33:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4952
Author: @utombords
Created: 11/1/2026
Status: ❌ Closed

Base: main ← Head: pr/windows-ecoqos


📝 Commits (1)

  • c938d37 windows: do not let EcoQoS throttle the engine we serve, or the run we measure

📊 Changes

2 files changed (+51 additions, -2 deletions)

View changed files

📝 serve/lifeline.py (+8 -1)
📝 tools/strata_bench.py (+43 -1)

📄 Description

Problem and result

On Windows 11 hybrid Intel CPUs (12th Gen through Arrow Lake), a console process that owns no foreground window is classified by the OS under EcoQoS (ProcessPowerThrottling), which schedules its threads onto E-cores and clamps clock frequency to a fraction of base clock. Both the isolated engine worker spawned by serve/lifeline.py and the benchmark process in tools/strata_bench.py run without a foreground window.

On an Intel Core Ultra 9 285K + RTX 5070 Ti (Windows 11), when Windows 11 clamps the backgrounded server under EcoQoS during tools/strata_bench.py --runs 3 (qwen3.8-flash-next-nvfp4-nvfp4-BF16, warm RAM, 15 CPU workers), median chat decode drops to 25.1 tok/s (21.6–36.5, n=9) and median agent decode drops to 28.7 tok/s (24.6–36.7, n=15). Even when EcoQoS only engages mid-session (during the final agent run), worst-turn agent decode drops to 27.2 tok/s.

With this change:

  1. serve/lifeline.py adds HIGH_PRIORITY_CLASS (0x00000080) to creationflags when spawning isolated roles (engine, vision) on Windows.
  2. tools/strata_bench.py calls SetPriorityClass(..., HIGH_PRIORITY_CLASS) and SetProcessInformation(..., ProcessPowerThrottling, ...) with StateMask = 0 on startup (and passes HIGH_PRIORITY_CLASS when spawning a server child) so benchmark runs measure the engine rather than Windows background power throttling.
  3. On the same warm-RAM 3-run tools/strata_bench.py suite, releasing the clamp lifts median chat decode from 25.1 to 57.7 tok/s (+129.9%), chat TTFT from 1.64 s to 0.92 s (-43.9%), 4K prompt from 1509.7 to 1702.5 tok/s (+12.8%), 16K prompt from 2476.2 to 2700.9 tok/s (+9.1%), and median agent decode from 28.7 to 67.8 tok/s (+136.2%, range 56.4–89.7 tok/s).

none

Approach

  • Apply the priority class at the single spawn point in serve/lifeline.py (popen() for ISOLATED_ROLES on os.name == "nt"), and release both HIGH_PRIORITY_CLASS and ProcessPowerThrottling (PROCESS_POWER_THROTTLING_STATE) in tools/strata_bench.py via ctypes.WinDLL("kernel32") on a best-effort basis.
  • No C++ engine rebuild is required.

Validation

Passed:

  • Windows 11 / Intel Core Ultra 9 285K + RTX 5070 Ti (16 GB VRAM), Python 3.11, on 870aedd9 (v0.2.8) and c62d5e3a (v0.2.9 / engine 0.1.55):
    • python -m unittest serve.test_lifeline: 7 tests, OK (skipped=3 POSIX-only tests).
    • python tools/strata_bench.py --runs 3 (qwen3.8-flash-next-nvfp4-nvfp4-BF16, RTX 5070 Ti 16 GB + --pool-workers 15, warm RAM, pure upstream AVX2):
                                                without 0003    with 0003    change
      chat decode tok/s                                25.10        57.70   +129.9%   (range: 21.6-36.5 -> 52.0-80.3, n=9)
      chat first token (s)                              1.64         0.92    -43.9%
      4K prompt tok/s                                1509.70      1702.50    +12.8%
      4K first token (s)                                2.75         2.42    -11.9%
      16K prompt tok/s                               2476.20      2700.90     +9.1%
      16K first token (s)                               6.58         6.04     -8.2%
      agent turn first token (s)                        2.19         2.05     -6.2%   (worst turn: 3.42 s -> 2.87 s)
      agent decode tok/s                               28.70        67.80   +136.2%   (range: 24.6-36.7 -> 56.4-89.7, n=15)
      

Failed:

  • none observed

Not run:

  • Older Windows 10 builds prior to 2004 where ProcessPowerThrottling is unsupported (disable_windows_throttling() catches any error and continues).

Limits

  • This sets process priority and power-throttling state from Python only; which logical cores the engine pins its worker pool to remains governed by src/kernels/cpu/pool_affinity_win.hpp.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4952 **Author:** [@utombords](https://github.com/utombords) **Created:** 11/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/windows-ecoqos` --- ### 📝 Commits (1) - [`c938d37`](https://github.com/Niko1221/Strata/commit/c938d37df752095c0a678290e7963693ae589513) windows: do not let EcoQoS throttle the engine we serve, or the run we measure ### 📊 Changes **2 files changed** (+51 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `serve/lifeline.py` (+8 -1) 📝 `tools/strata_bench.py` (+43 -1) </details> ### 📄 Description <!-- PR Title: [Engine] windows: do not let EcoQoS throttle the engine we serve, or the run we measure --> <!-- Commit: 0003 --> ## Problem and result On Windows 11 hybrid Intel CPUs (12th Gen through Arrow Lake), a console process that owns no foreground window is classified by the OS under EcoQoS (`ProcessPowerThrottling`), which schedules its threads onto E-cores and clamps clock frequency to a fraction of base clock. Both the isolated engine worker spawned by `serve/lifeline.py` and the benchmark process in `tools/strata_bench.py` run without a foreground window. On an Intel Core Ultra 9 285K + RTX 5070 Ti (Windows 11), when Windows 11 clamps the backgrounded server under EcoQoS during `tools/strata_bench.py --runs 3` (`qwen3.8-flash-next-nvfp4-nvfp4-BF16`, warm RAM, 15 CPU workers), median chat decode drops to `25.1 tok/s` (`21.6–36.5`, `n=9`) and median agent decode drops to `28.7 tok/s` (`24.6–36.7`, `n=15`). Even when EcoQoS only engages mid-session (during the final agent run), worst-turn agent decode drops to `27.2 tok/s`. With this change: 1. `serve/lifeline.py` adds `HIGH_PRIORITY_CLASS` (`0x00000080`) to `creationflags` when spawning isolated roles (`engine`, `vision`) on Windows. 2. `tools/strata_bench.py` calls `SetPriorityClass(..., HIGH_PRIORITY_CLASS)` and `SetProcessInformation(..., ProcessPowerThrottling, ...)` with `StateMask = 0` on startup (and passes `HIGH_PRIORITY_CLASS` when spawning a server child) so benchmark runs measure the engine rather than Windows background power throttling. 3. On the same warm-RAM 3-run `tools/strata_bench.py` suite, releasing the clamp lifts median chat decode from `25.1` to `57.7 tok/s` (`+129.9%`), chat TTFT from `1.64 s` to `0.92 s` (`-43.9%`), 4K prompt from `1509.7` to `1702.5 tok/s` (`+12.8%`), 16K prompt from `2476.2` to `2700.9 tok/s` (`+9.1%`), and median agent decode from `28.7` to `67.8 tok/s` (`+136.2%`, range `56.4–89.7 tok/s`). ## Related discussion none ## Approach - Apply the priority class at the single spawn point in `serve/lifeline.py` (`popen()` for `ISOLATED_ROLES` on `os.name == "nt"`), and release both `HIGH_PRIORITY_CLASS` and `ProcessPowerThrottling` (`PROCESS_POWER_THROTTLING_STATE`) in `tools/strata_bench.py` via `ctypes.WinDLL("kernel32")` on a best-effort basis. - No C++ engine rebuild is required. ## Validation **Passed:** - **Windows 11 / Intel Core Ultra 9 285K + RTX 5070 Ti (16 GB VRAM), Python 3.11, on `870aedd9` (v0.2.8) and `c62d5e3a` (v0.2.9 / engine 0.1.55)**: - `python -m unittest serve.test_lifeline`: `7` tests, `OK` (`skipped=3` POSIX-only tests). - `python tools/strata_bench.py --runs 3` (`qwen3.8-flash-next-nvfp4-nvfp4-BF16`, RTX 5070 Ti 16 GB + `--pool-workers 15`, warm RAM, pure upstream AVX2): ```text without 0003 with 0003 change chat decode tok/s 25.10 57.70 +129.9% (range: 21.6-36.5 -> 52.0-80.3, n=9) chat first token (s) 1.64 0.92 -43.9% 4K prompt tok/s 1509.70 1702.50 +12.8% 4K first token (s) 2.75 2.42 -11.9% 16K prompt tok/s 2476.20 2700.90 +9.1% 16K first token (s) 6.58 6.04 -8.2% agent turn first token (s) 2.19 2.05 -6.2% (worst turn: 3.42 s -> 2.87 s) agent decode tok/s 28.70 67.80 +136.2% (range: 24.6-36.7 -> 56.4-89.7, n=15) ``` **Failed:** - none observed **Not run:** - Older Windows 10 builds prior to 2004 where `ProcessPowerThrottling` is unsupported (`disable_windows_throttling()` catches any error and continues). ## Limits - This sets process priority and power-throttling state from Python only; which logical cores the engine pins its worker pool to remains governed by `src/kernels/cpu/pool_affinity_win.hpp`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:33:54 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5262
No description provided.