@@ -25,25 +25,56 @@ class MockSyncBufferHandler : public SyncBufferHandler {
2525 using SyncBufferHandler::usedBufferSize;
2626};
2727
28- class SyncBufferHandlerTest : public EnqueueHandlerTest {
28+ class SyncBufferEnqueueHandlerTest : public EnqueueHandlerTest {
29+ public:
30+ void SetUp () {
31+ hardwareInfo = *defaultHwInfo;
32+ uint64_t hwInfoConfig = defaultHardwareInfoConfigTable[productFamily];
33+ hardwareInfoSetup[productFamily](&hardwareInfo, true , hwInfoConfig);
34+ SetUpImpl (&hardwareInfo);
35+ }
36+
37+ void TearDown () {
38+ context->decRefInternal ();
39+ delete pClDevice;
40+ pClDevice = nullptr ;
41+ pDevice = nullptr ;
42+ }
43+
44+ void SetUpImpl (const NEO::HardwareInfo *hardwareInfo) {
45+ pDevice = MockDevice::createWithNewExecutionEnvironment<MockDevice>(hardwareInfo);
46+ ASSERT_NE (nullptr , pDevice);
47+ pClDevice = new MockClDevice{pDevice};
48+ ASSERT_NE (nullptr , pClDevice);
49+
50+ auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver ();
51+ pTagMemory = commandStreamReceiver.getTagAddress ();
52+ ASSERT_NE (nullptr , const_cast <uint32_t *>(pTagMemory));
53+
54+ context = new NEO::MockContext (pClDevice);
55+ }
56+ };
57+
58+ class SyncBufferHandlerTest : public SyncBufferEnqueueHandlerTest {
2959 public:
3060 void SetUp () override {}
3161 void TearDown () override {}
3262
3363 template <typename FamilyType>
3464 void SetUpT () {
35- EnqueueHandlerTest ::SetUp ();
65+ SyncBufferEnqueueHandlerTest ::SetUp ();
3666 kernelInternals = std::make_unique<MockKernelWithInternals>(*pClDevice, context);
3767 kernel = kernelInternals->mockKernel ;
3868 kernel->executionType = KernelExecutionType::Concurrent;
3969 commandQueue = reinterpret_cast <MockCommandQueue *>(new MockCommandQueueHw<FamilyType>(context, pClDevice, 0 ));
70+ hwHelper = &HwHelper::get (kernel->getDevice ().getHardwareInfo ().platform .eRenderCoreFamily );
4071 }
4172
4273 template <typename FamilyType>
4374 void TearDownT () {
4475 commandQueue->release ();
4576 kernelInternals.reset ();
46- EnqueueHandlerTest ::TearDown ();
77+ SyncBufferEnqueueHandlerTest ::TearDown ();
4778 }
4879
4980 void patchAllocateSyncBuffer () {
@@ -61,6 +92,10 @@ class SyncBufferHandlerTest : public EnqueueHandlerTest {
6192 return clEnqueueNDCountKernelINTEL (commandQueue, kernel, workDim, gwOffset, workgroupCount, lws, 0 , nullptr , nullptr );
6293 }
6394
95+ bool isCooperativeDispatchSupported () {
96+ return hwHelper->isCooperativeDispatchSupported (commandQueue->getGpgpuEngine ().getEngineType (), kernel->getDevice ().getHardwareInfo ().platform .eProductFamily );
97+ }
98+
6499 const cl_uint workDim = 1 ;
65100 const size_t gwOffset[3 ] = {0 , 0 , 0 };
66101 const size_t lws[3 ] = {10 , 1 , 1 };
@@ -71,6 +106,7 @@ class SyncBufferHandlerTest : public EnqueueHandlerTest {
71106 MockKernel *kernel;
72107 MockCommandQueue *commandQueue;
73108 SPatchAllocateSyncBuffer sPatchAllocateSyncBuffer ;
109+ HwHelper *hwHelper;
74110};
75111
76112HWTEST_TEMPLATED_F (SyncBufferHandlerTest, GivenAllocateSyncBufferPatchAndConcurrentKernelWhenEnqueuingKernelThenSyncBufferIsUsed) {
@@ -109,7 +145,7 @@ HWTEST_TEMPLATED_F(SyncBufferHandlerTest, GivenConcurrentKernelWithAllocateSyncB
109145}
110146
111147HWTEST_TEMPLATED_F (SyncBufferHandlerTest, GivenMaxWorkgroupCountWhenEnqueuingConcurrentKernelThenSuccessIsReturned) {
112- auto maxWorkGroupCount = kernel->getMaxWorkGroupCount (workDim, lws);
148+ auto maxWorkGroupCount = kernel->getMaxWorkGroupCount (workDim, lws, commandQueue );
113149 workgroupCount[0 ] = maxWorkGroupCount;
114150 globalWorkSize[0 ] = maxWorkGroupCount * lws[0 ];
115151
@@ -118,7 +154,7 @@ HWTEST_TEMPLATED_F(SyncBufferHandlerTest, GivenMaxWorkgroupCountWhenEnqueuingCon
118154}
119155
120156HWTEST_TEMPLATED_F (SyncBufferHandlerTest, GivenTooHighWorkgroupCountWhenEnqueuingConcurrentKernelThenErrorIsReturned) {
121- size_t maxWorkGroupCount = kernel->getMaxWorkGroupCount (workDim, lws);
157+ size_t maxWorkGroupCount = kernel->getMaxWorkGroupCount (workDim, lws, commandQueue );
122158 workgroupCount[0 ] = maxWorkGroupCount + 1 ;
123159 globalWorkSize[0 ] = maxWorkGroupCount * lws[0 ] + 1 ;
124160
0 commit comments