Prepare ults for patch tokens cleanup

Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>

Related-To: IGC-5606
This commit is contained in:
Kamil Kopryk
2022-08-18 14:11:45 +00:00
committed by Compute-Runtime-Automation
parent 7a586111f2
commit 67d7846974
2 changed files with 62 additions and 3 deletions

View File

@ -5,6 +5,7 @@
* *
*/ */
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/source/helpers/pause_on_gpu_properties.h" #include "shared/source/helpers/pause_on_gpu_properties.h"
#include "shared/source/helpers/preamble.h" #include "shared/source/helpers/preamble.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/debug_manager_state_restore.h"
@ -554,6 +555,8 @@ HWTEST_F(EnqueueKernelTest, GivenGpuHangAndBlockingCallWhenEnqueingKernelThenOut
} }
HWTEST_F(EnqueueKernelTest, WhenEnqueingKernelThenIndirectDataIsAdded) { HWTEST_F(EnqueueKernelTest, WhenEnqueingKernelThenIndirectDataIsAdded) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
auto dshBefore = pDSH->getUsed(); auto dshBefore = pDSH->getUsed();
auto iohBefore = pIOH->getUsed(); auto iohBefore = pIOH->getUsed();
auto sshBefore = pSSH->getUsed(); auto sshBefore = pSSH->getUsed();
@ -561,7 +564,7 @@ HWTEST_F(EnqueueKernelTest, WhenEnqueingKernelThenIndirectDataIsAdded) {
callOneWorkItemNDRKernel(); callOneWorkItemNDRKernel();
EXPECT_TRUE(UnitTestHelper<FamilyType>::evaluateDshUsage(dshBefore, pDSH->getUsed(), &pKernel->getKernelInfo().kernelDescriptor, rootDeviceIndex)); EXPECT_TRUE(UnitTestHelper<FamilyType>::evaluateDshUsage(dshBefore, pDSH->getUsed(), &pKernel->getKernelInfo().kernelDescriptor, rootDeviceIndex));
EXPECT_NE(iohBefore, pIOH->getUsed()); EXPECT_NE(iohBefore, pIOH->getUsed());
if (pKernel->usesBindfulAddressingForBuffers() || pKernel->getKernelInfo().kernelDescriptor.kernelAttributes.flags.usesImages) { if ((pKernel->usesBindfulAddressingForBuffers() || pKernel->getKernelInfo().kernelDescriptor.kernelAttributes.flags.usesImages) && compilerHwInfoConfig.isStatelessToStatefulBufferOffsetSupported()) {
EXPECT_NE(sshBefore, pSSH->getUsed()); EXPECT_NE(sshBefore, pSSH->getUsed());
} }
} }

View File

