Skip to content

Shaders: keep xcl shaders out of EcoQoS execution-speed throttling - #2777

Open
Anon64 wants to merge 1 commit into
xcl-dev:mainfrom
Anon64:shaders-full-speed
Open

Anon64 wants to merge 1 commit into
xcl-dev:mainfrom
Anon64:shaders-full-speed

Conversation

@Anon64

@Anon64 Anon64 commented Nov 26, 2026 •

Copy link
Copy Markdown

xcl shaders (--recomp, --precompile) is long CPU-bound work the user waits on, but Windows 11 puts it under EcoQoS when its console is not in the foreground, and on a hybrid CPU that keeps its threads on the E-cores. This opts the process out of execution-speed throttling at the start of shaders::run, with the same SetProcessInformation(ProcessPowerThrottling) call kernelx::fine_timer (#300) already makes for timer resolution. If Windows refuses, it prints a warning and goes on as before.

What is in it

  • crates/xcl/src/shaders.rs: full_speed(), called at the start of run, and a unit test that reads the state back with GetProcessInformation (it fails without the call: ControlMask reads back as 0).

Tested

  • RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF (8 P-cores / 16 logical, 16 E-cores), Windows 11 26200, stable Rust, debug for the tests, release for the runs.

  • cargo test --workspace -- --test-threads=4: 1436 passed, 0 failed, 47 ignored; 26 SKIPPED (no wave64, no dxil.dll).

  • xcl shaders <retail shader pack> --recomp started from a background shell, average use per logical CPU over 50 s (\Processor(*)\% Processor Time, 2 s samples), release builds of main and of this head:

    build P-cores (0-15) E-cores (16-31)
    main b49be18 9.3 % 98.7 %
    this PR e59d1d1 76.8 % 83.2 %
  • The whole xcl shaders <retail shader pack> --recomp (26,698 programs), same background shell, wall-clock time, runs alternated main / PR / main / PR: main 195.4 s, 193.0 s; this PR 143.4 s, 143.4 s (26 % less).

Regression run

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060
title: retail-1
seconds: 60
exit: 0x0
frames shown: 1586 (PresentX 1587)
presents per 2 s (last 3): 60 47 54
device removals: 0
crashes: 0
peak commit: 19185 MB
xcl-smoke v1
commit: e59d1d11043b4620aaa961d93580bf1171f2ae2f
gpu: NVIDIA GeForce RTX 3060
title: retail-1
seconds: 60
exit: 0x0
frames shown: 1486 (PresentX 1486)
presents per 2 s (last 3): 25 7 0
device removals: 0
crashes: 0
peak commit: 20688 MB

xcl run does not reach the changed code, so this is only a regression check.

Not tested

  • Wall-clock time of a whole --precompile (DXC and driver compiles; only --recomp was timed), a run started from a foreground window, AMD and Intel GPUs, CPUs without E-cores (the call should change nothing there), Windows 10.
  • The shader preparation workers on nvidia-dev, which also run xcl shaders and would get this when it is merged there.

AI use

  • Claude Code (Claude Opus 5.5) wrote the code, the test and this description, and ran the tests and the measurements on this machine.

🤖 Generated with Claude Code

Windows 11 can put a console process it judges to be in the background
under EcoQoS, which on a hybrid CPU moves its threads to the E-cores.
`xcl shaders --precompile` is long CPU-bound work that the user is
waiting on, so it opts out of execution-speed throttling at the start
of `run`, the same call `kernelx::fine_timer` makes for timer
resolution.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Prime1997 Prime1997 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good within the reviewed scope; retain for integration. This draft has a useful, narrowly scoped change: it disables execution-speed EcoQoS throttling for the shader command process.

PR head e59d1d11043b4620aaa961d93580bf1171f2ae2f integrated locally with current main b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7. The detached worktree remains at main with the combined changes staged, tree ed8cd9ab3bdcd5975bdab074e4e683e7f6346dd4; it is an uncommitted integration candidate, not a clean PR-head run. Source patch SHA-256 374d930a3c5c9ed3e40170d33c82a65135712a743aa01c1488f84281e3ee6fb2.

Targeted result: 1 passed, 0 failed, 0 ignored, 0 skipped. Each exact filter ran in a fresh process:

  • shaders::tests::full_speed_turns_execution_speed_throttling_off

Build: cargo test --locked --offline -p xcl --lib --no-run --message-format=json --target-dir <isolated-target>. Run: <test-exe> <each-exact-filter-above> --exact --test-threads=1 --nocapture. Private executable/target paths are placeholders. Windows 11 Pro 26200, i5-10400, 32 GiB RAM, Rust 1.100.0 MSVC debug. These selected fixtures did not dispatch GPU work.

Not tested: The process power-state fixture passed. It does not establish faster compilation, different scheduling priority or system-wide power changes. No whole suite or retail smoke was run for this batch; this is not merge certification.

AI use: Codex (GPT-6) reviewed source, ran the selected tests and verified raw results. Optional temporary Discord for coordinating contributor work, testing and comparing results.

@Prime1997 Prime1997 mentioned this pull request Nov 26, 2026
@Anon64
Anon64 marked this pull request as ready for review November 27, 2026 09:08
@Anon64

Anon64 commented Nov 27, 2026

Copy link
Copy Markdown
Author

@Prime1997 thanks for the run. On the point under Not tested: the description has the compile-time numbers from a hybrid CPU (i9-14900KF, 8 P + 16 E), where this matters. The full xcl shaders --recomp of a retail pack (26,698 programs) started from a background shell took 195.4 s / 193.0 s on main and 143.4 s / 143.4 s with this PR (runs alternated), and the P-cores went from 9.3 % to 76.8 % average use. An i5-10400 has no E-cores, so I would expect little or no difference there: EcoQoS mostly moves the work to E-cores. The PR is out of draft now; it merges cleanly with current main.

AI use: Claude Code (Claude Opus 5.5) wrote this reply from the measurements in the description.

@Anon64

Anon64 commented Nov 27, 2026

Copy link
Copy Markdown
Author

Rerun on current main (623d02e4, and 9da51938 = that plus this PR), same machine as in the description (i9-14900KF, 8 P + 16 E). The 26 % saving does not reproduce today: Windows is not throttling main now either, so there is nothing for the PR to undo.

xcl shaders <retail shader pack> --recomp, release, runs in A-B-B-A order:

power plan main PR PR main
High performance 133.7 s 142.2 s 143.1 s 141.3 s
Balanced 134.8 s 136.3 s 135.2 s 137.2 s

During a main run the P-cores now average 57 % (E-cores 72 %), against 9.3 % / 98.7 % in the description's measurement. So it isn't the power plan, and I found no change on main since b49be183 that touches the process's priority or QoS. My best guess is Windows' own foreground/background heuristic: the original runs started while the window that launched them was in the background, and today's did not. I can't reproduce that condition reliably, so I'm not claiming more than this. The PR is still the documented way to opt out (SetProcessInformation(ProcessPowerThrottling), as kernelx already does for the timer), and it costs nothing when Windows does not throttle. But on this evidence the saving shows only when Windows decides to throttle the process, not on every run. The unit test passes on the merge with current main (1 passed, 0 failed).

AI use: Claude Code (Claude Opus 5.5) ran the timings and wrote this comment.

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Triage (#1607) – head e59d1d1

No open or merged PR does this for xcl shaders. Closed #2589 put PROCESS_POWER_THROTTLING_EXECUTION_SPEED into kernelx::fine_timer for xcl run, and main does not have it. The SetProcessInformation call matches the existing fine_timer call, and the test reads the state back with GetProcessInformation. Note that the runtime's own shader-preparation workers (pipeline_worker_command, --graphics-records workers) also run shaders::run, so they opt out too. That looks intended, but the description could say so. The branch conflicts with main.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants