Repository navigation
Keep Linux PGSO startup code fast - #1517
Merged
Merged
Conversation
Profile use compiles the functions it judges cold for size. On Linux that makes short commands such as fx help slower than the control, past the startup gate. Training now keeps a profile for each of the five direct startup scenarios. Before profile use, a first pass applies the production profile and reads which startup functions came out minsize. Their records are removed from the production profile, except for functions a heavy benchmark runs, because the benchmarks build from the same profile. Every startup function is marked nooutline, so neither outliner moves its code into helpers far from the rest of the startup code. The candidate link places the startup functions first, in the order they first run. macOS has no startup scenarios, so its build is unchanged. Distributed builds don't carry the startup profiles, so they reject Linux.
… fazxes/pgso-linux-startup
… fazxes/pgso-linux-startup # Conflicts: # scripts/pgso/ir_size.py
… fazxes/pgso-linux-startup # Conflicts: # scripts/pgso/ir_size.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1502.
Profile use compiles the functions it judges cold for size. On Linux that makes short commands slower than the control:
fx helpfailed the startup gate in every Linux run without this change.This change keeps the startup path fast:
direct-help,direct-version,direct-status,direct-doctor,direct-sessions).ir_size.py minsize-functionsreads which startup functions came outminsize. Their records are removed from the production profile. Startup functions that stay hot, those the build inlines away, and those any heavy benchmark runs keep their records. The benchmarks build from the production profile, so dropping the allocator orIo.Mutexrecords slowedui-activityby about 6 points.nooutline(ir_size.py no-outline) before outlining, so neither the IR outliner nor llc's machine outliner moves its code into helpers far from the rest of the startup code. Those helpers costfx --versionextra page faults.macOS has no startup scenarios, so its build is unchanged. Distributed builds don't carry the startup profiles, so they reject Linux.
Testing
python3 -m unittest discover -s scripts/pgso/tests -t .passes all 238 tests. New coverage:minsize-functionsandno-outlineagainst real LLVM, record removal, the two-pass exemption with faked tools, startup profiles kept during training, startup-first link order, and the distributed rejection.python3 -m scripts.pgso all --target aarch64-linux:nooutline, training, profile use, the behavior corpus, and the startup gate passed.helpwas 34% faster than the control and--version6% slower, within the 10% limit.ui-activityfailed at +11.9%.tui-resume.test.tswhile the host was heavily loaded. The same tests pass three of three times against both the control and this candidate on recheck.help−7.0%,--version+1.1%,status−7.9%,doctor−8.9%,sessions−6.8%.ui-activityran +5.3% to +6.7% at p50, against +13.6% to +17.8% with the broader exemption.