|
1 | 1 | /* |
2 | | - * Copyright (C) 2022-2023 Intel Corporation |
| 2 | + * Copyright (C) 2022-2024 Intel Corporation |
3 | 3 | * |
4 | 4 | * SPDX-License-Identifier: MIT |
5 | 5 | * |
@@ -837,5 +837,55 @@ HWTEST_F(CommandQueueExecuteCommandListsSimpleTest, GivenDirtyFlagForContextInBi |
837 | 837 | commandQueue->destroy(); |
838 | 838 | } |
839 | 839 |
|
| 840 | +HWTEST_F(CommandQueueExecuteCommandListsSimpleTest, GivenRegisterInstructionCacheFlushWhenExecutingCmdListsThenInstructionCacheInvalidateIsSent) { |
| 841 | + using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; |
| 842 | + ze_command_queue_desc_t queueDesc = {}; |
| 843 | + ze_result_t returnValue; |
| 844 | + |
| 845 | + neoDevice->getDefaultEngine().commandStreamReceiver->registerInstructionCacheFlush(); |
| 846 | + |
| 847 | + queueDesc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS; |
| 848 | + auto commandQueue = whiteboxCast(CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, false, false, false, returnValue)); |
| 849 | + ASSERT_NE(nullptr, commandQueue); |
| 850 | + |
| 851 | + auto usedSpaceBefore = commandQueue->commandStream.getUsed(); |
| 852 | + |
| 853 | + ze_command_list_handle_t commandLists[] = { |
| 854 | + CommandList::create(productFamily, device, NEO::EngineGroupType::renderCompute, 0u, returnValue, false)->toHandle()}; |
| 855 | + uint32_t numCommandLists = 1; |
| 856 | + CommandList::fromHandle(commandLists[0])->close(); |
| 857 | + auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true); |
| 858 | + |
| 859 | + ASSERT_EQ(ZE_RESULT_SUCCESS, result); |
| 860 | + |
| 861 | + auto usedSpaceAfter = commandQueue->commandStream.getUsed(); |
| 862 | + ASSERT_GT(usedSpaceAfter, usedSpaceBefore); |
| 863 | + |
| 864 | + GenCmdList cmdList; |
| 865 | + ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer( |
| 866 | + cmdList, ptrOffset(commandQueue->commandStream.getCpuBase(), 0), usedSpaceAfter)); |
| 867 | + |
| 868 | + auto pipeControls = findAll<PIPE_CONTROL *>(cmdList.begin(), cmdList.end()); |
| 869 | + ASSERT_NE(0u, pipeControls.size()); |
| 870 | + |
| 871 | + bool foundInstructionCacheInvalidate = false; |
| 872 | + for (auto pipeControlIT : pipeControls) { |
| 873 | + auto pipeControl = reinterpret_cast<PIPE_CONTROL *>(*pipeControlIT); |
| 874 | + if (pipeControl->getInstructionCacheInvalidateEnable()) { |
| 875 | + foundInstructionCacheInvalidate = true; |
| 876 | + break; |
| 877 | + } |
| 878 | + } |
| 879 | + |
| 880 | + EXPECT_TRUE(foundInstructionCacheInvalidate); |
| 881 | + |
| 882 | + for (auto i = 0u; i < numCommandLists; i++) { |
| 883 | + auto commandList = CommandList::fromHandle(commandLists[i]); |
| 884 | + commandList->destroy(); |
| 885 | + } |
| 886 | + |
| 887 | + commandQueue->destroy(); |
| 888 | +} |
| 889 | + |
840 | 890 | } // namespace ult |
841 | 891 | } // namespace L0 |
0 commit comments