Save State Save Area Header in OCL

Signed-off-by: Matias Cabral <matias.a.cabral@intel.com>
This commit is contained in:
Matias Cabral
2021-05-03 16:53:05 -07:00
committed by Compute-Runtime-Automation
parent cf5cafcc49
commit 2830073139
4 changed files with 42 additions and 4 deletions

View File

@@ -72,7 +72,16 @@ class CommandQueueHw : public CommandQueue {
}
if (device->getDevice().getDebugger() && !getGpgpuCommandStreamReceiver().getDebugSurfaceAllocation()) {
getGpgpuCommandStreamReceiver().allocateDebugSurface(SipKernel::maxDbgSurfaceSize);
auto debugSurface = getGpgpuCommandStreamReceiver().allocateDebugSurface(SipKernel::maxDbgSurfaceSize);
auto &stateSaveAreaHeader = SipKernel::getSipKernel(device->getDevice()).getStateSaveAreaHeader();
if (stateSaveAreaHeader.size() > 0) {
auto hwInfo = device->getDevice().getHardwareInfo();
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
NEO::MemoryTransferHelper::transferMemoryToAllocation(hwHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *debugSurface),
device->getDevice(), debugSurface, 0, stateSaveAreaHeader.data(),
stateSaveAreaHeader.size());
}
}
uint64_t requestedSliceCount = getCmdQueueProperties<cl_command_queue_properties>(properties, CL_QUEUE_SLICE_COUNT_INTEL);

View File

@@ -96,6 +96,35 @@ HWTEST_F(CommandQueueHwTest, WhenConstructingTwoCommandQueuesThenOnlyOneDebugSur
EXPECT_EQ(dbgSurface, device->getGpgpuCommandStreamReceiver().getDebugSurfaceAllocation());
}
HWTEST_F(CommandQueueHwTest, WhenConstructingCommandQueueDebugOnButIgcDoesNotReturnSSAHDoNotCopyIt) {
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
executionEnvironment->rootDeviceEnvironments[0]->debugger.reset(new MockActiveSourceLevelDebugger(new MockOsLibrary));
MockGraphicsAllocation sipAlloc1;
auto mockSip1 = std::make_unique<MockSipKernel>(SipKernelType::DbgCsrLocal, &sipAlloc1);
mockSip1->mockStateSaveAreaHeader.clear();
MockGraphicsAllocation sipAlloc2;
auto mockSip2 = std::make_unique<MockSipKernel>(SipKernelType::DbgCsr, &sipAlloc2);
mockSip2->mockStateSaveAreaHeader.clear();
auto mockBuiltIns = new MockBuiltins();
mockBuiltIns->overrideSipKernel(std::move(mockSip1));
mockBuiltIns->overrideSipKernel(std::move(mockSip2));
executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(mockBuiltIns);
auto device = std::make_unique<MockClDevice>(MockDevice::create<MockDeviceWithDebuggerActive>(executionEnvironment, 0u));
MockCommandQueueHw<FamilyType> mockCmdQueueHw1(context, device.get(), nullptr);
auto dbgSurface = device->getGpgpuCommandStreamReceiver().getDebugSurfaceAllocation();
EXPECT_NE(dbgSurface, nullptr);
auto &stateSaveAreaHeader = SipKernel::getSipKernel(device->getDevice()).getStateSaveAreaHeader();
EXPECT_EQ(static_cast<size_t>(0), stateSaveAreaHeader.size());
}
HWTEST_F(CommandQueueHwTest, givenMultiDispatchInfoWhenAskingForAuxTranslationThenCheckMemObjectsCountAndDebugFlag) {
DebugManagerStateRestore restore;
MockBuffer buffer;

View File

@@ -28,11 +28,11 @@ class MockBuiltins : public BuiltIns {
return *MockSipData::mockSipKernel;
}
void overrideSipKernel(std::unique_ptr<SipKernel> kernel) {
void overrideSipKernel(std::unique_ptr<MockSipKernel> kernel) {
sipKernelsOverride[kernel->getType()] = std::move(kernel);
}
std::unique_ptr<BuiltinDispatchInfoBuilder> setBuiltinDispatchInfoBuilder(EBuiltInOps::Type operation, Context &context, Device &device, std::unique_ptr<BuiltinDispatchInfoBuilder> builder);
std::map<SipKernelType, std::unique_ptr<SipKernel>> sipKernelsOverride;
std::map<SipKernelType, std::unique_ptr<MockSipKernel>> sipKernelsOverride;
bool getSipKernelCalled = false;
SipKernelType getSipKernelType = SipKernelType::COUNT;
};

View File

@@ -34,7 +34,7 @@ class MockSipKernel : public SipKernel {
void createMockSipAllocation();
std::unique_ptr<MemoryAllocation> mockSipMemoryAllocation;
const std::vector<char> mockStateSaveAreaHeader = {'s', 's', 'a', 'h'};
std::vector<char> mockStateSaveAreaHeader = {'s', 's', 'a', 'h'};
MockExecutionEnvironment executionEnvironment;
};