summaryrefslogtreecommitdiff
blob: b9a1329e5931bb00e1e6331bba1d2b99ab860222 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From 73430b62a5437d1ba6c36a1d812a1434d1ad9df7 Mon Sep 17 00:00:00 2001
From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com>
Date: Tue, 20 Dec 2022 06:51:12 +0530
Subject: [PATCH 1/3] SWDEV-344620 - hipcc fails to parse version of clang in
 some cases (#3119)

Change-Id: I46f716c82a7500b9a2bcaf5f9ff4ad8a8f982770
Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com>
---
 bin/hipcc.pl | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/bin/hipcc.pl b/bin/hipcc.pl
index 645ae62d..2a01dcc3 100755
--- a/bin/hipcc.pl
+++ b/bin/hipcc.pl
@@ -144,7 +144,7 @@ if ($HIP_PLATFORM eq "amd") {
     $execExtension = "";
     if($isWindows) {
         $execExtension = ".exe";
-    } 
+    }
     $HIPCC="$HIP_CLANG_PATH/clang++" . $execExtension;
 
     # If $HIPCC clang++ is not compiled, use clang instead
@@ -157,13 +157,10 @@ if ($HIP_PLATFORM eq "amd") {
         $HIPLDFLAGS .= " -fuse-ld=lld";
         $HIPLDFLAGS .= " --ld-path=$HIP_CLANG_PATH/lld-link.exe";
     }
-    $HIP_CLANG_VERSION = `$HIPCC --version`;
-    $HIP_CLANG_VERSION=~/.*clang version (\S+).*/;
-    $HIP_CLANG_VERSION=$1;
 
-    # Figure out the target with which llvm is configured
-    $HIP_CLANG_TARGET = `$HIPCC -print-target-triple`;
-    $HIP_CLANG_TARGET = chomp($HIP_CLANG_TARGET);
+    # get Clang RT Builtin path 
+    $HIP_CLANG_RT_LIB = `$HIPCC --print-runtime-dir`;
+    chomp($HIP_CLANG_RT_LIB);
 
     if (! defined $HIP_CLANG_INCLUDE_PATH) {
         $HIP_CLANG_INCLUDE_PATH = abs_path("$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/include");
@@ -184,7 +181,7 @@ if ($HIP_PLATFORM eq "amd") {
         print ("HIP_INCLUDE_PATH=$HIP_INCLUDE_PATH\n");
         print ("HIP_LIB_PATH=$HIP_LIB_PATH\n");
         print ("DEVICE_LIB_PATH=$DEVICE_LIB_PATH\n");
-        print ("HIP_CLANG_TARGET=$HIP_CLANG_TARGET\n");
+        print ("HIP_CLANG_RT_LIB=$HIP_CLANG_RT_LIB\n");
     }
 
     if ($isWindows) {
@@ -715,13 +712,8 @@ if ($HIP_PLATFORM eq "amd") {
       } else {
         $toolArgs = ${toolArgs} . " -Wl,--enable-new-dtags -Wl,-rpath=$HIP_LIB_PATH:$ROCM_PATH/lib -lamdhip64 ";
       }
-      # To support __fp16 and _Float16, explicitly link with compiler-rt
-      $HIP_CLANG_BUILTIN_LIB="$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/$HIP_CLANG_TARGET/libclang_rt.builtins.a";
-      if (-e $HIP_CLANG_BUILTIN_LIB) {
-        $toolArgs .= " -L$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/$HIP_CLANG_TARGET -lclang_rt.builtins "
-      } else {
-        $toolArgs .= " -L$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/linux -lclang_rt.builtins-x86_64 "
-      }
+
+      $toolArgs .= " -L$HIP_CLANG_RT_LIB -lclang_rt.builtins-x86_64 "
     }
 }
 
-- 
2.38.1