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

PGO on Windows-GNU #49409

Closed
leonardo-m opened this issue Mar 27, 2018 · 8 comments · Fixed by #61080
Closed

PGO on Windows-GNU #49409

leonardo-m opened this issue Mar 27, 2018 · 8 comments · Fixed by #61080
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. O-windows-gnu Toolchain: GNU, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@leonardo-m
Copy link

I am trying to see if -Z pgo-gen is available on Windows-Gnu:

#48346

I am using:

rustc 1.26.0-nightly (188e693b3 2018-03-26)
binary: rustc
commit-hash: 188e693b392116c46f746e86f8521f9621fcfd43
commit-date: 2018-03-26
host: x86_64-pc-windows-gnu
release: 1.26.0-nightly
LLVM version: 6.0

I am using a very small Rust test program:

fn main() {
    println!("Hello");
}

If I compile with:

rustc -Z pgo-gen test.rs

It gives me:

error: debugging option `pgo-gen` requires a string (Z pgo-gen=<value>)

If I compile with (using a random string?):

rustc -Z pgo-gen=abc test.rs

It gives me:

error[E0463]: can't find crate for `profiler_builtins`
@matthiaskrgr
Copy link
Member

Hi, I was also struggling with that! :)
The =val is supposed to be the profile file which details are written into after executing the pgo-gen instrumented binary and details are read from when building the binary for the second time with pgo-use.

So
RUSTFLAGS="-Z pgo-gen=profile_data.pgo" cargo build --release
*do things with the program*
RUSTFLAGS="-Z pgo-use=profile_data.pgo" cargo build --release
might work :)

@leonardo-m
Copy link
Author

I've tried to do as you say, but perhaps I am doing something wrong. I've created a binary project with cargo (just the hello world), then I've set the variable:

set RUSTFLAGS="-Z pgo-gen=profile_data.pgo"

Then I've compiled:

cargo build --release

It gives me:

error: failed to run `rustc` to learn about target-specific information
Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names "-Z pgo-gen=profile_data.pgo" --target x86_64-pc-windows-gnu --crate-type bin --crate-typ
e rlib` (exit code: 101)
--- stderr
error: multiple input filenames provided

@matthiaskrgr
Copy link
Member

Hm, I'm not sure what is going on there now (I also can't reproduce since not a windows user), sorry :/

@pietroalbini pietroalbini added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. O-windows Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Mar 27, 2018
@leonardo-m
Copy link
Author

Using:

rustc 1.35.0-nightly (3de010678 2019-04-11)
binary: rustc
commit-hash: 3de0106789468b211bcc3a25c09c0cf07119186
commit-date: 2019-04-11
host: x86_64-pc-windows-gnu
release: 1.35.0-nightly
LLVM version: 8.0

Calling rustc directly gives:

...>rustc -O -Z pgo-gen=profile_data.pgo test.rs
error[E0463]: can't find crate for `profiler_builtins`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.

@mati865
Copy link
Contributor

mati865 commented Apr 12, 2019

@sanxiyn sanxiyn added O-windows-gnu Toolchain: GNU, Operating system: Windows and removed O-windows Operating system: Windows labels Apr 15, 2019
@michaelwoerister
Copy link
Member

I wonder if we could just enable the profiler on *-pc-windows-gnu.

@mati865
Copy link
Contributor

mati865 commented May 14, 2019

I think I can find time this week to test it.
I'm almost sure PGO was broken on some older GCC version but I cannot recall the details.

@mati865
Copy link
Contributor

mati865 commented May 19, 2019

Status update:
I've got it working few days ago but pushing this upstream is blocked on upgrading compiler-builtins to 0.1.15. It was meant to be done by #60841 but was backed off.

Centril added a commit to Centril/rust that referenced this issue May 25, 2019
Ship profiler with windows-gnu

Fixes rust-lang#49409

I don't know if we can enable it for testing, windows-gnu jobs are already taking too long: rust-lang#59637.

r? @michaelwoerister

P.S.
I have tested only x86_64 build.
Centril added a commit to Centril/rust that referenced this issue May 25, 2019
Ship profiler with windows-gnu

Fixes rust-lang#49409

I don't know if we can enable it for testing, windows-gnu jobs are already taking too long: rust-lang#59637.

r? @michaelwoerister

P.S.
I have tested only x86_64 build.
Centril added a commit to Centril/rust that referenced this issue May 25, 2019
Ship profiler with windows-gnu

Fixes rust-lang#49409

I don't know if we can enable it for testing, windows-gnu jobs are already taking too long: rust-lang#59637.

r? @michaelwoerister

P.S.
I have tested only x86_64 build.
Centril added a commit to Centril/rust that referenced this issue May 25, 2019
Ship profiler with windows-gnu

Fixes rust-lang#49409

I don't know if we can enable it for testing, windows-gnu jobs are already taking too long: rust-lang#59637.

r? @michaelwoerister

P.S.
I have tested only x86_64 build.
Centril added a commit to Centril/rust that referenced this issue May 25, 2019
Ship profiler with windows-gnu

Fixes rust-lang#49409

I don't know if we can enable it for testing, windows-gnu jobs are already taking too long: rust-lang#59637.

r? @michaelwoerister

P.S.
I have tested only x86_64 build.
bors added a commit that referenced this issue May 26, 2019
Ship profiler with windows-gnu

Fixes #49409

I don't know if we can enable it for testing, windows-gnu jobs are already taking too long: #59637.

r? @michaelwoerister

P.S.
I have tested only x86_64 build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. O-windows-gnu Toolchain: GNU, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants