From b87e1a34224245155e94f029a8f01cd6d69dd533 Mon Sep 17 00:00:00 2001 From: Siu Chi Chan Date: Wed, 7 Sep 2022 14:18:34 -0400 Subject: [PATCH 1/5] Remove the --enable-new-dtags Don't pass the --enable-new-dtags flag to clang, just the LLVM's default --- amd/hipcc/src/hipBin_amd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amd/hipcc/src/hipBin_amd.h b/amd/hipcc/src/hipBin_amd.h index f94e4a59a59f05..b94bdd9a7d2382 100644 --- a/amd/hipcc/src/hipBin_amd.h +++ b/amd/hipcc/src/hipBin_amd.h @@ -1100,7 +1100,7 @@ void HipBinAmd::executeHipCCCmd(vector argv) { roccmPath+ "/lib -lhsa-runtime64 -ldl -lnuma " + toolArgs; toolArgs = toolArgTemp; } else { - toolArgTemp = toolArgs + " -Wl,--enable-new-dtags -Wl,-rpath=" + hipLibPath + ":" + toolArgTemp = toolArgs + " -Wl,-rpath=" + hipLibPath + ":" + roccmPath+"/lib -lamdhip64 "; toolArgs = toolArgTemp; } From b2fedeebf97e80f3729002ab8e0a608956d4e0c4 Mon Sep 17 00:00:00 2001 From: Mark Searles Date: Thu, 15 Sep 2022 12:38:31 -0700 Subject: [PATCH 2/5] Use llvm-readelf rather than readelf --- amd/hipcc/src/hipBin_amd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amd/hipcc/src/hipBin_amd.h b/amd/hipcc/src/hipBin_amd.h index b94bdd9a7d2382..714eb3e5ad14c9 100644 --- a/amd/hipcc/src/hipBin_amd.h +++ b/amd/hipcc/src/hipBin_amd.h @@ -847,7 +847,7 @@ void HipBinAmd::executeHipCCCmd(vector argv) { isObj = (hipBinUtilPtr_->substringPresent(fileType, "ELF") || hipBinUtilPtr_->substringPresent(fileType, "COFF")); if (hipBinUtilPtr_->substringPresent(fileType, "ELF")) { - cmd = "readelf -e -W " + obj; + cmd = "llvm-readelf -e -W " + obj; SystemCmdOut sysOut; sysOut = hipBinUtilPtr_->exec(cmd.c_str()); string sections = sysOut.out; From 9d3864f6670e5606fe091dd8e39f7827b45c70e4 Mon Sep 17 00:00:00 2001 From: Siu Chi Chan Date: Wed, 7 Sep 2022 17:49:05 -0400 Subject: [PATCH 3/5] SWDEV-355608 - hipcc: remove -use_fast_math It doesn't seem to provide any functionality, probably leftover from some experimental codes. --- amd/hipcc/src/hipBin_amd.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/amd/hipcc/src/hipBin_amd.h b/amd/hipcc/src/hipBin_amd.h index 714eb3e5ad14c9..a6f044fcc2470a 100644 --- a/amd/hipcc/src/hipBin_amd.h +++ b/amd/hipcc/src/hipBin_amd.h @@ -689,10 +689,6 @@ void HipBinAmd::executeHipCCCmd(vector argv) { compileOnly = 1; buildDeps = 1; } - if (trimarg == "-use_fast_math") { - HIPCXXFLAGS += " -DHIP_FAST_MATH "; - HIPCFLAGS += " -DHIP_FAST_MATH "; - } if ((trimarg == "-use-staticlib") && (setLinkType == 0)) { linkType = 0; setLinkType = 1; From d0a48e9ff617cb08397ec9f098665df4dd7eac7b Mon Sep 17 00:00:00 2001 From: Siu Chi Chan Date: Wed, 7 Sep 2022 16:29:57 -0400 Subject: [PATCH 4/5] SWDEV-355608 - deprecate a few hipcc-only options --- amd/hipcc/src/hipBin_amd.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/amd/hipcc/src/hipBin_amd.h b/amd/hipcc/src/hipBin_amd.h index a6f044fcc2470a..155a600c4189b4 100644 --- a/amd/hipcc/src/hipBin_amd.h +++ b/amd/hipcc/src/hipBin_amd.h @@ -656,6 +656,10 @@ void HipBinAmd::executeHipCCCmd(vector argv) { // match arg with the starting of targetOpt string pattern = "^" + targetOpt + ".*"; if (hipBinUtilPtr_->stringRegexMatch(arg, pattern)) { + if (targetOpt == "--amdgpu-target=") { + cout << "Warning: The --amdgpu-target option has been deprecated and will be removed in the future." + << " Use --offload-arch instead.\n"; + } // If targets string is not empty, // add a comma before adding new target option value. targetsStr.size() >0 ? targetsStr += ",": targetsStr += ""; @@ -703,6 +707,8 @@ void HipBinAmd::executeHipCCCmd(vector argv) { } if (hipBinUtilPtr_->substringPresent( arg, "--amdhsa-code-object-version=")) { + cout << "Warning: The --amdhsa-code-object-version option has been deprecated and will be removed in the future." + << " Use -mllvm -mcode-object-version instead.\n"; arg = hipBinUtilPtr_->replaceStr( arg, "--amdhsa-code-object-version=", ""); hsacoVersion = arg; @@ -915,12 +921,11 @@ void HipBinAmd::executeHipCCCmd(vector argv) { //# Process HIPCC options here: if (hipBinUtilPtr_->stringRegexMatch(arg, "^--hipcc.*")) { swallowArg = 1; - // if $arg eq "--hipcc_profile") { # Example argument here, hipcc - // - // } if (arg == "--hipcc-func-supp") { + cout << "Warning: The --hipcc-func-supp option has been deprecated and will be removed in the future.\n"; funcSupp = 1; } else if (arg == "--hipcc-no-func-supp") { + cout << "Warning: The --hipcc-no-func-supp option has been deprecated and will be removed in the future.\n"; funcSupp = 0; } } else { From 55c94329859099fc0a582e3a2e88c6037c3ce4cc Mon Sep 17 00:00:00 2001 From: Siu Chi Chan Date: Fri, 23 Sep 2022 15:13:13 -0400 Subject: [PATCH 5/5] SWDEV-355608 - Remove clang include path Clang doesn't need to be told where to find the clang headers Change-Id: I2d1e84b31013aa6668efd2ff096f5e68f9ba9a64 --- amd/hipcc/src/hipBin_amd.h | 46 ++++--------------------------------- amd/hipcc/src/hipBin_base.h | 1 - 2 files changed, 4 insertions(+), 43 deletions(-) diff --git a/amd/hipcc/src/hipBin_amd.h b/amd/hipcc/src/hipBin_amd.h index 155a600c4189b4..4821bb203133ed 100644 --- a/amd/hipcc/src/hipBin_amd.h +++ b/amd/hipcc/src/hipBin_amd.h @@ -64,7 +64,6 @@ class HipBinAmd : public HipBinBase { virtual string getDeviceLibPath() const; virtual string getHipLibPath() const; virtual string getHipCC() const; - virtual string getCompilerIncludePath(); virtual string getHipInclude() const; virtual void initializeHipCXXFlags(); virtual void initializeHipCFlags(); @@ -166,9 +165,6 @@ void HipBinAmd::initializeHipLdFlags() { void HipBinAmd::initializeHipCFlags() { string hipCFlags; - string hipclangIncludePath; - hipclangIncludePath = getHipInclude(); - hipCFlags += " -isystem \"" + hipclangIncludePath + "\""; const OsType& os = getOSInfo(); if (os != windows) { string hsaPath; @@ -203,12 +199,6 @@ string HipBinAmd::getHipInclude() const { void HipBinAmd::initializeHipCXXFlags() { string hipCXXFlags; const OsType& os = getOSInfo(); - string hipClangIncludePath; - hipClangIncludePath = getCompilerIncludePath(); - hipCXXFlags += " -isystem \"" + hipClangIncludePath; - fs::path hipCXXFlagsTempFs = hipCXXFlags; - hipCXXFlagsTempFs /= "..\""; - hipCXXFlags = hipCXXFlagsTempFs.string(); const EnvVariables& var = getEnvVariables(); // Allow __fp16 as function parameter and return type. if (var.hipClangHccCompactModeEnv_.compare("1") == 0) { @@ -324,28 +314,19 @@ string HipBinAmd::getCppConfig() { string compilerVersion; compilerVersion = getCompilerVersion(); - fs::path hipPathInclude, hipClangInclude, cppConfigFs; - string hipClangVersionPath; + fs::path hipPathInclude, cppConfigFs; const string& hipPath = getHipPath(); hipPathInclude = hipPath; hipPathInclude /= "include"; - - const string& compilerPath = getCompilerPath(); - hipClangInclude = compilerPath; - hipClangInclude = hipClangInclude.parent_path(); - hipClangInclude /= "lib/clang/"; - hipClangInclude /= compilerVersion; - string hipClangPath = hipClangInclude.string(); - const OsType& osInfo = getOSInfo(); if (osInfo == windows) { - cppConfig += " -I" + hipPathInclude.string() + " -I" + hipClangPath; + cppConfig += " -I" + hipPathInclude.string(); cppConfigFs = cppConfig; cppConfigFs /= "/"; } else { const string& hsaPath = getHsaPath(); cppConfig += " -I" + hipPathInclude.string() + - " -I" + hipClangPath + " -I" + hsaPath; + " -I" + hsaPath; cppConfigFs = cppConfig; cppConfigFs /= "include"; cppConfig = cppConfigFs.string(); @@ -439,23 +420,6 @@ string HipBinAmd::getHipCC() const { return hipCC; } - - -string HipBinAmd::getCompilerIncludePath() { - string hipClangVersion, includePath, compilerIncludePath; - const string& hipClangPath = getCompilerPath(); - hipClangVersion = getCompilerVersion(); - fs::path includePathfs = hipClangPath; - includePathfs = includePathfs.parent_path(); - includePathfs /= "lib/clang/"; - includePathfs /= hipClangVersion; - includePathfs /= "include"; - includePathfs = fs::absolute(includePathfs).string(); - compilerIncludePath = includePathfs.string(); - return compilerIncludePath; -} - - void HipBinAmd::checkHipconfig() { printFull(); cout << endl << "Check system installation: " << endl; @@ -581,14 +545,13 @@ void HipBinAmd::executeHipCCCmd(vector argv) { HIPCXXFLAGS = getHipCXXFlags(); HIPLDFLAGS = getHipLdFlags(); string hipLibPath; - string hipclangIncludePath , hipIncludePath, deviceLibPath; + string hipIncludePath, deviceLibPath; hipLibPath = getHipLibPath(); const string& roccmPath = getRoccmPath(); const string& hipPath = getHipPath(); const PlatformInfo& platformInfo = getPlatformInfo(); const string& rocclrHomePath = getRocclrHomePath(); const string& hipClangPath = getCompilerPath(); - hipclangIncludePath = getCompilerIncludePath(); hipIncludePath = getHipInclude(); deviceLibPath = getDeviceLibPath(); const string& hipVersion = getHipVersion(); @@ -600,7 +563,6 @@ void HipBinAmd::executeHipCCCmd(vector argv) { cout << "ROCM_PATH=" << roccmPath << endl; cout << "HIP_ROCCLR_HOME="<< rocclrHomePath << endl; cout << "HIP_CLANG_PATH=" << hipClangPath <