[clang] [llvm] Rocm instal detect windows work (PR #113225)
David Salinas via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 21 14:20:16 PDT 2024
https://github.com/david-salinas created https://github.com/llvm/llvm-project/pull/113225
None
>From 803e3939a726bed2f1c43a3199850d580251c6d2 Mon Sep 17 00:00:00 2001
From: David Salinas <david.salinas at amd.com>
Date: Thu, 4 Jul 2024 03:32:13 +0000
Subject: [PATCH 1/3] Remove Linux path names in ROCm search paths on Windows
When target triple indicates we are on Windows, do not add linux
paths to search path in ROCm Installation Detection.
Change-Id: I18effb8c20252de3d84ea37ef562124695c5a570
---
clang/lib/Driver/ToolChains/AMDGPU.cpp | 24 +++++++++++++----------
clang/lib/Driver/ToolChains/AMDGPU.h | 2 +-
clang/lib/Driver/ToolChains/HIPAMD.cpp | 2 +-
clang/lib/Driver/ToolChains/MSVC.cpp | 4 ++++
clang/lib/Driver/ToolChains/ROCm.h | 9 ++++++++-
clang/test/Driver/rocm-detect-windows.hip | 9 +++++++++
6 files changed, 37 insertions(+), 13 deletions(-)
create mode 100644 clang/test/Driver/rocm-detect-windows.hip
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index 453daed7cc7d5b..1bd891498ca0d4 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -306,23 +306,25 @@ RocmInstallationDetector::getInstallationPathCandidates() {
LatestVer = Ver;
}
}
- if (!LatestROCm.empty())
- ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/" + LatestROCm,
- /*StrictChecking=*/true);
+ if (!isHostWindows()) {
+ if (!LatestROCm.empty())
+ ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/" + LatestROCm,
+ /*StrictChecking=*/true);
- ROCmSearchDirs.emplace_back(D.SysRoot + "/usr/local",
- /*StrictChecking=*/true);
- ROCmSearchDirs.emplace_back(D.SysRoot + "/usr",
- /*StrictChecking=*/true);
+ ROCmSearchDirs.emplace_back(D.SysRoot + "/usr/local",
+ /*StrictChecking=*/true);
+ ROCmSearchDirs.emplace_back(D.SysRoot + "/usr",
+ /*StrictChecking=*/true);
+ }
DoPrintROCmSearchDirs();
return ROCmSearchDirs;
}
RocmInstallationDetector::RocmInstallationDetector(
- const Driver &D, const llvm::Triple &HostTriple,
+ const Driver &D, const llvm::Triple &TargetTriple,
const llvm::opt::ArgList &Args, bool DetectHIPRuntime, bool DetectDeviceLib)
- : D(D) {
+ : D(D), TargetTriple(TargetTriple) {
Verbose = Args.hasArg(options::OPT_v);
RocmPathArg = Args.getLastArgValue(clang::driver::options::OPT_rocm_path_EQ);
PrintROCmSearchDirs =
@@ -820,8 +822,10 @@ bool AMDGPUToolChain::isWave64(const llvm::opt::ArgList &DriverArgs,
/// ROCM Toolchain
ROCMToolChain::ROCMToolChain(const Driver &D, const llvm::Triple &Triple,
- const ArgList &Args)
+ const ArgList &Args, bool isHostTCMSVC)
: AMDGPUToolChain(D, Triple, Args) {
+ RocmInstallation->setHostWindows(isHostTCMSVC);
+
RocmInstallation->detectDeviceLibrary();
}
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.h b/clang/lib/Driver/ToolChains/AMDGPU.h
index 7e70dae8ce152e..870230b3093df3 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.h
+++ b/clang/lib/Driver/ToolChains/AMDGPU.h
@@ -129,7 +129,7 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUToolChain : public Generic_ELF {
class LLVM_LIBRARY_VISIBILITY ROCMToolChain : public AMDGPUToolChain {
public:
ROCMToolChain(const Driver &D, const llvm::Triple &Triple,
- const llvm::opt::ArgList &Args);
+ 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/HIPAMD.cpp b/clang/lib/Driver/ToolChains/HIPAMD.cpp
index c35b0febb262da..4fe7e75360726d 100644
--- a/clang/lib/Driver/ToolChains/HIPAMD.cpp
+++ b/clang/lib/Driver/ToolChains/HIPAMD.cpp
@@ -250,7 +250,7 @@ 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(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/MSVC.cpp b/clang/lib/Driver/ToolChains/MSVC.cpp
index ca266e3e1d1d3c..7526c6613f4dd7 100644
--- a/clang/lib/Driver/ToolChains/MSVC.cpp
+++ b/clang/lib/Driver/ToolChains/MSVC.cpp
@@ -428,6 +428,9 @@ MSVCToolChain::MSVCToolChain(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args)
: ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args),
RocmInstallation(D, Triple, Args) {
+
+ RocmInstallation->setHostWindows(true);
+
getProgramPaths().push_back(getDriver().Dir);
std::optional<llvm::StringRef> VCToolsDir, VCToolsVersion;
@@ -453,6 +456,7 @@ MSVCToolChain::MSVCToolChain(const Driver &D, const llvm::Triple &Triple,
llvm::findVCToolChainViaSetupConfig(getVFS(), VCToolsVersion,
VCToolChainPath, VSLayout) ||
llvm::findVCToolChainViaRegistry(VCToolChainPath, VSLayout);
+
}
Tool *MSVCToolChain::buildLinker() const {
diff --git a/clang/lib/Driver/ToolChains/ROCm.h b/clang/lib/Driver/ToolChains/ROCm.h
index dceb0ab0366933..d766422396135d 100644
--- a/clang/lib/Driver/ToolChains/ROCm.h
+++ b/clang/lib/Driver/ToolChains/ROCm.h
@@ -80,6 +80,7 @@ class RocmInstallationDetector {
bool HasHIPStdParLibrary = false;
bool HasRocThrustLibrary = false;
bool HasRocPrimLibrary = false;
+ bool IsHostMSVC = false;
// Default version if not detected or specified.
const unsigned DefaultVersionMajor = 3;
@@ -111,6 +112,8 @@ class RocmInstallationDetector {
// Wheter -nogpulib is specified.
bool NoBuiltinLibs = false;
+ llvm::Triple TargetTriple;
+
// Paths
SmallString<0> InstallPath;
SmallString<0> BinPath;
@@ -166,7 +169,7 @@ class RocmInstallationDetector {
StringRef PackageName);
public:
- RocmInstallationDetector(const Driver &D, const llvm::Triple &HostTriple,
+ RocmInstallationDetector(const Driver &D, const llvm::Triple &TargetTriple,
const llvm::opt::ArgList &Args,
bool DetectHIPRuntime = true,
bool DetectDeviceLib = false);
@@ -193,6 +196,10 @@ class RocmInstallationDetector {
/// Check whether we detected a valid HIP STDPAR Acceleration library.
bool hasHIPStdParLibrary() const { return HasHIPStdParLibrary; }
+ /// Check whether the target triple is for Windows.
+ bool isHostWindows() const { return IsHostMSVC; }
+ void setHostWindows(bool val) { IsHostMSVC=val; }
+
/// Print information about the detected ROCm installation.
void print(raw_ostream &OS) const;
diff --git a/clang/test/Driver/rocm-detect-windows.hip b/clang/test/Driver/rocm-detect-windows.hip
new file mode 100644
index 00000000000000..d37a708e80b4fd
--- /dev/null
+++ b/clang/test/Driver/rocm-detect-windows.hip
@@ -0,0 +1,9 @@
+// REQUIRES: system-windows
+
+// Test to ensure that on Windows, we do not include linux sesrch paths
+// RUN: %clang -### -nogpulib -nogpuinc \
+// RUN: --print-rocm-search-dirs %s 2>&1 \
+// RUN: | FileCheck %s
+
+// CHECK-NOT: ROCm installation search path: {{/usr/local}}
+// CHECK-NOT: ROCm installation search path: {{/usr}}
>From 06352ff3bd0dad2b5c961b146f75e2e727369856 Mon Sep 17 00:00:00 2001
From: David <dsalinas at amd.com>
Date: Thu, 17 Oct 2024 00:01:21 +0100
Subject: [PATCH 2/3] debug and fix last commit
---
.project | 33 ++++++++++++++
.settings/.gitignore | 1 +
amd/comgr/.cproject | 16 +++++++
amd/comgr/.project | 20 +++++++++
clang/lib/Driver/Driver.cpp | 39 +++++++++++------
clang/lib/Driver/ToolChains/AMDGPU.cpp | 52 +++++++++++++++++------
clang/lib/Driver/ToolChains/Darwin.cpp | 5 ++-
clang/lib/Driver/ToolChains/Gnu.cpp | 5 +++
clang/lib/Driver/ToolChains/HIPAMD.cpp | 3 +-
clang/lib/Driver/ToolChains/MSVC.cpp | 8 +++-
clang/lib/Driver/ToolChains/MinGW.cpp | 3 ++
clang/lib/Driver/ToolChains/ROCm.h | 13 ++++--
clang/test/Driver/rocm-detect-windows.hip | 2 +-
13 files changed, 168 insertions(+), 32 deletions(-)
create mode 100644 .project
create mode 100644 .settings/.gitignore
create mode 100644 amd/comgr/.cproject
create mode 100644 amd/comgr/.project
diff --git a/.project b/.project
new file mode 100644
index 00000000000000..d372bbe16a0194
--- /dev/null
+++ b/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>llvm-project</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.autotools.core.genmakebuilderV2</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ <nature>org.eclipse.cdt.autotools.core.autotoolsNatureV2</nature>
+ </natures>
+</projectDescription>
diff --git a/.settings/.gitignore b/.settings/.gitignore
new file mode 100644
index 00000000000000..d81d4c414cc298
--- /dev/null
+++ b/.settings/.gitignore
@@ -0,0 +1 @@
+/language.settings.xml
diff --git a/amd/comgr/.cproject b/amd/comgr/.cproject
new file mode 100644
index 00000000000000..7d295f12215370
--- /dev/null
+++ b/amd/comgr/.cproject
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="org.eclipse.cdt.core.default.config.1793801460">
+ <storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="org.eclipse.cdt.core.default.config.1793801460" moduleId="org.eclipse.cdt.core.settings" name="Configuration">
+ <externalSettings/>
+ <extensions/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.pathentry">
+ <pathentry excluding="**/CMakeFiles/**" kind="out" path="build"/>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+</cproject>
\ No newline at end of file
diff --git a/amd/comgr/.project b/amd/comgr/.project
new file mode 100644
index 00000000000000..ce2d85f97017a9
--- /dev/null
+++ b/amd/comgr/.project
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>comgr</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.core.cBuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.cmake.core.cmakeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 221e222bdd47d9..5d9326f9f19bcc 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -769,7 +769,8 @@ Driver::OpenMPRuntimeKind Driver::getOpenMPRuntime(const ArgList &Args) const {
void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
InputList &Inputs) {
-
+ /* salinas */ fprintf(
+ stderr, "DAVE: Criver::CreateOffloadingDeviceToolChains ....\n");
//
// CUDA/HIP
//
@@ -812,7 +813,7 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
CudaInstallation.WarnIfUnsupportedVersion();
}
C.addOffloadDeviceToolChain(CudaTC.get(), OFK);
- } else if (IsHIP) {
+ } else if (IsHIP) { /* salinas */ fprintf(stderr,"\t creating HIP Offloading toolchain ...\n");
if (auto *OMPTargetArg =
C.getInputArgs().getLastArg(options::OPT_fopenmp_targets_EQ)) {
Diag(clang::diag::err_drv_unsupported_opt_for_language_mode)
@@ -820,6 +821,9 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
return;
}
const ToolChain *HostTC = C.getSingleOffloadToolChain<Action::OFK_Host>();
+ /* salinas */ fprintf(
+ stderr,
+ "Driver::CreateOffloadingDeviceToolChain .... OK got a HOST TC ...\n");
auto OFK = Action::OFK_HIP;
auto HIPTriple = getHIPOffloadTargetTriple(*this, C.getInputArgs());
if (!HIPTriple)
@@ -6329,7 +6333,7 @@ std::string Driver::GetClPchPath(Compilation &C, StringRef BaseName) const {
const ToolChain &Driver::getToolChain(const ArgList &Args,
const llvm::Triple &Target) const {
-
+ /* salinas */ fprintf(stderr, "Driver::getToolChain() ... ->%s<-\n",Target.str().c_str() );
auto &TC = ToolChains[Target.str()];
if (!TC) {
switch (Target.getOS()) {
@@ -6517,10 +6521,17 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
const ToolChain &Driver::getOffloadingDeviceToolChain(
const ArgList &Args, const llvm::Triple &Target, const ToolChain &HostTC,
const Action::OffloadKind &TargetDeviceOffloadKind) const {
+ /* salinas */ fprintf(stderr,"===== Driver::getOffloadingDeviceToolChain() ....\n");
+ if (HostTC.getTriple().isWindowsMSVCEnvironment())
+ fprintf(stderr, "\t\t HOST TC IS WINDOWS !!!!!\n");
+ else
+ fprintf(stderr, "\t\t HOST TC is NOT Windows \n");
+
// Use device / host triples as the key into the ToolChains map because the
// device ToolChain we create depends on both.
auto &TC = ToolChains[Target.str() + "/" + HostTC.getTriple().str()];
if (!TC) {
+ /* salinas */ fprintf(stderr, "\t\t DIDN't GET a TC .....\n");
// Categorized by offload kind > arch rather than OS > arch like
// the normal getToolChain call, as it seems a reasonable way to categorize
// things.
@@ -6530,21 +6541,25 @@ const ToolChain &Driver::getOffloadingDeviceToolChain(
Target.getArch() == llvm::Triple::spirv64) &&
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);
- 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);
+ !Args.hasArgNoClaim(options::OPT_offload_EQ)) /* salinas */ {
+ fprintf(stderr, "\t creating HIPAMDToolChain ...\n");
+ 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) /* salinas */ {
+ fprintf(stderr, "\t creating HIPSPVToolChain\n");
+ TC = std::make_unique<toolchains::HIPSPVToolChain>(
+ *this, Target, HostTC, Args); /* salinas */
+ }
break;
}
default:
break;
}
}
-
+ /* salinas */ fprintf(stderr,
+ "\t end of Driver::getOffloadDeviceToolChain\n");
return *TC;
}
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index 1bd891498ca0d4..e63de56f69bb62 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -180,6 +180,8 @@ bool RocmInstallationDetector::parseHIPVersionFile(llvm::StringRef V) {
const SmallVectorImpl<RocmInstallationDetector::Candidate> &
RocmInstallationDetector::getInstallationPathCandidates() {
+ /* salinas */ fprintf(stderr,"DAVE: RocmInstallationDetector::getInstallationPathCandidates() ...\n");
+
// Return the cached candidate list if it has already been populated.
if (!ROCmSearchDirs.empty())
return ROCmSearchDirs;
@@ -306,7 +308,12 @@ RocmInstallationDetector::getInstallationPathCandidates() {
LatestVer = Ver;
}
}
- if (!isHostWindows()) {
+
+ fprintf(stderr,"DAVE: checking isHostWindows() ...\n"); /* salinas */
+
+ if (!isHostWindows()) { /* salinas */
+ fprintf(stderr, "\t NOT WINDOWS ....\n");
+
if (!LatestROCm.empty())
ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/" + LatestROCm,
/*StrictChecking=*/true);
@@ -315,7 +322,7 @@ RocmInstallationDetector::getInstallationPathCandidates() {
/*StrictChecking=*/true);
ROCmSearchDirs.emplace_back(D.SysRoot + "/usr",
/*StrictChecking=*/true);
- }
+ } /* salinas */ else fprintf(stderr,"\t IS WINDOWS!\n");
DoPrintROCmSearchDirs();
return ROCmSearchDirs;
@@ -323,8 +330,11 @@ RocmInstallationDetector::getInstallationPathCandidates() {
RocmInstallationDetector::RocmInstallationDetector(
const Driver &D, const llvm::Triple &TargetTriple,
- const llvm::opt::ArgList &Args, bool DetectHIPRuntime, bool DetectDeviceLib)
+ const llvm::opt::ArgList &Args /*, SALINAS bool DetectHIPRuntime,
+ bool DetectDeviceLib, bool isMSVC*/)
: D(D), TargetTriple(TargetTriple) {
+ /* salinas */ fprintf(stderr,"RocmInstallationDetector::RocmInstallationDetector() ... \n");
+ /* SALINAS IsHostMSVC = isMSVC; */
Verbose = Args.hasArg(options::OPT_v);
RocmPathArg = Args.getLastArgValue(clang::driver::options::OPT_rocm_path_EQ);
PrintROCmSearchDirs =
@@ -378,10 +388,13 @@ RocmInstallationDetector::RocmInstallationDetector(
.str();
}
- if (DetectHIPRuntime)
- detectHIPRuntime();
- if (DetectDeviceLib)
- detectDeviceLibrary();
+ //if (DetectHIPRuntime) /* salinas */ {
+ // fprintf(stderr, "DAVE: RocmInstallationDetector ctor: calling "
+ // "detectHIPRuntime() ...\n");
+ // detectHIPRuntime();
+ //}
+ //if (DetectDeviceLib)
+ // detectDeviceLibrary();
}
void RocmInstallationDetector::detectDeviceLibrary() {
@@ -437,6 +450,7 @@ void RocmInstallationDetector::detectDeviceLibrary() {
// Find device libraries in a legacy ROCm directory structure
// ${ROCM_ROOT}/amdgcn/bitcode/*
+ /* salinas */ fprintf(stderr,"DAVE 1: calling getInstallationPathCandidates()\n");
auto &ROCmDirs = getInstallationPathCandidates();
for (const auto &Candidate : ROCmDirs) {
LibDevicePath = Candidate.Path;
@@ -447,7 +461,11 @@ void RocmInstallationDetector::detectDeviceLibrary() {
}
}
-void RocmInstallationDetector::detectHIPRuntime() {
+void RocmInstallationDetector::detectHIPRuntime() { /* salinas */
+ fprintf(stderr, "DAVE: RocmInstallationDetector::detectHIPRuntime()\n");
+ /* salinas */ std::optional<std::string> dave =
+ llvm::sys::Process::GetEnv("HIP_PATH");
+ /* salinas */ if (dave) fprintf(stderr, "DAVE: in detectHIPRuntime(): HIP_PATH = %s\n",(*dave).c_str());
SmallVector<Candidate, 4> HIPSearchDirs;
if (!HIPPathArg.empty())
HIPSearchDirs.emplace_back(HIPPathArg.str());
@@ -456,8 +474,12 @@ void RocmInstallationDetector::detectHIPRuntime() {
if (!HIPPathEnv->empty())
HIPSearchDirs.emplace_back(std::move(*HIPPathEnv));
}
- if (HIPSearchDirs.empty())
+ if (HIPSearchDirs.empty()) { /* salinas */
+ /* salinas */ fprintf(stderr,"DAVE 1: calling getInstallationPathCandidates()\n");
HIPSearchDirs.append(getInstallationPathCandidates());
+ } /* salinas */ else
+ fprintf(stderr,
+ "DAVE: detectHIPRuntime() .... HIPSearchDirs is NOT empty!\n");
auto &FS = D.getVFS();
for (const auto &Candidate : HIPSearchDirs) {
@@ -688,13 +710,16 @@ 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"}}) { /* salinas */
+ fprintf(stderr, "========= DAVE =========== AMDGPUToolChain() ctor ....\n");
// 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
// each tool invocation.
checkAMDGPUCodeObjectVersion(D, Args);
+ /* salinas */ fprintf(
+ stderr, " ===== DVE: AMDGPUToolChain ctor END ..... =========\n");
}
Tool *AMDGPUToolChain::buildLinker() const {
@@ -823,10 +848,13 @@ bool AMDGPUToolChain::isWave64(const llvm::opt::ArgList &DriverArgs,
/// ROCM Toolchain
ROCMToolChain::ROCMToolChain(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args, bool isHostTCMSVC)
- : AMDGPUToolChain(D, Triple, Args) {
+ : AMDGPUToolChain(D, Triple, Args) { /* salinas */ fprintf(stderr,"DAVE: ROCMToolChain::ROCMToolChain() ...\n");
+ /* salinas */ fprintf(
+ stderr, "DAVE: in ROCMToolChain ctor calling setHostWindows()\n");
RocmInstallation->setHostWindows(isHostTCMSVC);
RocmInstallation->detectDeviceLibrary();
+ /* salinas */ fprintf(stderr, "DAVE: end of ROCMToolChain ctor\n");
}
void AMDGPUToolChain::addClangTargetOptions(
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 64ab328a6d25f6..6ef576e3b79111 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -931,7 +931,10 @@ 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) {
+ /* SALINAS*/
+ RocmInstallation->init();
+}
types::ID MachO::LookupTypeForExtension(StringRef Ext) const {
types::ID Ty = ToolChain::LookupTypeForExtension(Ext);
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index b141e5f2adfab1..8dc710b7bffc62 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -3050,6 +3050,11 @@ Generic_GCC::Generic_GCC(const Driver &D, const llvm::Triple &Triple,
: ToolChain(D, Triple, Args), GCCInstallation(D),
CudaInstallation(D, Triple, Args), RocmInstallation(D, Triple, Args) {
getProgramPaths().push_back(getDriver().Dir);
+ /* SALINAS */
+ /* salinas */ fprintf(
+ stderr,
+ " +++++++++ Generic_GCC ctor ... about to call rocninstall init ...\n");
+ //RocmInstallation->init();
}
Generic_GCC::~Generic_GCC() {}
diff --git a/clang/lib/Driver/ToolChains/HIPAMD.cpp b/clang/lib/Driver/ToolChains/HIPAMD.cpp
index 4fe7e75360726d..40e478620dc3a2 100644
--- a/clang/lib/Driver/ToolChains/HIPAMD.cpp
+++ b/clang/lib/Driver/ToolChains/HIPAMD.cpp
@@ -250,7 +250,7 @@ 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) { /* salinas */ fprintf(stderr,"DAVE: HIPAMDToolChain::HIPAMDToolChain() ...\n");
// Lookup binaries into the driver directory, this is used to
// discover the clang-offload-bundler executable.
getProgramPaths().push_back(getDriver().Dir);
@@ -265,6 +265,7 @@ HIPAMDToolChain::HIPAMDToolChain(const Driver &D, const llvm::Triple &Triple,
D.getDiags().Report(clang::diag::warn_drv_unsupported_option_for_target)
<< A->getAsString(Args) << getTriple().str();
}
+ /* salinas */ fprintf(stderr, "DAVE: end of HIPAMDToolChain ctor\n");
}
void HIPAMDToolChain::addClangTargetOptions(
diff --git a/clang/lib/Driver/ToolChains/MSVC.cpp b/clang/lib/Driver/ToolChains/MSVC.cpp
index 7526c6613f4dd7..ade85422bc2542 100644
--- a/clang/lib/Driver/ToolChains/MSVC.cpp
+++ b/clang/lib/Driver/ToolChains/MSVC.cpp
@@ -427,9 +427,12 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
MSVCToolChain::MSVCToolChain(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args)
: ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args),
- RocmInstallation(D, Triple, Args) {
-
+ RocmInstallation(D, Triple, Args) { /* salinas */ fprintf(stderr,"DAVE: MSVCToolChain::MSVCToolChain() ... \n");
+ /* salnas */ fprintf(stderr,
+ "DAVE in MSVCToolChain ctor calling setHostWindows()\n");
RocmInstallation->setHostWindows(true);
+ /* SALINAS */
+ RocmInstallation->init();
getProgramPaths().push_back(getDriver().Dir);
@@ -457,6 +460,7 @@ MSVCToolChain::MSVCToolChain(const Driver &D, const llvm::Triple &Triple,
VCToolChainPath, VSLayout) ||
llvm::findVCToolChainViaRegistry(VCToolChainPath, VSLayout);
+ /* salinas */ fprintf(stderr, "DAVE: end of MSVC ToolChain ctor\n");
}
Tool *MSVCToolChain::buildLinker() const {
diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp
index c81a7ed1702963..8edad36dc87639 100644
--- a/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -487,6 +487,9 @@ 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 */
+ RocmInstallation->init();
+
getProgramPaths().push_back(getDriver().Dir);
std::string InstallBase =
diff --git a/clang/lib/Driver/ToolChains/ROCm.h b/clang/lib/Driver/ToolChains/ROCm.h
index d766422396135d..21ee84bcf73fe3 100644
--- a/clang/lib/Driver/ToolChains/ROCm.h
+++ b/clang/lib/Driver/ToolChains/ROCm.h
@@ -170,9 +170,10 @@ class RocmInstallationDetector {
public:
RocmInstallationDetector(const Driver &D, const llvm::Triple &TargetTriple,
- const llvm::opt::ArgList &Args,
+ const llvm::opt::ArgList &Args/* SALINAS ,
bool DetectHIPRuntime = true,
- bool DetectDeviceLib = false);
+ bool DetectDeviceLib = false,
+ bool isMSVC = false*/);
/// Get file paths of default bitcode libraries common to AMDGPU based
/// toolchains.
@@ -198,7 +199,7 @@ class RocmInstallationDetector {
/// 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; /* salinas */ fprintf(stderr,"DAVE: RocmInstallationDetector::setHostWindows()\n"); }
/// Print information about the detected ROCm installation.
void print(raw_ostream &OS) const;
@@ -279,6 +280,12 @@ class RocmInstallationDetector {
return Loc->second;
}
+ /* SALINAS */
+ void init() {
+ fprintf(stderr, "DAVE: RocmInstallationDetector::init()\n");
+ detectHIPRuntime();
+ detectDeviceLibrary();
+ }
void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const;
diff --git a/clang/test/Driver/rocm-detect-windows.hip b/clang/test/Driver/rocm-detect-windows.hip
index d37a708e80b4fd..79a4ce4b415639 100644
--- a/clang/test/Driver/rocm-detect-windows.hip
+++ b/clang/test/Driver/rocm-detect-windows.hip
@@ -3,7 +3,7 @@
// Test to ensure that on Windows, we do not include linux sesrch paths
// RUN: %clang -### -nogpulib -nogpuinc \
// RUN: --print-rocm-search-dirs %s 2>&1 \
-// RUN: | FileCheck %s
+// RUN: | FileCheck %s --dump-input-context 100
// CHECK-NOT: ROCm installation search path: {{/usr/local}}
// CHECK-NOT: ROCm installation search path: {{/usr}}
>From 01fa7e4ea72b96735d85ed0511d44ca4df106e41 Mon Sep 17 00:00:00 2001
From: David <dsalinas at amd.com>
Date: Mon, 21 Oct 2024 21:47:15 +0100
Subject: [PATCH 3/3] remove debug stmts
---
clang/lib/Driver/Driver.cpp | 27 +++-------------
clang/lib/Driver/ToolChains/AMDGPU.cpp | 38 +++++------------------
clang/lib/Driver/ToolChains/Darwin.cpp | 2 --
clang/lib/Driver/ToolChains/Gnu.cpp | 5 ---
clang/lib/Driver/ToolChains/HIPAMD.cpp | 3 +-
clang/lib/Driver/ToolChains/MSVC.cpp | 6 +---
clang/lib/Driver/ToolChains/ROCm.h | 2 +-
clang/test/Driver/rocm-detect-windows.hip | 2 +-
8 files changed, 17 insertions(+), 68 deletions(-)
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 5d9326f9f19bcc..eac895b74969ab 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -769,8 +769,6 @@ Driver::OpenMPRuntimeKind Driver::getOpenMPRuntime(const ArgList &Args) const {
void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
InputList &Inputs) {
- /* salinas */ fprintf(
- stderr, "DAVE: Criver::CreateOffloadingDeviceToolChains ....\n");
//
// CUDA/HIP
//
@@ -813,7 +811,7 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
CudaInstallation.WarnIfUnsupportedVersion();
}
C.addOffloadDeviceToolChain(CudaTC.get(), OFK);
- } else if (IsHIP) { /* salinas */ fprintf(stderr,"\t creating HIP Offloading toolchain ...\n");
+ } else if (IsHIP) {
if (auto *OMPTargetArg =
C.getInputArgs().getLastArg(options::OPT_fopenmp_targets_EQ)) {
Diag(clang::diag::err_drv_unsupported_opt_for_language_mode)
@@ -821,9 +819,6 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
return;
}
const ToolChain *HostTC = C.getSingleOffloadToolChain<Action::OFK_Host>();
- /* salinas */ fprintf(
- stderr,
- "Driver::CreateOffloadingDeviceToolChain .... OK got a HOST TC ...\n");
auto OFK = Action::OFK_HIP;
auto HIPTriple = getHIPOffloadTargetTriple(*this, C.getInputArgs());
if (!HIPTriple)
@@ -6333,7 +6328,6 @@ std::string Driver::GetClPchPath(Compilation &C, StringRef BaseName) const {
const ToolChain &Driver::getToolChain(const ArgList &Args,
const llvm::Triple &Target) const {
- /* salinas */ fprintf(stderr, "Driver::getToolChain() ... ->%s<-\n",Target.str().c_str() );
auto &TC = ToolChains[Target.str()];
if (!TC) {
switch (Target.getOS()) {
@@ -6521,17 +6515,11 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
const ToolChain &Driver::getOffloadingDeviceToolChain(
const ArgList &Args, const llvm::Triple &Target, const ToolChain &HostTC,
const Action::OffloadKind &TargetDeviceOffloadKind) const {
- /* salinas */ fprintf(stderr,"===== Driver::getOffloadingDeviceToolChain() ....\n");
- if (HostTC.getTriple().isWindowsMSVCEnvironment())
- fprintf(stderr, "\t\t HOST TC IS WINDOWS !!!!!\n");
- else
- fprintf(stderr, "\t\t HOST TC is NOT Windows \n");
// Use device / host triples as the key into the ToolChains map because the
// device ToolChain we create depends on both.
auto &TC = ToolChains[Target.str() + "/" + HostTC.getTriple().str()];
if (!TC) {
- /* salinas */ fprintf(stderr, "\t\t DIDN't GET a TC .....\n");
// Categorized by offload kind > arch rather than OS > arch like
// the normal getToolChain call, as it seems a reasonable way to categorize
// things.
@@ -6541,25 +6529,20 @@ const ToolChain &Driver::getOffloadingDeviceToolChain(
Target.getArch() == llvm::Triple::spirv64) &&
Target.getVendor() == llvm::Triple::AMD &&
Target.getOS() == llvm::Triple::AMDHSA) ||
- !Args.hasArgNoClaim(options::OPT_offload_EQ)) /* salinas */ {
- fprintf(stderr, "\t creating HIPAMDToolChain ...\n");
+ !Args.hasArgNoClaim(options::OPT_offload_EQ))
TC = std::make_unique<toolchains::HIPAMDToolChain>(
*this, Target, HostTC, Args);
- } else if (Target.getArch() == llvm::Triple::spirv64 &&
+ else if (Target.getArch() == llvm::Triple::spirv64 &&
Target.getVendor() == llvm::Triple::UnknownVendor &&
- Target.getOS() == llvm::Triple::UnknownOS) /* salinas */ {
- fprintf(stderr, "\t creating HIPSPVToolChain\n");
+ Target.getOS() == llvm::Triple::UnknownOS)
TC = std::make_unique<toolchains::HIPSPVToolChain>(
- *this, Target, HostTC, Args); /* salinas */
- }
+ *this, Target, HostTC, Args);
break;
}
default:
break;
}
}
- /* salinas */ fprintf(stderr,
- "\t end of Driver::getOffloadDeviceToolChain\n");
return *TC;
}
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index e63de56f69bb62..8df8c16345ba46 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -180,8 +180,6 @@ bool RocmInstallationDetector::parseHIPVersionFile(llvm::StringRef V) {
const SmallVectorImpl<RocmInstallationDetector::Candidate> &
RocmInstallationDetector::getInstallationPathCandidates() {
- /* salinas */ fprintf(stderr,"DAVE: RocmInstallationDetector::getInstallationPathCandidates() ...\n");
-
// Return the cached candidate list if it has already been populated.
if (!ROCmSearchDirs.empty())
return ROCmSearchDirs;
@@ -309,10 +307,7 @@ RocmInstallationDetector::getInstallationPathCandidates() {
}
}
- fprintf(stderr,"DAVE: checking isHostWindows() ...\n"); /* salinas */
-
- if (!isHostWindows()) { /* salinas */
- fprintf(stderr, "\t NOT WINDOWS ....\n");
+ if (!isHostWindows()) {
if (!LatestROCm.empty())
ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/" + LatestROCm,
@@ -322,7 +317,7 @@ RocmInstallationDetector::getInstallationPathCandidates() {
/*StrictChecking=*/true);
ROCmSearchDirs.emplace_back(D.SysRoot + "/usr",
/*StrictChecking=*/true);
- } /* salinas */ else fprintf(stderr,"\t IS WINDOWS!\n");
+ }
DoPrintROCmSearchDirs();
return ROCmSearchDirs;
@@ -333,7 +328,6 @@ RocmInstallationDetector::RocmInstallationDetector(
const llvm::opt::ArgList &Args /*, SALINAS bool DetectHIPRuntime,
bool DetectDeviceLib, bool isMSVC*/)
: D(D), TargetTriple(TargetTriple) {
- /* salinas */ fprintf(stderr,"RocmInstallationDetector::RocmInstallationDetector() ... \n");
/* SALINAS IsHostMSVC = isMSVC; */
Verbose = Args.hasArg(options::OPT_v);
RocmPathArg = Args.getLastArgValue(clang::driver::options::OPT_rocm_path_EQ);
@@ -388,9 +382,8 @@ RocmInstallationDetector::RocmInstallationDetector(
.str();
}
- //if (DetectHIPRuntime) /* salinas */ {
- // fprintf(stderr, "DAVE: RocmInstallationDetector ctor: calling "
- // "detectHIPRuntime() ...\n");
+ // SALINAS
+ //if (DetectHIPRuntime)
// detectHIPRuntime();
//}
//if (DetectDeviceLib)
@@ -450,7 +443,6 @@ void RocmInstallationDetector::detectDeviceLibrary() {
// Find device libraries in a legacy ROCm directory structure
// ${ROCM_ROOT}/amdgcn/bitcode/*
- /* salinas */ fprintf(stderr,"DAVE 1: calling getInstallationPathCandidates()\n");
auto &ROCmDirs = getInstallationPathCandidates();
for (const auto &Candidate : ROCmDirs) {
LibDevicePath = Candidate.Path;
@@ -461,11 +453,7 @@ void RocmInstallationDetector::detectDeviceLibrary() {
}
}
-void RocmInstallationDetector::detectHIPRuntime() { /* salinas */
- fprintf(stderr, "DAVE: RocmInstallationDetector::detectHIPRuntime()\n");
- /* salinas */ std::optional<std::string> dave =
- llvm::sys::Process::GetEnv("HIP_PATH");
- /* salinas */ if (dave) fprintf(stderr, "DAVE: in detectHIPRuntime(): HIP_PATH = %s\n",(*dave).c_str());
+void RocmInstallationDetector::detectHIPRuntime() {
SmallVector<Candidate, 4> HIPSearchDirs;
if (!HIPPathArg.empty())
HIPSearchDirs.emplace_back(HIPPathArg.str());
@@ -474,12 +462,8 @@ void RocmInstallationDetector::detectHIPRuntime() { /* salinas */
if (!HIPPathEnv->empty())
HIPSearchDirs.emplace_back(std::move(*HIPPathEnv));
}
- if (HIPSearchDirs.empty()) { /* salinas */
- /* salinas */ fprintf(stderr,"DAVE 1: calling getInstallationPathCandidates()\n");
+ if (HIPSearchDirs.empty())
HIPSearchDirs.append(getInstallationPathCandidates());
- } /* salinas */ else
- fprintf(stderr,
- "DAVE: detectHIPRuntime() .... HIPSearchDirs is NOT empty!\n");
auto &FS = D.getVFS();
for (const auto &Candidate : HIPSearchDirs) {
@@ -711,15 +695,12 @@ 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"}}) { /* salinas */
- fprintf(stderr, "========= DAVE =========== AMDGPUToolChain() ctor ....\n");
+ {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
// each tool invocation.
checkAMDGPUCodeObjectVersion(D, Args);
- /* salinas */ fprintf(
- stderr, " ===== DVE: AMDGPUToolChain ctor END ..... =========\n");
}
Tool *AMDGPUToolChain::buildLinker() const {
@@ -848,13 +829,10 @@ bool AMDGPUToolChain::isWave64(const llvm::opt::ArgList &DriverArgs,
/// ROCM Toolchain
ROCMToolChain::ROCMToolChain(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args, bool isHostTCMSVC)
- : AMDGPUToolChain(D, Triple, Args) { /* salinas */ fprintf(stderr,"DAVE: ROCMToolChain::ROCMToolChain() ...\n");
- /* salinas */ fprintf(
- stderr, "DAVE: in ROCMToolChain ctor calling setHostWindows()\n");
+ : AMDGPUToolChain(D, Triple, Args) {
RocmInstallation->setHostWindows(isHostTCMSVC);
RocmInstallation->detectDeviceLibrary();
- /* salinas */ fprintf(stderr, "DAVE: end of ROCMToolChain ctor\n");
}
void AMDGPUToolChain::addClangTargetOptions(
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 6ef576e3b79111..e805639dc288d8 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -932,8 +932,6 @@ MachO::MachO(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
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) {
- /* SALINAS*/
- RocmInstallation->init();
}
types::ID MachO::LookupTypeForExtension(StringRef Ext) const {
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 8dc710b7bffc62..b141e5f2adfab1 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -3050,11 +3050,6 @@ Generic_GCC::Generic_GCC(const Driver &D, const llvm::Triple &Triple,
: ToolChain(D, Triple, Args), GCCInstallation(D),
CudaInstallation(D, Triple, Args), RocmInstallation(D, Triple, Args) {
getProgramPaths().push_back(getDriver().Dir);
- /* SALINAS */
- /* salinas */ fprintf(
- stderr,
- " +++++++++ Generic_GCC ctor ... about to call rocninstall init ...\n");
- //RocmInstallation->init();
}
Generic_GCC::~Generic_GCC() {}
diff --git a/clang/lib/Driver/ToolChains/HIPAMD.cpp b/clang/lib/Driver/ToolChains/HIPAMD.cpp
index 40e478620dc3a2..4fe7e75360726d 100644
--- a/clang/lib/Driver/ToolChains/HIPAMD.cpp
+++ b/clang/lib/Driver/ToolChains/HIPAMD.cpp
@@ -250,7 +250,7 @@ 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) { /* salinas */ fprintf(stderr,"DAVE: HIPAMDToolChain::HIPAMDToolChain() ...\n");
+ : 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);
@@ -265,7 +265,6 @@ HIPAMDToolChain::HIPAMDToolChain(const Driver &D, const llvm::Triple &Triple,
D.getDiags().Report(clang::diag::warn_drv_unsupported_option_for_target)
<< A->getAsString(Args) << getTriple().str();
}
- /* salinas */ fprintf(stderr, "DAVE: end of HIPAMDToolChain ctor\n");
}
void HIPAMDToolChain::addClangTargetOptions(
diff --git a/clang/lib/Driver/ToolChains/MSVC.cpp b/clang/lib/Driver/ToolChains/MSVC.cpp
index ade85422bc2542..1beac8a9209fa2 100644
--- a/clang/lib/Driver/ToolChains/MSVC.cpp
+++ b/clang/lib/Driver/ToolChains/MSVC.cpp
@@ -427,9 +427,7 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
MSVCToolChain::MSVCToolChain(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args)
: ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args),
- RocmInstallation(D, Triple, Args) { /* salinas */ fprintf(stderr,"DAVE: MSVCToolChain::MSVCToolChain() ... \n");
- /* salnas */ fprintf(stderr,
- "DAVE in MSVCToolChain ctor calling setHostWindows()\n");
+ RocmInstallation(D, Triple, Args) {
RocmInstallation->setHostWindows(true);
/* SALINAS */
RocmInstallation->init();
@@ -459,8 +457,6 @@ MSVCToolChain::MSVCToolChain(const Driver &D, const llvm::Triple &Triple,
llvm::findVCToolChainViaSetupConfig(getVFS(), VCToolsVersion,
VCToolChainPath, VSLayout) ||
llvm::findVCToolChainViaRegistry(VCToolChainPath, VSLayout);
-
- /* salinas */ fprintf(stderr, "DAVE: end of MSVC ToolChain ctor\n");
}
Tool *MSVCToolChain::buildLinker() const {
diff --git a/clang/lib/Driver/ToolChains/ROCm.h b/clang/lib/Driver/ToolChains/ROCm.h
index 21ee84bcf73fe3..10baa4e06701a5 100644
--- a/clang/lib/Driver/ToolChains/ROCm.h
+++ b/clang/lib/Driver/ToolChains/ROCm.h
@@ -199,7 +199,7 @@ class RocmInstallationDetector {
/// Check whether the target triple is for Windows.
bool isHostWindows() const { return IsHostMSVC; }
- void setHostWindows(bool val) { IsHostMSVC=val; /* salinas */ fprintf(stderr,"DAVE: RocmInstallationDetector::setHostWindows()\n"); }
+ void setHostWindows(bool val) { IsHostMSVC=val;}
/// Print information about the detected ROCm installation.
void print(raw_ostream &OS) const;
diff --git a/clang/test/Driver/rocm-detect-windows.hip b/clang/test/Driver/rocm-detect-windows.hip
index 79a4ce4b415639..d37a708e80b4fd 100644
--- a/clang/test/Driver/rocm-detect-windows.hip
+++ b/clang/test/Driver/rocm-detect-windows.hip
@@ -3,7 +3,7 @@
// Test to ensure that on Windows, we do not include linux sesrch paths
// RUN: %clang -### -nogpulib -nogpuinc \
// RUN: --print-rocm-search-dirs %s 2>&1 \
-// RUN: | FileCheck %s --dump-input-context 100
+// RUN: | FileCheck %s
// CHECK-NOT: ROCm installation search path: {{/usr/local}}
// CHECK-NOT: ROCm installation search path: {{/usr}}
More information about the cfe-commits
mailing list