Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Add script for pgo/lto builds #1333

Merged
merged 1 commit into from
Feb 13, 2025
Merged

Conversation

hodgesds
Copy link
Contributor

@hodgesds hodgesds commented Feb 12, 2025

Add a script to generate PGO/LTO builds. This may improve performance for some of the more userspace oriented schedulers. See this section in the Rust book on PGO. In nightly versions of cargo I think we should be able to get rid of the script and add a build profile (issue).

If everything goes right and the toolchain supports it then a binary should be produced:

$ ./pgo-lto.sh /tmp/pgo-data scx_rustland 10
<lots of output>
   Compiling ordered-float v3.9.2
   Compiling simplelog v0.12.2
   Compiling scx_rustland_core v2.2.8 (/root/scx/rust/scx_rustland_core)
   Compiling fb_procfs v0.7.1
   Compiling scx_rustland v1.0.9 (/root/scx/scheds/rust/scx_rustland)
warning: scx_rustland_core.307c2d1e9a16060e-cgu.0: function control flow change detected (hash mismatch) __rust_realloc Hash = 2202711501531239 up to 467244 count discarded

warning: scx_rustland_core.307c2d1e9a16060e-cgu.0: function control flow change detected (hash mismatch) __rust_alloc_zeroed Hash = 2202711501531239 up to 198 count discarded

warning: `scx_rustland_core` (lib) generated 2 warnings
    Finished `release` profile [optimized] target(s) in 1m 59s

Copy link
Contributor

@JakeHillion JakeHillion left a comment

Choose a reason for hiding this comment

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

I don't see any reason not to do this, though I think to get the most benefit you'd have to run a realistic workload instead of the sleep "$PGO_DUR". This one might end up optimising some of the early returns instead of the important bits if the machine is quiet for example.

Maybe we should throw this in a directory like build? Not sure if that name is already taken.

@etsal
Copy link
Contributor

etsal commented Feb 12, 2025

Seems reasonable to me!

I don't see any reason not to do this, though I think to get the most benefit you'd have to run a realistic workload instead of the sleep "$PGO_DUR". This one might end up optimising some of the early returns instead of the important bits if the machine is quiet for example.

Given that most schedulers mostly do a bunch of initialization at startup then a bunch of periodic jobs in userspace that wouldn't be that big of an issue, e.g., scx_rusty still makes an attempt to load balance and traverses the relevant code paths even if the machine is relatively idle.

@hodgesds hodgesds added this pull request to the merge queue Feb 13, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 13, 2025
@hodgesds hodgesds added this pull request to the merge queue Feb 13, 2025
Merged via the queue into sched-ext:main with commit 2fc4b4b Feb 13, 2025
23 checks passed
@hodgesds hodgesds deleted the pgo-builds branch February 13, 2025 15:10
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