mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-29 09:03:14 +08:00
Pass root device environment to get TargetDevice for IGC
Related-To: NEO-6853 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
893c3cdb53
commit
8f1bdb220f
@@ -274,7 +274,7 @@ ze_result_t ModuleTranslationUnit::createFromNativeBinary(const char *input, siz
|
||||
UNRECOVERABLE_IF((nullptr == device) || (nullptr == device->getNEODevice()));
|
||||
auto productAbbreviation = NEO::hardwarePrefix[device->getNEODevice()->getHardwareInfo().platform.eProductFamily];
|
||||
|
||||
NEO::TargetDevice targetDevice = NEO::targetDeviceFromHwInfo(device->getNEODevice()->getHardwareInfo());
|
||||
NEO::TargetDevice targetDevice = NEO::getTargetDevice(device->getNEODevice()->getRootDeviceEnvironment());
|
||||
std::string decodeErrors;
|
||||
std::string decodeWarnings;
|
||||
ArrayRef<const uint8_t> archive(reinterpret_cast<const uint8_t *>(input), inputSize);
|
||||
@@ -340,7 +340,7 @@ ze_result_t ModuleTranslationUnit::processUnpackedBinary() {
|
||||
auto blob = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(this->unpackedDeviceBinary.get()), this->unpackedDeviceBinarySize);
|
||||
NEO::SingleDeviceBinary binary = {};
|
||||
binary.deviceBinary = blob;
|
||||
binary.targetDevice = NEO::targetDeviceFromHwInfo(device->getHwInfo());
|
||||
binary.targetDevice = NEO::getTargetDevice(device->getNEODevice()->getRootDeviceEnvironment());
|
||||
std::string decodeErrors;
|
||||
std::string decodeWarnings;
|
||||
|
||||
@@ -393,7 +393,7 @@ ze_result_t ModuleTranslationUnit::processUnpackedBinary() {
|
||||
}
|
||||
|
||||
NEO::SingleDeviceBinary singleDeviceBinary = {};
|
||||
singleDeviceBinary.targetDevice = NEO::targetDeviceFromHwInfo(device->getNEODevice()->getHardwareInfo());
|
||||
singleDeviceBinary.targetDevice = NEO::getTargetDevice(device->getNEODevice()->getRootDeviceEnvironment());
|
||||
singleDeviceBinary.buildOptions = this->options;
|
||||
singleDeviceBinary.deviceBinary = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(this->unpackedDeviceBinary.get()), this->unpackedDeviceBinarySize);
|
||||
singleDeviceBinary.intermediateRepresentation = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(this->irBinary.get()), this->irBinarySize);
|
||||
|
||||
@@ -180,7 +180,7 @@ cl_int Program::processGenBinary(const ClDevice &clDevice) {
|
||||
if (isAnyPackedDeviceBinaryFormat(archive)) {
|
||||
std::string outErrReason, outWarning;
|
||||
auto productAbbreviation = NEO::hardwarePrefix[clDevice.getHardwareInfo().platform.eProductFamily];
|
||||
NEO::TargetDevice targetDevice = NEO::targetDeviceFromHwInfo(clDevice.getHardwareInfo());
|
||||
NEO::TargetDevice targetDevice = NEO::getTargetDevice(clDevice.getRootDeviceEnvironment());
|
||||
|
||||
auto singleDeviceBinary = unpackSingleDeviceBinary(archive, ConstStringRef(productAbbreviation, strlen(productAbbreviation)), targetDevice, outErrReason, outWarning);
|
||||
auto singleDeviceBinarySize = singleDeviceBinary.deviceBinary.size();
|
||||
@@ -206,7 +206,7 @@ cl_int Program::processGenBinary(const ClDevice &clDevice) {
|
||||
auto blob = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(buildInfo.unpackedDeviceBinary.get()), buildInfo.unpackedDeviceBinarySize);
|
||||
SingleDeviceBinary binary = {};
|
||||
binary.deviceBinary = blob;
|
||||
binary.targetDevice = NEO::targetDeviceFromHwInfo(clDevice.getDevice().getHardwareInfo());
|
||||
binary.targetDevice = NEO::getTargetDevice(clDevice.getRootDeviceEnvironment());
|
||||
std::string decodeErrors;
|
||||
std::string decodeWarnings;
|
||||
|
||||
|
||||
@@ -151,10 +151,11 @@ cl_int Program::createProgramFromBinary(
|
||||
deviceBuildInfos[&clDevice].programBinaryType = CL_PROGRAM_BINARY_TYPE_EXECUTABLE;
|
||||
this->isCreatedFromBinary = true;
|
||||
|
||||
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[rootDeviceIndex];
|
||||
auto hwInfo = rootDeviceEnvironment.getHardwareInfo();
|
||||
auto productAbbreviation = hardwarePrefix[hwInfo->platform.eProductFamily];
|
||||
|
||||
TargetDevice targetDevice = targetDeviceFromHwInfo(*hwInfo);
|
||||
TargetDevice targetDevice = getTargetDevice(rootDeviceEnvironment);
|
||||
std::string decodeErrors;
|
||||
std::string decodeWarnings;
|
||||
auto singleDeviceBinary = unpackSingleDeviceBinary(archive, ConstStringRef(productAbbreviation, strlen(productAbbreviation)), targetDevice,
|
||||
@@ -372,11 +373,11 @@ cl_int Program::packDeviceBinary(ClDevice &clDevice) {
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[rootDeviceIndex];
|
||||
|
||||
if (nullptr != this->buildInfos[rootDeviceIndex].unpackedDeviceBinary.get()) {
|
||||
SingleDeviceBinary singleDeviceBinary = {};
|
||||
singleDeviceBinary.targetDevice = NEO::targetDeviceFromHwInfo(*hwInfo);
|
||||
singleDeviceBinary.targetDevice = NEO::getTargetDevice(rootDeviceEnvironment);
|
||||
singleDeviceBinary.buildOptions = this->options;
|
||||
singleDeviceBinary.deviceBinary = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(this->buildInfos[rootDeviceIndex].unpackedDeviceBinary.get()), this->buildInfos[rootDeviceIndex].unpackedDeviceBinarySize);
|
||||
singleDeviceBinary.intermediateRepresentation = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(this->irBinary.get()), this->irBinarySize);
|
||||
|
||||
@@ -1491,7 +1491,6 @@ using ProgramWithDebugDataTests = Test<ProgramSimpleFixture>;
|
||||
|
||||
TEST_F(ProgramWithDebugDataTests, GivenPatchtokensProgramWithDebugSymbolsWhenPackDeviceBinaryThenDebugDataIsAddedToSingleDeviceBinary) {
|
||||
auto clDevice = pContext->getDevices()[0];
|
||||
auto &hwInfo = clDevice->getHardwareInfo();
|
||||
auto rootDeviceIdx = clDevice->getRootDeviceIndex();
|
||||
|
||||
pProgram = new PatchtokensProgramWithDebugData(*clDevice);
|
||||
@@ -1501,7 +1500,7 @@ TEST_F(ProgramWithDebugDataTests, GivenPatchtokensProgramWithDebugSymbolsWhenPac
|
||||
EXPECT_NE(nullptr, buildInfo.packedDeviceBinary.get());
|
||||
|
||||
auto packedDeviceBinary = ArrayRef<const uint8_t>::fromAny(buildInfo.packedDeviceBinary.get(), buildInfo.packedDeviceBinarySize);
|
||||
TargetDevice targetDevice = NEO::targetDeviceFromHwInfo(hwInfo);
|
||||
TargetDevice targetDevice = NEO::getTargetDevice(pDevice->getRootDeviceEnvironment());
|
||||
std::string decodeErrors;
|
||||
std::string decodeWarnings;
|
||||
auto singleDeviceBinary = unpackSingleDeviceBinary(packedDeviceBinary, {}, targetDevice,
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/device_binary_format/device_binary_formats.h"
|
||||
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
@@ -20,9 +21,11 @@ std::vector<uint8_t> packDeviceBinary(const SingleDeviceBinary binary, std::stri
|
||||
return packDeviceBinary<DeviceBinaryFormat::OclElf>(binary, outErrReason, outWarning);
|
||||
}
|
||||
|
||||
TargetDevice targetDeviceFromHwInfo(const HardwareInfo &hwInfo) {
|
||||
TargetDevice getTargetDevice(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
||||
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
|
||||
TargetDevice targetDevice = {};
|
||||
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
|
||||
targetDevice.coreFamily = hwInfo.platform.eRenderCoreFamily;
|
||||
targetDevice.productFamily = hwInfo.platform.eProductFamily;
|
||||
@@ -30,7 +33,7 @@ TargetDevice targetDeviceFromHwInfo(const HardwareInfo &hwInfo) {
|
||||
targetDevice.stepping = hwInfo.platform.usRevId;
|
||||
targetDevice.maxPointerSizeInBytes = sizeof(uintptr_t);
|
||||
targetDevice.grfSize = hwInfo.capabilityTable.grfSize;
|
||||
targetDevice.minScratchSpaceSize = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily).getMinimalScratchSpaceSize();
|
||||
targetDevice.minScratchSpaceSize = gfxCoreHelper.getMinimalScratchSpaceSize();
|
||||
return targetDevice;
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
namespace NEO {
|
||||
struct ProgramInfo;
|
||||
struct HardwareInfo;
|
||||
struct RootDeviceEnvironment;
|
||||
|
||||
enum class DeviceBinaryFormat : uint8_t {
|
||||
Unknown,
|
||||
@@ -63,7 +63,7 @@ struct TargetDevice {
|
||||
uint32_t grfSize = 32U;
|
||||
uint32_t minScratchSpaceSize = 0U;
|
||||
};
|
||||
TargetDevice targetDeviceFromHwInfo(const NEO::HardwareInfo &hwInfo);
|
||||
TargetDevice getTargetDevice(const RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
|
||||
struct SingleDeviceBinary {
|
||||
DeviceBinaryFormat format = DeviceBinaryFormat::Unknown;
|
||||
|
||||
Reference in New Issue
Block a user