the underlying hardware.
This fixes a bug triggered by diff: D29660
llvm-svn: 310549
}
StringRef Arch = DAL->getLastArgValue(options::OPT_march_EQ);
- if (Arch.empty())
- // Default compute capability for CUDA toolchain is sm_20.
+ if (Arch.empty()) {
+ // Default compute capability for CUDA toolchain is the
+ // lowest compute capability supported by the installed
+ // CUDA version.
DAL->AddJoinedArg(nullptr,
- Opts.getOption(options::OPT_march_EQ), "sm_20");
+ Opts.getOption(options::OPT_march_EQ),
+ CudaInstallation.getLowestExistingArch());
+ }
return DAL;
}
std::string getLibDeviceFile(StringRef Gpu) const {
return LibDeviceMap.lookup(Gpu);
}
+ /// \brief Get lowest available compute capability
+ /// for which a libdevice library exists.
+ std::string getLowestExistingArch() const {
+ std::string LibDeviceFile;
+ for (auto key : LibDeviceMap.keys()) {
+ LibDeviceFile = LibDeviceMap.lookup(key);
+ if (!LibDeviceFile.empty())
+ return key;
+ }
+ llvm_unreachable("no libdevice exists.");
+ }
};
namespace tools {