@@ -599,33 +599,30 @@ TEST(Buffer, givenClMemCopyHostPointerPassedToBufferCreateWhenAllocationIsNotInS
599599 }
600600}
601601
602- TEST (Buffer, givenDcFlushMitigationWhenCreateBufferCopyHostptrThenUseBlitterCopy) {
603- DebugManagerStateRestore restorer;
604- debugManager.flags .AllowDcFlush .set (0 );
605- ExecutionEnvironment *executionEnvironment = MockClDevice::prepareExecutionEnvironment (defaultHwInfo.get (), 0u );
606- executionEnvironment->rootDeviceEnvironments [0 ]->getMutableHardwareInfo ()->capabilityTable .blitterOperationsSupported = true ;
602+ namespace CpuIntrinsicsTests {
603+ extern std::atomic<uint32_t > sfenceCounter;
604+ } // namespace CpuIntrinsicsTests
607605
606+ TEST (Buffer, givenDcFlushMitigationWhenCreateBufferCopyHostptrThenUseLockPointerCopyWithSfence) {
607+ ExecutionEnvironment *executionEnvironment = MockClDevice::prepareExecutionEnvironment (defaultHwInfo.get (), 0u );
608608 auto productHelper = executionEnvironment->rootDeviceEnvironments [0 ]->productHelper .get ();
609- if (!( productHelper->isBlitterFullySupported (*defaultHwInfo) && productHelper-> isDcFlushMitigated () )) {
609+ if (!productHelper->isDcFlushMitigated ()) {
610610 GTEST_SKIP ();
611611 }
612612
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);
613+ VariableBackup<UltHwConfig> backup (&ultHwConfig);
614+ ultHwConfig.useGpuCopyForDcFlushMitigation = true ;
615+
616+ DebugManagerStateRestore restorer;
617+ debugManager.flags .AllowDcFlush .set (0 );
622618
623619 auto *memoryManager = new MockMemoryManagerFailFirstAllocation (*executionEnvironment);
624620 executionEnvironment->memoryManager .reset (memoryManager);
625621 memoryManager->returnBaseAllocateGraphicsMemoryInDevicePool = true ;
626622 auto device = std::make_unique<MockClDevice>(MockDevice::create<MockDevice>(executionEnvironment, 0 ));
627623
628624 MockContext ctx (device.get ());
625+ CpuIntrinsicsTests::sfenceCounter.store (0u );
629626
630627 cl_int retVal = 0 ;
631628 cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR;
@@ -634,7 +631,8 @@ TEST(Buffer, givenDcFlushMitigationWhenCreateBufferCopyHostptrThenUseBlitterCopy
634631 std::unique_ptr<Buffer> buffer (Buffer::create (&ctx, flags, sizeof (memory), memory, retVal));
635632
636633 ASSERT_NE (nullptr , buffer.get ());
637- EXPECT_EQ (blitterCalled, 1u );
634+ EXPECT_EQ (1u , CpuIntrinsicsTests::sfenceCounter.load ());
635+ CpuIntrinsicsTests::sfenceCounter.store (0u );
638636}
639637
640638TEST (Buffer, givenPropertiesWithClDeviceHandleListKHRWhenCreateBufferThenCorrectBufferIsSet) {
0 commit comments