google / google/autofdo

Unable to create profile with create_llvm_prof - Empty profile map error

Open
#230 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
619
Forks
127
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm trying to compile clang using AutoFDO. In order, I'm running the following (adapted from the propeller script):

- Build baseline clang to generate profiles
```
COMMON_CMAKE_FLAGS=(
"-DLLVM_OPTIMIZED_TABLEGEN=On"
"-DCMAKE_BUILD_TYPE=RelWithDebInfo"
"-DLLVM_TARGETS_TO_BUILD=X86"
"-DLLVM_ENABLE_PROJECTS=clang"
"-DCMAKE_C_COMPILER=${PATH_TO_TRUNK_LLVM_BUILD}/bin/clang"
"-DCMAKE_CXX_COMPILER=${PATH_TO_TRUNK_LLVM_BUILD}/bin/clang++"
"-DLLVM_BUILD_INSTRUMENTED=ON" )

cmake -G Ninja "${COMMON_CMAKE_FLAGS[@]}"\
${PATH_TO_SOURCES}/llvm-project/llvm
ninja -j 40 clang
```

- Use perf to obtain branch data
```
ninja -t commands | head -100 >& ./perf_commands.sh
chmod +x ./perf_commands.sh
perf record -j any,u ./perf_commands.sh
```

- Use create_llvm_prof to generate the profile
`create_llvm_prof --binary $PATH_TO_BINARIES/clang.baseline --out baseline.prof`

Everything succeeds, until the very last command which gives the following output:
```
[WARNING:/home/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1322] Skipping 492 bytes of metadata: HEADER_CPU_TOPOLOGY
[WARNING:autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1069] Skipping unsupported event PERF_RECORD_CPU_MAP
[INFO:/home/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1060] Number of events stored: 8366776
[INFO:/home/autofdo/third_party/perf_data_converter/src/quipper/perf_parser.cc:272] Parser processed: 1221 MMAP/MMAP2 events, 112 COMM events, 110 FORK events, 111 EXIT events, 8336706 SAMPLE events, 8287979 of these were mapped, 0 SAMPLE events with a data address, 0 of these were mapped
WARNING: Logging before InitGoogleLogging() is written to STDERR
I20240926 10:32:30.280131 89010 sample_reader.cc:289] No buildid found in binary
I20240926 10:32:34.213464 89010 symbol_map.cc:477] Adding loadable exec segment: offset=1597000 vaddr=1597000
W20240926 10:32:42.118443 89010 llvm_profile_writer.cc:50] Got an empty profile map. The output file might still be not empty (e.g., containing symbol list in binary format) but might be not helpful as a profile
```

I have tested several configurations and also tried to use different perf option, but the outcome does not seems to change.

Thanks in advance.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.