diff --git a/opencl/source/kernel/kernel.cpp b/opencl/source/kernel/kernel.cpp index 7c08e8a7a8..26a5e7c7b2 100644 --- a/opencl/source/kernel/kernel.cpp +++ b/opencl/source/kernel/kernel.cpp @@ -2335,37 +2335,6 @@ void Kernel::reconfigureKernel() { this->systolicPipelineSelectMode = kernelDescriptor.kernelAttributes.flags.usesSystolicPipelineSelectMode; } -bool Kernel::requiresCacheFlushCommand(const CommandQueue &commandQueue) const { - if (false == GfxCoreHelper::cacheFlushAfterWalkerSupported(commandQueue.getDevice().getHardwareInfo())) { - return false; - } - - if (debugManager.flags.EnableCacheFlushAfterWalkerForAllQueues.get() != -1) { - return !!debugManager.flags.EnableCacheFlushAfterWalkerForAllQueues.get(); - } - - bool cmdQueueRequiresCacheFlush = commandQueue.getRequiresCacheFlushAfterWalker(); - if (false == cmdQueueRequiresCacheFlush) { - return false; - } - if (commandQueue.getGpgpuCommandStreamReceiver().isMultiOsContextCapable()) { - return false; - } - bool isMultiDevice = commandQueue.getContext().containsMultipleSubDevices(commandQueue.getDevice().getRootDeviceIndex()); - if (false == isMultiDevice) { - return false; - } - bool isDefaultContext = (commandQueue.getContext().peekContextType() == ContextType::CONTEXT_TYPE_DEFAULT); - if (true == isDefaultContext) { - return false; - } - - if (getProgram()->getGlobalSurface(commandQueue.getDevice().getRootDeviceIndex()) != nullptr) { - return true; - } - return false; -} - void Kernel::updateAuxTranslationRequired() { if (CompressionSelector::allowStatelessCompression()) { if (hasDirectStatelessAccessToHostMemory() || diff --git a/opencl/source/kernel/kernel.h b/opencl/source/kernel/kernel.h index afb379f4e9..f478ab0293 100644 --- a/opencl/source/kernel/kernel.h +++ b/opencl/source/kernel/kernel.h @@ -326,8 +326,6 @@ class Kernel : public ReferenceTrackedObject { std::unique_ptr fillWithKernelObjsForAuxTranslation(); - MOCKABLE_VIRTUAL bool requiresCacheFlushCommand(const CommandQueue &commandQueue) const; - void setAuxTranslationDirection(AuxTranslationDirection auxTranslationDirection) { this->auxTranslationDirection = auxTranslationDirection; } diff --git a/opencl/test/unit_test/kernel/CMakeLists.txt b/opencl/test/unit_test/kernel/CMakeLists.txt index 6d2b9fa513..af372bcda8 100644 --- a/opencl/test/unit_test/kernel/CMakeLists.txt +++ b/opencl/test/unit_test/kernel/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2018-2023 Intel Corporation +# Copyright (C) 2018-2024 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -16,7 +16,6 @@ set(IGDRCL_SRCS_tests_kernel ${CMAKE_CURRENT_SOURCE_DIR}/kernel_arg_info_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/kernel_arg_pipe_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/kernel_arg_svm_tests.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/kernel_cache_flush_requirements_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/kernel_info_cl_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/kernel_image_arg_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/kernel_immediate_arg_tests.cpp diff --git a/opencl/test/unit_test/kernel/kernel_cache_flush_requirements_tests.cpp b/opencl/test/unit_test/kernel/kernel_cache_flush_requirements_tests.cpp deleted file mode 100644 index e8eed5f429..0000000000 --- a/opencl/test/unit_test/kernel/kernel_cache_flush_requirements_tests.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (C) 2019-2023 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/test/common/helpers/debug_manager_state_restore.h" -#include "shared/test/common/helpers/variable_backup.h" -#include "shared/test/common/mocks/mock_device.h" -#include "shared/test/common/mocks/mock_graphics_allocation.h" -#include "shared/test/common/test_macros/hw_test.h" - -#include "opencl/test/unit_test/fixtures/cl_device_fixture.h" -#include "opencl/test/unit_test/fixtures/context_fixture.h" -#include "opencl/test/unit_test/fixtures/platform_fixture.h" -#include "opencl/test/unit_test/mocks/mock_command_queue.h" -#include "opencl/test/unit_test/mocks/mock_context.h" -#include "opencl/test/unit_test/mocks/mock_kernel.h" -#include "opencl/test/unit_test/mocks/mock_program.h" - -namespace NEO { - -class KernelWithCacheFlushTests : public PlatformFixture, public testing::TestWithParam> { - public: - void SetUp() override { - } - void TearDown() override { - } - void initializePlatform() { - PlatformFixture::setUp(); - } - void clearPlatform() { - PlatformFixture::tearDown(); - } -}; -TEST_F(KernelWithCacheFlushTests, givenDeviceWhichDoesntRequireCacheFlushWhenCheckIfKernelRequireFlushThenReturnedFalse) { - initializePlatform(); - auto device = pPlatform->getClDevice(0); - - auto mockKernel = std::make_unique(*device); - MockContext mockContext(device); - MockCommandQueue queue(mockContext); - bool flushRequired = mockKernel->mockKernel->Kernel::requiresCacheFlushCommand(queue); - EXPECT_FALSE(flushRequired); - clearPlatform(); -} -TEST_F(KernelWithCacheFlushTests, givenQueueWhichDoesntRequireCacheFlushWhenCheckIfKernelRequireFlushThenReturnedFalse) { - initializePlatform(); - DebugManagerStateRestore dbgRestore; - debugManager.flags.EnableCacheFlushAfterWalker.set(1); - auto device = pPlatform->getClDevice(0); - - auto mockKernel = std::make_unique(*device); - MockContext mockContext(device); - MockCommandQueue queue(mockContext); - - bool flushRequired = mockKernel->mockKernel->Kernel::requiresCacheFlushCommand(queue); - EXPECT_FALSE(flushRequired); - clearPlatform(); -} -TEST_F(KernelWithCacheFlushTests, givenCacheFlushForAllQueuesDisabledWhenCheckIfKernelRequireFlushThenReturnedFalse) { - initializePlatform(); - DebugManagerStateRestore dbgRestore; - debugManager.flags.EnableCacheFlushAfterWalker.set(1); - debugManager.flags.EnableCacheFlushAfterWalkerForAllQueues.set(0); - auto device = pPlatform->getClDevice(0); - - auto mockKernel = std::make_unique(*device); - MockContext mockContext(device); - MockCommandQueue queue(mockContext); - bool flushRequired = mockKernel->mockKernel->Kernel::requiresCacheFlushCommand(queue); - - EXPECT_FALSE(flushRequired); - clearPlatform(); -} -HWTEST_F(KernelWithCacheFlushTests, givenCacheFlushForMultiEngineEnabledWhenCheckIfKernelRequireFlushThenReturnedFalse) { - initializePlatform(); - DebugManagerStateRestore dbgRestore; - debugManager.flags.EnableCacheFlushAfterWalker.set(1); - auto device = pPlatform->getClDevice(0); - - auto mockKernel = std::make_unique(*device); - MockContext mockContext(device); - auto cmdQ = std::make_unique>(&mockContext, device, nullptr); - cmdQ->requiresCacheFlushAfterWalker = true; - auto &ultCsr = static_cast &>(cmdQ->getGpgpuCommandStreamReceiver()); - ultCsr.multiOsContextCapable = true; - bool flushRequired = mockKernel->mockKernel->Kernel::requiresCacheFlushCommand(*cmdQ.get()); - - EXPECT_FALSE(flushRequired); - clearPlatform(); -} - -HWTEST_F(KernelWithCacheFlushTests, givenCacheFlushForSingleDeviceProgramWhenCheckIfKernelRequireFlushThenReturnedFalse) { - DebugManagerStateRestore dbgRestore; - debugManager.flags.CreateMultipleSubDevices.set(1); - initializePlatform(); - debugManager.flags.EnableCacheFlushAfterWalker.set(1); - auto device = pPlatform->getClDevice(0); - - auto mockKernel = std::make_unique(*device); - MockContext mockContext(device); - auto cmdQ = std::make_unique>(&mockContext, device, nullptr); - auto &ultCsr = static_cast &>(cmdQ->getGpgpuCommandStreamReceiver()); - ultCsr.multiOsContextCapable = false; - cmdQ->requiresCacheFlushAfterWalker = true; - bool flushRequired = mockKernel->mockKernel->Kernel::requiresCacheFlushCommand(*cmdQ.get()); - - EXPECT_FALSE(flushRequired); - clearPlatform(); -} - -HWTEST_F(KernelWithCacheFlushTests, givenCacheFlushForDefaultTypeContextWhenCheckIfKernelRequireFlushThenReturnedFalse) { - DebugManagerStateRestore dbgRestore; - debugManager.flags.EnableCacheFlushAfterWalker.set(1); - uint32_t numDevices = 2; - debugManager.flags.CreateMultipleSubDevices.set(numDevices); - initializePlatform(); - auto device = pPlatform->getClDevice(0); - - auto mockKernel = std::make_unique(*device); - MockContext mockContext(device); - auto cmdQ = std::make_unique>(&mockContext, device, nullptr); - cmdQ->requiresCacheFlushAfterWalker = true; - auto &ultCsr = static_cast &>(cmdQ->getGpgpuCommandStreamReceiver()); - ultCsr.multiOsContextCapable = false; - bool flushRequired = mockKernel->mockKernel->Kernel::requiresCacheFlushCommand(*cmdQ.get()); - - EXPECT_FALSE(flushRequired); - clearPlatform(); -} -HWTEST_F(KernelWithCacheFlushTests, givenCacheFlushWithNullGlobalSurfaceWhenCheckIfKernelRequireFlushThenReturnedFalse) { - DebugManagerStateRestore dbgRestore; - debugManager.flags.EnableCacheFlushAfterWalker.set(1); - uint32_t numDevices = 2; - debugManager.flags.CreateMultipleSubDevices.set(numDevices); - initializePlatform(); - auto device = pPlatform->getClDevice(0); - - auto mockKernel = std::make_unique(*device); - MockContext mockContext(device); - mockContext.contextType = ContextType::CONTEXT_TYPE_SPECIALIZED; - auto cmdQ = std::make_unique>(&mockContext, device, nullptr); - cmdQ->requiresCacheFlushAfterWalker = true; - auto &ultCsr = static_cast &>(cmdQ->getGpgpuCommandStreamReceiver()); - ultCsr.multiOsContextCapable = false; - bool flushRequired = mockKernel->mockKernel->Kernel::requiresCacheFlushCommand(*cmdQ.get()); - - EXPECT_FALSE(flushRequired); - clearPlatform(); -} -HWTEST_F(KernelWithCacheFlushTests, givenCacheFlushWithGlobalSurfaceWhenCheckIfKernelRequireFlushThenReturnedTrue) { - DebugManagerStateRestore dbgRestore; - debugManager.flags.EnableCacheFlushAfterWalker.set(1); - uint32_t numDevices = 2; - debugManager.flags.CreateMultipleSubDevices.set(numDevices); - initializePlatform(); - auto device = pPlatform->getClDevice(0); - - auto mockKernel = std::make_unique(*device); - MockContext mockContext(device); - mockContext.contextType = ContextType::CONTEXT_TYPE_SPECIALIZED; - - void *allocPtr = reinterpret_cast(static_cast(6 * MemoryConstants::pageSize)); - MockGraphicsAllocation globalAllocation{allocPtr, MemoryConstants::pageSize * 2}; - mockKernel->mockProgram->setGlobalSurface(&globalAllocation); - - auto cmdQ = std::make_unique>(&mockContext, device, nullptr); - cmdQ->requiresCacheFlushAfterWalker = true; - auto &ultCsr = static_cast &>(cmdQ->getGpgpuCommandStreamReceiver()); - ultCsr.multiOsContextCapable = false; - bool flushRequired = mockKernel->mockKernel->Kernel::requiresCacheFlushCommand(*cmdQ.get()); - - EXPECT_TRUE(flushRequired); - mockKernel->mockProgram->setGlobalSurface(nullptr); - clearPlatform(); -} -} // namespace NEO diff --git a/opencl/test/unit_test/mocks/mock_kernel.cpp b/opencl/test/unit_test/mocks/mock_kernel.cpp index 124928a7cd..b99da2701b 100644 --- a/opencl/test/unit_test/mocks/mock_kernel.cpp +++ b/opencl/test/unit_test/mocks/mock_kernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -39,13 +39,6 @@ void MockKernel::getResidency(std::vector &dst) { getResidencyCalls++; Kernel::getResidency(dst); } -bool MockKernel::requiresCacheFlushCommand(const CommandQueue &commandQueue) const { - if (debugManager.flags.EnableCacheFlushAfterWalker.get() != -1) { - return !!debugManager.flags.EnableCacheFlushAfterWalker.get(); - } - - return false; -} cl_int MockKernel::setArgSvmAlloc(uint32_t argIndex, void *svmPtr, GraphicsAllocation *svmAlloc, uint32_t allocId) { ++setArgSvmAllocCalls; diff --git a/opencl/test/unit_test/mocks/mock_kernel.h b/opencl/test/unit_test/mocks/mock_kernel.h index 1f817c26f8..a20cd3b73d 100644 --- a/opencl/test/unit_test/mocks/mock_kernel.h +++ b/opencl/test/unit_test/mocks/mock_kernel.h @@ -248,8 +248,6 @@ class MockKernel : public Kernel { void setSystolicPipelineSelectMode(bool value) { systolicPipelineSelectMode = value; } - bool requiresCacheFlushCommand(const CommandQueue &commandQueue) const override; - cl_int setArgSvmAlloc(uint32_t argIndex, void *svmPtr, GraphicsAllocation *svmAlloc, uint32_t allocId) override; uint32_t makeResidentCalls = 0;