@@ -427,17 +427,17 @@ class SurfaceMock : public Surface {
427
427
};
428
428
429
429
TEST_F (InternalsEventTest, processBlockedCommandsKernelOperation) {
430
- MockEvent<Event> event ( nullptr , CL_COMMAND_NDRANGE_KERNEL, 0 , 0 );
431
- CommandQueue *pCmdQ = new CommandQueue (mockContext, pDevice , 0 );
430
+ CommandQueue cmdQ (mockContext, pDevice, nullptr );
431
+ MockEvent<Event> event (&cmdQ, CL_COMMAND_NDRANGE_KERNEL, 0 , 0 );
432
432
433
433
auto cmdStream = new LinearStream (alignedMalloc (4096 , 4096 ), 4096 );
434
434
IndirectHeap *dsh = nullptr , *ioh = nullptr , *ssh = nullptr ;
435
- pCmdQ-> allocateHeapMemory (IndirectHeap::DYNAMIC_STATE, 4096u , dsh);
436
- pCmdQ-> allocateHeapMemory (IndirectHeap::INDIRECT_OBJECT, 4096u , ioh);
437
- pCmdQ-> allocateHeapMemory (IndirectHeap::SURFACE_STATE, 4096u , ssh);
435
+ cmdQ. allocateHeapMemory (IndirectHeap::DYNAMIC_STATE, 4096u , dsh);
436
+ cmdQ. allocateHeapMemory (IndirectHeap::INDIRECT_OBJECT, 4096u , ioh);
437
+ cmdQ. allocateHeapMemory (IndirectHeap::SURFACE_STATE, 4096u , ssh);
438
438
using UniqueIH = std::unique_ptr<IndirectHeap>;
439
439
auto blockedCommandsData = new KernelOperation (std::unique_ptr<LinearStream>(cmdStream), UniqueIH (dsh),
440
- UniqueIH (ioh), UniqueIH (ssh), *pCmdQ-> getDevice ().getMemoryManager ());
440
+ UniqueIH (ioh), UniqueIH (ssh), *cmdQ. getDevice ().getMemoryManager ());
441
441
442
442
MockKernelWithInternals mockKernelWithInternals (*pDevice);
443
443
auto pKernel = mockKernelWithInternals.mockKernel ;
@@ -448,7 +448,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsKernelOperation) {
448
448
surface->graphicsAllocation = new GraphicsAllocation ((void *)0x1234 , 100u );
449
449
PreemptionMode preemptionMode = pDevice->getPreemptionMode ();
450
450
v.push_back (surface);
451
- auto cmd = new CommandComputeKernel (*pCmdQ, csr , std::unique_ptr<KernelOperation>(blockedCommandsData), v, false , false , false , nullptr , preemptionMode, pKernel, 1 );
451
+ auto cmd = new CommandComputeKernel (cmdQ , std::unique_ptr<KernelOperation>(blockedCommandsData), v, false , false , false , nullptr , preemptionMode, pKernel, 1 );
452
452
event.setCommand (std::unique_ptr<Command>(cmd));
453
453
454
454
auto taskLevelBefore = csr.peekTaskLevel ();
@@ -458,25 +458,24 @@ TEST_F(InternalsEventTest, processBlockedCommandsKernelOperation) {
458
458
auto taskLevelAfter = csr.peekTaskLevel ();
459
459
460
460
EXPECT_EQ (taskLevelBefore + 1 , taskLevelAfter);
461
- delete pCmdQ;
462
461
463
462
EXPECT_EQ (surface->resident , 1u );
464
463
EXPECT_FALSE (surface->graphicsAllocation ->isResident (0u ));
465
464
delete surface->graphicsAllocation ;
466
465
}
467
466
468
467
TEST_F (InternalsEventTest, processBlockedCommandsAbortKernelOperation) {
469
- MockEvent<Event> event ( nullptr , CL_COMMAND_NDRANGE_KERNEL, 0 , 0 );
470
- CommandQueue *pCmdQ = new CommandQueue (mockContext, pDevice , 0 );
468
+ CommandQueue cmdQ (mockContext, pDevice, nullptr );
469
+ MockEvent<Event> event (&cmdQ, CL_COMMAND_NDRANGE_KERNEL, 0 , 0 );
471
470
472
471
auto cmdStream = new LinearStream (alignedMalloc (4096 , 4096 ), 4096 );
473
472
IndirectHeap *dsh = nullptr , *ioh = nullptr , *ssh = nullptr ;
474
- pCmdQ-> allocateHeapMemory (IndirectHeap::DYNAMIC_STATE, 4096u , dsh);
475
- pCmdQ-> allocateHeapMemory (IndirectHeap::INDIRECT_OBJECT, 4096u , ioh);
476
- pCmdQ-> allocateHeapMemory (IndirectHeap::SURFACE_STATE, 4096u , ssh);
473
+ cmdQ. allocateHeapMemory (IndirectHeap::DYNAMIC_STATE, 4096u , dsh);
474
+ cmdQ. allocateHeapMemory (IndirectHeap::INDIRECT_OBJECT, 4096u , ioh);
475
+ cmdQ. allocateHeapMemory (IndirectHeap::SURFACE_STATE, 4096u , ssh);
477
476
using UniqueIH = std::unique_ptr<IndirectHeap>;
478
477
auto blockedCommandsData = new KernelOperation (std::unique_ptr<LinearStream>(cmdStream), UniqueIH (dsh),
479
- UniqueIH (ioh), UniqueIH (ssh), *pCmdQ-> getDevice ().getMemoryManager ());
478
+ UniqueIH (ioh), UniqueIH (ssh), *cmdQ. getDevice ().getMemoryManager ());
480
479
481
480
MockKernelWithInternals mockKernelWithInternals (*pDevice);
482
481
auto pKernel = mockKernelWithInternals.mockKernel ;
@@ -486,7 +485,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsAbortKernelOperation) {
486
485
NullSurface *surface = new NullSurface;
487
486
v.push_back (surface);
488
487
PreemptionMode preemptionMode = pDevice->getPreemptionMode ();
489
- auto cmd = new CommandComputeKernel (*pCmdQ, csr , std::unique_ptr<KernelOperation>(blockedCommandsData), v, false , false , false , nullptr , preemptionMode, pKernel, 1 );
488
+ auto cmd = new CommandComputeKernel (cmdQ , std::unique_ptr<KernelOperation>(blockedCommandsData), v, false , false , false , nullptr , preemptionMode, pKernel, 1 );
490
489
event.setCommand (std::unique_ptr<Command>(cmd));
491
490
492
491
auto taskLevelBefore = csr.peekTaskLevel ();
@@ -496,22 +495,21 @@ TEST_F(InternalsEventTest, processBlockedCommandsAbortKernelOperation) {
496
495
auto taskLevelAfter = csr.peekTaskLevel ();
497
496
498
497
EXPECT_EQ (taskLevelBefore, taskLevelAfter);
499
- delete pCmdQ;
500
498
}
501
499
502
500
TEST_F (InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOutput) {
503
501
testing::internal::CaptureStdout ();
504
- MockEvent<Event> event ( nullptr , CL_COMMAND_NDRANGE_KERNEL, 0 , 0 );
505
- CommandQueue *pCmdQ = new CommandQueue (mockContext, pDevice , 0 );
502
+ CommandQueue cmdQ (mockContext, pDevice, nullptr );
503
+ MockEvent<Event> event (&cmdQ, CL_COMMAND_NDRANGE_KERNEL, 0 , 0 );
506
504
507
505
auto cmdStream = new LinearStream (alignedMalloc (4096 , 4096 ), 4096 );
508
506
IndirectHeap *dsh = nullptr , *ioh = nullptr , *ssh = nullptr ;
509
- pCmdQ-> allocateHeapMemory (IndirectHeap::DYNAMIC_STATE, 4096u , dsh);
510
- pCmdQ-> allocateHeapMemory (IndirectHeap::INDIRECT_OBJECT, 4096u , ioh);
511
- pCmdQ-> allocateHeapMemory (IndirectHeap::SURFACE_STATE, 4096u , ssh);
507
+ cmdQ. allocateHeapMemory (IndirectHeap::DYNAMIC_STATE, 4096u , dsh);
508
+ cmdQ. allocateHeapMemory (IndirectHeap::INDIRECT_OBJECT, 4096u , ioh);
509
+ cmdQ. allocateHeapMemory (IndirectHeap::SURFACE_STATE, 4096u , ssh);
512
510
using UniqueIH = std::unique_ptr<IndirectHeap>;
513
511
auto blockedCommandsData = new KernelOperation (std::unique_ptr<LinearStream>(cmdStream), UniqueIH (dsh),
514
- UniqueIH (ioh), UniqueIH (ssh), *pCmdQ-> getDevice ().getMemoryManager ());
512
+ UniqueIH (ioh), UniqueIH (ssh), *cmdQ. getDevice ().getMemoryManager ());
515
513
516
514
SPatchAllocateStatelessPrintfSurface *pPrintfSurface = new SPatchAllocateStatelessPrintfSurface ();
517
515
pPrintfSurface->DataParamOffset = 0 ;
@@ -542,10 +540,9 @@ TEST_F(InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOut
542
540
printfSurface[0 ] = 8 ;
543
541
printfSurface[1 ] = 0 ;
544
542
545
- auto &csr = pDevice->getCommandStreamReceiver ();
546
543
std::vector<Surface *> v;
547
544
PreemptionMode preemptionMode = pDevice->getPreemptionMode ();
548
- auto cmd = new CommandComputeKernel (*pCmdQ, csr , std::unique_ptr<KernelOperation>(blockedCommandsData), v, false , false , false , std::move (printfHandler), preemptionMode, pKernel, 1 );
545
+ auto cmd = new CommandComputeKernel (cmdQ , std::unique_ptr<KernelOperation>(blockedCommandsData), v, false , false , false , std::move (printfHandler), preemptionMode, pKernel, 1 );
549
546
event.setCommand (std::unique_ptr<Command>(cmd));
550
547
551
548
event.submitCommand (false );
@@ -555,7 +552,6 @@ TEST_F(InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOut
555
552
EXPECT_FALSE (surface->isResident (0u ));
556
553
557
554
delete pPrintfSurface;
558
- delete pCmdQ;
559
555
}
560
556
561
557
TEST_F (InternalsEventTest, processBlockedCommandsMapOperation) {
@@ -1431,7 +1427,7 @@ HWTEST_F(InternalsEventTest, givenAbortedCommandWhenSubmitCalledThenDontUpdateFl
1431
1427
UniqueIH (ioh), UniqueIH (ssh), *pCmdQ->getDevice ().getMemoryManager ());
1432
1428
PreemptionMode preemptionMode = pDevice->getPreemptionMode ();
1433
1429
std::vector<Surface *> v;
1434
- auto cmd = new CommandComputeKernel (*pCmdQ, csr, std::unique_ptr<KernelOperation>(blockedCommandsData), v, false , false , false , nullptr , preemptionMode, pKernel, 1 );
1430
+ auto cmd = new CommandComputeKernel (*pCmdQ, std::unique_ptr<KernelOperation>(blockedCommandsData), v, false , false , false , nullptr , preemptionMode, pKernel, 1 );
1435
1431
event->setCommand (std::unique_ptr<Command>(cmd));
1436
1432
1437
1433
FlushStamp expectedFlushStamp = 0 ;
0 commit comments