Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*
774 Discussions

Problem generating dyn files with icpx compiler

tofushan
Beginner
850 Views

Hi, 

 

I would like to generate .dyn files to obtain codecov report following this tutorial. However, I just realize that newer C++ compiler (icpx) does not have the corresponding flag (-pro-gen=srcpos) used by the older one (icpc) to generate the .dyn files. I also tried to use -fprofile-generate tag for icpx, but it generates a different file format (*.profraw), which I guess it cannot be used by profmerge or codecov. 

 

I have been looking for a documentation or similar questions but still couldn't find a solution. Any feedback is appreciated! 

 

 

0 Kudos
3 Replies
Alex_Y_Intel
Moderator
775 Views

Try something like this, suppose your source file is test.c

icx -c -fcoverage-mapping -fprofile-instr-generate test.c
icx -c -fprofile-instr-generate -fcoverage-mapping -mllvm -spi-generate -mllvm -spi-filename=test.spi test.c
icx test.o -o test -fprofile-instr-generate
./test

 

Check where your llvm-profgen is: 

icx --print-prog-name=llvm-profgen 

It'll tell you something like this: /opt/intel/oneapi/compiler/2024.2/bin/compiler/llvm-profgen

 

/opt/intel/oneapi/compiler/2024.2/bin/compiler/llvm-profdata merge -o test.profdata *profraw

You should have 2 additional output: default.profraw, test.profdata

/opt/intel/oneapi/compiler/2024.2/bin/compiler/llvm-cov report -format=xml -instr-profile=test.profdata test.spi

You'll get some output about coverage info in xml format. 

 

You can also send the output to another xml file: 
/opt/intel/oneapi/compiler/2024.2/bin/compiler/llvm-cov report -format=xml -show-regions-in-xml -instr-profile=test.profdata test.spi > cov.xml

 

https://llvm.org/docs/CommandGuide/llvm-cov.html

0 Kudos
tofushan
Beginner
682 Views

Hi, 

 

Thanks for your response! I would like to try your method, but is there a way to generate .dyn files that can be used by codecov?

0 Kudos
Alex_Y_Intel
Moderator
615 Views

not with icx. 
codecov doesn't understand the profile generated by icx

0 Kudos
Reply