Improve driverstore compatibility checker

make checker case-insensitive
handle HostDriverStore scenarios

Related-To: NEO-5182, NEO-6025
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2021-07-01 18:26:01 +00:00
committed by Compute-Runtime-Automation
parent bcf93a6aeb
commit 294045071b
2 changed files with 66 additions and 19 deletions

View File

@@ -70,13 +70,21 @@ std::string DriverInfoWindows::getVersion(std::string defaultVersion) {
};
bool DriverInfoWindows::isCompatibleDriverStore() const {
auto currentLibraryPath = getCurrentLibraryPath();
auto toLowerAndUnifyDriverStore = [](std::string &input) -> std::string {
std::transform(input.begin(), input.end(), input.begin(), [](unsigned char c) { return std::tolower(c); });
auto hostDriverStorePos = input.find("\\hostdriverstore\\");
if (hostDriverStorePos != std::string::npos) {
input.erase(hostDriverStorePos + 1, 4);
}
return input;
};
auto currentLibraryPath = toLowerAndUnifyDriverStore(getCurrentLibraryPath());
auto openclDriverName = registryReader.get()->getSetting("OpenCLDriverName", std::string{});
if (openclDriverName.empty()) {
return false;
}
auto driverStorePath = registryReader.get()->getSetting("DriverStorePathForComputeRuntime", currentLibraryPath);
auto driverStorePath = toLowerAndUnifyDriverStore(registryReader.get()->getSetting("DriverStorePathForComputeRuntime", currentLibraryPath));
return currentLibraryPath.find(driverStorePath.c_str()) == 0u;
}