Significant SPEC CPU2017 perf regression due to ConPTY window visibility #19126

Open
opened 2026-01-31 06:34:32 +00:00 by claunia · 0 comments
Owner

Originally created by @lhecker on GitHub (Dec 23, 2022).

Originally assigned to: @DHowett, @lhecker, @zadjii-msft on GitHub.

Steps to reproduce

As per an internal "Spec benchmark QoS observations on Surface and Samsung system with latest OS" discussion:

Here are steps to run the SPEC CPU2017 ST workload:

  1. Open CMD window [not as administrator] and CD into the directory "SPEC.CPU2017_Windows_IC2022.1". You should see the install.bat file in the current working directory [with DIR command].
  2. On the CMD prompt, type install.bat. Confirm the directory question and allow the script to finish. You should see 'success'.
  3. Run the script "run-1copy-1subtest-ic2021.2-win-core-avx2-smt-on-20210430.bat" for a quick 5 minute run. This script will run only test #531 "deepsjeng" for 1 copy and 1 iteration.
  4. When it finishes, in the result directory you should see newly created files such as "CPU2017.001.intrate.refrate.pdf" with the geomean in the top right of the first page highlighted in gray. Look for "SPECrate2017_int_base ".
  5. In the broken state, this score will be about 3 (+/- 0.5) and in the working state it should be about 7 (+/- 0.5)

Additionally,

  1. The above run is all via cmd line automation
  2. The cmd line that runs this is always in focus
  3. Not run as admin
  4. Nothing else is blocking the window. Spec doesn't have any UI associated

Expected Behavior

No response

Actual Behavior

The benchmark process gets assigned a "utility" QoS, due to it seemingly being in the background from the perspective of Windows' "Background Activity Manager" (BAM):

The difference I observed between working and broken set of traces is that WindowsTerminal is being used to launch the benchmark in broken case and cmd.exe is being used in working case. BAM understands when either one of those are in focus.

Benchmarks process is running without a window and BAM and uses parent/child relationship heuristics to determine appropriate PPM policy. In working case benchmark process is descendant of in-focus cmd.exe and that means it inherits its in-focus state.

In broken case though WindowsTerminal is not an ancestor of benchmark process. Benchmark has somewhat long ancestor chain which goes something like explorer.exe->cmd.exe->specinvoke.exe->cmd.exe->specinvoke.exe->benchmark. WindowsTerminal is created by DcomLaunch and it doesn’t launch any other processes.

The cause for this bug (and a potential solution!) is explained in detail in these two comments:

  1. https://github.com/microsoft/terminal/issues/11823#issuecomment-979185489
  2. https://github.com/microsoft/terminal/issues/11823#issuecomment-982193256
Originally created by @lhecker on GitHub (Dec 23, 2022). Originally assigned to: @DHowett, @lhecker, @zadjii-msft on GitHub. ### Steps to reproduce As per an internal "Spec benchmark QoS observations on Surface and Samsung system with latest OS" discussion: > Here are steps to run the SPEC CPU2017 ST workload: > > 1. Open CMD window [not as administrator] and CD into the directory "SPEC.CPU2017_Windows_IC2022.1". You should see the install.bat file in the current working directory [with DIR command]. > 2. On the CMD prompt, type install.bat. Confirm the directory question and allow the script to finish. You should see 'success'. > 3. Run the script "run-1copy-1subtest-ic2021.2-win-core-avx2-smt-on-20210430.bat" for a quick 5 minute run. This script will run only test #531 "deepsjeng" for 1 copy and 1 iteration. > 4. When it finishes, in the result directory you should see newly created files such as "CPU2017.001.intrate.refrate.pdf" with the geomean in the top right of the first page highlighted in gray. Look for "SPECrate2017_int_base ". > 5. In the broken state, this score will be about 3 (+/- 0.5) and in the working state it should be about 7 (+/- 0.5) > > Additionally, > 1. The above run is all via cmd line automation > 2. The cmd line that runs this is always in focus > 3. Not run as admin > 4. Nothing else is blocking the window. Spec doesn't have any UI associated ### Expected Behavior _No response_ ### Actual Behavior The benchmark process gets assigned a "utility" QoS, due to it seemingly being in the background from the perspective of Windows' "Background Activity Manager" (BAM): > The difference I observed between working and broken set of traces is that WindowsTerminal is being used to launch the benchmark in broken case and cmd.exe is being used in working case. BAM understands when either one of those are in focus. > > Benchmarks process is running without a window and BAM and uses parent/child relationship heuristics to determine appropriate PPM policy. In working case benchmark process is descendant of in-focus cmd.exe and that means it inherits its in-focus state. > > In broken case though WindowsTerminal is not an ancestor of benchmark process. Benchmark has somewhat long ancestor chain which goes something like explorer.exe->cmd.exe->specinvoke.exe->cmd.exe->specinvoke.exe->benchmark. WindowsTerminal is created by DcomLaunch and it doesn’t launch any other processes. The cause for this bug (and a potential solution!) is explained in detail in these two comments: 1. https://github.com/microsoft/terminal/issues/11823#issuecomment-979185489 2. https://github.com/microsoft/terminal/issues/11823#issuecomment-982193256
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19126