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: Invalid instrumentation profile data (bad magic) #49410

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

Comments

Projects
None yet
6 participants
@matthiaskrgr
Copy link
Contributor

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

@emilio

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

matthiaskrgr commented Mar 27, 2018

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

This comment has been minimized.

Copy link
Contributor

emilio commented Mar 28, 2018

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

@emilio

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

sfackler commented Mar 28, 2018

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

This comment has been minimized.

Copy link
Contributor

matthiaskrgr commented Mar 28, 2018

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

@emilio

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

sfackler commented Mar 28, 2018

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

@japaric

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

steveklabnik commented Nov 15, 2018

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