startup: make the default hook step cheap (no hold for ntdll stubs) #3463
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#3463
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Leyukaka on GitHub · 2026-11-29 14:50 UTC · original
Measurement. Full run of the application under
debug_launch.py --trace-files 1, cold shader cache, about 95 live threads: consecutive traced file calls are about 20 ms apart with the default--suspend-others 1. In an earlier run built before #1408, they were about 3 ms apart, at a different point of the run; the probe below is meant to measure the difference properly.On that run, the startup did not move past publishing about 2.7k compute requests (in the trace: 19 file calls per request, one request after another) until about 650 s; in an earlier run with the requests already cached, the same point came about 5 s after the preceding step.
Why the hold exists. A hook is one INT3 byte that is restored for a single step, and a thread entering the function during that step runs untraced (#1281); #1408 holds every other thread around each step. #3334 (for #3333) added the opt-out
-SuspendOthers 0/--suspend-others 0, which turns the hold off for timing runs; calls can then go untraced again.Plan (default path only;
--suspend-others 0stays unchanged):Nt*stubs: when the first instruction ismov r10, rcx(4C 8B D1), emulate it (R10 = RCX, RIP += 3) instead of restoring the byte and stepping. No byte is restored, so no hold is needed. Any other first instruction keeps today's restore, hold and step.Each traced file call opens two step windows today (entry and return); both go away on that path.
How it will be measured. A new mode of
tests/startup_launch_probe.cpp: about 96 threads blocked on an event, one thread doing N opens, reporting ms/open. Three legs: main default, main--suspend-others 0, branch default. Expected on the branch: close to the--suspend-others 0time withunprotected=0on thehook windows:line and every open traced. The existing overlap check with--suspend-others 0must still lose opens.I'm working on this.