@@ -1573,8 +1573,8 @@ HWTEST_F(EnqueueKernelTest, givenKernelWithRequiredAuxTranslationWhenEnqueuedThe
15731573 class MyCmdQ : public CommandQueueHw <FamilyType> {
15741574 public:
15751575 MyCmdQ (Context *context, Device *device) : CommandQueueHw<FamilyType>(context, device, nullptr ) {}
1576- void dispatchAuxTranslation (MultiDispatchInfo &multiDispatchInfo) override {
1577- CommandQueueHw<FamilyType>::dispatchAuxTranslation (multiDispatchInfo);
1576+ void dispatchAuxTranslation (MultiDispatchInfo &multiDispatchInfo, BuffersForAuxTranslation &buffersForAuxTranslation ) override {
1577+ CommandQueueHw<FamilyType>::dispatchAuxTranslation (multiDispatchInfo, buffersForAuxTranslation );
15781578 multiDispatchInfoSizes.push_back (multiDispatchInfo.size ());
15791579 }
15801580
@@ -1595,3 +1595,57 @@ HWTEST_F(EnqueueKernelTest, givenKernelWithRequiredAuxTranslationWhenEnqueuedThe
15951595 cmdQ.enqueueKernel (mockKernel.mockKernel , 1 , nullptr , gws, nullptr , 0 , nullptr , nullptr );
15961596 EXPECT_EQ (2u , cmdQ.multiDispatchInfoSizes .size ()); // not changed
15971597}
1598+
1599+ HWTEST_F (EnqueueKernelTest, givenMultipleArgsWhenAuxTranslationIsRequiredThenPickOnlyApplicableBuffers) {
1600+ class MyCmdQ : public CommandQueueHw <FamilyType> {
1601+ public:
1602+ MyCmdQ (Context *context, Device *device) : CommandQueueHw<FamilyType>(context, device, nullptr ) {}
1603+ void dispatchAuxTranslation (MultiDispatchInfo &multiDispatchInfo, BuffersForAuxTranslation &buffersForAuxTranslation) override {
1604+ CommandQueueHw<FamilyType>::dispatchAuxTranslation (multiDispatchInfo, buffersForAuxTranslation);
1605+ inputBuffersForAuxTranslation.push_back (buffersForAuxTranslation);
1606+ }
1607+
1608+ std::vector<BuffersForAuxTranslation> inputBuffersForAuxTranslation;
1609+ };
1610+ MyCmdQ cmdQ (context, pDevice);
1611+ size_t gws[3 ] = {1 , 0 , 0 };
1612+ MockBuffer buffer0, buffer1, buffer2, buffer3;
1613+ cl_mem clMem0 = &buffer0;
1614+ cl_mem clMem1 = &buffer1;
1615+ cl_mem clMem2 = &buffer2;
1616+ cl_mem clMem3 = &buffer3;
1617+ buffer0.getGraphicsAllocation ()->setAllocationType (GraphicsAllocation::AllocationType::BUFFER);
1618+ buffer1.getGraphicsAllocation ()->setAllocationType (GraphicsAllocation::AllocationType::BUFFER);
1619+ buffer2.getGraphicsAllocation ()->setAllocationType (GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
1620+ buffer3.getGraphicsAllocation ()->setAllocationType (GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
1621+
1622+ MockKernelWithInternals mockKernel (*pDevice, context);
1623+ mockKernel.mockKernel ->auxTranslationRequired = true ;
1624+ mockKernel.kernelInfo .kernelArgInfo .resize (6 );
1625+ for (auto &kernelInfo : mockKernel.kernelInfo .kernelArgInfo ) {
1626+ kernelInfo.kernelArgPatchInfoVector .resize (1 );
1627+ }
1628+
1629+ mockKernel.mockKernel ->initialize ();
1630+ mockKernel.kernelInfo .kernelArgInfo .at (0 ).pureStatefulBufferAccess = false ;
1631+ mockKernel.kernelInfo .kernelArgInfo .at (1 ).pureStatefulBufferAccess = true ;
1632+ mockKernel.kernelInfo .kernelArgInfo .at (2 ).pureStatefulBufferAccess = false ;
1633+ mockKernel.kernelInfo .kernelArgInfo .at (3 ).pureStatefulBufferAccess = true ;
1634+ mockKernel.kernelInfo .kernelArgInfo .at (4 ).pureStatefulBufferAccess = false ;
1635+ mockKernel.kernelInfo .kernelArgInfo .at (5 ).pureStatefulBufferAccess = false ;
1636+
1637+ mockKernel.mockKernel ->setArgBuffer (0 , sizeof (cl_mem *), &clMem0); // stateless on regular buffer - dont insert
1638+ mockKernel.mockKernel ->setArgBuffer (1 , sizeof (cl_mem *), &clMem1); // stateful on regular buffer - dont insert
1639+ mockKernel.mockKernel ->setArgBuffer (2 , sizeof (cl_mem *), &clMem2); // stateless on BUFFER_COMPRESSED - insert
1640+ mockKernel.mockKernel ->setArgBuffer (3 , sizeof (cl_mem *), &clMem3); // stateful on BUFFER_COMPRESSED - dont insert
1641+ mockKernel.mockKernel ->setArgBuffer (4 , sizeof (cl_mem *), nullptr ); // nullptr - dont insert
1642+ mockKernel.mockKernel ->kernelArguments .at (5 ).type = Kernel::kernelArgType::IMAGE_OBJ; // non-buffer arg - dont insert
1643+
1644+ cmdQ.enqueueKernel (mockKernel.mockKernel , 1 , nullptr , gws, nullptr , 0 , nullptr , nullptr );
1645+ EXPECT_EQ (2u , cmdQ.inputBuffersForAuxTranslation .size ());
1646+ EXPECT_EQ (1u , cmdQ.inputBuffersForAuxTranslation [0 ].size ()); // before kernel
1647+ EXPECT_EQ (1u , cmdQ.inputBuffersForAuxTranslation [1 ].size ()); // after kernel
1648+
1649+ EXPECT_EQ (&buffer2, *cmdQ.inputBuffersForAuxTranslation [0 ].begin ());
1650+ EXPECT_EQ (&buffer2, *cmdQ.inputBuffersForAuxTranslation [1 ].begin ());
1651+ }
0 commit comments