[HIPIFY][perl][fix] Treat ::device_function as a device function

+ Do not treat somenamespace::device_function_name as a device function
+ Fix generation of warnUnsupportedDeviceFunctions function in hipify-clang
+ Update hipify-perl based on hipify-clang -perl generation
+ Update device test math_functions.cu for hipify-perl

[Restrictions]
- hipify-perl is yet unable to handle function declarations in user namespaces
- hipify-perl is yet unable to handle using directive
This commit is contained in:
Evgeny Mankov
2019-09-16 17:36:55 +03:00
parent dd752e3d4e
commit b43bb7d3c1
3 changed files with 27 additions and 11 deletions
+6 -4
View File
@@ -1956,11 +1956,13 @@ sub warnUnsupportedDeviceFunctions
"umul24"
)
{
# match math at the beginning of a word, but not if it already has a namespace qualifier ('::') :
my $mt = m/[:]?[:]?\b($func)\b(\w*\()/g;
if ($mt) {
# match device function from the list of unsupported, 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;
print STDERR " warning: $fileName:#$line_num : unsupported device function : $_\n";
print STDERR " warning: $fileName:$line_num: unsupported device function \"$func\": $_\n";
}
}
return $m;