2
0
Ficheiros
rocm-systems/catch/hipTestMain/hip_test_features.cc
T
ROCm CI Service Account d33ccb3569 SWDEV-393910 - Port gfx940 changes to mainline. (#321)
Change-Id: I77e70bcb15fbd38b1c79c1f68b7e483b2b3e0daf
2023-06-29 08:57:51 +05:30

46 linhas
1.4 KiB
C++

#include "hip_test_features.hh"
#include <iostream>
#include <assert.h>
#include "hip_test_context.hh"
std::vector<std::unordered_set<std::string>> GCNArchFeatMap = {
{"gfx90a", "gfx940", "gfx941", "gfx942"}, // CT_FEATURE_FINEGRAIN_HWSUPPORT
{"gfx90a", "gfx940", "gfx941", "gfx942"}, // CT_FEATURE_HMM
{"gfx90a", "gfx940", "gfx941", "gfx942"}, // CT_FEATURE_TEXTURES_NOT_SUPPORTED
};
#if HT_AMD
std::string TrimAndGetGFXName(const std::string& full_gfx_name) {
std::string gfx_name("");
// Split the first part of the delimiter
std::string delimiter = ":";
auto pos = full_gfx_name.find(delimiter);
if (pos == std::string::npos) {
gfx_name = full_gfx_name;
} else {
gfx_name = full_gfx_name.substr(0, pos);
}
assert(gfx_name.substr(0,3) == "gfx");
return gfx_name;
}
#endif
// Check if the GCN Maps
bool CheckIfFeatSupported(enum CTFeatures test_feat, std::string gcn_arch) {
#if HT_NVIDIA
return true; // returning true since feature check does not exist for NV.
#elif HT_AMD
assert(test_feat >= 0 && test_feat < CTFeatures::CT_FEATURE_LAST);
gcn_arch = TrimAndGetGFXName(gcn_arch);
assert(gcn_arch != "");
return (GCNArchFeatMap[test_feat].find(gcn_arch) != GCNArchFeatMap[test_feat].cend());
#else
std::cout<<"Platform has to be either AMD or NVIDIA, asserting..."<<std::endl;
assert(false);
#endif
}