From f6162a9aa05dc5760da4282c9b011c723ddc4062 Mon Sep 17 00:00:00 2001 From: Ajay Date: Mon, 7 Feb 2022 17:34:02 +0000 Subject: [PATCH] SWDEV-321904 - remove unknown device warning and fix knownFeatures check Change-Id: If4641cc805d79a89a6dd3dbbcecca19286acf85b --- src/hipBin_amd.h | 50 ++++++++++++++++-------------------------------- 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/src/hipBin_amd.h b/src/hipBin_amd.h index 7c73c86..d5a80f0 100644 --- a/src/hipBin_amd.h +++ b/src/hipBin_amd.h @@ -27,21 +27,17 @@ THE SOFTWARE. #include "hipBin_util.h" #include #include +#include +#include -// Known HIP target names. -vector knownTargets = { "gfx700", "gfx701", "gfx702", "gfx703", - "gfx704", "gfx705", "gfx801", "gfx802", - "gfx803", "gfx805", "gfx810", "gfx900", - "gfx902", "gfx904", "gfx906", "gfx908", - "gfx909", "gfx90a", "gfx1010", "gfx1011", - "gfx1012", "gfx1030", "gfx1031", "gfx1032" }; - +// Use (void) to silent unused warnings. +#define assertm(exp, msg) assert(((void)msg, exp)) // Known Features -vector knownFeatures = { "sramecc - " , "sramecc + ", - "xnack - ", "xnack + " }; - + std::unordered_set + knownFeatures = { "sramecc-" , "sramecc+", + "xnack-", "xnack+" }; class HipBinAmd : public HipBinBase { private: @@ -1015,25 +1011,21 @@ void HipBinAmd::executeHipCCCmd(vector argv) { vector targets = hipBinUtilPtr_->splitStr(targetsStr, ','); string GPU_ARCH_OPT = " --offload-arch="; - for (unsigned int count = 0; count < targets.size(); count++) { - string val = targets.at(count); + for (auto &val : targets) { // Ignore 'gfx000' target reported by rocm_agent_enumerator. if (val != "gfx000") { vector procAndFeatures = hipBinUtilPtr_->splitStr(val, ':'); - int len = static_cast(procAndFeatures.size()); - string procName; - if (len >= 1 && len <= 3) { //# proc and features - procName = procAndFeatures.at(0); - for (int i = 1; i< len; i++) { - for (unsigned int j = 0; j = 1, "Pass the correct device/feature"); + for (size_t i = 1; i < len; i++) { + // fixme: currently it checks only for validity of the feature string. + // does not check if the device supports the feature or not + // e.g. vega10 does not support sramecc + if (knownFeatures.find(procAndFeatures.at(i)) == knownFeatures.end()) { cout << "Warning: The Feature: "<< procAndFeatures.at(i) << - "is unknown. Correct compilation is not guaranteed.\n"; - } + " is unknown. Correct compilation is not guaranteed.\n"; } - } - } else { - procName = val; } string GPU_ARCH_ARG; GPU_ARCH_ARG = GPU_ARCH_OPT + val; @@ -1042,14 +1034,6 @@ void HipBinAmd::executeHipCCCmd(vector argv) { if (hasHIP) { HIPCXXFLAGS += GPU_ARCH_ARG; } - for (unsigned int j= 0; j < knownTargets.size(); j++) { - // If the specified target is not - // in the list of known target names, emit a warning. - if (procName == knownTargets.at(j)) { - cout << "Warning: The specified HIP target: "<< val << - " is unknown. Correct compilation is not guaranteed.\n"; - } - } } // end of val != "gfx000" } // end of targets for loop string HCC_EXTRA_LIBRARIES;