[HIPIFY] Add supported device functions (from math_functions.h)

+ [perl] Add generation of sub countSupportedDeviceFunctions
+ [FIX] Do not perform any replacement for supported device functions
+ [perl] Sync hipify-perl accordingly
Bu işleme şunda yer alıyor:
Evgeny Mankov
2019-09-17 16:17:28 +03:00
ebeveyn 85553ec483
işleme 33cd4dffd5
5 değiştirilmiş dosya ile 417 ekleme ve 31 silme
+183 -7
Dosyayı Görüntüle
@@ -1812,15 +1812,191 @@ if ($count_conversions) {
sub countSupportedDeviceFunctions
{
my $m = 0;
# TODO: list all of the supported functions
# TODO: split the list on math, device, and maybe fp16
foreach $func (
# Synchronization:
"__syncthreads",
"abs",
"acos",
"acosf",
"acosh",
"acoshf",
"asin",
"asinf",
"asinh",
"asinhf",
"atan",
"atan2",
"atan2f",
"atanf",
"atanh",
"atanhf",
"cbrt",
"cbrtf",
"ceil",
"ceilf",
"copysign",
"copysignf",
"cos",
"cosf",
"cosh",
"coshf",
"cospi",
"cospif",
"cyl_bessel_i0",
"cyl_bessel_i0f",
"cyl_bessel_i1",
"cyl_bessel_i1f",
"erf",
"erfc",
"erfcf",
"erfcinv",
"erfcinvf",
"erfcx",
"erfcxf",
"erff",
"erfinv",
"erfinvf",
"exp",
"exp10",
"exp10f",
"exp2",
"exp2f",
"expf",
"expm1",
"expm1f",
"fabs",
"fabsf",
"fdim",
"fdimf",
"floor",
"floorf",
"fma",
"fmaf",
"fmax",
"fmaxf",
"fmin",
"fminf",
"fmod",
"fmodf",
"frexp",
"frexpf",
"hypot",
"hypotf",
"ilogb",
"ilogbf",
"isfinite",
"isinf",
"isnan",
"j0",
"j0f",
"j1",
"j1f",
"jn",
"jnf",
"labs",
"ldexp",
"ldexpf",
"lgamma",
"lgammaf",
"llabs",
"llrint",
"llrintf",
"llround",
"llroundf",
"log",
"log10",
"log10f",
"log1p",
"log1pf",
"log2",
"log2f",
"logb",
"logbf",
"logf",
"lrint",
"lrintf",
"lround",
"lroundf",
"max",
"min",
"modf",
"modff",
"nan",
"nanf",
"nearbyint",
"nearbyintf",
"nextafter",
"nextafterf",
"norm",
"norm3d",
"norm3df",
"norm4d",
"norm4df",
"normcdf",
"normcdff",
"normcdfinv",
"normcdfinvf",
"normf",
"pow",
"powf",
"rcbrt",
"rcbrtf",
"remainder",
"remainderf",
"remquo",
"remquof",
"rhypot",
"rhypotf",
"rint",
"rintf",
"rnorm",
"rnorm3d",
"rnorm3df",
"rnorm4d",
"rnorm4df",
"rnormf",
"round",
"roundf",
"rsqrt",
"rsqrtf",
"scalbln",
"scalblnf",
"scalbn",
"scalbnf",
"signbit",
"sin",
"sincos",
"sincosf",
"sincospi",
"sincospif",
"sinf",
"sinh",
"sinhf",
"sinpi",
"sinpif",
"sqrt",
"sqrtf",
"tan",
"tanf",
"tanh",
"tanhf",
"tgamma",
"tgammaf",
"trunc",
"truncf",
"y0",
"y0f",
"y1",
"y1f",
"yn",
"ynf"
)
{
# match device func at the beginning of a word, but not if it already has a namespace qualifier ('::') :
$m += m/[:]?[:]?\b($func)\b(\w*\()/g;
# match device function from the list, except those, which have a namespace prefix (aka somenamespace::umin(...));
# function with only global namespace qualifier '::' (aka ::umin(...)) should be treated as a device function (and warned as well as without such qualifier);
my $mt_namespace = m/(\w+)::($func)\s*\(\s*.*\s*\)/g;
my $mt = m/($func)\s*\(\s*.*\s*\)/g;
if ($mt && !$mt_namespace) {
$m += $mt;
}
}
return $m;
}
@@ -1956,7 +2132,7 @@ sub warnUnsupportedDeviceFunctions
"umul24"
)
{
# match device function from the list of unsupported, except those, which have a namespace prefix (aka somenamespace::umin(...));
# match device function from the list, except those, which have a namespace prefix (aka somenamespace::umin(...));
# function with only global namespace qualifier '::' (aka ::umin(...)) should be treated as a device function (and warned as well as without such qualifier);
my $mt_namespace = m/(\w+)::($func)\s*\(\s*.*\s*\)/g;
my $mt = m/($func)\s*\(\s*.*\s*\)/g;