Add debug flag for EOT WA

EOT WA requires allocating last 64KB of kernel heap and putting EOT
signature at the last 16 bytes of kernel heap

Related-To: NEO-7099
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-06-15 01:12:33 +00:00
committed by Compute-Runtime-Automation
parent 9a667308b9
commit cf3817e058
21 changed files with 271 additions and 12 deletions

View File

@@ -59,6 +59,9 @@ Device::~Device() {
syncBufferHandler.reset();
commandStreamReceivers.clear();
if (kernelEotWaAllocation) {
executionEnvironment->memoryManager->freeGraphicsMemory(kernelEotWaAllocation);
}
executionEnvironment->memoryManager->waitForDeletions();
executionEnvironment->decRefInternal();
@@ -215,10 +218,22 @@ bool Device::createDeviceImpl() {
if (getDebugger() && hwHelper.disableL3CacheForDebug(hwInfo)) {
getGmmHelper()->forceAllResourcesUncached();
}
if (DebugManager.flags.EnableEotWa.get()) {
AllocationProperties allocationProperties{rootDeviceIndex, MemoryConstants::pageSize64k, AllocationType::KERNEL_ISA, deviceBitfield};
auto memoryManager = executionEnvironment->memoryManager.get();
auto heapBase = memoryManager->getInternalHeapBaseAddress(rootDeviceIndex, memoryManager->isLocalMemoryUsedForIsa(rootDeviceIndex));
allocationProperties.gpuAddress = heapBase + 4 * MemoryConstants::gigaByte - MemoryConstants::pageSize64k;
kernelEotWaAllocation = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(allocationProperties);
}
if (!createEngines()) {
return false;
}
if (kernelEotWaAllocation) {
auto memoryManager = executionEnvironment->memoryManager.get();
uint8_t eotMemoryPattern[]{0x31, 0x09, 0x0C, 0x80, 0x04, 0x00, 0x00, 0x00, 0x0C, 0x7F, 0x20, 0x30, 0x00, 0x00, 0x00, 0x00};
memoryManager->copyMemoryToAllocation(kernelEotWaAllocation, MemoryConstants::pageSize64k - sizeof(eotMemoryPattern) - MemoryConstants::pageSize, eotMemoryPattern, sizeof(eotMemoryPattern));
}
getDefaultEngine().osContext->setDefaultContext(true);
@@ -373,6 +388,11 @@ bool Device::createEngine(uint32_t deviceCsrIndex, EngineTypeUsage engineTypeUsa
addEngineToEngineGroup(engine);
}
if (kernelEotWaAllocation) {
if (!EngineHelpers::isBcs(engineType)) {
commandStreamReceiver->addAdditionalAllocationForResidency(kernelEotWaAllocation);
}
}
commandStreamReceivers.push_back(std::move(commandStreamReceiver));
return true;

View File

@@ -202,6 +202,7 @@ class Device : public ReferenceTrackedObject<Device> {
uintptr_t specializedDevice = reinterpret_cast<uintptr_t>(nullptr);
GraphicsAllocation *kernelEotWaAllocation = nullptr;
GraphicsAllocation *rtMemoryBackedBuffer = nullptr;
std::vector<GraphicsAllocation *> rtDispatchGlobals;
struct {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -67,6 +67,9 @@ void RootDevice::initializeRootCommandStreamReceiver() {
rootCommandStreamReceiver->initializeTagAllocation();
rootCommandStreamReceiver->createGlobalFenceAllocation();
rootCommandStreamReceiver->createWorkPartitionAllocation(*this);
if (kernelEotWaAllocation) {
rootCommandStreamReceiver->addAdditionalAllocationForResidency(kernelEotWaAllocation);
}
commandStreamReceivers.push_back(std::move(rootCommandStreamReceiver));
EngineControl engine{commandStreamReceivers.back().get(), osContext};