================
@@ -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");
+
----------------
yxsamliu wrote:
If `native` finds two GPU architectures, the driver creates two device jobs,
but clang-repl silently uses the first. Could we report an error and ask the
user to pass one `--offload-arch` for now?
https://github.com/llvm/llvm-project/pull/231783
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits