@@ -599,30 +599,33 @@ TEST(Buffer, givenClMemCopyHostPointerPassedToBufferCreateWhenAllocationIsNotInS
599599 }
600600}
601601
602- namespace CpuIntrinsicsTests {
603- extern std::atomic<uint32_t > sfenceCounter;
604- } // namespace CpuIntrinsicsTests
605-
606- TEST (Buffer, givenDcFlushMitigationWhenCreateBufferCopyHostptrThenUseLockPointerCopyWithSfence) {
602+ TEST (Buffer, givenDcFlushMitigationWhenCreateBufferCopyHostptrThenUseBlitterCopy) {
603+ DebugManagerStateRestore restorer;
604+ debugManager.flags .AllowDcFlush .set (0 );
607605 ExecutionEnvironment *executionEnvironment = MockClDevice::prepareExecutionEnvironment (defaultHwInfo.get (), 0u );
606+ executionEnvironment->rootDeviceEnvironments [0 ]->getMutableHardwareInfo ()->capabilityTable .blitterOperationsSupported = true ;
607+
608608 auto productHelper = executionEnvironment->rootDeviceEnvironments [0 ]->productHelper .get ();
609- if (!productHelper->isDcFlushMitigated ()) {
609+ if (!( productHelper->isBlitterFullySupported (*defaultHwInfo) && productHelper-> isDcFlushMitigated () )) {
610610 GTEST_SKIP ();
611611 }
612612
613- VariableBackup<UltHwConfig> backup (&ultHwConfig);
614- ultHwConfig.useGpuCopyForDcFlushMitigation = true ;
615-
616- DebugManagerStateRestore restorer;
617- debugManager.flags .AllowDcFlush .set (0 );
613+ auto blitterCalled = 0u ;
614+ auto mockBlitMemoryToAllocation = [&](const NEO::Device &device, NEO::GraphicsAllocation *memory, size_t offset, const void *hostPtr,
615+ Vec3<size_t > size) -> NEO::BlitOperationResult {
616+ memcpy (memory->getUnderlyingBuffer (), hostPtr, size.x );
617+ blitterCalled++;
618+ return BlitOperationResult::success;
619+ };
620+ VariableBackup<NEO::BlitHelperFunctions::BlitMemoryToAllocationFunc> blitMemoryToAllocationFuncBackup (
621+ &NEO::BlitHelperFunctions::blitMemoryToAllocation, mockBlitMemoryToAllocation);
618622
619623 auto *memoryManager = new MockMemoryManagerFailFirstAllocation (*executionEnvironment);
620624 executionEnvironment->memoryManager .reset (memoryManager);
621625 memoryManager->returnBaseAllocateGraphicsMemoryInDevicePool = true ;
622626 auto device = std::make_unique<MockClDevice>(MockDevice::create<MockDevice>(executionEnvironment, 0 ));
623627
624628 MockContext ctx (device.get ());
625- CpuIntrinsicsTests::sfenceCounter.store (0u );
626629
627630 cl_int retVal = 0 ;
628631 cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR;
@@ -631,8 +634,7 @@ TEST(Buffer, givenDcFlushMitigationWhenCreateBufferCopyHostptrThenUseLockPointer
631634 std::unique_ptr<Buffer> buffer (Buffer::create (&ctx, flags, sizeof (memory), memory, retVal));
632635
633636 ASSERT_NE (nullptr , buffer.get ());
634- EXPECT_EQ (1u , CpuIntrinsicsTests::sfenceCounter.load ());
635- CpuIntrinsicsTests::sfenceCounter.store (0u );
637+ EXPECT_EQ (blitterCalled, 1u );
636638}
637639
638640TEST (Buffer, givenPropertiesWithClDeviceHandleListKHRWhenCreateBufferThenCorrectBufferIsSet) {
0 commit comments