From 62d088b2c77bfb05767e32334fbb2c275fb82280 Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Wed, 25 Mar 2020 17:41:27 -0400 Subject: [PATCH] Add option --hipcc-func-supp for function support (#1957) By default hipcc passes -mllvm options to let HIP-Clang inline all device functions. --hipcc-func-supp enables function support and disables inline all. --hipcc-no-func-supp disable function support and enables inline all. This is a temporary solution to match HCC behavior for performance. This option is mainly for debugging purpose. Change-Id: I0c44ac1812bb3cea5c3e5b6e14ebaa45919236f6 [ROCm/clr commit: 2198aead384f62861e282349c99ad486a5ec6ce0] --- projects/clr/hipamd/bin/hipcc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/clr/hipamd/bin/hipcc b/projects/clr/hipamd/bin/hipcc index 38be6fb5ef..74ca844629 100755 --- a/projects/clr/hipamd/bin/hipcc +++ b/projects/clr/hipamd/bin/hipcc @@ -337,6 +337,7 @@ my $buildDeps = 0; my $linkType = 1; my $setLinkType = 0; my $coFormatv3 = 0; +my $funcSupp = 0; # enable function support my @options = (); my @inputs = (); @@ -600,6 +601,11 @@ foreach $arg (@ARGV) #if $arg eq "--hipcc_profile") { # Example argument here, hipcc # #} + if ($arg eq "--hipcc-func-supp") { + $funcSupp = 1; + } elsif ($arg eq "--hipcc-no-func-supp") { + $funcSupp = 0; + } } else { push (@options, $arg); } @@ -743,7 +749,7 @@ if ($HIP_PLATFORM eq "clang") { } # Do not pass -mllvm on Windows since there is a clang bug causing duplicate -mllvm options in clang -cc1 on Windows. # ToDo : remove restriction for Windows after clang bug is fixed. - if ($optArg ne "-O0" and not $isWindows) { + if (!$funcSupp and $optArg ne "-O0" and not $isWindows) { $HIPCXXFLAGS .= " -mllvm -amdgpu-early-inline-all=true -mllvm -amdgpu-function-calls=false"; if ($needLDFLAGS and not $needCXXFLAGS) { $HIPLDFLAGS .= " -mllvm -amdgpu-early-inline-all=true -mllvm -amdgpu-function-calls=false";