Skip to content

pgo: Invalid instrumentation profile data (bad magic) #49410

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

Closed
matthiaskrgr opened this issue Mar 27, 2018 · 12 comments
Closed

pgo: Invalid instrumentation profile data (bad magic) #49410

matthiaskrgr opened this issue Mar 27, 2018 · 12 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Mar 27, 2018

Hi, I was trying to use pgo to build fd-find as a test but I'm running into an error:

warning: /tmp/fd.pgo: Invalid instrumentation profile data (bad magic)
git clone https://github.com/sharkdp/fd
cd fd
RUSTFLAGS="-Z pgo-gen=/tmp/fd.pgo -C target-cpu=native" cargo build --release
./target/release/fd
RUSTFLAGS="-Z pgo-use=/tmp/fd.pgo -C target-cpu=native" cargo build --release
[...]
   Compiling textwrap v0.9.0
   Compiling clap v2.31.1
   Compiling ctrlc v3.1.0
   Compiling regex v0.2.8
   Compiling fd-find v7.0.0 (file:///tmp/fd)
   Compiling globset v0.3.0
warning: /tmp/fd.pgo: Invalid instrumentation profile data (bad magic)
   Compiling ignore v0.4.1
warning: /tmp/fd.pgo: Invalid instrumentation profile data (bad magic)
    Finished release [optimized] target(s) in 87.91 secs

cc @emilio

@matthiaskrgr matthiaskrgr changed the title invalid instru pgo: Invalid instrumentation profile data (bad magic) Mar 27, 2018
@pietroalbini pietroalbini added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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
@emilio
Copy link
Contributor

emilio commented Mar 27, 2018

You need to run llvm-profdata merge -o fd.profdata /tmp/fd.pgo in order to convert to the format that LLVM expects. If it keeps happening after that then it's a bug.

@emilio
Copy link
Contributor

emilio commented Mar 27, 2018

(I don't get such a warning when inserting the step above before running with -Z pgo-use.

@matthiaskrgr
Copy link
Member Author

Thanks, I tried to

git clone https://github.com/sharkdp/fd
cd fd
RUSTFLAGS="-Z pgo-gen=/tmp/fd.pgo -C target-cpu=native" cargo build --release
./target/release/fd
~/LLVM/LLVM6/stage_2/build/bin/llvm-profdata merge -o fd.profdata /tmp/fd.pgo
RUSTFLAGS="-Z pgo-use=/tmp/fd.pgo -C target-cpu=native" cargo build --release

now but I'm still getting the same error, hmm :/

I was lucky to have some working llvm 6.0 toolchain around though, since it seems that llvm-profdata is not shipped by rustup, is it possible to add it to the toolchain?
There might be problems if someone has let's say has llvm 5 installed on their system and tries to run llvm-profdata 5.0 with rusts llvm6 pgo data, etc...

@emilio
Copy link
Contributor

emilio commented Mar 28, 2018

You need to -C pgo-use=fd.profdata, otherwise the command is useless :)

@emilio
Copy link
Contributor

emilio commented Mar 28, 2018

(Well, -Z pgo-use).

I suspect the profraw / profdata format is not very unstable, but yeah, probably adding the llvm utilities to that would be helpful.

@sfackler
Copy link
Member

There's already some desire to ship llvm-binutils for embedded use cases so it seems like we could add llvm-profdata to that as well.

@matthiaskrgr
Copy link
Member Author

Ah, I got it working with that, thanks a lot!

@emilio
Copy link
Contributor

emilio commented Mar 28, 2018

Probably this should be closed, and another issue filed for llvm-profdata. I don't have the rights to do that though.

@sfackler is there any issue tracking shipping llvm-binutils?

@sfackler
Copy link
Member

I thought I saw one but can't find it now. @japaric would probably know?

@japaric
Copy link
Member

japaric commented Mar 29, 2018

@sfackler not yet. I'll open an issue this week to discuss which binutils we want to add.

@japaric
Copy link
Member

japaric commented Apr 2, 2018

I'll open an issue this week to discuss which binutils we want to add.

See #49584

@steveklabnik
Copy link
Member

Triage: #49584 was merged.

Given the previous comment:

Probably this should be closed, and another issue filed for llvm-profdata.

I think this can be closed. @matthiaskrgr please let me know if this is wrong!

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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants