L0 debugger - reports process ENTER/EXIT events for zeCommandQueues

- PROCESS_ENTRY - triggered by first zeCommandQueueCreate()
- PROCESS_EXIT  - triggered by last zeCommandQueueDestroy()

Resolves: NEO-6503

Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
This commit is contained in:
Igor Venevtsev
2022-02-10 11:13:59 +00:00
committed by Compute-Runtime-Automation
parent dbe1779e4b
commit 60d6505932
11 changed files with 105 additions and 4 deletions

View File

@@ -57,6 +57,9 @@ ze_result_t CommandQueueImp::initialize(bool copyOnly, bool isInternal) {
if (!isInternal) {
partitionCount = csr->getActivePartitions();
}
if (NEO::Debugger::isDebugEnabled(internalUsage) && device->getL0Debugger()) {
device->getL0Debugger()->notifyCommandQueueCreated();
}
}
return returnValue;
}

View File

@@ -56,6 +56,9 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::destroy() {
commandStream = nullptr;
}
buffers.destroy(this->getDevice());
if (NEO::Debugger::isDebugEnabled(internalUsage) && device->getL0Debugger()) {
device->getL0Debugger()->notifyCommandQueueDestroyed();
}
delete this;
return ZE_RESULT_SUCCESS;
}

View File

@@ -86,6 +86,8 @@ class DebuggerL0 : public NEO::Debugger, NEO::NonCopyableOrMovableClass {
void captureStateBaseAddress(NEO::CommandContainer &container, SbaAddresses sba) override;
void printTrackedAddresses(uint32_t contextId);
MOCKABLE_VIRTUAL void registerElf(NEO::DebugData *debugData, NEO::GraphicsAllocation *isaAllocation);
MOCKABLE_VIRTUAL void notifyCommandQueueCreated();
MOCKABLE_VIRTUAL void notifyCommandQueueDestroyed();
virtual size_t getSbaTrackingCommandsSize(size_t trackedAddressCount) = 0;
virtual void programSbaTrackingCommands(NEO::LinearStream &cmdStream, const SbaAddresses &sba) = 0;
@@ -108,6 +110,8 @@ class DebuggerL0 : public NEO::Debugger, NEO::NonCopyableOrMovableClass {
std::unordered_map<uint32_t, NEO::GraphicsAllocation *> perContextSbaAllocations;
NEO::AddressRange sbaTrackingGpuVa;
NEO::GraphicsAllocation *moduleDebugArea = nullptr;
std::atomic<uint32_t> commandQueueCount = 0u;
uint32_t uuidL0CommandQueueHandle = 0;
};
using DebugerL0CreateFn = DebuggerL0 *(*)(NEO::Device *device);
@@ -132,4 +136,4 @@ struct DebuggerL0PopulateFactory {
}
};
} // namespace L0
} // namespace L0

View File

@@ -58,4 +58,23 @@ bool DebuggerL0::removeZebinModule(uint32_t moduleHandle) {
drm->unregisterResource(moduleHandle);
return true;
}
void DebuggerL0::notifyCommandQueueCreated() {
if (device->getRootDeviceEnvironment().osInterface.get() != nullptr) {
if (++commandQueueCount == 1) {
auto drm = device->getRootDeviceEnvironment().osInterface->getDriverModel()->as<NEO::Drm>();
uuidL0CommandQueueHandle = drm->notifyFirstCommandQueueCreated();
}
}
}
void DebuggerL0::notifyCommandQueueDestroyed() {
if (device->getRootDeviceEnvironment().osInterface.get() != nullptr) {
if (--commandQueueCount == 0) {
auto drm = device->getRootDeviceEnvironment().osInterface->getDriverModel()->as<NEO::Drm>();
drm->notifyLastCommandQueueDestroyed(uuidL0CommandQueueHandle);
}
}
}
} // namespace L0

View File

@@ -27,4 +27,10 @@ bool DebuggerL0::removeZebinModule(uint32_t moduleHandle) {
return false;
}
void DebuggerL0::notifyCommandQueueCreated() {
}
void DebuggerL0::notifyCommandQueueDestroyed() {
}
} // namespace L0