================
@@ -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 both -cuda and -hip are passed, the one that appears later wins.
+ bool UseHip = HipEnabled && (!CudaEnabled || HipEnabled.getPosition() >
+ CudaEnabled.getPosition());
+ bool DeviceEnabled = HipEnabled || CudaEnabled;
- if (OffloadArch.empty()) {
- OffloadArch = "sm_35";
- }
- CB.SetOffloadArch(OffloadArch);
+ clang::OffloadType OffloadKind =
+ UseHip ? clang::OffloadType::HIP : clang::OffloadType::CUDA;
+ std::string DevicePath = UseHip ? RocmPath : CudaPath;
+ llvm::StringRef DeviceOffloadArch = !OffloadArch.empty()
+ ? llvm::StringRef(OffloadArch)
+ : (UseHip ? "native" : "sm_35");
+
----------------
AdityaSinha149 wrote:
Did the change, thanks for the review.
https://github.com/llvm/llvm-project/pull/231783
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits