fix: reset patched scratch per thread size values after command list reset

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2024-04-08 18:22:30 +00:00
committed by Compute-Runtime-Automation
parent f40449b3e8
commit 0ad5316f53
2 changed files with 15 additions and 0 deletions

View File

@@ -122,6 +122,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::reset() {
commandListPreemptionMode = device->getDevicePreemptionMode();
commandListPerThreadScratchSize[0] = 0u;
commandListPerThreadScratchSize[1] = 0u;
commandListPatchedPerThreadScratchSize[0] = 0u;
commandListPatchedPerThreadScratchSize[1] = 0u;
requiredStreamState.resetState();
finalStreamState.resetState();
containsAnyKernel = false;

View File

@@ -1533,6 +1533,9 @@ void CommandListScratchPatchFixtureInit::testScratchGrowingPatching() {
result = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false, nullptr, 0, nullptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(0x40u, commandList->getCommandListPatchedPerThreadScratchSize(0));
EXPECT_EQ(0u, commandList->getCommandListPatchedPerThreadScratchSize(1));
auto scratchAddress = scratchController->getScratchPatchAddress();
auto fullScratchAddress = surfaceHeapGpuBase + scratchAddress;
@@ -1543,6 +1546,10 @@ void CommandListScratchPatchFixtureInit::testScratchGrowingPatching() {
EXPECT_EQ(fullScratchAddress, scratchInlineValue);
commandList->reset();
EXPECT_EQ(0u, commandList->getCommandListPatchedPerThreadScratchSize(0));
EXPECT_EQ(0u, commandList->getCommandListPatchedPerThreadScratchSize(1));
mockKernelImmData->kernelDescriptor->kernelAttributes.perThreadScratchSize[1] = 0x40;
usedBefore = cmdListStream->getUsed();
@@ -1563,9 +1570,15 @@ void CommandListScratchPatchFixtureInit::testScratchGrowingPatching() {
result = commandList->close();
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
// simulate slot 0 is already patched - to check slot 1 change is detected
commandList->setCommandListPatchedPerThreadScratchSize(0, 0x40);
result = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false, nullptr, 0, nullptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(0x40u, commandList->getCommandListPatchedPerThreadScratchSize(0));
EXPECT_EQ(0x40u, commandList->getCommandListPatchedPerThreadScratchSize(1));
scratchAddress = scratchController->getScratchPatchAddress();
auto fullScratchSlot1Address = surfaceHeapGpuBase + scratchAddress;