@@ -176,6 +176,42 @@ HWTEST_F(CommandQueueHwTest, WhenEnqueuingBlockedMapUnmapOperationThenVirtualEve
176176 pHwQ->virtualEvent = nullptr ;
177177}
178178
179+ class MockCommandStreamReceiverWithFailingFlushBatchedSubmission : public MockCommandStreamReceiver {
180+ public:
181+ using MockCommandStreamReceiver::MockCommandStreamReceiver;
182+ bool flushBatchedSubmissions () override {
183+ return false ;
184+ }
185+ };
186+
187+ template <typename GfxFamily>
188+ struct MockCommandQueueHwWithOverwrittenCsr : public CommandQueueHw <GfxFamily> {
189+ using CommandQueueHw<GfxFamily>::CommandQueueHw;
190+ MockCommandStreamReceiverWithFailingFlushBatchedSubmission *csr;
191+ CommandStreamReceiver &getGpgpuCommandStreamReceiver () const override { return *csr; }
192+ };
193+
194+ HWTEST_F (CommandQueueHwTest, GivenCommandQueueWhenProcessDispatchForMarkerCalledThenEventAllocationIsMadeResident) {
195+
196+ pDevice->getUltCommandStreamReceiver <FamilyType>().timestampPacketWriteEnabled = false ;
197+ MockCommandStreamReceiverWithFailingFlushBatchedSubmission csr (*pDevice->getExecutionEnvironment (), 0 , pDevice->getDeviceBitfield ());
198+ auto myCmdQ = std::make_unique<MockCommandQueueHwWithOverwrittenCsr<FamilyType>>(pCmdQ->getContextPtr (), pClDevice, nullptr , false );
199+ myCmdQ->csr = &csr;
200+ csr.osContext = &pCmdQ->getCommandStreamReceiver (false ).getOsContext ();
201+ std::unique_ptr<Event> event (new Event (myCmdQ.get (), CL_COMMAND_COPY_BUFFER, 0 , 0 ));
202+ ASSERT_NE (nullptr , event);
203+
204+ GraphicsAllocation *allocation = event->getHwTimeStampNode ()->getBaseGraphicsAllocation ()->getDefaultGraphicsAllocation ();
205+ ASSERT_NE (nullptr , allocation);
206+ cl_event a = event.get ();
207+ EventsRequest eventsRequest (0 , nullptr , &a);
208+ uint32_t streamBuffer[100 ] = {};
209+ NEO::LinearStream linearStream (streamBuffer, sizeof (streamBuffer));
210+ CsrDependencies deps = {};
211+ myCmdQ->processDispatchForMarker (*myCmdQ.get (), &linearStream, eventsRequest, deps);
212+ EXPECT_GT (csr.makeResidentCalledTimes , 0u );
213+ }
214+
179215HWTEST_F (CommandQueueHwTest, givenCommandQueueWhenAskingForCacheFlushOnBcsThenReturnTrue) {
180216 auto pHwQ = static_cast <CommandQueueHw<FamilyType> *>(pCmdQ);
181217
@@ -1366,21 +1402,6 @@ HWTEST_F(CommandQueueHwTest, givenSizeWhenForceStatelessIsCalledThenCorrectValue
13661402 EXPECT_FALSE (pCmdQHw->forceStateless (static_cast <size_t >(smallSize)));
13671403}
13681404
1369- class MockCommandStreamReceiverWithFailingFlushBatchedSubmission : public MockCommandStreamReceiver {
1370- public:
1371- using MockCommandStreamReceiver::MockCommandStreamReceiver;
1372- bool flushBatchedSubmissions () override {
1373- return false ;
1374- }
1375- };
1376-
1377- template <typename GfxFamily>
1378- struct MockCommandQueueHwWithOverwrittenCsr : public CommandQueueHw <GfxFamily> {
1379- using CommandQueueHw<GfxFamily>::CommandQueueHw;
1380- MockCommandStreamReceiverWithFailingFlushBatchedSubmission *csr;
1381- CommandStreamReceiver &getGpgpuCommandStreamReceiver () const override { return *csr; }
1382- };
1383-
13841405HWTEST_F (CommandQueueHwTest, givenFlushWhenFlushBatchedSubmissionsFailsThenErrorIsRetured) {
13851406 MockCommandQueueHwWithOverwrittenCsr<FamilyType> cmdQueue (context, pClDevice, nullptr , false );
13861407 MockCommandStreamReceiverWithFailingFlushBatchedSubmission csr (*pDevice->executionEnvironment , 0 , pDevice->getDeviceBitfield ());
0 commit comments