[Llvm-bgq-discuss] mathcalls.h and ppu_intrinsics.h

Jozsef Bakosi jbakosi at lanl.gov
Wed Jan 25 16:23:04 CST 2017


Hi Hal,

When I commented out the inclusion of ppu_intrinsics.h, I got:

<...>/include/Random123/philox.h:198:40: error: use of undeclared identifier '__mulhdu'
_mulhilo_cuda_intrin_tpl(64, uint64_t, R123_MULHILO64_MULHI_INTRIN)

Thus it is __mulhdu, so I guess ppu_intrinsics.h would pull in the assembly
intrinsics for the mulhdu (Multiply High Double Word Unsigned) instruction.
Also, as you can see, this is coming out of the Random123 random number
generator library:
http://www.thesalmons.org/john/random123/releases/latest/docs/index.html.

Based on their documentation I was able to work around the problem by overriding
a couple of their pre-processor symbols before including their header:

#define R123_USE_MULHILO64_MULHI_INTRIN 0
#define R123_USE_GNU_UINT128 1

#include <Random123/philox.h>

This turns off looking for the intrinsics that would be enabled via
ppu_intrinsics.h and falls back to a non-intrinsics version.

Though this compiles fine, I have not been able to test this solution for
correctness or performance yet.

I guess a ppu_intrinsics.h that is compatible with mathcalls.h would allow me to
use the intrinsics, but I'm okay with this solution for now.

Jozsef
-- 
Jozsef Bakosi
Computational Physics and Algorithms (CCS-2)
MS D413, Los Alamos National Laboratory
Los Alamos, NM 87545, USA
email: jbakosi at lanl.gov
phone: 505-665-0950
fax: 505-665-4972

On 01.24.2017 18:05, Hal Finkel wrote:
> Hi Jozsef,
> 
> Interesting. Do you know what is being used out of ppu_intrinsics.h? That is
> really a GCC-internal header file. Maybe we need a Clang equivalent, or
> maybe this is easy to work around?
> 
>  -Hal
> 
> 
> On 01/24/2017 03:02 PM, Jozsef Bakosi wrote:
> > Hi folks,
> > 
> > I'm trying to compile code including ppu_intrinsics.h as well as math.h and they
> > seem to be incompatible with each other. Here is the error I get:
> > 
> > =============================================
> > In file included from /soft/compilers/bgclang/r284961-stable/libc++/include/c++/v1/unordered_map:369:
> > In file included from /soft/compilers/bgclang/r284961-stable/libc++/include/c++/v1/__hash_table:19:
> > In file included from /soft/compilers/bgclang/r284961-stable/libc++/include/c++/v1/cmath:305:
> > In file included from /soft/compilers/bgclang/r284961-stable/libc++/include/c++/v1/math.h:301:
> > In file included from /bgsys/drivers/V1R2M2/ppc64/gnu-linux-4.7.2/powerpc64-bgq-linux/sys-include/math.h:70:
> > /bgsys/drivers/V1R2M2/ppc64/gnu-linux-4.7.2/powerpc64-bgq-linux/sys-include/bits/mathcalls.h:182:1: error: exception specification in declaration does not match previous
> >        declaration
> > __MATHCALLX (fabs,, (_Mdouble_ __x), (__const__));
> > ^
> > /bgsys/drivers/V1R2M2/ppc64/gnu-linux-4.7.2/powerpc64-bgq-linux/sys-include/math.h:59:3: note: expanded from macro '__MATHCALLX'
> >    __MATHDECLX (_Mdouble_,function,suffix, args, attrib)
> >    ^
> > /bgsys/drivers/V1R2M2/ppc64/gnu-linux-4.7.2/powerpc64-bgq-linux/sys-include/math.h:62:22: note: expanded from macro '__MATHDECLX'
> >    __MATHDECL_1(type, __CONCAT(__,function),suffix, args) __attribute__ (attrib)
> >                       ^
> > /bgsys/drivers/V1R2M2/ppc64/gnu-linux-4.7.2/powerpc64-bgq-linux/sys-include/sys/cdefs.h:89:23: note: expanded from macro '__CONCAT'
> > #define __CONCAT(x,y)   x ## y
> >                          ^
> > <scratch space>:360:1: note: expanded from here
> > __fabs
> > ^
> > /usr/lib/gcc/ppc64-redhat-linux/4.4.4/include/ppu_intrinsics.h:411:16: note: expanded from macro '__fabs'
> > #define __fabs __ppu_fabs
> >                 ^
> > /usr/lib/gcc/ppc64-redhat-linux/4.4.4/include/ppu_intrinsics.h:416:1: note: previous declaration is here
> > __fabs(double x)
> > ^
> > /usr/lib/gcc/ppc64-redhat-linux/4.4.4/include/ppu_intrinsics.h:411:16: note: expanded from macro '__fabs'
> > #define __fabs __ppu_fabs
> >                 ^
> > =============================================
> > 
> > Does anyone have an idea of a workaround?
> > 
> > Thanks,
> > Jozsef
> 
> -- 
> Hal Finkel
> Lead, Compiler Technology and Programming Languages
> Leadership Computing Facility
> Argonne National Laboratory


More information about the llvm-bgq-discuss mailing list