Use device ID from ProductConfigHelper

This commit switches the device ID logic from the deprecated
to the new one, so that if the user passes a hex value to the -device
parameter, ocloc will use the new implementation in the product config
helper.

Signed-off-by: Daria Hinz <daria.hinz@intel.com>
Related-To: NEO-7487
This commit is contained in:
Daria Hinz
2022-11-07 14:22:31 +01:00
committed by Compute-Runtime-Automation
parent a30cc94708
commit 60a8bcb3d7
10 changed files with 121 additions and 95 deletions

View File

@@ -58,13 +58,7 @@ OclocArgHelper::OclocArgHelper(const uint32_t numSources, const uint8_t **dataSo
uint64_t **lenOutputs, char ***nameOutputs)
: numOutputs(numOutputs), nameOutputs(nameOutputs),
dataOutputs(dataOutputs), lenOutputs(lenOutputs), hasOutput(numOutputs != nullptr),
messagePrinter(hasOutput), deviceProductTable({
#define NAMEDDEVICE(devId, product, ignored_devName) {devId, NEO::hardwarePrefix[NEO::product::hwInfo.platform.eProductFamily]},
#define DEVICE(devId, product) {devId, NEO::hardwarePrefix[NEO::product::hwInfo.platform.eProductFamily]},
#include "devices.inl"
#undef DEVICE
#undef NAMEDDEVICE
{0u, std::string("")}}) {
messagePrinter(hasOutput) {
for (uint32_t i = 0; i < numSources; ++i) {
inputs.push_back(Source(dataSources[i], static_cast<size_t>(lenSources[i]), nameSources[i]));
}
@@ -199,25 +193,4 @@ void OclocArgHelper::saveOutput(const std::string &filename, const std::ostream
std::ofstream file(filename);
file << ss.str();
}
}
bool OclocArgHelper::setAcronymForDeviceId(std::string &device) {
auto product = returnProductNameForDevice(std::stoi(device, 0, 16));
if (!product.empty()) {
printf("Auto-detected target based on %s device id: %s\n", device.c_str(), product.c_str());
} else {
printf("Could not determine target based on device id: %s\n", device.c_str());
return false;
}
device = std::move(product);
return true;
}
std::string OclocArgHelper::returnProductNameForDevice(unsigned short deviceId) {
for (int i = 0; deviceProductTable[i].deviceId != 0; i++) {
if (deviceProductTable[i].deviceId == deviceId) {
return deviceProductTable[i].product;
}
}
return "";
}