File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -486,10 +486,16 @@ void RocmInstallationDetector::detectHIPRuntime() {
486
486
return newpath;
487
487
};
488
488
// If HIP version file can be found and parsed, use HIP version from there.
489
- for (const auto &VersionFilePath :
490
- {Append (SharePath, " hip" , " version" ),
491
- Append (ParentSharePath, " hip" , " version" ),
492
- Append (BinPath, " .hipVersion" )}) {
489
+ std::vector<SmallString<0 >> VersionFilePaths = {
490
+ Append (SharePath, " hip" , " version" ),
491
+ InstallPath != D.SysRoot + " /usr/local"
492
+ ? Append (ParentSharePath, " hip" , " version" )
493
+ : SmallString<0 >(),
494
+ Append (BinPath, " .hipVersion" )};
495
+
496
+ for (const auto &VersionFilePath : VersionFilePaths) {
497
+ if (VersionFilePath.empty ())
498
+ continue ;
493
499
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> VersionFile =
494
500
FS.getBufferForFile (VersionFilePath);
495
501
if (!VersionFile)
Original file line number Diff line number Diff line change 77
77
// RUN: --hip-path=%t/myhip --print-rocm-search-dirs %s 2>&1 \
78
78
// RUN: | FileCheck -check-prefixes=ROCM-ENV,HIP-PATH %s
79
79
80
+ // Test detecting /usr directory.
81
+ // RUN: rm -rf %t/*
82
+ // RUN: cp -r %S/Inputs/rocm %t/usr
83
+ // RUN: mkdir -p %t/usr/share/hip
84
+ // RUN: mv %t/usr/bin/.hipVersion %t/usr/share/hip/version
85
+ // RUN: mkdir -p %t/usr/local
86
+ // RUN: %clang -### --target=x86_64-linux-gnu --offload-arch=gfx1010 --sysroot=%t \
87
+ // RUN: --print-rocm-search-dirs --hip-link %s 2>&1 \
88
+ // RUN: | FileCheck -check-prefixes=USR %s
89
+
80
90
// Test detecting latest /opt/rocm-{release} directory.
81
- // RUN: rm -rf %t/opt
91
+ // RUN: rm -rf %t/*
82
92
// RUN: mkdir -p %t/opt
83
93
// RUN: cp -r %S/Inputs/rocm %t/opt/rocm-3.9.0-1234
84
94
// RUN: cp -r %S/Inputs/rocm %t/opt/rocm-3.10.0
130
140
// ROCM-PATH: "-idirafter" "[[ROCM_PATH]]/include"
131
141
// ROCM-PATH: "-L[[ROCM_PATH]]/lib" {{.*}}"-lamdhip64"
132
142
143
+ // USR: ROCm installation search path: [[ROCM_PATH:.*/usr$]]
144
+ // USR: "-mlink-builtin-bitcode" "[[ROCM_PATH]]/amdgcn/bitcode/oclc_isa_version_1010.bc"
145
+ // USR: "-idirafter" "[[ROCM_PATH]]/include"
146
+ // USR: "-L[[ROCM_PATH]]/lib" {{.*}}"-lamdhip64"
147
+
133
148
// ROCM-REL: ROCm installation search path: {{.*}}/opt/rocm
134
149
// ROCM-REL: ROCm installation search path: {{.*}}/opt/rocm-3.10.0
135
150
You can’t perform that action at this time.
0 commit comments