@ -8,6 +8,7 @@
#include "shared/source/device/device.h" #include "shared/source/device/device.h"
#include "shared/source/device_binary_format/patchtokens_decoder.h" #include "shared/source/device_binary_format/patchtokens_decoder.h"
#include "shared/source/helpers/basic_math.h" #include "shared/source/helpers/basic_math.h"
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/source/helpers/file_io.h" #include "shared/source/helpers/file_io.h"
#include "shared/source/helpers/hash.h" #include "shared/source/helpers/hash.h"
#include "shared/source/memory_manager/surface.h" #include "shared/source/memory_manager/surface.h"
@ -723,6 +724,12 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenContextIsCreatedThenCorrect
} }
TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsExecutedThenGTPinCallbacksAreCalled) { TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsExecutedThenGTPinCallbacksAreCalled) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired() || !compilerHwInfoConfig.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP();
}
gtpinCallbacks.onContextCreate = onContextCreate; gtpinCallbacks.onContextCreate = onContextCreate;
gtpinCallbacks.onContextDestroy = onContextDestroy; gtpinCallbacks.onContextDestroy = onContextDestroy;
gtpinCallbacks.onKernelCreate = onKernelCreate; gtpinCallbacks.onKernelCreate = onKernelCreate;
@ -873,6 +880,12 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsExecutedThenGTPinCa
} }
TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelINTELIsExecutedThenGTPinCallbacksAreCalled) { TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelINTELIsExecutedThenGTPinCallbacksAreCalled) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired() || !compilerHwInfoConfig.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP();
}
gtpinCallbacks.onContextCreate = onContextCreate; gtpinCallbacks.onContextCreate = onContextCreate;
gtpinCallbacks.onContextDestroy = onContextDestroy; gtpinCallbacks.onContextDestroy = onContextDestroy;
gtpinCallbacks.onKernelCreate = onKernelCreate; gtpinCallbacks.onKernelCreate = onKernelCreate;
@ -1071,6 +1084,12 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelWithoutSSHIsUsedThenK
} }
TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelWithoutSSHIsUsedThenGTPinSubmitKernelCallbackIsNotCalled) { TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelWithoutSSHIsUsedThenGTPinSubmitKernelCallbackIsNotCalled) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired() || !compilerHwInfoConfig.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP();
}
gtpinCallbacks.onContextCreate = onContextCreate; gtpinCallbacks.onContextCreate = onContextCreate;
gtpinCallbacks.onContextDestroy = onContextDestroy; gtpinCallbacks.onContextDestroy = onContextDestroy;
gtpinCallbacks.onKernelCreate = onKernelCreate; gtpinCallbacks.onKernelCreate = onKernelCreate;
@ -1185,6 +1204,12 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelWithoutSSHIsUsedThenG
} }
TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenBlockedKernelWithoutSSHIsUsedThenGTPinSubmitKernelCallbackIsNotCalled) { TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenBlockedKernelWithoutSSHIsUsedThenGTPinSubmitKernelCallbackIsNotCalled) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired() || !compilerHwInfoConfig.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP();
}
gtpinCallbacks.onContextCreate = onContextCreate; gtpinCallbacks.onContextCreate = onContextCreate;
gtpinCallbacks.onContextDestroy = onContextDestroy; gtpinCallbacks.onContextDestroy = onContextDestroy;
gtpinCallbacks.onKernelCreate = onKernelCreate; gtpinCallbacks.onKernelCreate = onKernelCreate;
@ -1308,6 +1333,12 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenBlockedKernelWithoutSSHIsUs
} }
TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenTheSameKerneIsExecutedTwiceThenGTPinCreateKernelCallbackIsCalledOnce) { TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenTheSameKerneIsExecutedTwiceThenGTPinCreateKernelCallbackIsCalledOnce) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired() || !compilerHwInfoConfig.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP();
}
gtpinCallbacks.onContextCreate = onContextCreate; gtpinCallbacks.onContextCreate = onContextCreate;
gtpinCallbacks.onContextDestroy = onContextDestroy; gtpinCallbacks.onContextDestroy = onContextDestroy;
gtpinCallbacks.onKernelCreate = onKernelCreate; gtpinCallbacks.onKernelCreate = onKernelCreate;
@ -1471,6 +1502,10 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenTheSameKerneIsExecutedTwice
} }
TEST_F(GTPinTests, givenMultipleKernelSubmissionsWhenOneOfGtpinSurfacesIsNullThenOnlyNonNullSurfacesAreMadeResident) { TEST_F(GTPinTests, givenMultipleKernelSubmissionsWhenOneOfGtpinSurfacesIsNullThenOnlyNonNullSurfacesAreMadeResident) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired() || !compilerHwInfoConfig.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP();
}
gtpinCallbacks.onContextCreate = onContextCreate; gtpinCallbacks.onContextCreate = onContextCreate;
gtpinCallbacks.onContextDestroy = onContextDestroy; gtpinCallbacks.onContextDestroy = onContextDestroy;
gtpinCallbacks.onKernelCreate = onKernelCreate; gtpinCallbacks.onKernelCreate = onKernelCreate;
@ -1533,6 +1568,8 @@ TEST_F(GTPinTests, givenMultipleKernelSubmissionsWhenOneOfGtpinSurfacesIsNullThe
auto pCmdQueue = castToObject<CommandQueue>(cmdQ); auto pCmdQueue = castToObject<CommandQueue>(cmdQ);
gtpinNotifyKernelSubmit(pMultiDeviceKernel1, pCmdQueue); gtpinNotifyKernelSubmit(pMultiDeviceKernel1, pCmdQueue);
ASSERT_NE(0u, kernelExecQueue.size());
EXPECT_EQ(nullptr, kernelExecQueue[0].gtpinResource); EXPECT_EQ(nullptr, kernelExecQueue[0].gtpinResource);
CommandStreamReceiver &csr = pCmdQueue->getGpgpuCommandStreamReceiver(); CommandStreamReceiver &csr = pCmdQueue->getGpgpuCommandStreamReceiver();
@ -1592,6 +1629,12 @@ TEST_F(GTPinTests, givenMultipleKernelSubmissionsWhenOneOfGtpinSurfacesIsNullThe
} }
TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsCreatedThenAllKernelSubmitRelatedNotificationsAreCalled) { TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsCreatedThenAllKernelSubmitRelatedNotificationsAreCalled) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired() || !compilerHwInfoConfig.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP();
}
gtpinCallbacks.onContextCreate = onContextCreate; gtpinCallbacks.onContextCreate = onContextCreate;
gtpinCallbacks.onContextDestroy = onContextDestroy; gtpinCallbacks.onContextDestroy = onContextDestroy;
gtpinCallbacks.onKernelCreate = onKernelCreate; gtpinCallbacks.onKernelCreate = onKernelCreate;
@ -1787,6 +1830,12 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsCreatedThenAllKerne
} }
TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenOneKernelIsSubmittedSeveralTimesThenCorrectBuffersAreMadeResident) { TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenOneKernelIsSubmittedSeveralTimesThenCorrectBuffersAreMadeResident) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired() || !compilerHwInfoConfig.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP();
}
gtpinCallbacks.onContextCreate = onContextCreate; gtpinCallbacks.onContextCreate = onContextCreate;
gtpinCallbacks.onContextDestroy = onContextDestroy; gtpinCallbacks.onContextDestroy = onContextDestroy;
gtpinCallbacks.onKernelCreate = onKernelCreate; gtpinCallbacks.onKernelCreate = onKernelCreate;
@ -2035,6 +2084,11 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenLowMemoryConditionOccursThe
} }
TEST_F(GTPinTests, givenKernelWithSSHThenVerifyThatSSHResizeWorksWell) { TEST_F(GTPinTests, givenKernelWithSSHThenVerifyThatSSHResizeWorksWell) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired() || !compilerHwInfoConfig.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP();
}
cl_kernel kernel = nullptr; cl_kernel kernel = nullptr;
cl_program pProgram = nullptr; cl_program pProgram = nullptr;
cl_device_id device = (cl_device_id)pDevice; cl_device_id device = (cl_device_id)pDevice;
@ -2221,7 +2275,7 @@ TEST(GTPinOfflineTests, givenGtPinInDisabledStateWhenCallbacksFromEnqueuePathAre
auto dummyQueue = reinterpret_cast<void *>(0x1000); auto dummyQueue = reinterpret_cast<void *>(0x1000);
uint32_t dummyCompletedTask = 0u; uint32_t dummyCompletedTask = 0u;
//now call gtpin function with dummy data, this must not crash // now call gtpin function with dummy data, this must not crash
gtpinNotifyKernelSubmit(dummyKernel, dummyQueue); gtpinNotifyKernelSubmit(dummyKernel, dummyQueue);
gtpinNotifyPreFlushTask(dummyQueue); gtpinNotifyPreFlushTask(dummyQueue);
gtpinNotifyTaskCompletion(dummyCompletedTask); gtpinNotifyTaskCompletion(dummyCompletedTask);
@ -2491,7 +2545,9 @@ HWTEST_F(GTPinTestsWithLocalMemory, givenGtPinCanUseSharedAllocationWhenGtPinBuf
HWTEST_F(GTPinTestsWithLocalMemory, givenGtPinCanUseSharedAllocationWhenGtPinBufferIsAllocatedInSharedMemoryThenSetSurfaceStateForTheBufferAndMakeItResident) { HWTEST_F(GTPinTestsWithLocalMemory, givenGtPinCanUseSharedAllocationWhenGtPinBufferIsAllocatedInSharedMemoryThenSetSurfaceStateForTheBufferAndMakeItResident) {
GTPinHwHelper &gtpinHelper = GTPinHwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily); GTPinHwHelper &gtpinHelper = GTPinHwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily);
if (!gtpinHelper.canUseSharedAllocation(pDevice->getHardwareInfo())) { const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (!gtpinHelper.canUseSharedAllocation(pDevice->getHardwareInfo()) ||
compilerHwInfoConfig.isForceToStatelessRequired() || !compilerHwInfoConfig.isStatelessToStatefulBufferOffsetSupported()) {
GTEST_SKIP(); GTEST_SKIP();
} }