Skip to content

Commit 970ea3e

Browse files
david-salinasDavid Salinas
authored and
David Salinas
committed
Hipcc mishandles paths when HIP_PLATFORM=nvidia on Window
SWDEV-457608 - [Windows Hip/ROCm SDK]Blender building is getting failed when CUDA installed on the config. Change-Id: Idbda75a0b5febbd76786e04b775f1f190fc53e66
1 parent a1d1633 commit 970ea3e

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

amd/hipcc/src/hipBin_nvidia.h

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ string HipBinNvidia::getHipCC() const {
112112
hipCCPath = cudaPath;
113113
hipCCPath /= "bin/nvcc";
114114
hipCC = hipCCPath.string();
115+
if (getOSInfo() == windows)
116+
hipCC = "\"" + hipCC + "\"";
115117
return hipCC;
116118
}
117119

@@ -176,7 +178,11 @@ string HipBinNvidia::getHipInclude() const {
176178
void HipBinNvidia::initializeHipLdFlags() {
177179
string hipLdFlags;
178180
const string& cudaPath = getCompilerPath();
179-
hipLdFlags = " -Wno-deprecated-gpu-targets -lcuda -lcudart -L" +
181+
if (getOSInfo() == windows)
182+
hipLdFlags = " -Wno-deprecated-gpu-targets -lcuda -lcudart -L\"" +
183+
cudaPath + "/lib64\"";
184+
else
185+
hipLdFlags = " -Wno-deprecated-gpu-targets -lcuda -lcudart -L" +
180186
cudaPath + "/lib64";
181187
hipLdFlags_ = hipLdFlags;
182188
}
@@ -196,7 +202,10 @@ const string& HipBinNvidia::getHipLdFlags() const {
196202
void HipBinNvidia::initializeHipCFlags() {
197203
string hipCFlags;
198204
const string& cudaPath = getCompilerPath();
199-
hipCFlags += " -isystem " + cudaPath + "/include";
205+
if (getOSInfo() == windows)
206+
hipCFlags += " -isystem \"" + cudaPath + "/include\"";
207+
else
208+
hipCFlags += " -isystem " + cudaPath + "/include";
200209
string hipIncludePath;
201210
hipIncludePath = getHipInclude();
202211
hipCFlags += " -isystem \"" + hipIncludePath + "\"";
@@ -212,7 +221,10 @@ const string& HipBinNvidia::getHipCXXFlags() const {
212221
void HipBinNvidia::initializeHipCXXFlags() {
213222
string hipCXXFlags = " -Wno-deprecated-gpu-targets ";
214223
const string& cudaPath = getCompilerPath();
215-
hipCXXFlags += " -isystem " + cudaPath + "/include";
224+
if (getOSInfo() == windows)
225+
hipCXXFlags += " -isystem \"" + cudaPath + "/include\"";
226+
else
227+
hipCXXFlags += " -isystem " + cudaPath + "/include";
216228
string hipIncludePath;
217229
hipIncludePath = getHipInclude();
218230
hipCXXFlags += " -isystem \"" + hipIncludePath + "\"";
@@ -253,7 +265,10 @@ void HipBinNvidia::printCompilerInfo() const {
253265
fs::path nvcc;
254266
nvcc = getCompilerPath();
255267
nvcc /= "bin/nvcc";
256-
cmd = nvcc.string() + " --version";
268+
if (getOSInfo() == windows)
269+
cmd = "\"" + nvcc.string() + "\"" + " --version";
270+
else
271+
cmd = nvcc.string() + " --version";
257272
system(cmd.c_str());
258273
}
259274

@@ -263,7 +278,10 @@ string HipBinNvidia::getCompilerVersion() {
263278
fs::path nvcc;
264279
nvcc = getCompilerPath();
265280
nvcc /= "bin/nvcc";
266-
cmd = nvcc.string() + " --version";
281+
if (getOSInfo() == windows)
282+
cmd = "\"" + nvcc.string() + "\"" + " --version";
283+
else
284+
cmd = nvcc.string() + " --version";
267285
system(cmd.c_str());
268286
return compilerVersion;
269287
}
@@ -591,6 +609,9 @@ void HipBinNvidia::executeHipCCCmd(vector<string> argv) {
591609
}
592610
if (runCmd) {
593611
SystemCmdOut sysOut;
612+
if (os == windows)
613+
CMD = "\"" + CMD + "\"";
614+
594615
sysOut = hipBinUtilPtr_->exec(CMD.c_str(), true);
595616
string cmdOut = sysOut.out;
596617
int CMD_EXIT_CODE = sysOut.exitCode;

0 commit comments

Comments
 (0)