================
@@ -310,24 +312,31 @@ int main(int argc, const char **argv) {
   IEB->SlabAllocateSize = *SizeOrErr;
   IEB->UseSharedMemory = UseSharedMemory;
 
-  std::unique_ptr<clang::CompilerInstance> DeviceCI;
-  if (CudaEnabled) {
-    if (!CudaPath.empty())
-      CB.SetCudaSDK(CudaPath);
+  if (HipEnabled && CudaEnabled) {
+    if (HipEnabled.getPosition() > CudaEnabled.getPosition())
+      CudaEnabled = false;
+    else
+      HipEnabled = false;
+  }
 
-    if (OffloadArch.empty()) {
-      OffloadArch = "sm_35";
-    }
-    CB.SetOffloadArch(OffloadArch);
+  bool DeviceEnabled = HipEnabled || CudaEnabled;
+  llvm::StringRef DevicePath = HipEnabled ? RocmPath : CudaPath;
+  llvm::StringRef DeviceOffloadArch = !OffloadArch.empty()
+                                          ? llvm::StringRef(OffloadArch)
+                                          : (HipEnabled ? "gfx90a" : "sm_35");
----------------
yxsamliu wrote:

Hard-coding `gfx90a` will fail on other AMD GPUs. Could HIP use 
`--offload-arch=native` by default? The driver already detects the architecture 
with `amdgpu-arch`. If it finds no GPU or multiple architectures, Clang-Repl 
can report an error since it currently supports one device architecture.

https://github.com/llvm/llvm-project/pull/217582
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to