Refactor source level debugger notification in OCL. [1/n]

Refactor source level debugger notification in OCL path - in build()
cl_program method. It fixes confusing debug data creation (mixed
legacy/zebin path) and thus incorrect kernel notification about debug
data.

Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
Related-To: NEO-6644
This commit is contained in:
Kacper Nowak
2022-02-09 13:18:18 +00:00
committed by Compute-Runtime-Automation
parent 454888a045
commit 741ee49c9a
6 changed files with 113 additions and 76 deletions

View File

@@ -186,13 +186,24 @@ cl_int Program::build(
if (BuildPhase::DebugDataNotification == phaseReached[rootDeviceIndex]) {
continue;
}
createDebugData(clDevice->getRootDeviceIndex());
if (clDevice->getSourceLevelDebugger()) {
for (auto kernelInfo : buildInfos[rootDeviceIndex].kernelInfoArray) {
clDevice->getSourceLevelDebugger()->notifyKernelDebugData(&kernelInfo->debugData,
kernelInfo->kernelDescriptor.kernelMetadata.kernelName,
kernelInfo->heapInfo.pKernelHeap,
kernelInfo->heapInfo.KernelHeapSize);
auto refBin = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(this->buildInfos[clDevice->getRootDeviceIndex()].unpackedDeviceBinary.get()), this->buildInfos[clDevice->getRootDeviceIndex()].unpackedDeviceBinarySize);
if (NEO::isDeviceBinaryFormat<NEO::DeviceBinaryFormat::Zebin>(refBin)) {
createDebugZebin(clDevice->getRootDeviceIndex());
if (clDevice->getSourceLevelDebugger()) {
NEO::DebugData debugData;
debugData.vIsa = reinterpret_cast<const char *>(this->buildInfos[clDevice->getRootDeviceIndex()].debugData.get());
debugData.vIsaSize = static_cast<uint32_t>(this->buildInfos[clDevice->getRootDeviceIndex()].debugDataSize);
clDevice->getSourceLevelDebugger()->notifyKernelDebugData(&debugData, "debug_zebin", nullptr, 0);
}
} else {
processDebugData(clDevice->getRootDeviceIndex());
if (clDevice->getSourceLevelDebugger()) {
for (auto kernelInfo : buildInfos[rootDeviceIndex].kernelInfoArray) {
clDevice->getSourceLevelDebugger()->notifyKernelDebugData(&kernelInfo->debugData,
kernelInfo->kernelDescriptor.kernelMetadata.kernelName,
kernelInfo->heapInfo.pKernelHeap,
kernelInfo->heapInfo.KernelHeapSize);
}
}
}
phaseReached[rootDeviceIndex] = BuildPhase::DebugDataNotification;