Files
compute-runtime/shared/source/helpers/product_config_helper.h
Daria Hinz ce645f13b7 Encode PRODUCT_CONFIG value into fatbinary
Change modifies the encoding entry in fatbinary for platforms.
If numbering in -device is used, the value PRODUCT_CONFIG will be encoded.
The functionality that returns the correct product config values has
also been added.

Related-To: NEO-6744
Signed-off-by: Daria Hinz <daria.hinz@intel.com>
2022-04-11 15:09:17 +02:00

42 lines
1.1 KiB
C++

/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "platforms.h"
#include <sstream>
#include <string>
namespace NEO {
struct ProductConfigHelper {
static uint32_t getMajor(PRODUCT_CONFIG config) {
return (static_cast<uint32_t>(config) & 0xff0000) >> 16;
}
static uint32_t getMinor(PRODUCT_CONFIG config) {
return (static_cast<uint32_t>(config) & 0x00ff00) >> 8;
}
static uint32_t getRevision(PRODUCT_CONFIG config) {
return static_cast<uint32_t>(config) & 0x0000ff;
}
static std::string parseMajorMinorRevisionValue(PRODUCT_CONFIG config) {
std::stringstream stringConfig;
stringConfig << getMajor(config) << "." << getMinor(config) << "." << getRevision(config);
return stringConfig.str();
}
static std::string parseMajorMinorValue(PRODUCT_CONFIG config) {
std::stringstream stringConfig;
stringConfig << getMajor(config) << "." << getMinor(config);
return stringConfig.str();
}
};
} // namespace NEO