@@ -4169,5 +4169,37 @@ TEST_F(BindlessKernelTest, givenBindlessKernelWithInlineSamplersWhenPatchingSamp
41694169 EXPECT_EQ (patchValue2, crossThreadData[6 ]);
41704170}
41714171
4172+ using KernelSyncBufferTest = Test<ModuleFixture>;
4173+
4174+ TEST_F (KernelSyncBufferTest, GivenSyncBufferArgWhenPatchingSyncBufferThenPtrIsCorrectlyPatchedInCrossThreadData) {
4175+ Mock<KernelImp> kernel;
4176+ neoDevice->incRefInternal ();
4177+
4178+ Mock<Module> mockModule (device, nullptr );
4179+ kernel.module = &mockModule;
4180+
4181+ kernel.crossThreadData = std::make_unique<uint8_t []>(64 );
4182+ kernel.crossThreadDataSize = 64 ;
4183+
4184+ auto &syncBuffer = kernel.immutableData .kernelDescriptor ->payloadMappings .implicitArgs .syncBufferAddress ;
4185+ syncBuffer.stateless = 0x8 ;
4186+ syncBuffer.pointerSize = 8 ;
4187+
4188+ NEO::MockGraphicsAllocation alloc;
4189+ alloc.setGpuPtr (0xffff800300060000 );
4190+ alloc.setGpuBaseAddress (0xffff800300000000 );
4191+ alloc.allocationOffset = 0x0 ;
4192+
4193+ size_t bufferOffset = 0u ;
4194+
4195+ kernel.patchSyncBuffer (&alloc, bufferOffset);
4196+
4197+ auto patchValue = *reinterpret_cast <uint64_t *>(ptrOffset (kernel.crossThreadData .get (), syncBuffer.stateless ));
4198+ auto expectedPatchValue = ptrOffset (alloc.getGpuAddress (), bufferOffset);
4199+ EXPECT_EQ (expectedPatchValue, patchValue);
4200+
4201+ neoDevice->decRefInternal ();
4202+ }
4203+
41724204} // namespace ult
41734205} // namespace L0
0 commit comments