mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 22:12:59 +08:00
Fix debugSurface initialization
Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
0e9aa45e46
commit
21690dcea5
@@ -274,6 +274,20 @@ TEST_F(TwoSubDevicesDebuggerEnabledTest, givenDebuggingEnabledWhenSubDevicesAreC
|
||||
EXPECT_EQ(deviceL0->getDebugSurface(), subDevice0->getDebugSurface());
|
||||
}
|
||||
|
||||
TEST_F(TwoSubDevicesDebuggerEnabledTest, givenDebuggingEnabledWhenSubDevicesAreCreatedThenDebugSurfaceIsProperlyInitialized) {
|
||||
NEO::MockCompilerEnableGuard mock(true);
|
||||
|
||||
auto debugSurface = deviceL0->getDebugSurface();
|
||||
|
||||
EXPECT_NE(nullptr, debugSurface);
|
||||
|
||||
auto &stateSaveAreaHeader = SipKernel::getSipKernel(*deviceL0->getNEODevice()).getStateSaveAreaHeader();
|
||||
for (auto i = 0u; i < debugSurface->storageInfo.getNumBanks(); ++i) {
|
||||
EXPECT_EQ(0, memcmp(static_cast<uint8_t *>(debugSurface->getUnderlyingBuffer()) + i * debugSurface->getUnderlyingBufferSize(),
|
||||
stateSaveAreaHeader.data(), stateSaveAreaHeader.size()));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Debugger, GivenLegacyDebuggerAndProgramDebuggingEnabledWhenInitializingDriverThenAbortIsCalledAfterPrintingError) {
|
||||
DebugManagerStateRestore restorer;
|
||||
NEO::DebugManager.flags.PrintDebugMessages.set(1);
|
||||
|
||||
@@ -619,7 +619,10 @@ bool MemoryManager::copyMemoryToAllocation(GraphicsAllocation *graphicsAllocatio
|
||||
if (!graphicsAllocation->getUnderlyingBuffer()) {
|
||||
return false;
|
||||
}
|
||||
memcpy_s(ptrOffset(graphicsAllocation->getUnderlyingBuffer(), destinationOffset), (graphicsAllocation->getUnderlyingBufferSize() - destinationOffset), memoryToCopy, sizeToCopy);
|
||||
for (auto i = 0u; i < graphicsAllocation->storageInfo.getNumBanks(); ++i) {
|
||||
memcpy_s(ptrOffset(static_cast<uint8_t *>(graphicsAllocation->getUnderlyingBuffer()) + i * graphicsAllocation->getUnderlyingBufferSize(), destinationOffset),
|
||||
(graphicsAllocation->getUnderlyingBufferSize() - destinationOffset), memoryToCopy, sizeToCopy);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,11 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryWithAlignment
|
||||
counter++;
|
||||
return memoryAllocation;
|
||||
}
|
||||
|
||||
if (allocationData.type == GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA) {
|
||||
sizeAligned *= allocationData.storageInfo.getNumBanks();
|
||||
}
|
||||
|
||||
auto ptr = allocateSystemMemory(sizeAligned, allocationData.alignment ? alignUp(allocationData.alignment, MemoryConstants::pageSize) : MemoryConstants::pageSize);
|
||||
if (ptr != nullptr) {
|
||||
memoryAllocation = createMemoryAllocation(allocationData.type, ptr, ptr, reinterpret_cast<uint64_t>(ptr), allocationData.size,
|
||||
@@ -86,6 +91,10 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryWithAlignment
|
||||
gpuPtr = alignUp(gpuPtr, allocationData.alignment);
|
||||
memoryAllocation->setCpuPtrAndGpuAddress(ptr, reinterpret_cast<uint64_t>(gpuPtr));
|
||||
}
|
||||
|
||||
if (allocationData.type == GraphicsAllocation::AllocationType::DEBUG_CONTEXT_SAVE_AREA) {
|
||||
memoryAllocation->storageInfo = allocationData.storageInfo;
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
return memoryAllocation;
|
||||
|
||||
Reference in New Issue
Block a user