google / benchmark

A microbenchmark support library
Apache License 2.0
9.06k stars 1.63k forks source link

Build fails on ppc64le #449

Open jayfurmanek opened 7 years ago

jayfurmanek commented 7 years ago

Hi, I've tried building this on a ppc64le machine (power8) and it fails in src/cycleclock.h:

In file included from /tmp/build/protobuf/third_party/benchmark/src/sysinfo.cc:44:0: /tmp/build/protobuf/third_party/benchmark/src/cycleclock.h: In function 'int64_t benchmark::cycleclock::Now()': /tmp/build/protobuf/third_party/benchmark/src/cycleclock.h:82:23: error: 'int64' does not name a type tbl &= -static_cast(tbu0 == tbu1);

It looks like there is no 64bit ppc timebase instructions. The needed instruction is 'mfspr'. It returns a 64bit unsigned int and no need for low/high bit wrangling.

I'd submit a patch, but I haven't signed the CLA yet. Please let me know if you need a patch and I can get that started.

dmah42 commented 7 years ago

I'd like a patch, but are you running at head? the line numbers don't line up (it's 91 at head) and it was replaced with int64_t at some point.

Dominic Hamon | Google There are no bad ideas; only good ideas that go horribly wrong.

On Wed, Sep 27, 2017 at 3:33 PM, jayfurmanek notifications@github.com wrote:

Hi, I've tried building this on a ppc64le machine (power8) and it fails in src/cycleclock.h:

In file included from /tmp/build/protobuf/third_ party/benchmark/src/sysinfo.cc:44:0: /tmp/build/protobuf/third_party/benchmark/src/cycleclock.h: In function 'int64_t benchmark::cycleclock::Now()': /tmp/build/protobuf/third_party/benchmark/src/cycleclock.h:82:23: error: 'int64' does not name a type tbl &= -static_cast(tbu0 == tbu1);

It looks like there is no 64bit ppc timebase instructions. The needed instruction is 'mfspr'. It returns a 64bit unsigned int and no need for low/high bit wrangling.

I'd submit a patch, but I haven't signed the CLA yet. Please let me know if you need a patch and I can get that started.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/benchmark/issues/449, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfIMjmMiTIyyT4pUgsPeoS8QPwOE5q7ks5sms0-gaJpZM4PmfNP .

jayfurmanek commented 7 years ago

Oh I guess I was working on the commit level that is a sub-module of protobuf. Yea, there is the that int64/int64_t bug in the powerpc section, but that whole section is old and generally aimed at 32bit systems. The new mfspr instruction in the 64bit ISA is better and more appropriate for powerpc64 systems.

I'll work on the CLA

nasica88 commented 7 years ago

@jayfurmanek I'm trying to build caffe2 on ppc64le (POWER8) and it got stuck in this error. It would be appreciated if you can get started on the patch for this.

/home/u0017649/caffe2/third_party/benchmark/src/cycleclock.h:82:23: error: ‘int64’ does not name a type tbl &= -static_cast<int64>(tbu0 == tbu1); ^ third_party/benchmark/src/CMakeFiles/benchmark.dir/build.make:230: recipe for target 'third_party/benchmark/src/CMakeFiles/benchmark.dir/sysinfo.cc.o' failed