mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Ocloc: Set DeviceId in HwInfo
User can pass a heximal value of device id via -device param. This change makes the setting of this value in hwInfo. Signed-off-by: Daria Hinz <daria.hinz@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
cdf3d00919
commit
88c16542a1
@ -342,6 +342,7 @@ int OfflineCompiler::initHardwareInfo(std::string deviceName) {
|
||||
overridePlatformName(deviceName);
|
||||
std::transform(deviceName.begin(), deviceName.end(), deviceName.begin(), ::tolower);
|
||||
const char hexPrefix = 2;
|
||||
auto deviceId = -1;
|
||||
std::string product("");
|
||||
|
||||
auto numeration = argHelper->getMajorMinorRevision(deviceName);
|
||||
@ -362,7 +363,8 @@ int OfflineCompiler::initHardwareInfo(std::string deviceName) {
|
||||
}
|
||||
|
||||
if (deviceName.substr(0, hexPrefix) == "0x" && std::all_of(deviceName.begin() + hexPrefix, deviceName.end(), (::isxdigit))) {
|
||||
product = argHelper->returnProductNameForDevice(stoi(deviceName, 0, 16));
|
||||
deviceId = stoi(deviceName, 0, 16);
|
||||
product = argHelper->returnProductNameForDevice(deviceId);
|
||||
if (!product.empty()) {
|
||||
argHelper->printf("Auto-detected target based on %s device id: %s\n", deviceName.c_str(), product.c_str());
|
||||
deviceName = product;
|
||||
@ -379,6 +381,9 @@ int OfflineCompiler::initHardwareInfo(std::string deviceName) {
|
||||
if (revisionId != -1) {
|
||||
hwInfo.platform.usRevId = revisionId;
|
||||
}
|
||||
if (deviceId != -1) {
|
||||
hwInfo.platform.usDeviceID = deviceId;
|
||||
}
|
||||
|
||||
auto hwInfoConfig = defaultHardwareInfoConfigTable[hwInfo.platform.eProductFamily];
|
||||
setHwInfoValuesFromConfig(hwInfoConfig, hwInfo);
|
||||
|
Reference in New Issue
Block a user