feature: bindless global heap with debugger

- program debugSurface's SurfaceState at the beginning of Bindless Surface
State Heap - SPECIAL_SSH
- ensure SPECIAL_SSH is resident

Related-To: NEO-7063

Signed-off-by: Hoppe, Mateusz <mateusz.hoppe@intel.com>
This commit is contained in:
Hoppe, Mateusz
2023-09-28 19:33:44 +00:00
committed by Compute-Runtime-Automation
parent ba4c06811f
commit 5c565efe28
10 changed files with 181 additions and 13 deletions

View File

@@ -158,10 +158,13 @@ NEO::CompletionStamp CommandListCoreFamilyImmediate<gfxCoreFamily>::flushImmedia
if (this->device->getL0Debugger()) {
this->csr->makeResident(*this->device->getL0Debugger()->getSbaTrackingBuffer(this->csr->getOsContext().getContextId()));
this->csr->makeResident(*this->device->getDebugSurface());
if (this->device->getNEODevice()->getBindlessHeapsHelper()) {
this->csr->makeResident(*this->device->getNEODevice()->getBindlessHeapsHelper()->getHeap(NEO::BindlessHeapsHelper::SPECIAL_SSH)->getGraphicsAllocation());
}
}
NEO::Device *neoDevice = this->device->getNEODevice();
if (neoDevice->getDebugger()) {
if (neoDevice->getDebugger() && !neoDevice->getBindlessHeapsHelper()) {
auto csrHw = static_cast<NEO::CommandStreamReceiverHw<GfxFamily> *>(this->csr);
auto &sshState = csrHw->getSshState();
bool sshDirty = sshState.updateAndCheck(ssh);
@@ -270,10 +273,13 @@ NEO::CompletionStamp CommandListCoreFamilyImmediate<gfxCoreFamily>::flushRegular
UNRECOVERABLE_IF(!NEO::Debugger::isDebugEnabled(this->internalUsage));
this->csr->makeResident(*this->device->getL0Debugger()->getSbaTrackingBuffer(this->csr->getOsContext().getContextId()));
this->csr->makeResident(*this->device->getDebugSurface());
if (this->device->getNEODevice()->getBindlessHeapsHelper()) {
this->csr->makeResident(*this->device->getNEODevice()->getBindlessHeapsHelper()->getHeap(NEO::BindlessHeapsHelper::SPECIAL_SSH)->getGraphicsAllocation());
}
}
NEO::Device *neoDevice = this->device->getNEODevice();
if (neoDevice->getDebugger() && this->immediateCmdListHeapSharing) {
if (neoDevice->getDebugger() && this->immediateCmdListHeapSharing && !neoDevice->getBindlessHeapsHelper()) {
auto csrHw = static_cast<NEO::CommandStreamReceiverHw<GfxFamily> *>(this->csr);
auto sshStateCopy = csrHw->getSshState();
bool sshDirty = sshStateCopy.updateAndCheck(ssh);

View File

@@ -220,7 +220,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
this->containsStatelessUncachedResource = dispatchKernelArgs.requiresUncachedMocs;
}
if (neoDevice->getDebugger() && !this->immediateCmdListHeapSharing) {
if (neoDevice->getDebugger() && !this->immediateCmdListHeapSharing && !neoDevice->getBindlessHeapsHelper()) {
auto *ssh = commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE);
auto surfaceStateSpace = neoDevice->getDebugger()->getDebugSurfaceReservedSurfaceState(*ssh);
auto surfaceState = GfxFamily::cmdInitRenderSurfaceState;

View File

@@ -338,7 +338,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
}
}
if (neoDevice->getDebugger() && !this->immediateCmdListHeapSharing) {
if (neoDevice->getDebugger() && !this->immediateCmdListHeapSharing && !neoDevice->getBindlessHeapsHelper()) {
auto *ssh = commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE);
auto surfaceStateSpace = neoDevice->getDebugger()->getDebugSurfaceReservedSurfaceState(*ssh);
auto surfaceState = GfxFamily::cmdInitRenderSurfaceState;

View File

@@ -913,6 +913,9 @@ void CommandQueueHw<gfxCoreFamily>::makeDebugSurfaceResidentIfNEODebuggerActive(
}
UNRECOVERABLE_IF(this->device->getDebugSurface() == nullptr);
this->csr->makeResident(*this->device->getDebugSurface());
if (this->device->getNEODevice()->getBindlessHeapsHelper()) {
this->csr->makeResident(*this->device->getNEODevice()->getBindlessHeapsHelper()->getHeap(NEO::BindlessHeapsHelper::SPECIAL_SSH)->getGraphicsAllocation());
}
}
template <GFXCORE_FAMILY gfxCoreFamily>

View File

@@ -18,6 +18,7 @@
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/bindless_heaps_helper.h"
#include "shared/source/helpers/compiler_product_helper.h"
#include "shared/source/helpers/constants.h"
#include "shared/source/helpers/engine_node_helper.h"
@@ -25,6 +26,7 @@
#include "shared/source/helpers/ray_tracing_helper.h"
#include "shared/source/helpers/string.h"
#include "shared/source/helpers/topology_map.h"
#include "shared/source/indirect_heap/indirect_heap.h"
#include "shared/source/kernel/grf_config.h"
#include "shared/source/memory_manager/allocation_properties.h"
#include "shared/source/memory_manager/allocations_list.h"
@@ -56,6 +58,8 @@
#include "level_zero/tools/source/metrics/metric.h"
#include "level_zero/tools/source/sysman/sysman.h"
#include "encode_surface_state_args.h"
#include <algorithm>
namespace NEO {
@@ -1243,6 +1247,22 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool
NEO::MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *debugSurface),
*neoDevice, debugSurface, 0, stateSaveAreaHeader.data(),
stateSaveAreaHeader.size());
if (neoDevice->getBindlessHeapsHelper()) {
auto &gfxCoreHelper = neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[debugSurface->getRootDeviceIndex()]->getHelper<NEO::GfxCoreHelper>();
auto ssh = neoDevice->getBindlessHeapsHelper()->getHeap(NEO::BindlessHeapsHelper::SPECIAL_SSH)->getCpuBase();
NEO::EncodeSurfaceStateArgs args;
args.outMemory = ssh;
args.graphicsAddress = device->getDebugSurface()->getGpuAddress();
args.size = device->getDebugSurface()->getUnderlyingBufferSize();
args.mocs = device->getMOCS(false, false);
args.numAvailableDevices = neoDevice->getNumGenericSubDevices();
args.allocation = device->getDebugSurface();
args.gmmHelper = neoDevice->getGmmHelper();
args.useGlobalAtomics = false;
args.areMultipleSubDevicesInContext = neoDevice->getNumGenericSubDevices() > 1;
args.isDebuggerActive = true;
gfxCoreHelper.encodeBufferSurfaceState(args);
}
}
for (auto &neoSubDevice : neoDevice->getSubDevices()) {

View File

@@ -230,6 +230,8 @@ ze_result_t DriverHandleImp::initialize(std::vector<std::unique_ptr<NEO::Device>
auto osInterface = device->getNEODevice()->getRootDeviceEnvironment().osInterface.get();
if (osInterface && !osInterface->isDebugAttachAvailable() && enableProgramDebugging != NEO::DebuggingMode::Disabled) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"Debug mode is not enabled in the system.\n");
return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE;
}