@@ -23,6 +23,7 @@ template <GFXCORE_FAMILY gfxCoreFamily>
23
23
class MockCommandListHw : public WhiteBox <::L0::CommandListCoreFamily<gfxCoreFamily>> {
24
24
public:
25
25
MockCommandListHw () : WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>() {}
26
+ MockCommandListHw (bool failOnFirst) : WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>(), failOnFirstCopy(failOnFirst) {}
26
27
27
28
AlignedAllocationData getAlignedAllocation (L0::Device *device, const void *buffer, uint64_t bufferSize) override {
28
29
return {0 , 0 , nullptr , true };
@@ -41,6 +42,10 @@ class MockCommandListHw : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFam
41
42
appendMemoryCopyKernelWithGACalledTimes++;
42
43
if (isStateless)
43
44
appendMemoryCopyKernelWithGAStatelessCalledTimes++;
45
+ if (failOnFirstCopy &&
46
+ (appendMemoryCopyKernelWithGACalledTimes == 1 || appendMemoryCopyKernelWithGAStatelessCalledTimes == 1 )) {
47
+ return ZE_RESULT_ERROR_UNKNOWN;
48
+ }
44
49
return ZE_RESULT_SUCCESS;
45
50
}
46
51
ze_result_t appendMemoryCopyBlit (uintptr_t dstPtr,
@@ -50,6 +55,9 @@ class MockCommandListHw : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFam
50
55
uint64_t srcOffset,
51
56
uint64_t size) override {
52
57
appendMemoryCopyBlitCalledTimes++;
58
+ if (failOnFirstCopy && appendMemoryCopyBlitCalledTimes == 1 ) {
59
+ return ZE_RESULT_ERROR_UNKNOWN;
60
+ }
53
61
return ZE_RESULT_SUCCESS;
54
62
}
55
63
@@ -118,6 +126,7 @@ class MockCommandListHw : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFam
118
126
Vec3<size_t > appendImageRegionCopySize = {0 , 0 , 0 };
119
127
Vec3<size_t > appendImageRegionSrcOrigin = {9 , 9 , 9 };
120
128
Vec3<size_t > appendImageRegionDstOrigin = {9 , 9 , 9 };
129
+ bool failOnFirstCopy = false ;
121
130
};
122
131
123
132
using Platforms = IsAtLeastProduct<IGFX_SKYLAKE>;
@@ -179,6 +188,20 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledThenappendPa
179
188
EXPECT_EQ (cmdList.appendMemoryCopyKernelWithGAStatelessCalledTimes , 0u );
180
189
}
181
190
191
+ HWTEST2_F (CommandListCreate, givenCommandListWhenPageFaultCopyCalledWithCopyEngineThenappendPageFaultCopyWithappendMemoryCopyKernelWithGACalled, Platforms) {
192
+ MockCommandListHw<gfxCoreFamily> cmdList;
193
+ size_t size = (sizeof (uint32_t ) * 4 );
194
+ cmdList.initialize (device, NEO::EngineGroupType::Copy, 0u );
195
+ NEO::MockGraphicsAllocation mockAllocationSrc (0 , NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
196
+ reinterpret_cast <void *>(0x1234 ), size, 0 , sizeof (uint32_t ),
197
+ MemoryPool::System4KBPages);
198
+ NEO::MockGraphicsAllocation mockAllocationDst (0 , NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
199
+ reinterpret_cast <void *>(0x2345 ), size, 0 , sizeof (uint32_t ),
200
+ MemoryPool::System4KBPages);
201
+ cmdList.appendPageFaultCopy (&mockAllocationDst, &mockAllocationSrc, size, false );
202
+ EXPECT_EQ (cmdList.appendMemoryCopyBlitCalledTimes , 1u );
203
+ }
204
+
182
205
HWTEST2_F (CommandListCreate, givenCommandListWhenPageFaultCopyCalledThenappendPageFaultCopyWithappendMemoryCopyKernelWithGACalledForMiddleAndRightSizesAreCalled, Platforms) {
183
206
MockCommandListHw<gfxCoreFamily> cmdList;
184
207
size_t size = ((sizeof (uint32_t ) * 4 ) + 1 );
@@ -194,6 +217,49 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenPageFaultCopyCalledThenappendPa
194
217
EXPECT_EQ (cmdList.appendMemoryCopyKernelWithGAStatelessCalledTimes , 0u );
195
218
}
196
219
220
+ HWTEST2_F (CommandListCreate, givenCommandListWhenPageFaultCopyCalledAndErrorOnMidCopyThenappendPageFaultCopyWithappendMemoryCopyKernelWithGACalledForMiddleIsCalled, Platforms) {
221
+ MockCommandListHw<gfxCoreFamily> cmdList (true );
222
+ size_t size = ((sizeof (uint32_t ) * 4 ) + 1 );
223
+ cmdList.initialize (device, NEO::EngineGroupType::RenderCompute, 0u );
224
+ NEO::MockGraphicsAllocation mockAllocationSrc (0 , NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
225
+ reinterpret_cast <void *>(0x1234 ), size, 0 , sizeof (uint32_t ),
226
+ MemoryPool::System4KBPages);
227
+ NEO::MockGraphicsAllocation mockAllocationDst (0 , NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
228
+ reinterpret_cast <void *>(0x2345 ), size, 0 , sizeof (uint32_t ),
229
+ MemoryPool::System4KBPages);
230
+ cmdList.appendPageFaultCopy (&mockAllocationDst, &mockAllocationSrc, size, false );
231
+ EXPECT_EQ (cmdList.appendMemoryCopyKernelWithGACalledTimes , 1u );
232
+ EXPECT_EQ (cmdList.appendMemoryCopyKernelWithGAStatelessCalledTimes , 0u );
233
+ }
234
+
235
+ HWTEST2_F (CommandListCreate, givenCommandListWhenPageFaultCopyCalledWithCopyEngineThenappendPageFaultCopyWithappendMemoryCopyKernelWithGACalledForMiddleAndRightSizesAreCalled, Platforms) {
236
+ MockCommandListHw<gfxCoreFamily> cmdList;
237
+ size_t size = ((sizeof (uint32_t ) * 4 ) + 1 );
238
+ cmdList.initialize (device, NEO::EngineGroupType::Copy, 0u );
239
+ NEO::MockGraphicsAllocation mockAllocationSrc (0 , NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
240
+ reinterpret_cast <void *>(0x1234 ), size, 0 , sizeof (uint32_t ),
241
+ MemoryPool::System4KBPages);
242
+ NEO::MockGraphicsAllocation mockAllocationDst (0 , NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
243
+ reinterpret_cast <void *>(0x2345 ), size, 0 , sizeof (uint32_t ),
244
+ MemoryPool::System4KBPages);
245
+ cmdList.appendPageFaultCopy (&mockAllocationDst, &mockAllocationSrc, size, false );
246
+ EXPECT_EQ (cmdList.appendMemoryCopyBlitCalledTimes , 2u );
247
+ }
248
+
249
+ HWTEST2_F (CommandListCreate, givenCommandListWhenPageFaultCopyCalledWithCopyEngineAndErrorOnMidOperationThenappendPageFaultCopyWithappendMemoryCopyKernelWithGACalledForMiddleIsCalled, Platforms) {
250
+ MockCommandListHw<gfxCoreFamily> cmdList (true );
251
+ size_t size = ((sizeof (uint32_t ) * 4 ) + 1 );
252
+ cmdList.initialize (device, NEO::EngineGroupType::Copy, 0u );
253
+ NEO::MockGraphicsAllocation mockAllocationSrc (0 , NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
254
+ reinterpret_cast <void *>(0x1234 ), size, 0 , sizeof (uint32_t ),
255
+ MemoryPool::System4KBPages);
256
+ NEO::MockGraphicsAllocation mockAllocationDst (0 , NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
257
+ reinterpret_cast <void *>(0x2345 ), size, 0 , sizeof (uint32_t ),
258
+ MemoryPool::System4KBPages);
259
+ cmdList.appendPageFaultCopy (&mockAllocationDst, &mockAllocationSrc, size, false );
260
+ EXPECT_EQ (cmdList.appendMemoryCopyBlitCalledTimes , 1u );
261
+ }
262
+
197
263
HWTEST2_F (CommandListCreate, givenCommandListWhen4GBytePageFaultCopyCalledThenPageFaultCopyWithappendMemoryCopyKernelWithGAStatelessCalled, Platforms) {
198
264
MockCommandListHw<gfxCoreFamily> cmdList;
199
265
size_t size = 0x100000000 ;
0 commit comments