feature: Tbx faults for all once writable types

Patch #34223 introduced the TbxPageFaultManager for handling
uploads/downloads of host buffers to the Tbx server, ensuring
host memory is kept consistent between the host and device,
even after multiple alternating writes from the host and gpu.

This patch enable fault handling for all `isAubOnceWritable`
types.

Minor exception for gpuTimestampBuffers as enabling this type
seems to break things in real-world use cases outside of ULTs.

Related-To: NEO-12319
Signed-off-by: Jack Myers <jack.myers@intel.com>
This commit is contained in:
Jack Myers
2025-01-16 00:06:13 +00:00
committed by Compute-Runtime-Automation
parent 99a7b5a4fb
commit 0b2ac4d331
2 changed files with 57 additions and 1 deletions

View File

@ -89,7 +89,7 @@ bool TbxCommandStreamReceiverHw<GfxFamily>::isAllocTbxFaultable(GraphicsAllocati
return false;
}
auto allocType = gfxAlloc->getAllocationType();
return allocType == AllocationType::bufferHostMemory;
return AubHelper::isOneTimeAubWritableAllocationType(allocType) && allocType != AllocationType::gpuTimestampDeviceBuffer;
}
template <typename GfxFamily>

View File

@ -1546,3 +1546,59 @@ HWTEST_F(TbxCommandStreamTests, givenTbxModeWhenPageFaultManagerIsNotAvailableTh
memoryManager->freeGraphicsMemory(gfxAlloc1);
}
HWTEST_F(TbxCommandStreamTests, givenTbxModeWhenPageFaultManagerIsAvailableThenTbxFaultableTypesShouldReturnTrue) {
DebugManagerStateRestore stateRestore;
debugManager.flags.SetCommandStreamReceiver.set(static_cast<int32_t>(CommandStreamReceiverType::tbx));
debugManager.flags.EnableTbxPageFaultManager.set(true);
std::unique_ptr<MockTbxCsrForPageFaultTests<FamilyType>> tbxCsr(new MockTbxCsrForPageFaultTests<FamilyType>(*pDevice->executionEnvironment, pDevice->getDeviceBitfield()));
tbxCsr->setupContext(*pDevice->getDefaultEngine().osContext);
auto memoryManager = pDevice->getMemoryManager();
NEO::GraphicsAllocation *gfxAlloc1 = memoryManager->allocateGraphicsMemoryWithProperties(
{pDevice->getRootDeviceIndex(),
MemoryConstants::pageSize,
AllocationType::bufferHostMemory,
pDevice->getDeviceBitfield()});
auto backupAllocType = gfxAlloc1->getAllocationType();
std::array onceWritableTypes{
AllocationType::pipe,
AllocationType::constantSurface,
AllocationType::globalSurface,
AllocationType::kernelIsa,
AllocationType::kernelIsaInternal,
AllocationType::privateSurface,
AllocationType::scratchSurface,
AllocationType::workPartitionSurface,
AllocationType::buffer,
AllocationType::image,
AllocationType::timestampPacketTagBuffer,
AllocationType::externalHostPtr,
AllocationType::mapAllocation,
AllocationType::svmGpu,
AllocationType::gpuTimestampDeviceBuffer,
AllocationType::assertBuffer,
AllocationType::tagBuffer,
AllocationType::syncDispatchToken,
AllocationType::bufferHostMemory,
};
std::set unsupportedOnceWritableTypes{AllocationType::gpuTimestampDeviceBuffer};
for (const auto &allocType : onceWritableTypes) {
gfxAlloc1->setAllocationType(allocType);
auto isSupportedOnceWritableType = unsupportedOnceWritableTypes.count(allocType) == 0;
if (isSupportedOnceWritableType) {
EXPECT_TRUE(tbxCsr->isAllocTbxFaultable(gfxAlloc1));
} else {
EXPECT_FALSE(tbxCsr->isAllocTbxFaultable(gfxAlloc1));
}
}
gfxAlloc1->setAllocationType(backupAllocType);
memoryManager->freeGraphicsMemory(gfxAlloc1);
}