Add debug flag to override platform used by compiler
Change-Id: I6fc4254f928158d0cb07f53436d1ddd09fcef7d5
This commit is contained in:
parent
bbe4eddf9c
commit
c1782b802a
|
@ -83,14 +83,7 @@ bool getDevicesImpl(HardwareInfo **hwInfo, size_t &numDevicesReturned) {
|
|||
case CSR_TBX_WITH_AUB:
|
||||
auto productFamily = DebugManager.flags.ProductFamilyOverride.get();
|
||||
auto hwInfoConst = *platformDevices;
|
||||
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) {
|
||||
if (hardwarePrefix[j] == nullptr)
|
||||
continue;
|
||||
if (strcmp(hardwarePrefix[j], productFamily.c_str()) == 0) {
|
||||
hwInfoConst = hardwareInfoTable[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
getHwInfoForPlatformString(productFamily.c_str(), hwInfoConst);
|
||||
*hwInfo = const_cast<HardwareInfo *>(hwInfoConst);
|
||||
hardwareInfoSetupGt[hwInfoConst->pPlatform->eProductFamily](const_cast<GT_SYSTEM_INFO *>(hwInfo[0]->pSysInfo));
|
||||
numDevicesReturned = 1;
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
#include "runtime/compiler_interface/binary_cache.h"
|
||||
#include "runtime/compiler_interface/compiler_interface.h"
|
||||
#include "runtime/compiler_interface/compiler_interface.inl"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/program/program.h"
|
||||
#include "runtime/os_interface/debug_settings_manager.h"
|
||||
#include "runtime/os_interface/os_inc_base.h"
|
||||
|
||||
#include <fstream>
|
||||
|
@ -426,9 +428,13 @@ CIF::RAII::UPtr_t<IGC::IgcOclTranslationCtxTagOCL> CompilerInterface::createIgcT
|
|||
DEBUG_BREAK_IF(true); // could not acquire handles to device descriptors
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform, *device.getHardwareInfo().pPlatform);
|
||||
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo, *device.getHardwareInfo().pSysInfo);
|
||||
const HardwareInfo *hwInfo = &device.getHardwareInfo();
|
||||
auto productFamily = DebugManager.flags.ForceCompilerUsePlatform.get();
|
||||
if (productFamily != "unk") {
|
||||
getHwInfoForPlatformString(productFamily.c_str(), hwInfo);
|
||||
}
|
||||
IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform, *hwInfo->pPlatform);
|
||||
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo, *hwInfo->pSysInfo);
|
||||
|
||||
igcFeWa.get()->SetFtrDesktop(device.getHardwareInfo().pSkuTable->ftrDesktop);
|
||||
igcFeWa.get()->SetFtrChannelSwizzlingXOREnabled(device.getHardwareInfo().pSkuTable->ftrChannelSwizzlingXOREnabled);
|
||||
|
|
|
@ -60,4 +60,18 @@ const char *getPlatformType(const HardwareInfo &hwInfo) {
|
|||
}
|
||||
return "lp";
|
||||
}
|
||||
|
||||
bool getHwInfoForPlatformString(const char *str, const HardwareInfo *&hwInfoIn) {
|
||||
bool ret = false;
|
||||
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) {
|
||||
if (hardwarePrefix[j] == nullptr)
|
||||
continue;
|
||||
if (strcmp(hardwarePrefix[j], str) == 0) {
|
||||
hwInfoIn = hardwareInfoTable[j];
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -117,5 +117,5 @@ struct EnableGfxFamilyHw {
|
|||
};
|
||||
|
||||
const char *getPlatformType(const HardwareInfo &hwInfo);
|
||||
|
||||
bool getHwInfoForPlatformString(const char *str, const HardwareInfo *&hwInfoIn);
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -95,3 +95,4 @@ DECLARE_DEBUG_VARIABLE(int32_t, OverrideThreadArbitrationPolicy, -1, "-1 (dont o
|
|||
DECLARE_DEBUG_VARIABLE(bool, HwQueueSupported, false, "Windows only. Pass flag to KMD during Wddm Context creation")
|
||||
DECLARE_DEBUG_VARIABLE(bool, UseMaxSimdSizeToDeduceMaxWorkgroupSize, false, "With this flag on, max workgroup size is deduced using SIMD32 instead of SIMD8, this causes the max wkg size to be 4 times bigger")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideAubDeviceId, -1, "-1 dont override, any other: use this value for AUB generation device id")
|
||||
DECLARE_DEBUG_VARIABLE(std::string, ForceCompilerUsePlatform, std::string("unk"), "Specify product for use in compiler interface")
|
|
@ -24,10 +24,13 @@
|
|||
#include "runtime/compiler_interface/compiler_interface.inl"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/helpers/file_io.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/os_interface/debug_settings_manager.h"
|
||||
#include "runtime/platform/platform.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/global_environment.h"
|
||||
#include "unit_tests/helpers/test_files.h"
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/helpers/memory_management.h"
|
||||
#include "unit_tests/mocks/mock_cif.h"
|
||||
#include "unit_tests/mocks/mock_compilers.h"
|
||||
|
@ -797,6 +800,44 @@ TEST_F(CompilerInterfaceTest, GivenRequestForNewIgcTranslationCtxWhenCouldNotPop
|
|||
setIgcDebugVars(prevDebugVars);
|
||||
}
|
||||
|
||||
TEST_F(CompilerInterfaceTest, givenNoDbgKeyForceUseDifferentPlatformWhenRequestForNewTranslationCtxThenUseDefaultPlatform) {
|
||||
auto device = this->pContext->getDevice(0);
|
||||
auto retIgc = pCompilerInterface->createIgcTranslationCtx(*device, IGC::CodeType::llvmBc, IGC::CodeType::oclGenBin);
|
||||
EXPECT_NE(nullptr, retIgc);
|
||||
IGC::IgcOclDeviceCtxTagOCL *devCtx = pCompilerInterface->peekIgcDeviceCtx(device);
|
||||
auto igcPlatform = devCtx->GetPlatformHandle();
|
||||
auto igcSysInfo = devCtx->GetGTSystemInfoHandle();
|
||||
EXPECT_EQ(device->getHardwareInfo().pPlatform->eProductFamily, igcPlatform->GetProductFamily());
|
||||
EXPECT_EQ(device->getHardwareInfo().pPlatform->eRenderCoreFamily, igcPlatform->GetRenderCoreFamily());
|
||||
EXPECT_EQ(device->getHardwareInfo().pSysInfo->SliceCount, igcSysInfo->GetSliceCount());
|
||||
EXPECT_EQ(device->getHardwareInfo().pSysInfo->SubSliceCount, igcSysInfo->GetSubSliceCount());
|
||||
EXPECT_EQ(device->getHardwareInfo().pSysInfo->EUCount, igcSysInfo->GetEUCount());
|
||||
EXPECT_EQ(device->getHardwareInfo().pSysInfo->ThreadCount, igcSysInfo->GetThreadCount());
|
||||
}
|
||||
|
||||
TEST_F(CompilerInterfaceTest, givenDbgKeyForceUseDifferentPlatformWhenRequestForNewTranslationCtxThenUseDbgKeyPlatform) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
auto dbgProdFamily = DEFAULT_TEST_PLATFORM::hwInfo.pPlatform->eProductFamily;
|
||||
std::string dbgPlatformString(hardwarePrefix[dbgProdFamily]);
|
||||
const PLATFORM dbgPlatform = *hardwareInfoTable[dbgProdFamily]->pPlatform;
|
||||
const GT_SYSTEM_INFO dbgSystemInfo = *hardwareInfoTable[dbgProdFamily]->pSysInfo;
|
||||
DebugManager.flags.ForceCompilerUsePlatform.set(dbgPlatformString);
|
||||
|
||||
auto device = this->pContext->getDevice(0);
|
||||
auto retIgc = pCompilerInterface->createIgcTranslationCtx(*device, IGC::CodeType::llvmBc, IGC::CodeType::oclGenBin);
|
||||
EXPECT_NE(nullptr, retIgc);
|
||||
IGC::IgcOclDeviceCtxTagOCL *devCtx = pCompilerInterface->peekIgcDeviceCtx(device);
|
||||
auto igcPlatform = devCtx->GetPlatformHandle();
|
||||
auto igcSysInfo = devCtx->GetGTSystemInfoHandle();
|
||||
|
||||
EXPECT_EQ(dbgPlatform.eProductFamily, igcPlatform->GetProductFamily());
|
||||
EXPECT_EQ(dbgPlatform.eRenderCoreFamily, igcPlatform->GetRenderCoreFamily());
|
||||
EXPECT_EQ(dbgSystemInfo.SliceCount, igcSysInfo->GetSliceCount());
|
||||
EXPECT_EQ(dbgSystemInfo.SubSliceCount, igcSysInfo->GetSubSliceCount());
|
||||
EXPECT_EQ(dbgSystemInfo.EUCount, igcSysInfo->GetEUCount());
|
||||
EXPECT_EQ(dbgSystemInfo.ThreadCount, igcSysInfo->GetThreadCount());
|
||||
}
|
||||
|
||||
TEST_F(CompilerInterfaceTest, IsCompilerAvailable) {
|
||||
ASSERT_TRUE(this->pCompilerInterface->GetIgcMain() && this->pCompilerInterface->GetFclMain());
|
||||
EXPECT_TRUE(this->pCompilerInterface->isCompilerAvailable());
|
||||
|
|
|
@ -73,9 +73,55 @@ MockCompilerDebugVars getFclDebugVars();
|
|||
MockCompilerDebugVars getIgcDebugVars();
|
||||
|
||||
struct MockPlatform : MockCIF<IGC::PlatformTagOCL> {
|
||||
IGC::TypeErasedEnum GetProductFamily() const override {
|
||||
return productFamily;
|
||||
}
|
||||
void SetProductFamily(IGC::TypeErasedEnum v) override {
|
||||
productFamily = v;
|
||||
}
|
||||
IGC::TypeErasedEnum GetRenderCoreFamily() const override {
|
||||
return renderCoreFamily;
|
||||
}
|
||||
void SetRenderCoreFamily(IGC::TypeErasedEnum v) override {
|
||||
renderCoreFamily = v;
|
||||
}
|
||||
|
||||
protected:
|
||||
IGC::TypeErasedEnum productFamily;
|
||||
IGC::TypeErasedEnum renderCoreFamily;
|
||||
};
|
||||
|
||||
struct MockGTSystemInfo : MockCIF<IGC::GTSystemInfoTagOCL> {
|
||||
uint32_t GetEUCount() const override {
|
||||
return this->euCount;
|
||||
}
|
||||
void SetEUCount(uint32_t v) override {
|
||||
euCount = v;
|
||||
}
|
||||
uint32_t GetThreadCount() const override {
|
||||
return this->threadCount;
|
||||
}
|
||||
void SetThreadCount(uint32_t v) override {
|
||||
threadCount = v;
|
||||
}
|
||||
uint32_t GetSliceCount() const override {
|
||||
return this->sliceCount;
|
||||
}
|
||||
void SetSliceCount(uint32_t v) override {
|
||||
sliceCount = v;
|
||||
}
|
||||
uint32_t GetSubSliceCount() const override {
|
||||
return this->subsliceCount;
|
||||
}
|
||||
void SetSubSliceCount(uint32_t v) override {
|
||||
subsliceCount = v;
|
||||
}
|
||||
|
||||
protected:
|
||||
uint32_t euCount;
|
||||
uint32_t threadCount;
|
||||
uint32_t sliceCount;
|
||||
uint32_t subsliceCount;
|
||||
};
|
||||
|
||||
struct MockIgcFeaturesAndWorkarounds : MockCIF<IGC::IgcFeaturesAndWorkaroundsTagOCL> {
|
||||
|
@ -305,6 +351,8 @@ class MockCompilerInterface : public CompilerInterface {
|
|||
|
||||
std::vector<char> sipKernelBinaryOverride;
|
||||
SipKernelType requestedSipKernel = SipKernelType::COUNT;
|
||||
|
||||
IGC::IgcOclDeviceCtxTagOCL *peekIgcDeviceCtx(Device *device) { return igcDeviceContexts[device].get(); }
|
||||
};
|
||||
|
||||
template <>
|
||||
|
|
|
@ -66,4 +66,5 @@ HwQueueSupported = false
|
|||
DisableZeroCopyForUseHostPtr = false
|
||||
SchedulerGWS = 0
|
||||
DisableZeroCopyForBuffers = false
|
||||
OverrideAubDeviceId = -1
|
||||
OverrideAubDeviceId = -1
|
||||
ForceCompilerUsePlatform = unk
|
Loading…
Reference in New Issue