-
Notifications
You must be signed in to change notification settings - Fork 139
Build Analysis using ClangBuildAnalyzer and Ninjatracing
1.1.1 In a suitable docker, install ClangBuildAnalyzer
:
git clone https://github.com/aras-p/ClangBuildAnalyzer.git
cd ClangBuildAnalyzer/
mkdir build;cd build
cmake ..
make -j$(nrpoc) install
1.1.2 then clone the Composable Kernel repository:
git clone https://github.com/ROCmSoftwarePlatform/composable_kernel.git
cd composable_kernel/
mkdir build;cd build
1.1.3 then generate report
and analyze it:
ClangBuildAnalyzer --start ./
CC=/opt/rocm/llvm/bin/clang CXX=/opt/rocm/llvm/bin/clang++ cmake DCMAKE_C_FLAGS="-ftime-trace -O3 " -DCMAKE_CXX_FLAGS="-ftime-trace -O3 " -DGPU_TARGETS="gfx900;gfx906;gfx908;gfx90a;gfx1030" ..
make -j$(nrpoc)
ClangBuildAnalyzer --stop ./ report
1.1.4 it will print out report like this:
**** Time summary:
Compilation (452 times):
Parsing (frontend): 11023.3 s
Codegen & opts (backend): 2069.6 s
A detailed sample is attached here: ClangBuildAnalyzer_CK_report.log
1.2.1 In a suitable docker, install ninja-build
, for example in Ubuntu:
apt-get install ninja-build
1.2.2 hence the only change is -GNinja
and use ninja
to replace make
, so it can be also used in combination with ClangBuildAnalyzer
:
git clone https://github.com/ROCmSoftwarePlatform/composable_kernel.git
cd composable_kernel/
mkdir build;cd build
CC=/opt/rocm/llvm/bin/clang CXX=/opt/rocm/llvm/bin/clang++ cmake DCMAKE_C_FLAGS="-ftime-trace -O3 " -DCMAKE_CXX_FLAGS="-ftime-trace -O3 " -DGPU_TARGETS="gfx900;gfx906;gfx908;gfx90a;gfx1030" -GNinja ..
time ninja
1.2.3 download ninjatracing
and assume it is within the build
directory for composable kernel already
git clone https://github.com/nico/ninjatracing.git
python3 ./ninjatracing/ninjatracing .ninja_log > report.json
If you need more detailed report via clang's time-trace
, use
python3 ./ninjatracing/ninjatracing -e .ninja_log > report_detail.json
hence the detailed report could be large: for example, normal report is about 60K
while the detailed report is 371M
.
1.2.4 download report json files and open with chrome:tracing
- Open chrome and type
chrome://tracing/
in the URL - Use
load
to load the downloaded json file
for example: