Add copy engine support for USM shared migration
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
parent
cd702af3a1
commit
62de443660
|
@ -104,8 +104,8 @@ struct CommandListCoreFamily : CommandListImp {
|
||||||
ze_result_t appendMemoryCopy(void *dstptr, const void *srcptr, size_t size,
|
ze_result_t appendMemoryCopy(void *dstptr, const void *srcptr, size_t size,
|
||||||
ze_event_handle_t hSignalEvent, uint32_t numWaitEvents,
|
ze_event_handle_t hSignalEvent, uint32_t numWaitEvents,
|
||||||
ze_event_handle_t *phWaitEvents) override;
|
ze_event_handle_t *phWaitEvents) override;
|
||||||
ze_result_t appendPageFaultCopy(NEO::GraphicsAllocation *dstptr,
|
ze_result_t appendPageFaultCopy(NEO::GraphicsAllocation *dstAllocation,
|
||||||
NEO::GraphicsAllocation *srcptr,
|
NEO::GraphicsAllocation *srcAllocation,
|
||||||
size_t size,
|
size_t size,
|
||||||
bool flushHost) override;
|
bool flushHost) override;
|
||||||
ze_result_t appendMemoryCopyRegion(void *dstPtr,
|
ze_result_t appendMemoryCopyRegion(void *dstPtr,
|
||||||
|
|
|
@ -977,8 +977,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendCopyImageBlit(NEO::Graph
|
||||||
}
|
}
|
||||||
|
|
||||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||||
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendPageFaultCopy(NEO::GraphicsAllocation *dstptr,
|
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendPageFaultCopy(NEO::GraphicsAllocation *dstAllocation,
|
||||||
NEO::GraphicsAllocation *srcptr,
|
NEO::GraphicsAllocation *srcAllocation,
|
||||||
size_t size, bool flushHost) {
|
size_t size, bool flushHost) {
|
||||||
|
|
||||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||||
|
@ -991,32 +991,45 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendPageFaultCopy(NEO::Graph
|
||||||
isStateless = true;
|
isStateless = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t dstAddress = dstptr->getGpuAddress();
|
uintptr_t dstAddress = static_cast<uintptr_t>(dstAllocation->getGpuAddress());
|
||||||
uint64_t srcAddress = srcptr->getGpuAddress();
|
uintptr_t srcAddress = static_cast<uintptr_t>(srcAllocation->getGpuAddress());
|
||||||
ze_result_t ret = appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAddress),
|
ze_result_t ret = ZE_RESULT_ERROR_UNKNOWN;
|
||||||
dstptr, 0,
|
if (isCopyOnly()) {
|
||||||
reinterpret_cast<void *>(&srcAddress),
|
ret = appendMemoryCopyBlit(dstAddress, dstAllocation, 0u,
|
||||||
srcptr, 0,
|
srcAddress, srcAllocation, 0u,
|
||||||
size - rightSize,
|
size - rightSize);
|
||||||
middleElSize,
|
|
||||||
Builtin::CopyBufferToBufferMiddle,
|
|
||||||
nullptr,
|
|
||||||
isStateless);
|
|
||||||
if (ret == ZE_RESULT_SUCCESS && rightSize) {
|
|
||||||
appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAddress),
|
|
||||||
dstptr, size - rightSize,
|
|
||||||
reinterpret_cast<void *>(&srcAddress),
|
|
||||||
srcptr, size - rightSize,
|
|
||||||
rightSize, 1UL,
|
|
||||||
Builtin::CopyBufferToBufferSide,
|
|
||||||
nullptr,
|
|
||||||
isStateless);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NEO::MemorySynchronizationCommands<GfxFamily>::isDcFlushAllowed()) {
|
if (ret == ZE_RESULT_SUCCESS && rightSize) {
|
||||||
if (flushHost) {
|
ret = appendMemoryCopyBlit(dstAddress, dstAllocation, size - rightSize,
|
||||||
NEO::PipeControlArgs args(true);
|
srcAddress, srcAllocation, size - rightSize,
|
||||||
NEO::MemorySynchronizationCommands<GfxFamily>::addPipeControl(*commandContainer.getCommandStream(), args);
|
rightSize);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret = appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAddress),
|
||||||
|
dstAllocation, 0,
|
||||||
|
reinterpret_cast<void *>(&srcAddress),
|
||||||
|
srcAllocation, 0,
|
||||||
|
size - rightSize,
|
||||||
|
middleElSize,
|
||||||
|
Builtin::CopyBufferToBufferMiddle,
|
||||||
|
nullptr,
|
||||||
|
isStateless);
|
||||||
|
if (ret == ZE_RESULT_SUCCESS && rightSize) {
|
||||||
|
ret = appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAddress),
|
||||||
|
dstAllocation, size - rightSize,
|
||||||
|
reinterpret_cast<void *>(&srcAddress),
|
||||||
|
srcAllocation, size - rightSize,
|
||||||
|
rightSize, 1UL,
|
||||||
|
Builtin::CopyBufferToBufferSide,
|
||||||
|
nullptr,
|
||||||
|
isStateless);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NEO::MemorySynchronizationCommands<GfxFamily>::isDcFlushAllowed()) {
|
||||||
|
if (flushHost) {
|
||||||
|
NEO::PipeControlArgs args(true);
|
||||||
|
NEO::MemorySynchronizationCommands<GfxFamily>::addPipeControl(*commandContainer.getCommandStream(), args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,8 @@ struct CommandListCoreFamilyImmediate : public CommandListCoreFamily<gfxCoreFami
|
||||||
|
|
||||||
ze_result_t appendEventReset(ze_event_handle_t hEvent) override;
|
ze_result_t appendEventReset(ze_event_handle_t hEvent) override;
|
||||||
|
|
||||||
ze_result_t appendPageFaultCopy(NEO::GraphicsAllocation *dstptr, NEO::GraphicsAllocation *srcptr,
|
ze_result_t appendPageFaultCopy(NEO::GraphicsAllocation *dstAllocation,
|
||||||
|
NEO::GraphicsAllocation *srcAllocation,
|
||||||
size_t size, bool flushHost) override;
|
size_t size, bool flushHost) override;
|
||||||
|
|
||||||
ze_result_t appendWaitOnEvents(uint32_t numEvents, ze_event_handle_t *phEvent) override;
|
ze_result_t appendWaitOnEvents(uint32_t numEvents, ze_event_handle_t *phEvent) override;
|
||||||
|
|
|
@ -331,13 +331,15 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendEventReset(ze_e
|
||||||
}
|
}
|
||||||
|
|
||||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||||
ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendPageFaultCopy(NEO::GraphicsAllocation *dstptr, NEO::GraphicsAllocation *srcptr, size_t size, bool flushHost) {
|
ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendPageFaultCopy(NEO::GraphicsAllocation *dstAllocation,
|
||||||
|
NEO::GraphicsAllocation *srcAllocation,
|
||||||
|
size_t size, bool flushHost) {
|
||||||
|
|
||||||
if (this->isFlushTaskSubmissionEnabled) {
|
if (this->isFlushTaskSubmissionEnabled) {
|
||||||
checkAvailableSpace();
|
checkAvailableSpace();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ret = CommandListCoreFamily<gfxCoreFamily>::appendPageFaultCopy(dstptr, srcptr, size, flushHost);
|
auto ret = CommandListCoreFamily<gfxCoreFamily>::appendPageFaultCopy(dstAllocation, srcAllocation, size, flushHost);
|
||||||
if (ret == ZE_RESULT_SUCCESS) {
|
if (ret == ZE_RESULT_SUCCESS) {
|
||||||
if (this->isFlushTaskSubmissionEnabled) {
|
if (this->isFlushTaskSubmissionEnabled) {
|
||||||
executeCommandListImmediateWithFlushTask(false);
|
executeCommandListImmediateWithFlushTask(false);
|
||||||
|
|
|
@ -89,28 +89,36 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
|
||||||
CommandListImp *commandList = nullptr;
|
CommandListImp *commandList = nullptr;
|
||||||
returnValue = ZE_RESULT_ERROR_UNINITIALIZED;
|
returnValue = ZE_RESULT_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
NEO::EngineGroupType engineType = engineGroupType;
|
||||||
|
|
||||||
if (allocator) {
|
if (allocator) {
|
||||||
commandList = static_cast<CommandListImp *>((*allocator)(CommandList::commandListimmediateIddsPerBlock));
|
|
||||||
commandList->internalUsage = internalUsage;
|
|
||||||
commandList->cmdListType = CommandListType::TYPE_IMMEDIATE;
|
|
||||||
commandList->isSyncModeQueue = (desc->mode == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS);
|
|
||||||
returnValue = commandList->initialize(device, engineGroupType, desc->flags);
|
|
||||||
if (returnValue != ZE_RESULT_SUCCESS) {
|
|
||||||
commandList->destroy();
|
|
||||||
commandList = nullptr;
|
|
||||||
return commandList;
|
|
||||||
}
|
|
||||||
NEO::CommandStreamReceiver *csr = nullptr;
|
NEO::CommandStreamReceiver *csr = nullptr;
|
||||||
auto deviceImp = static_cast<DeviceImp *>(device);
|
auto deviceImp = static_cast<DeviceImp *>(device);
|
||||||
if (internalUsage) {
|
if (internalUsage) {
|
||||||
csr = deviceImp->neoDevice->getInternalEngine().commandStreamReceiver;
|
if (NEO::EngineGroupType::Copy == engineType && deviceImp->getActiveDevice()->getInternalCopyEngine()) {
|
||||||
|
csr = deviceImp->getActiveDevice()->getInternalCopyEngine()->commandStreamReceiver;
|
||||||
|
} else {
|
||||||
|
csr = deviceImp->getActiveDevice()->getInternalEngine().commandStreamReceiver;
|
||||||
|
engineType = NEO::EngineGroupType::RenderCompute;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
device->getCsrForOrdinalAndIndex(&csr, desc->ordinal, desc->index);
|
device->getCsrForOrdinalAndIndex(&csr, desc->ordinal, desc->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNRECOVERABLE_IF(nullptr == csr);
|
UNRECOVERABLE_IF(nullptr == csr);
|
||||||
|
|
||||||
auto commandQueue = CommandQueue::create(productFamily, device, csr, desc, NEO::EngineGroupType::Copy == engineGroupType, internalUsage, returnValue);
|
commandList = static_cast<CommandListImp *>((*allocator)(CommandList::commandListimmediateIddsPerBlock));
|
||||||
|
commandList->internalUsage = internalUsage;
|
||||||
|
commandList->cmdListType = CommandListType::TYPE_IMMEDIATE;
|
||||||
|
commandList->isSyncModeQueue = (desc->mode == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS);
|
||||||
|
returnValue = commandList->initialize(device, engineType, desc->flags);
|
||||||
|
if (returnValue != ZE_RESULT_SUCCESS) {
|
||||||
|
commandList->destroy();
|
||||||
|
commandList = nullptr;
|
||||||
|
return commandList;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto commandQueue = CommandQueue::create(productFamily, device, csr, desc, NEO::EngineGroupType::Copy == engineType, internalUsage, returnValue);
|
||||||
if (!commandQueue) {
|
if (!commandQueue) {
|
||||||
commandList->destroy();
|
commandList->destroy();
|
||||||
commandList = nullptr;
|
commandList = nullptr;
|
||||||
|
|
|
@ -794,7 +794,7 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, uint3
|
||||||
ze_result_t resultValue = ZE_RESULT_SUCCESS;
|
ze_result_t resultValue = ZE_RESULT_SUCCESS;
|
||||||
device->pageFaultCommandList =
|
device->pageFaultCommandList =
|
||||||
CommandList::createImmediate(
|
CommandList::createImmediate(
|
||||||
device->neoDevice->getHardwareInfo().platform.eProductFamily, device, &cmdQueueDesc, true, NEO::EngineGroupType::RenderCompute, resultValue);
|
device->neoDevice->getHardwareInfo().platform.eProductFamily, device, &cmdQueueDesc, true, NEO::EngineGroupType::Copy, resultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->getSourceLevelDebugger()) {
|
if (device->getSourceLevelDebugger()) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ template <GFXCORE_FAMILY gfxCoreFamily>
|
||||||
class MockCommandListHw : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>> {
|
class MockCommandListHw : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>> {
|
||||||
public:
|
public:
|
||||||
MockCommandListHw() : WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>() {}
|
MockCommandListHw() : WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>() {}
|
||||||
|
MockCommandListHw(bool failOnFirst) : WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>(), failOnFirstCopy(failOnFirst) {}
|
||||||
|
|
||||||
AlignedAllocationData getAlignedAllocation(L0::Device *device, const void *buffer, uint64_t bufferSize) override {
|
AlignedAllocationData getAlignedAllocation(L0::Device *device, const void *buffer, uint64_t bufferSize) override {
|
||||||
return {0, 0, nullptr, true};
|
return {0, 0, nullptr, true};
|
||||||
|
@ -41,6 +42,10 @@ class MockCommandListHw : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFam
|
||||||
appendMemoryCopyKernelWithGACalledTimes++;
|
appendMemoryCopyKernelWithGACalledTimes++;
|
||||||
if (isStateless)
|
if (isStateless)
|
||||||
appendMemoryCopyKernelWithGAStatelessCalledTimes++;
|
appendMemoryCopyKernelWithGAStatelessCalledTimes++;
|
||||||
|
if (failOnFirstCopy &&
|
||||||
|
(appendMemoryCopyKernelWithGACalledTimes == 1 || appendMemoryCopyKernelWithGAStatelessCalledTimes == 1)) {
|
||||||
|
return ZE_RESULT_ERROR_UNKNOWN;
|
||||||
|
}
|
||||||
return ZE_RESULT_SUCCESS;
|
return ZE_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
ze_result_t appendMemoryCopyBlit(uintptr_t dstPtr,
|
ze_result_t appendMemoryCopyBlit(uintptr_t dstPtr,
|
||||||
|
@ -50,6 +55,9 @@ class MockCommandListHw : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFam
|
||||||
uint64_t srcOffset,
|
uint64_t srcOffset,
|
||||||
uint64_t size) override {
|
uint64_t size) override {
|
||||||
appendMemoryCopyBlitCalledTimes++;
|
appendMemoryCopyBlitCalledTimes++;
|
||||||
|
if (failOnFirstCopy && appendMemoryCopyBlitCalledTimes == 1) {
|
||||||
|
return ZE_RESULT_ERROR_UNKNOWN;
|
||||||
|
}
|
||||||
return ZE_RESULT_SUCCESS;
|
return ZE_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +126,7 @@ class MockCommandListHw : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFam
|
||||||
Vec3<size_t> appendImageRegionCopySize = {0, 0, 0};
|
Vec3<size_t> appendImageRegionCopySize = {0, 0, 0};
|
||||||
Vec3<size_t> appendImageRegionSrcOrigin = {9, 9, 9};
|
Vec3<size_t> appendImageRegionSrcOrigin = {9, 9, 9};
|
||||||
Vec3<size_t> appendImageRegionDstOrigin = {9, 9, 9};
|
Vec3<size_t> appendImageRegionDstOrigin = {9, 9, 9};
|
||||||
|
bool failOnFirstCopy = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
using Platforms = IsAtLeastProduct<IGFX_SKYLAKE>;
|
using Platforms = IsAtLeastProduct<IGFX_SKYLAKE>;
|
||||||
|
@ -179,6 +188,20 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledThenappendPa
|
||||||
EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGAStatelessCalledTimes, 0u);
|
EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGAStatelessCalledTimes, 0u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledWithCopyEngineThenappendPageFaultCopyWithappendMemoryCopyKernelWithGACalled, Platforms) {
|
||||||
|
MockCommandListHw<gfxCoreFamily> cmdList;
|
||||||
|
size_t size = (sizeof(uint32_t) * 4);
|
||||||
|
cmdList.initialize(device, NEO::EngineGroupType::Copy, 0u);
|
||||||
|
NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||||
|
reinterpret_cast<void *>(0x1234), size, 0, sizeof(uint32_t),
|
||||||
|
MemoryPool::System4KBPages);
|
||||||
|
NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||||
|
reinterpret_cast<void *>(0x2345), size, 0, sizeof(uint32_t),
|
||||||
|
MemoryPool::System4KBPages);
|
||||||
|
cmdList.appendPageFaultCopy(&mockAllocationDst, &mockAllocationSrc, size, false);
|
||||||
|
EXPECT_EQ(cmdList.appendMemoryCopyBlitCalledTimes, 1u);
|
||||||
|
}
|
||||||
|
|
||||||
HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledThenappendPageFaultCopyWithappendMemoryCopyKernelWithGACalledForMiddleAndRightSizesAreCalled, Platforms) {
|
HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledThenappendPageFaultCopyWithappendMemoryCopyKernelWithGACalledForMiddleAndRightSizesAreCalled, Platforms) {
|
||||||
MockCommandListHw<gfxCoreFamily> cmdList;
|
MockCommandListHw<gfxCoreFamily> cmdList;
|
||||||
size_t size = ((sizeof(uint32_t) * 4) + 1);
|
size_t size = ((sizeof(uint32_t) * 4) + 1);
|
||||||
|
@ -194,6 +217,49 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledThenappendPa
|
||||||
EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGAStatelessCalledTimes, 0u);
|
EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGAStatelessCalledTimes, 0u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledAndErrorOnMidCopyThenappendPageFaultCopyWithappendMemoryCopyKernelWithGACalledForMiddleIsCalled, Platforms) {
|
||||||
|
MockCommandListHw<gfxCoreFamily> cmdList(true);
|
||||||
|
size_t size = ((sizeof(uint32_t) * 4) + 1);
|
||||||
|
cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
|
||||||
|
NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||||
|
reinterpret_cast<void *>(0x1234), size, 0, sizeof(uint32_t),
|
||||||
|
MemoryPool::System4KBPages);
|
||||||
|
NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||||
|
reinterpret_cast<void *>(0x2345), size, 0, sizeof(uint32_t),
|
||||||
|
MemoryPool::System4KBPages);
|
||||||
|
cmdList.appendPageFaultCopy(&mockAllocationDst, &mockAllocationSrc, size, false);
|
||||||
|
EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGACalledTimes, 1u);
|
||||||
|
EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGAStatelessCalledTimes, 0u);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledWithCopyEngineThenappendPageFaultCopyWithappendMemoryCopyKernelWithGACalledForMiddleAndRightSizesAreCalled, Platforms) {
|
||||||
|
MockCommandListHw<gfxCoreFamily> cmdList;
|
||||||
|
size_t size = ((sizeof(uint32_t) * 4) + 1);
|
||||||
|
cmdList.initialize(device, NEO::EngineGroupType::Copy, 0u);
|
||||||
|
NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||||
|
reinterpret_cast<void *>(0x1234), size, 0, sizeof(uint32_t),
|
||||||
|
MemoryPool::System4KBPages);
|
||||||
|
NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||||
|
reinterpret_cast<void *>(0x2345), size, 0, sizeof(uint32_t),
|
||||||
|
MemoryPool::System4KBPages);
|
||||||
|
cmdList.appendPageFaultCopy(&mockAllocationDst, &mockAllocationSrc, size, false);
|
||||||
|
EXPECT_EQ(cmdList.appendMemoryCopyBlitCalledTimes, 2u);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledWithCopyEngineAndErrorOnMidOperationThenappendPageFaultCopyWithappendMemoryCopyKernelWithGACalledForMiddleIsCalled, Platforms) {
|
||||||
|
MockCommandListHw<gfxCoreFamily> cmdList(true);
|
||||||
|
size_t size = ((sizeof(uint32_t) * 4) + 1);
|
||||||
|
cmdList.initialize(device, NEO::EngineGroupType::Copy, 0u);
|
||||||
|
NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||||
|
reinterpret_cast<void *>(0x1234), size, 0, sizeof(uint32_t),
|
||||||
|
MemoryPool::System4KBPages);
|
||||||
|
NEO::MockGraphicsAllocation mockAllocationDst(0, NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||||
|
reinterpret_cast<void *>(0x2345), size, 0, sizeof(uint32_t),
|
||||||
|
MemoryPool::System4KBPages);
|
||||||
|
cmdList.appendPageFaultCopy(&mockAllocationDst, &mockAllocationSrc, size, false);
|
||||||
|
EXPECT_EQ(cmdList.appendMemoryCopyBlitCalledTimes, 1u);
|
||||||
|
}
|
||||||
|
|
||||||
HWTEST2_F(CommandListCreate, givenCommandListWhen4GBytePageFaultCopyCalledThenPageFaultCopyWithappendMemoryCopyKernelWithGAStatelessCalled, Platforms) {
|
HWTEST2_F(CommandListCreate, givenCommandListWhen4GBytePageFaultCopyCalledThenPageFaultCopyWithappendMemoryCopyKernelWithGAStatelessCalled, Platforms) {
|
||||||
MockCommandListHw<gfxCoreFamily> cmdList;
|
MockCommandListHw<gfxCoreFamily> cmdList;
|
||||||
size_t size = 0x100000000;
|
size_t size = 0x100000000;
|
||||||
|
|
|
@ -838,7 +838,11 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenMemoryCopyRegionWithSi
|
||||||
ASSERT_NE(nullptr, commandList0);
|
ASSERT_NE(nullptr, commandList0);
|
||||||
|
|
||||||
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
||||||
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
if (neoDevice->getInternalCopyEngine()) {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
void *srcBuffer = reinterpret_cast<void *>(0x1234);
|
void *srcBuffer = reinterpret_cast<void *>(0x1234);
|
||||||
void *dstBuffer = reinterpret_cast<void *>(0x2345);
|
void *dstBuffer = reinterpret_cast<void *>(0x2345);
|
||||||
|
@ -869,7 +873,7 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenMemoryCopyRegionWithSi
|
||||||
|
|
||||||
using ImageSupported = IsAtLeastProduct<IGFX_SKYLAKE>;
|
using ImageSupported = IsAtLeastProduct<IGFX_SKYLAKE>;
|
||||||
|
|
||||||
HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenCopyRegionFromImageToImageUsingRenderThenSuccessIsReturned, ImageSupported) {
|
HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenCopyRegionFromImageToImageUsingRenderThenSuccessIsReturned, IsAtLeastXeHpCore) {
|
||||||
const ze_command_queue_desc_t queueDesc = {};
|
const ze_command_queue_desc_t queueDesc = {};
|
||||||
bool internalEngine = true;
|
bool internalEngine = true;
|
||||||
|
|
||||||
|
@ -883,7 +887,11 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenCopyRegionFromImageToI
|
||||||
ASSERT_NE(nullptr, commandList0);
|
ASSERT_NE(nullptr, commandList0);
|
||||||
|
|
||||||
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
||||||
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
if (neoDevice->getInternalCopyEngine()) {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
ze_image_desc_t desc = {};
|
ze_image_desc_t desc = {};
|
||||||
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||||
|
@ -909,7 +917,7 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenCopyRegionFromImageToI
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenCopyRegionFromImageToImageUsingCopyWintInvalidRegionArguementsThenErrorIsReturned, ImageSupported) {
|
HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenCopyRegionFromImageToImageUsingCopyWintInvalidRegionArguementsThenErrorIsReturned, IsAtLeastXeHpCore) {
|
||||||
const ze_command_queue_desc_t queueDesc = {};
|
const ze_command_queue_desc_t queueDesc = {};
|
||||||
bool internalEngine = true;
|
bool internalEngine = true;
|
||||||
|
|
||||||
|
@ -923,7 +931,11 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenCopyRegionFromImageToI
|
||||||
ASSERT_NE(nullptr, commandList0);
|
ASSERT_NE(nullptr, commandList0);
|
||||||
|
|
||||||
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
||||||
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
if (neoDevice->getInternalCopyEngine()) {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
ze_image_desc_t desc = {};
|
ze_image_desc_t desc = {};
|
||||||
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||||
|
@ -950,7 +962,7 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenCopyRegionFromImageToI
|
||||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, returnValue);
|
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, returnValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenCopyFromImageToImageUsingRenderThenSuccessIsReturned, ImageSupported) {
|
HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenCopyFromImageToImageUsingRenderThenSuccessIsReturned, IsAtLeastXeHpCore) {
|
||||||
const ze_command_queue_desc_t queueDesc = {};
|
const ze_command_queue_desc_t queueDesc = {};
|
||||||
bool internalEngine = true;
|
bool internalEngine = true;
|
||||||
|
|
||||||
|
@ -964,7 +976,11 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenCopyFromImageToImageUs
|
||||||
ASSERT_NE(nullptr, commandList0);
|
ASSERT_NE(nullptr, commandList0);
|
||||||
|
|
||||||
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
||||||
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
if (neoDevice->getInternalCopyEngine()) {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
ze_image_desc_t desc = {};
|
ze_image_desc_t desc = {};
|
||||||
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||||
|
@ -1003,7 +1019,11 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenMemoryCopyRegionWithSi
|
||||||
ASSERT_NE(nullptr, commandList0);
|
ASSERT_NE(nullptr, commandList0);
|
||||||
|
|
||||||
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
||||||
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
if (neoDevice->getInternalCopyEngine()) {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
void *srcBuffer = reinterpret_cast<void *>(0x1234);
|
void *srcBuffer = reinterpret_cast<void *>(0x1234);
|
||||||
void *dstBuffer = reinterpret_cast<void *>(0x2345);
|
void *dstBuffer = reinterpret_cast<void *>(0x2345);
|
||||||
|
|
|
@ -573,7 +573,11 @@ HWTEST2_F(HostPointerManagerCommandListTest, givenImmediateCommandListWhenMemory
|
||||||
ASSERT_NE(nullptr, commandList0);
|
ASSERT_NE(nullptr, commandList0);
|
||||||
|
|
||||||
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
||||||
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
if (neoDevice->getInternalCopyEngine()) {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
ret = hostDriverHandle->importExternalPointer(heapPointer, MemoryConstants::pageSize);
|
ret = hostDriverHandle->importExternalPointer(heapPointer, MemoryConstants::pageSize);
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, ret);
|
EXPECT_EQ(ZE_RESULT_SUCCESS, ret);
|
||||||
|
@ -619,7 +623,11 @@ HWTEST2_F(HostPointerManagerCommandListTest, givenImmediateCommandListWhenMemory
|
||||||
ASSERT_NE(nullptr, commandList0);
|
ASSERT_NE(nullptr, commandList0);
|
||||||
|
|
||||||
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
||||||
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
if (neoDevice->getInternalCopyEngine()) {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
ret = hostDriverHandle->importExternalPointer(heapPointer, MemoryConstants::pageSize);
|
ret = hostDriverHandle->importExternalPointer(heapPointer, MemoryConstants::pageSize);
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, ret);
|
EXPECT_EQ(ZE_RESULT_SUCCESS, ret);
|
||||||
|
|
|
@ -727,7 +727,7 @@ HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledForI
|
||||||
commandList->destroy();
|
commandList->destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForImmediateCommandListForAppendImageCopyRegionThenSuccessIsReturned, IsSklOrAbove) {
|
HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForImmediateCommandListForAppendImageCopyRegionThenSuccessIsReturned, IsAtLeastXeHpCore) {
|
||||||
DebugManagerStateRestore restorer;
|
DebugManagerStateRestore restorer;
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
|
||||||
|
|
||||||
|
@ -747,7 +747,11 @@ HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForI
|
||||||
ASSERT_NE(nullptr, commandList0);
|
ASSERT_NE(nullptr, commandList0);
|
||||||
|
|
||||||
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
||||||
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
if (neoDevice->getInternalCopyEngine()) {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
ze_image_desc_t desc = {};
|
ze_image_desc_t desc = {};
|
||||||
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||||
|
@ -775,7 +779,7 @@ HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForI
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledForImmediateCommandListForAppendImageCopyRegionThenSuccessIsReturned, IsSklOrAbove) {
|
HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledForImmediateCommandListForAppendImageCopyRegionThenSuccessIsReturned, IsAtLeastXeHpCore) {
|
||||||
DebugManagerStateRestore restorer;
|
DebugManagerStateRestore restorer;
|
||||||
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
|
||||||
|
|
||||||
|
@ -795,7 +799,11 @@ HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledFor
|
||||||
ASSERT_NE(nullptr, commandList0);
|
ASSERT_NE(nullptr, commandList0);
|
||||||
|
|
||||||
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
||||||
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
if (neoDevice->getInternalCopyEngine()) {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver);
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
ze_image_desc_t desc = {};
|
ze_image_desc_t desc = {};
|
||||||
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||||
|
|
|
@ -565,6 +565,16 @@ EngineControl &Device::getInternalEngine() {
|
||||||
return this->getNearestGenericSubDevice(0)->getEngine(engineType, EngineUsage::Internal);
|
return this->getNearestGenericSubDevice(0)->getEngine(engineType, EngineUsage::Internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EngineControl *Device::getInternalCopyEngine() {
|
||||||
|
for (auto &engine : engines) {
|
||||||
|
if (engine.osContext->getEngineType() == aub_stream::ENGINE_BCS &&
|
||||||
|
engine.osContext->isInternalEngine()) {
|
||||||
|
return &engine;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void Device::initializeRayTracing() {
|
void Device::initializeRayTracing() {
|
||||||
if (rtMemoryBackedBuffer == nullptr) {
|
if (rtMemoryBackedBuffer == nullptr) {
|
||||||
auto size = RayTracingHelper::getTotalMemoryBackedFifoSize(*this);
|
auto size = RayTracingHelper::getTotalMemoryBackedFifoSize(*this);
|
||||||
|
|
|
@ -66,6 +66,7 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||||
EngineControl &getEngine(uint32_t index);
|
EngineControl &getEngine(uint32_t index);
|
||||||
EngineControl &getDefaultEngine();
|
EngineControl &getDefaultEngine();
|
||||||
EngineControl &getInternalEngine();
|
EngineControl &getInternalEngine();
|
||||||
|
EngineControl *getInternalCopyEngine();
|
||||||
SelectorCopyEngine &getSelectorCopyEngine();
|
SelectorCopyEngine &getSelectorCopyEngine();
|
||||||
MemoryManager *getMemoryManager() const;
|
MemoryManager *getMemoryManager() const;
|
||||||
GmmHelper *getGmmHelper() const;
|
GmmHelper *getGmmHelper() const;
|
||||||
|
|
Loading…
Reference in New Issue