1

For the purpose of my PhD thesis, I'm trying to trace the GAP Benchmark Suite using the SimPoints methodology and you may know, the first step to do so is to get Basic Block vectors for the application that you want to trace.

I've trying to use several methods available around such as experimental tools for valgrind:

valgrind --tool=exp-bbv /bin/ls

But I obtain errors such as this one when I'm trying to generate basic block vector files:

==177076== exp-bbv, a SimPoint basic block vector generator
==177076== NOTE: This is an Experimental-Class Valgrind Tool
==177076== Copyright (C) 2006-2015 Vince Weaver
==177076== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==177076== Command: /gpfs/scratch/bsc28/bsc28798/GAP/gapbs/pr -f /gpfs/scratch/bsc28/bsc28798/GAP/gapbs/benchmark/graphs/road.sg -i1000 -tle-4 -n16
==177076== 
vex amd64->IR: unhandled instruction bytes: 0x62 0xF1 0x7D 0x28 0xEF 0xC0 0xBF 0x0
vex amd64->IR:   REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR:   VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=NONE
vex amd64->IR:   PFX.66=0 PFX.F2=0 PFX.F3=0
==177076== valgrind: Unrecognised instruction at address 0x4cb88a4.
==177076==    at 0x4CB88A4: ??? (in /gpfs/apps/MN4/GCC/7.2.0/lib64/libstdc++.so.6.0.24)
==177076==    by 0x400ECB9: call_init.part.0 (in /lib64/ld-2.22.so)
==177076==    by 0x400EDA2: _dl_init (in /lib64/ld-2.22.so)
==177076==    by 0x4001229: ??? (in /lib64/ld-2.22.so)
==177076==    by 0x5: ???
==177076==    by 0xFFEFFEE6A: ???
==177076==    by 0xFFEFFEE94: ???
==177076==    by 0xFFEFFEE97: ???
==177076==    by 0xFFEFFEED7: ???
==177076==    by 0xFFEFFEEDE: ???
==177076==    by 0xFFEFFEEE5: ???
==177076== Your program just tried to execute an instruction that Valgrind
==177076== did not recognise.  There are two possible reasons for this.
==177076== 1. Your program has a bug and erroneously jumped to a non-code
==177076==    location.  If you are running Memcheck and you just saw a
==177076==    warning about a bad jump, it's probably your program's fault.
==177076== 2. The instruction is legitimate but Valgrind doesn't handle it,
==177076==    i.e. it's Valgrind's fault.  If you think this is the case or
==177076==    you are not sure, please let us know and we'll try to fix it.
==177076== Either way, Valgrind will now raise a SIGILL signal which will
==177076== probably kill your program.
==177076== 
==177076== Process terminating with default action of signal 4 (SIGILL)
==177076==  Illegal opcode at address 0x4CB88A4
==177076==    at 0x4CB88A4: ??? (in /gpfs/apps/MN4/GCC/7.2.0/lib64/libstdc++.so.6.0.24)
==177076==    by 0x400ECB9: call_init.part.0 (in /lib64/ld-2.22.so)
==177076==    by 0x400EDA2: _dl_init (in /lib64/ld-2.22.so)
==177076==    by 0x4001229: ??? (in /lib64/ld-2.22.so)
==177076==    by 0x5: ???
==177076==    by 0xFFEFFEE6A: ???
==177076==    by 0xFFEFFEE94: ???
==177076==    by 0xFFEFFEE97: ???
==177076==    by 0xFFEFFEED7: ???
==177076==    by 0xFFEFFEEDE: ???
==177076==    by 0xFFEFFEEE5: ???
==177076== 
==177076== 
==177076== 
==177076== # Thread 1

I've also been trying to use the different options proposed on the SimPoints website, but it has been a dead-end so far. So here I am, asking the community, if you may know about a way to achieve this. :)

N.B.: Also, the workloads are running just fine on their own, it's when we want to trace them that we face issues.

  • clang asm output includes basic block markers (as labels or comments). See [this answer](https://stackoverflow.com/questions/49612818/jump-in-the-middle-of-basic-block/49681836#49681836) – Peter Cordes Jan 28 '20 at 03:07
  • You mean that I could somehow parse the assembly code out of clang and get basic blocks this way? – Alexandre Valentin Jamet Feb 04 '20 at 18:24
  • Yes. Compile with `clang -O3 -S foo.c`. IDK if there's a convenient way to get that for a whole program (not just individual compilation units). Maybe there's a way to get link-time optimization (LTO) to emit one big asm file instead of a linked executable? – Peter Cordes Feb 05 '20 at 01:17

1 Answers1

0

Let us assume the binary you want to test is called bin and you have already created it. Then simply:

valgrind --tool=exp-bbv ./