Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
Merge pull request #14 from ROCm-Developer-Tools/develop
Browse files Browse the repository at this point in the history
Merge Develop into Main
  • Loading branch information
searlmc1 committed Feb 8, 2022
2 parents f3b03c2 + 7c4e2af commit 8874e8f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 43 deletions.
20 changes: 10 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
cmake_minimum_required(VERSION 3.16.3)
project (hipcc)
project (hipcc.bin)

# specify the C++ standard
# Specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

set ( LINK_LIBS libstdc++fs.so)
add_executable(hipcc src/hipBin.cpp)
if (NOT WIN32) #c++17 does not require the std lib linking
target_link_libraries(hipcc ${LINK_LIBS} ) # for hipcc
set (LINK_LIBS libstdc++fs.so)
add_executable(hipcc.bin src/hipBin.cpp)
if (NOT WIN32) # C++17 does not require the std lib linking
target_link_libraries(hipcc.bin ${LINK_LIBS} ) # for hipcc.bin
endif()

project (hipconfig)
add_executable(hipconfig src/hipBin.cpp)
if (NOT WIN32) #c++17 does not require the std lib linking
target_link_libraries(hipconfig ${LINK_LIBS} ) # for hipconfig
project (hipconfig.bin)
add_executable(hipconfig.bin src/hipBin.cpp)
if (NOT WIN32) # C++17 does not require the std lib linking
target_link_libraries(hipconfig.bin ${LINK_LIBS} ) # for hipconfig.bin
endif()

set(HIP_VERSION_MAJOR 4 PARENT_SCOPE)
Expand Down
50 changes: 17 additions & 33 deletions src/hipBin_amd.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,17 @@ THE SOFTWARE.
#include "hipBin_util.h"
#include <vector>
#include <string>
#include <unordered_set>
#include <cassert>


// Known HIP target names.
vector<string> 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<string> knownFeatures = { "sramecc - " , "sramecc + ",
"xnack - ", "xnack + " };

std::unordered_set
<std::string> knownFeatures = { "sramecc-" , "sramecc+",
"xnack-", "xnack+" };

class HipBinAmd : public HipBinBase {
private:
Expand Down Expand Up @@ -1015,25 +1011,21 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
vector<string> 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<string> procAndFeatures = hipBinUtilPtr_->splitStr(val, ':');
int len = static_cast<int>(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 <knownFeatures.size(); j++) {
if (procAndFeatures.at(i) == knownFeatures.at(j)) {
size_t len = procAndFeatures.size();
// proc and features
assertm(procAndFeatures.size() >= 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;
Expand All @@ -1042,14 +1034,6 @@ void HipBinAmd::executeHipCCCmd(vector<string> 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;
Expand Down

0 comments on commit 8874e8f

Please sign in to comment.