|
24 | 24 | #include "runtime/compiler_interface/compiler_interface.inl"
|
25 | 25 | #include "runtime/context/context.h"
|
26 | 26 | #include "runtime/helpers/file_io.h"
|
| 27 | +#include "runtime/helpers/hw_info.h" |
| 28 | +#include "runtime/os_interface/debug_settings_manager.h" |
27 | 29 | #include "runtime/platform/platform.h"
|
28 | 30 | #include "unit_tests/fixtures/device_fixture.h"
|
29 | 31 | #include "unit_tests/global_environment.h"
|
30 | 32 | #include "unit_tests/helpers/test_files.h"
|
| 33 | +#include "unit_tests/helpers/debug_manager_state_restore.h" |
31 | 34 | #include "unit_tests/helpers/memory_management.h"
|
32 | 35 | #include "unit_tests/mocks/mock_cif.h"
|
33 | 36 | #include "unit_tests/mocks/mock_compilers.h"
|
@@ -797,6 +800,44 @@ TEST_F(CompilerInterfaceTest, GivenRequestForNewIgcTranslationCtxWhenCouldNotPop
|
797 | 800 | setIgcDebugVars(prevDebugVars);
|
798 | 801 | }
|
799 | 802 |
|
| 803 | +TEST_F(CompilerInterfaceTest, givenNoDbgKeyForceUseDifferentPlatformWhenRequestForNewTranslationCtxThenUseDefaultPlatform) { |
| 804 | + auto device = this->pContext->getDevice(0); |
| 805 | + auto retIgc = pCompilerInterface->createIgcTranslationCtx(*device, IGC::CodeType::llvmBc, IGC::CodeType::oclGenBin); |
| 806 | + EXPECT_NE(nullptr, retIgc); |
| 807 | + IGC::IgcOclDeviceCtxTagOCL *devCtx = pCompilerInterface->peekIgcDeviceCtx(device); |
| 808 | + auto igcPlatform = devCtx->GetPlatformHandle(); |
| 809 | + auto igcSysInfo = devCtx->GetGTSystemInfoHandle(); |
| 810 | + EXPECT_EQ(device->getHardwareInfo().pPlatform->eProductFamily, igcPlatform->GetProductFamily()); |
| 811 | + EXPECT_EQ(device->getHardwareInfo().pPlatform->eRenderCoreFamily, igcPlatform->GetRenderCoreFamily()); |
| 812 | + EXPECT_EQ(device->getHardwareInfo().pSysInfo->SliceCount, igcSysInfo->GetSliceCount()); |
| 813 | + EXPECT_EQ(device->getHardwareInfo().pSysInfo->SubSliceCount, igcSysInfo->GetSubSliceCount()); |
| 814 | + EXPECT_EQ(device->getHardwareInfo().pSysInfo->EUCount, igcSysInfo->GetEUCount()); |
| 815 | + EXPECT_EQ(device->getHardwareInfo().pSysInfo->ThreadCount, igcSysInfo->GetThreadCount()); |
| 816 | +} |
| 817 | + |
| 818 | +TEST_F(CompilerInterfaceTest, givenDbgKeyForceUseDifferentPlatformWhenRequestForNewTranslationCtxThenUseDbgKeyPlatform) { |
| 819 | + DebugManagerStateRestore dbgRestore; |
| 820 | + auto dbgProdFamily = DEFAULT_TEST_PLATFORM::hwInfo.pPlatform->eProductFamily; |
| 821 | + std::string dbgPlatformString(hardwarePrefix[dbgProdFamily]); |
| 822 | + const PLATFORM dbgPlatform = *hardwareInfoTable[dbgProdFamily]->pPlatform; |
| 823 | + const GT_SYSTEM_INFO dbgSystemInfo = *hardwareInfoTable[dbgProdFamily]->pSysInfo; |
| 824 | + DebugManager.flags.ForceCompilerUsePlatform.set(dbgPlatformString); |
| 825 | + |
| 826 | + auto device = this->pContext->getDevice(0); |
| 827 | + auto retIgc = pCompilerInterface->createIgcTranslationCtx(*device, IGC::CodeType::llvmBc, IGC::CodeType::oclGenBin); |
| 828 | + EXPECT_NE(nullptr, retIgc); |
| 829 | + IGC::IgcOclDeviceCtxTagOCL *devCtx = pCompilerInterface->peekIgcDeviceCtx(device); |
| 830 | + auto igcPlatform = devCtx->GetPlatformHandle(); |
| 831 | + auto igcSysInfo = devCtx->GetGTSystemInfoHandle(); |
| 832 | + |
| 833 | + EXPECT_EQ(dbgPlatform.eProductFamily, igcPlatform->GetProductFamily()); |
| 834 | + EXPECT_EQ(dbgPlatform.eRenderCoreFamily, igcPlatform->GetRenderCoreFamily()); |
| 835 | + EXPECT_EQ(dbgSystemInfo.SliceCount, igcSysInfo->GetSliceCount()); |
| 836 | + EXPECT_EQ(dbgSystemInfo.SubSliceCount, igcSysInfo->GetSubSliceCount()); |
| 837 | + EXPECT_EQ(dbgSystemInfo.EUCount, igcSysInfo->GetEUCount()); |
| 838 | + EXPECT_EQ(dbgSystemInfo.ThreadCount, igcSysInfo->GetThreadCount()); |
| 839 | +} |
| 840 | + |
800 | 841 | TEST_F(CompilerInterfaceTest, IsCompilerAvailable) {
|
801 | 842 | ASSERT_TRUE(this->pCompilerInterface->GetIgcMain() && this->pCompilerInterface->GetFclMain());
|
802 | 843 | EXPECT_TRUE(this->pCompilerInterface->isCompilerAvailable());
|
|
0 commit comments