fix: create and use new allocation type for syncBuffer

Related-To: NEO-11533
Related-To: HSD-18039788811
Signed-off-by: Fabian Zwoliński <fabian.zwolinski@intel.com>
This commit is contained in:
Fabian Zwoliński
2024-09-05 19:37:52 +00:00
committed by Compute-Runtime-Automation
parent d11d61d229
commit 38e1614f4a
13 changed files with 17 additions and 6 deletions

View File

@@ -1182,7 +1182,7 @@ void KernelImp::patchSyncBuffer(NEO::GraphicsAllocation *gfxAllocation, size_t b
this->internalResidencyContainer.push_back(gfxAllocation);
NEO::patchPointer(ArrayRef<uint8_t>(crossThreadData.get(), crossThreadDataSize),
this->getImmutableData()->getDescriptor().payloadMappings.implicitArgs.syncBufferAddress,
static_cast<uintptr_t>(ptrOffset(gfxAllocation->getGpuAddress(), bufferOffset)));
static_cast<uintptr_t>(ptrOffset(gfxAllocation->getGpuAddressToPatch(), bufferOffset)));
}
void KernelImp::patchRegionGroupBarrier(NEO::GraphicsAllocation *gfxAllocation, size_t bufferOffset) {

View File

@@ -4187,7 +4187,6 @@ TEST_F(KernelSyncBufferTest, GivenSyncBufferArgWhenPatchingSyncBufferThenPtrIsCo
NEO::MockGraphicsAllocation alloc;
alloc.setGpuPtr(0xffff800300060000);
alloc.setGpuBaseAddress(0xffff800300000000);
alloc.allocationOffset = 0x0;
size_t bufferOffset = 0u;
@@ -4195,7 +4194,7 @@ TEST_F(KernelSyncBufferTest, GivenSyncBufferArgWhenPatchingSyncBufferThenPtrIsCo
kernel.patchSyncBuffer(&alloc, bufferOffset);
auto patchValue = *reinterpret_cast<uint64_t *>(ptrOffset(kernel.crossThreadData.get(), syncBuffer.stateless));
auto expectedPatchValue = ptrOffset(alloc.getGpuAddress(), bufferOffset);
auto expectedPatchValue = ptrOffset(alloc.getGpuAddressToPatch(), bufferOffset);
EXPECT_EQ(expectedPatchValue, patchValue);
neoDevice->decRefInternal();

View File

@@ -86,6 +86,8 @@ const char *AppResourceHelper::getResourceTagStr(AllocationType type) {
return "SVM_GPU";
case AllocationType::svmZeroCopy:
return "SVM0COPY";
case AllocationType::syncBuffer:
return "SYNCBUFF";
case AllocationType::tagBuffer:
return "TAGBUFER";
case AllocationType::globalFence:

View File

@@ -43,6 +43,7 @@ enum class AllocationType {
svmCpu,
svmGpu,
svmZeroCopy,
syncBuffer,
tagBuffer,
globalFence,
timestampPacketTagBuffer,

View File

@@ -83,6 +83,7 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope
case AllocationType::commandBuffer:
case AllocationType::internalHeap:
case AllocationType::linearStream:
case AllocationType::syncBuffer:
storageInfo.cloningOfPageTables = properties.flags.multiOsContextCapable;
if (!properties.flags.multiOsContextCapable) {
storageInfo.pageTablesVisibility = preferredTile;

View File

@@ -223,7 +223,8 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
allocationType == AllocationType::gpuTimestampDeviceBuffer ||
allocationType == AllocationType::debugModuleArea ||
allocationType == AllocationType::assertBuffer ||
allocationType == AllocationType::syncDispatchToken;
allocationType == AllocationType::syncDispatchToken ||
allocationType == AllocationType::syncBuffer;
}
static bool isLockable(AllocationType allocationType) {
return isCpuAccessRequired(allocationType) ||

View File

@@ -32,7 +32,7 @@ void SyncBufferHandler::makeResident(CommandStreamReceiver &csr) {
void SyncBufferHandler::allocateNewBuffer() {
AllocationProperties allocationProperties{device.getRootDeviceIndex(), true, bufferSize,
AllocationType::linearStream,
AllocationType::syncBuffer,
(device.getNumGenericSubDevices() > 1u), /* multiOsContextCapable */
false, device.getDeviceBitfield()};
graphicsAllocation = memoryManager.allocateGraphicsMemoryWithProperties(allocationProperties);

View File

@@ -214,6 +214,8 @@ const char *getAllocationTypeString(GraphicsAllocation const *graphicsAllocation
return "SVM_GPU";
case AllocationType::svmZeroCopy:
return "SVM_ZERO_COPY";
case AllocationType::syncBuffer:
return "SYNC_BUFFER";
case AllocationType::tagBuffer:
return "TAG_BUFFER";
case AllocationType::globalFence:

View File

@@ -87,6 +87,7 @@ AllocationTypeTagTestCase allocationTypeTagValues[static_cast<int>(AllocationTyp
{AllocationType::svmCpu, "SVM_CPU"},
{AllocationType::svmGpu, "SVM_GPU"},
{AllocationType::svmZeroCopy, "SVM0COPY"},
{AllocationType::syncBuffer, "SYNCBUFF"},
{AllocationType::tagBuffer, "TAGBUFER"},
{AllocationType::globalFence, "GLBLFENC"},
{AllocationType::timestampPacketTagBuffer, "TSPKTGBF"},

View File

@@ -159,6 +159,7 @@ TEST(GraphicsAllocationTest, givenAllocationTypeWhenCheckingCpuAccessRequiredThe
case AllocationType::debugModuleArea:
case AllocationType::assertBuffer:
case AllocationType::syncDispatchToken:
case AllocationType::syncBuffer:
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(allocType));
break;
default:

View File

@@ -1292,6 +1292,7 @@ static const AllocationType allocationHaveNotToBeForcedTo48Bit[] = {
AllocationType::svmCpu,
AllocationType::svmGpu,
AllocationType::svmZeroCopy,
AllocationType::syncBuffer,
AllocationType::tagBuffer,
AllocationType::globalFence,
AllocationType::writeCombined,

View File

@@ -563,6 +563,7 @@ TEST_F(WddmMemoryManagerTests, givenTypeWhenCallIsStatelessAccessRequiredThenPro
AllocationType::svmCpu,
AllocationType::svmGpu,
AllocationType::svmZeroCopy,
AllocationType::syncBuffer,
AllocationType::tagBuffer,
AllocationType::globalFence,
AllocationType::timestampPacketTagBuffer,

View File

@@ -446,7 +446,7 @@ TEST(AllocationTypeLogging, givenGraphicsAllocationTypeWhenConvertingToStringThe
DebugVariables flags;
FullyEnabledFileLogger fileLogger(testFile, flags);
std::array<std::pair<NEO::AllocationType, const char *>, 40> allocationTypeValues = {
std::array<std::pair<NEO::AllocationType, const char *>, 41> allocationTypeValues = {
{{AllocationType::buffer, "BUFFER"},
{AllocationType::bufferHostMemory, "BUFFER_HOST_MEMORY"},
{AllocationType::commandBuffer, "COMMAND_BUFFER"},
@@ -478,6 +478,7 @@ TEST(AllocationTypeLogging, givenGraphicsAllocationTypeWhenConvertingToStringThe
{AllocationType::svmCpu, "SVM_CPU"},
{AllocationType::svmGpu, "SVM_GPU"},
{AllocationType::svmZeroCopy, "SVM_ZERO_COPY"},
{AllocationType::syncBuffer, "SYNC_BUFFER"},
{AllocationType::tagBuffer, "TAG_BUFFER"},
{AllocationType::globalFence, "GLOBAL_FENCE"},
{AllocationType::timestampPacketTagBuffer, "TIMESTAMP_PACKET_TAG_BUFFER"},