Kernel Source Level debugger support 4/n

- adding DebugSurface allocation and setup
- unit tests refactors:
  - mock kernel with kernel debug option
  - separating fixtures to headers
  - added helper for getting internal-options kernels
    filenames

Change-Id: I7b6f4d46e2ab7cff0da8d5212483f44ae0d4be31
This commit is contained in:
Hoppe, Mateusz
2018-03-21 12:58:30 +01:00
committed by sys_ocldev
parent 7b1fd38fe6
commit 7f32eb06d1
20 changed files with 372 additions and 59 deletions

View File

@ -20,6 +20,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "runtime/built_ins/sip.h"
#include "runtime/command_queue/command_queue.h"
#include "runtime/command_queue/command_queue_hw.h"
#include "runtime/command_stream/command_stream_receiver.h"
@ -629,4 +630,22 @@ void CommandQueue::enqueueBlockedMapUnmapOperation(const cl_event *eventWaitList
this->virtualEvent = eventBuilder->getEvent();
}
bool CommandQueue::setupDebugSurface(Kernel *kernel) {
auto &commandStreamReceiver = device->getCommandStreamReceiver();
auto debugSurface = commandStreamReceiver.getDebugSurfaceAllocation();
if (!debugSurface) {
debugSurface = commandStreamReceiver.allocateDebugSurface(SipKernel::maxDbgSurfaceSize);
}
DEBUG_BREAK_IF(!kernel->requiresSshForBuffers());
auto surfaceState = ptrOffset(reinterpret_cast<uintptr_t *>(kernel->getSurfaceStateHeap()),
kernel->getKernelInfo().patchInfo.pAllocateSystemThreadSurface->Offset);
void *addressToPatch = reinterpret_cast<void *>(debugSurface->getGpuAddress());
size_t sizeToPatch = debugSurface->getUnderlyingBufferSize();
Buffer::setSurfaceState(context, surfaceState, sizeToPatch, addressToPatch, debugSurface);
return true;
}
} // namespace OCLRT