[Driver] Promote SmallSet of enum to a bitset. NFCI.

This commit is contained in:
Benjamin Kramer 2020-07-20 16:50:00 +02:00
parent 33c9d0320e
commit f3f1ce4fa9
3 changed files with 4 additions and 15 deletions

View File

@ -259,13 +259,13 @@ void CudaInstallationDetector::AddCudaIncludeArgs(
void CudaInstallationDetector::CheckCudaVersionSupportsArch(
CudaArch Arch) const {
if (Arch == CudaArch::UNKNOWN || Version == CudaVersion::UNKNOWN ||
ArchsWithBadVersion.count(Arch) > 0)
ArchsWithBadVersion[(int)Arch])
return;
auto MinVersion = MinVersionForCudaArch(Arch);
auto MaxVersion = MaxVersionForCudaArch(Arch);
if (Version < MinVersion || Version > MaxVersion) {
ArchsWithBadVersion.insert(Arch);
ArchsWithBadVersion[(int)Arch] = true;
D.Diag(diag::err_drv_cuda_version_unsupported)
<< CudaArchToString(Arch) << CudaVersionToString(MinVersion)
<< CudaVersionToString(MaxVersion) << InstallPath

View File

@ -15,9 +15,9 @@
#include "clang/Driver/Tool.h"
#include "clang/Driver/ToolChain.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/VersionTuple.h"
#include <bitset>
#include <set>
#include <vector>
@ -41,7 +41,7 @@ private:
// CUDA architectures for which we have raised an error in
// CheckCudaVersionSupportsArch.
mutable llvm::SmallSet<CudaArch, 4> ArchsWithBadVersion;
mutable std::bitset<(int)CudaArch::LAST> ArchsWithBadVersion;
public:
CudaInstallationDetector(const Driver &D, const llvm::Triple &HostTriple,

View File

@ -13,7 +13,6 @@
#include "clang/Basic/LLVM.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/Options.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/Triple.h"
@ -103,10 +102,6 @@ private:
CorrectlyRoundedSqrt.isValid();
}
// GPU architectures for which we have raised an error in
// CheckRocmVersionSupportsArch.
mutable llvm::SmallSet<CudaArch, 4> ArchsWithBadVersion;
void scanLibDevicePath(llvm::StringRef Path);
void ParseHIPVersionFile(llvm::StringRef V);
SmallVector<Candidate, 4> getInstallationPathCandidates();
@ -124,12 +119,6 @@ public:
bool DAZ, bool FiniteOnly, bool UnsafeMathOpt,
bool FastRelaxedMath, bool CorrectSqrt) const;
/// Emit an error if Version does not support the given Arch.
///
/// If either Version or Arch is unknown, does not emit an error. Emits at
/// most one error per Arch.
void CheckRocmVersionSupportsArch(CudaArch Arch) const;
/// Check whether we detected a valid HIP runtime.
bool hasHIPRuntime() const { return HasHIPRuntime; }