003 File Manager
Current Path:
/usr/src/contrib/llvm-project/clang/lib/Driver/ToolChains
usr
/
src
/
contrib
/
llvm-project
/
clang
/
lib
/
Driver
/
ToolChains
/
📁
..
📄
AIX.cpp
(7.69 KB)
📄
AIX.h
(2.51 KB)
📄
AMDGPU.cpp
(21.42 KB)
📄
AMDGPU.h
(3.72 KB)
📄
AVR.cpp
(5.72 KB)
📄
AVR.h
(1.94 KB)
📄
Ananas.cpp
(5.21 KB)
📄
Ananas.h
(2.06 KB)
📁
Arch
📄
BareMetal.cpp
(6.4 KB)
📄
BareMetal.h
(2.96 KB)
📄
Clang.cpp
(270.02 KB)
📄
Clang.h
(7.82 KB)
📄
CloudABI.cpp
(5.05 KB)
📄
CloudABI.h
(2.3 KB)
📄
CommonArgs.cpp
(49.63 KB)
📄
CommonArgs.h
(5.95 KB)
📄
Contiki.cpp
(926 B)
📄
Contiki.h
(1.25 KB)
📄
CrossWindows.cpp
(9.44 KB)
📄
CrossWindows.h
(2.93 KB)
📄
Cuda.cpp
(36.52 KB)
📄
Cuda.h
(7.5 KB)
📄
Darwin.cpp
(103.49 KB)
📄
Darwin.h
(20.22 KB)
📄
DragonFly.cpp
(6.83 KB)
📄
DragonFly.h
(2.16 KB)
📄
Flang.cpp
(2.57 KB)
📄
Flang.h
(1.45 KB)
📄
FreeBSD.cpp
(15.99 KB)
📄
FreeBSD.h
(3.72 KB)
📄
Fuchsia.cpp
(12.4 KB)
📄
Fuchsia.h
(3.72 KB)
📄
Gnu.cpp
(118.91 KB)
📄
Gnu.h
(14.8 KB)
📄
HIP.cpp
(15.47 KB)
📄
HIP.h
(4.4 KB)
📄
Haiku.cpp
(1.28 KB)
📄
Haiku.h
(1.25 KB)
📄
Hexagon.cpp
(23.79 KB)
📄
Hexagon.h
(4.34 KB)
📄
Hurd.cpp
(7.1 KB)
📄
Hurd.h
(1.5 KB)
📄
InterfaceStubs.cpp
(2.63 KB)
📄
InterfaceStubs.h
(1.23 KB)
📄
Lanai.h
(1.31 KB)
📄
Linux.cpp
(32.88 KB)
📄
Linux.h
(2.69 KB)
📄
MSP430.cpp
(7.95 KB)
📄
MSP430.h
(2.45 KB)
📄
MSVC.cpp
(57.11 KB)
📄
MSVC.h
(6.12 KB)
📄
MSVCSetupApi.h
(19.2 KB)
📄
MinGW.cpp
(21.52 KB)
📄
MinGW.h
(3.8 KB)
📄
Minix.cpp
(3.98 KB)
📄
Minix.h
(2.05 KB)
📄
MipsLinux.cpp
(4.48 KB)
📄
MipsLinux.h
(1.98 KB)
📄
Myriad.cpp
(11.75 KB)
📄
Myriad.h
(3.73 KB)
📄
NaCl.cpp
(13.25 KB)
📄
NaCl.h
(3.01 KB)
📄
NetBSD.cpp
(16.56 KB)
📄
NetBSD.h
(2.97 KB)
📄
OpenBSD.cpp
(10.17 KB)
📄
OpenBSD.h
(3.31 KB)
📄
PPCLinux.cpp
(1.06 KB)
📄
PPCLinux.h
(1.05 KB)
📄
PS4CPU.cpp
(9.53 KB)
📄
PS4CPU.h
(3.68 KB)
📄
RISCVToolchain.cpp
(7.25 KB)
📄
RISCVToolchain.h
(2.28 KB)
📄
ROCm.h
(6.94 KB)
📄
Solaris.cpp
(10.41 KB)
📄
Solaris.h
(2.5 KB)
📄
TCE.cpp
(1.49 KB)
📄
TCE.h
(1.49 KB)
📄
VEToolchain.cpp
(4.09 KB)
📄
VEToolchain.h
(2.16 KB)
📄
WebAssembly.cpp
(13.53 KB)
📄
WebAssembly.h
(2.94 KB)
📄
XCore.cpp
(5.48 KB)
📄
XCore.h
(2.98 KB)
Editing: ROCm.h
//===--- ROCm.h - ROCm installation detector --------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ROCM_H #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ROCM_H #include "clang/Basic/Cuda.h" #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" #include "llvm/Option/ArgList.h" #include "llvm/Support/VersionTuple.h" namespace clang { namespace driver { /// A class to find a viable ROCM installation /// TODO: Generalize to handle libclc. class RocmInstallationDetector { private: struct ConditionalLibrary { SmallString<0> On; SmallString<0> Off; bool isValid() const { return !On.empty() && !Off.empty(); } StringRef get(bool Enabled) const { assert(isValid()); return Enabled ? On : Off; } }; // Installation path candidate. struct Candidate { llvm::SmallString<0> Path; bool StrictChecking; Candidate(std::string Path, bool StrictChecking = false) : Path(Path), StrictChecking(StrictChecking) {} }; const Driver &D; bool HasHIPRuntime = false; bool HasDeviceLibrary = false; // Default version if not detected or specified. const unsigned DefaultVersionMajor = 3; const unsigned DefaultVersionMinor = 5; const char *DefaultVersionPatch = "0"; // The version string in Major.Minor.Patch format. std::string DetectedVersion; // Version containing major and minor. llvm::VersionTuple VersionMajorMinor; // Version containing patch. std::string VersionPatch; // ROCm path specified by --rocm-path. StringRef RocmPathArg; // ROCm device library paths specified by --rocm-device-lib-path. std::vector<std::string> RocmDeviceLibPathArg; // HIP version specified by --hip-version. StringRef HIPVersionArg; // Wheter -nogpulib is specified. bool NoBuiltinLibs = false; // Paths SmallString<0> InstallPath; SmallString<0> BinPath; SmallString<0> LibPath; SmallString<0> LibDevicePath; SmallString<0> IncludePath; llvm::StringMap<std::string> LibDeviceMap; // Libraries that are always linked. SmallString<0> OCML; SmallString<0> OCKL; // Libraries that are always linked depending on the language SmallString<0> OpenCL; SmallString<0> HIP; // Libraries swapped based on compile flags. ConditionalLibrary WavefrontSize64; ConditionalLibrary FiniteOnly; ConditionalLibrary UnsafeMath; ConditionalLibrary DenormalsAreZero; ConditionalLibrary CorrectlyRoundedSqrt; bool allGenericLibsValid() const { return !OCML.empty() && !OCKL.empty() && !OpenCL.empty() && !HIP.empty() && WavefrontSize64.isValid() && FiniteOnly.isValid() && UnsafeMath.isValid() && DenormalsAreZero.isValid() && 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(); public: RocmInstallationDetector(const Driver &D, const llvm::Triple &HostTriple, const llvm::opt::ArgList &Args, bool DetectHIPRuntime = true, bool DetectDeviceLib = false); /// Add arguments needed to link default bitcode libraries. void addCommonBitcodeLibCC1Args(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, StringRef LibDeviceFile, bool Wave64, 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; } /// Check whether we detected a valid ROCm device library. bool hasDeviceLibrary() const { return HasDeviceLibrary; } /// Print information about the detected ROCm installation. void print(raw_ostream &OS) const; /// Get the detected Rocm install's version. // RocmVersion version() const { return Version; } /// Get the detected Rocm installation path. StringRef getInstallPath() const { return InstallPath; } /// Get the detected path to Rocm's bin directory. // StringRef getBinPath() const { return BinPath; } /// Get the detected Rocm Include path. StringRef getIncludePath() const { return IncludePath; } /// Get the detected Rocm library path. StringRef getLibPath() const { return LibPath; } /// Get the detected Rocm device library path. StringRef getLibDevicePath() const { return LibDevicePath; } StringRef getOCMLPath() const { assert(!OCML.empty()); return OCML; } StringRef getOCKLPath() const { assert(!OCKL.empty()); return OCKL; } StringRef getOpenCLPath() const { assert(!OpenCL.empty()); return OpenCL; } StringRef getHIPPath() const { assert(!HIP.empty()); return HIP; } StringRef getWavefrontSize64Path(bool Enabled) const { return WavefrontSize64.get(Enabled); } StringRef getFiniteOnlyPath(bool Enabled) const { return FiniteOnly.get(Enabled); } StringRef getUnsafeMathPath(bool Enabled) const { return UnsafeMath.get(Enabled); } StringRef getDenormalsAreZeroPath(bool Enabled) const { return DenormalsAreZero.get(Enabled); } StringRef getCorrectlyRoundedSqrtPath(bool Enabled) const { return CorrectlyRoundedSqrt.get(Enabled); } /// Get libdevice file for given architecture std::string getLibDeviceFile(StringRef Gpu) const { return LibDeviceMap.lookup(Gpu); } void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const; void detectDeviceLibrary(); void detectHIPRuntime(); /// Get the values for --rocm-device-lib-path arguments std::vector<std::string> getRocmDeviceLibPathArg() const { return RocmDeviceLibPathArg; } /// Get the value for --rocm-path argument StringRef getRocmPathArg() const { return RocmPathArg; } /// Get the value for --hip-version argument StringRef getHIPVersionArg() const { return HIPVersionArg; } std::string getHIPVersion() const { return DetectedVersion; } }; } // end namespace driver } // end namespace clang #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ROCM_H
Upload File
Create Folder