Add device product table based on device_base file for ocloc use

Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit is contained in:
Kacper Nowak
2021-03-15 17:01:04 +01:00
committed by Compute-Runtime-Automation
parent 027a916107
commit 260f7e37cb
5 changed files with 52 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -8,8 +8,11 @@
#include "ocloc_arg_helper.h"
#include "shared/source/helpers/file_io.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/string.h"
#include "hw_cmds.h"
#include <cstring>
#include <sstream>
@@ -44,7 +47,13 @@ OclocArgHelper::OclocArgHelper(const uint32_t numSources, const uint8_t **dataSo
uint32_t *numOutputs, uint8_t ***dataOutputs,
uint64_t **lenOutputs, char ***nameOutputs)
: numOutputs(numOutputs), nameOutputs(nameOutputs),
dataOutputs(dataOutputs), lenOutputs(lenOutputs), hasOutput(numOutputs != nullptr) {
dataOutputs(dataOutputs), lenOutputs(lenOutputs), hasOutput(numOutputs != nullptr), deviceProductTable({
#define NAMEDDEVICE(devId, product, ignored_gtType, ignored_devName) {devId, NEO::hardwarePrefix[NEO::product::hwInfo.platform.eProductFamily]},
#define DEVICE(devId, product, ignored_gtType) {devId, NEO::hardwarePrefix[NEO::product::hwInfo.platform.eProductFamily]},
#include "devices.inl"
#undef DEVICE
#undef NAMEDDEVICE
{0u, std::string("")}}) {
for (uint32_t i = 0; i < numSources; ++i) {
inputs.push_back(Source(dataSources[i], static_cast<size_t>(lenSources[i]), nameSources[i]));
}
@@ -150,3 +159,13 @@ void OclocArgHelper::saveOutput(const std::string &filename, const std::ostream
file << ss.str();
}
}
std::string OclocArgHelper::returnProductNameForDevice(unsigned short deviceId) {
std::string res = "";
for (int i = 0; deviceProductTable[i].deviceId != 0; i++) {
if (deviceProductTable[i].deviceId == deviceId) {
res = deviceProductTable[i].product;
}
}
return res;
}