[clang] [llvm] Rocm instal detect windows work (PR #113225)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 21 14:36:03 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 845dee36ba4161df153ba05009cea615e20eda5a 01fa7e4ea72b96735d85ed0511d44ca4df106e41 --extensions cpp,h -- clang/lib/Driver/Driver.cpp clang/lib/Driver/ToolChains/AMDGPU.cpp clang/lib/Driver/ToolChains/AMDGPU.h clang/lib/Driver/ToolChains/Darwin.cpp clang/lib/Driver/ToolChains/HIPAMD.cpp clang/lib/Driver/ToolChains/MSVC.cpp clang/lib/Driver/ToolChains/MinGW.cpp clang/lib/Driver/ToolChains/ROCm.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index eac895b7496..4c9ea71c6f8 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -6530,13 +6530,13 @@ const ToolChain &Driver::getOffloadingDeviceToolChain(
Target.getVendor() == llvm::Triple::AMD &&
Target.getOS() == llvm::Triple::AMDHSA) ||
!Args.hasArgNoClaim(options::OPT_offload_EQ))
- TC = std::make_unique<toolchains::HIPAMDToolChain>(
- *this, Target, HostTC, Args);
+ TC = std::make_unique<toolchains::HIPAMDToolChain>(*this, Target,
+ HostTC, Args);
else if (Target.getArch() == llvm::Triple::spirv64 &&
- Target.getVendor() == llvm::Triple::UnknownVendor &&
- Target.getOS() == llvm::Triple::UnknownOS)
- TC = std::make_unique<toolchains::HIPSPVToolChain>(
- *this, Target, HostTC, Args);
+ Target.getVendor() == llvm::Triple::UnknownVendor &&
+ Target.getOS() == llvm::Triple::UnknownOS)
+ TC = std::make_unique<toolchains::HIPSPVToolChain>(*this, Target,
+ HostTC, Args);
break;
}
default:
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index 8df8c16345b..5c33922e99b 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -308,7 +308,7 @@ RocmInstallationDetector::getInstallationPathCandidates() {
}
if (!isHostWindows()) {
-
+
if (!LatestROCm.empty())
ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/" + LatestROCm,
/*StrictChecking=*/true);
@@ -323,10 +323,13 @@ RocmInstallationDetector::getInstallationPathCandidates() {
return ROCmSearchDirs;
}
-RocmInstallationDetector::RocmInstallationDetector(
- const Driver &D, const llvm::Triple &TargetTriple,
- const llvm::opt::ArgList &Args /*, SALINAS bool DetectHIPRuntime,
- bool DetectDeviceLib, bool isMSVC*/)
+RocmInstallationDetector::RocmInstallationDetector(const Driver &D,
+ const llvm::Triple
+ &TargetTriple,
+ const llvm::opt::ArgList
+ &Args /*, SALINAS bool
+ DetectHIPRuntime, bool DetectDeviceLib, bool
+ isMSVC*/)
: D(D), TargetTriple(TargetTriple) {
/* SALINAS IsHostMSVC = isMSVC; */
Verbose = Args.hasArg(options::OPT_v);
@@ -383,10 +386,10 @@ RocmInstallationDetector::RocmInstallationDetector(
}
// SALINAS
- //if (DetectHIPRuntime)
+ // if (DetectHIPRuntime)
// detectHIPRuntime();
//}
- //if (DetectDeviceLib)
+ // if (DetectDeviceLib)
// detectDeviceLibrary();
}
@@ -694,8 +697,8 @@ void amdgpu::getAMDGPUTargetFeatures(const Driver &D,
AMDGPUToolChain::AMDGPUToolChain(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args)
: Generic_ELF(D, Triple, Args),
- OptionsDefault({{options::OPT_O, "3"},
- {options::OPT_cl_std_EQ, "CL1.2"}}) {
+ OptionsDefault(
+ {{options::OPT_O, "3"}, {options::OPT_cl_std_EQ, "CL1.2"}}) {
// Check code object version options. Emit warnings for legacy options
// and errors for the last invalid code object version options.
// It is done here to avoid repeated warning or error messages for
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.h b/clang/lib/Driver/ToolChains/AMDGPU.h
index 870230b3093..1eac8adc1b6 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.h
+++ b/clang/lib/Driver/ToolChains/AMDGPU.h
@@ -129,7 +129,7 @@ protected:
class LLVM_LIBRARY_VISIBILITY ROCMToolChain : public AMDGPUToolChain {
public:
ROCMToolChain(const Driver &D, const llvm::Triple &Triple,
- const llvm::opt::ArgList &Args, bool isHostTCMSVC=false);
+ const llvm::opt::ArgList &Args, bool isHostTCMSVC = false);
void
addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args,
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index e805639dc28..64ab328a6d2 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -931,8 +931,7 @@ MachO::MachO(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
/// Darwin - Darwin tool chain for i386 and x86_64.
Darwin::Darwin(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
: MachO(D, Triple, Args), TargetInitialized(false),
- CudaInstallation(D, Triple, Args), RocmInstallation(D, Triple, Args) {
-}
+ CudaInstallation(D, Triple, Args), RocmInstallation(D, Triple, Args) {}
types::ID MachO::LookupTypeForExtension(StringRef Ext) const {
types::ID Ty = ToolChain::LookupTypeForExtension(Ext);
diff --git a/clang/lib/Driver/ToolChains/HIPAMD.cpp b/clang/lib/Driver/ToolChains/HIPAMD.cpp
index 4fe7e753607..7566d10f5ed 100644
--- a/clang/lib/Driver/ToolChains/HIPAMD.cpp
+++ b/clang/lib/Driver/ToolChains/HIPAMD.cpp
@@ -250,7 +250,9 @@ void AMDGCN::Linker::ConstructJob(Compilation &C, const JobAction &JA,
HIPAMDToolChain::HIPAMDToolChain(const Driver &D, const llvm::Triple &Triple,
const ToolChain &HostTC, const ArgList &Args)
- : ROCMToolChain(D, Triple, Args, HostTC.getTriple().isWindowsMSVCEnvironment()), HostTC(HostTC) {
+ : ROCMToolChain(D, Triple, Args,
+ HostTC.getTriple().isWindowsMSVCEnvironment()),
+ HostTC(HostTC) {
// Lookup binaries into the driver directory, this is used to
// discover the clang-offload-bundler executable.
getProgramPaths().push_back(getDriver().Dir);
diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp
index 8edad36dc87..0cc5d2a22be 100644
--- a/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -487,7 +487,7 @@ toolchains::MinGW::MinGW(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args)
: ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args),
RocmInstallation(D, Triple, Args) {
- /* SALINAS */
+ /* SALINAS */
RocmInstallation->init();
getProgramPaths().push_back(getDriver().Dir);
diff --git a/clang/lib/Driver/ToolChains/ROCm.h b/clang/lib/Driver/ToolChains/ROCm.h
index 10baa4e0670..69ac5a2e80e 100644
--- a/clang/lib/Driver/ToolChains/ROCm.h
+++ b/clang/lib/Driver/ToolChains/ROCm.h
@@ -199,7 +199,7 @@ public:
/// Check whether the target triple is for Windows.
bool isHostWindows() const { return IsHostMSVC; }
- void setHostWindows(bool val) { IsHostMSVC=val;}
+ void setHostWindows(bool val) { IsHostMSVC = val; }
/// Print information about the detected ROCm installation.
void print(raw_ostream &OS) const;
@@ -281,8 +281,8 @@ public:
}
/* SALINAS */
- void init() {
- fprintf(stderr, "DAVE: RocmInstallationDetector::init()\n");
+ void init() {
+ fprintf(stderr, "DAVE: RocmInstallationDetector::init()\n");
detectHIPRuntime();
detectDeviceLibrary();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/113225
More information about the llvm-commits
mailing list