This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: AutoFDO profile toolchain is open-sourced


Hi,

One more question.

On 10.04.2015 23:39, Jan Hubicka wrote:
I must say I did not even try running AutoFDO myself (so I am happy to hear
it works).

I tried to use executable create_gcov built from AutoFDO repository at github. The problem is that the data generated by this program has size 1600 bytes not depending on the profile data given to it.
Steps to reproduce the issue:

1. Build AutoFDO under x86_64

2. Build, for example, the benchmark ytest.c (see attachment):

   g++ -O2 -o ytest ytest.c -g2

(I used g++ that was built just now from gcc-5-branch branch from git://gcc.gnu.org/git/gcc.git)

3. Run it under perf to collect the profile data:

   sudo perf record ./ytest


The perf reports no error and says that

   [ perf record: Woken up 1 times to write data ]
   [ perf record: Captured and wrote 0.125 MB perf.data (~5442 samples) ]


Perf generates perf.data.

4. Run create_gcov on the obtained data:

   create_gcov --binary ytest --profile perf.data --gcov ytest.gcov
   --debug_dump

It creates 2 files:
* ytest.gcov which is 1600 bytes of size
* ytest.gcov.imports which is empty

Also there is no debug output from the program.
If I run create_llvm_prof on the data

   create_llvm_prof --binary ytest --profile perf.data --out ytest.out
   --debug_dump

It reports the following log:

   Length of symbol map: 1
   Number of functions:  0

and creates an empty file ytest.out.

Which is not true: all functions in the benchmark are marked with __attribute__((noinline)) and readelf says that they stay in the binary:

   readelf -s ytest | grep px_cycle
        56: 0000000000400640   111 FUNC    GLOBAL DEFAULT   12 _Z8px_cyclei
   readelf -s ytest | grep py_cycle
        60: 00000000004006b0    36 FUNC    GLOBAL DEFAULT   12 _Z8py_cyclev

The size of resulting gcov data is the same (1600 bytes) for different levels of debug information (-g0, -g1, -g2) and for different input sources files.

What am I doing wrong?

--
Best regards,
Ilya Palachev

#define DX (480*4)

#define DY (640*4)

int* src = new int[DX*DY];
int* dst = new int[DX*DY];
int pxm = DX;
int pym = DY;

void px_cycle(int py) __attribute__((noinline));
void px_cycle(int py) {
    int *p1 = dst + (py*pxm);
    int *p2 = src + (pym - py - 1);
    for (int px = 0; px < pxm; px++) {
        if (px < pym && py < pxm) {
            *p1 = *p2;
        }
        p1++;
        p2 += pym;
    }
}

void py_cycle() __attribute__((noinline));
void py_cycle() {
    for (int py = 0; py < pym; py++) {
        px_cycle(py);
    }
}

int main() {
    int i;
    for (i = 0; i < 100; i++) {
        py_cycle();
    }
    return 0;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]