From c3b8727e975070362a7af2d4f1707dd789f61097 Mon Sep 17 00:00:00 2001 From: Filip Hazubski Date: Thu, 22 Oct 2020 16:13:05 +0200 Subject: [PATCH] Remove opencl includes from HwHelper Resolves: NEO-3964 Change-Id: Ie891ba6a205a89b41ca2cce0fa386dc4c93a0aaa Signed-off-by: Filip Hazubski --- level_zero/core/source/device/device.h | 2 ++ .../core/source/image/image_format_desc_helper.cpp | 2 ++ level_zero/core/source/kernel/kernel_imp.cpp | 1 + level_zero/core/source/windows/driver_teardown.cpp | 4 +++- opencl/source/cl_device/cl_device_caps.cpp | 1 + opencl/source/command_queue/enqueue_common.h | 7 ++++--- opencl/source/helpers/cl_hw_helper.h | 3 +++ opencl/source/helpers/cl_hw_helper_base.inl | 11 +++++++++++ .../unit_test/command_queue/blit_enqueue_tests.cpp | 1 + .../enqueue_command_without_kernel_tests.cpp | 1 + .../command_stream/tbx_command_stream_tests.cpp | 1 + opencl/test/unit_test/helpers/hw_helper_tests.cpp | 11 ++++++----- .../offline_compiler/ocloc_fatbinary_tests.cpp | 1 + .../unit_test/os_interface/linux/drm_neo_create.cpp | 1 + .../os_interface/linux/hw_info_config_linux_tests.cpp | 2 ++ shared/source/helpers/hw_helper.cpp | 2 ++ shared/source/helpers/hw_helper.h | 6 ++---- shared/source/helpers/hw_helper_base.inl | 10 ---------- 18 files changed, 44 insertions(+), 23 deletions(-) diff --git a/level_zero/core/source/device/device.h b/level_zero/core/source/device/device.h index 7804bfc211..b6146845f5 100644 --- a/level_zero/core/source/device/device.h +++ b/level_zero/core/source/device/device.h @@ -19,6 +19,8 @@ #include #include +#include "CL/cl.h" + struct _ze_device_handle_t {}; namespace NEO { class Device; diff --git a/level_zero/core/source/image/image_format_desc_helper.cpp b/level_zero/core/source/image/image_format_desc_helper.cpp index e5c558e777..cf1a32d0de 100644 --- a/level_zero/core/source/image/image_format_desc_helper.cpp +++ b/level_zero/core/source/image/image_format_desc_helper.cpp @@ -9,6 +9,8 @@ #include "shared/source/utilities/compiler_support.h" +#include "third_party/opencl_headers/CL/cl_ext_intel.h" + namespace L0 { cl_channel_type getClChannelDataType(const ze_image_format_t &imgDescription) { diff --git a/level_zero/core/source/kernel/kernel_imp.cpp b/level_zero/core/source/kernel/kernel_imp.cpp index 52d7d347ab..22c3e95b56 100644 --- a/level_zero/core/source/kernel/kernel_imp.cpp +++ b/level_zero/core/source/kernel/kernel_imp.cpp @@ -18,6 +18,7 @@ #include "shared/source/utilities/arrayref.h" #include "opencl/source/command_queue/gpgpu_walker.h" +#include "opencl/source/mem_obj/buffer.h" #include "opencl/source/program/kernel_info.h" #include "level_zero/core/source/device/device.h" diff --git a/level_zero/core/source/windows/driver_teardown.cpp b/level_zero/core/source/windows/driver_teardown.cpp index 6e1191d701..bf819e0e55 100644 --- a/level_zero/core/source/windows/driver_teardown.cpp +++ b/level_zero/core/source/windows/driver_teardown.cpp @@ -7,6 +7,8 @@ #include "level_zero/core/source/driver/driver_handle_imp.h" +#include + using namespace L0; BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { @@ -17,4 +19,4 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { } } return TRUE; -} \ No newline at end of file +} diff --git a/opencl/source/cl_device/cl_device_caps.cpp b/opencl/source/cl_device/cl_device_caps.cpp index b0507f1b7e..490f865bd2 100644 --- a/opencl/source/cl_device/cl_device_caps.cpp +++ b/opencl/source/cl_device/cl_device_caps.cpp @@ -5,6 +5,7 @@ * */ +#include "shared/source/debug_settings/debug_settings_manager.h" #include "shared/source/device/device.h" #include "shared/source/device/device_info.h" #include "shared/source/helpers/basic_math.h" diff --git a/opencl/source/command_queue/enqueue_common.h b/opencl/source/command_queue/enqueue_common.h index 06a1122743..1d1ce1ef18 100644 --- a/opencl/source/command_queue/enqueue_common.h +++ b/opencl/source/command_queue/enqueue_common.h @@ -27,6 +27,7 @@ #include "opencl/source/event/user_event.h" #include "opencl/source/gtpin/gtpin_notify.h" #include "opencl/source/helpers/cl_blit_properties.h" +#include "opencl/source/helpers/cl_hw_helper.h" #include "opencl/source/helpers/dispatch_info_builder.h" #include "opencl/source/helpers/enqueue_properties.h" #include "opencl/source/helpers/hardware_commands_helper.h" @@ -94,7 +95,7 @@ void CommandQueueHw::enqueueHandler(Surface *(&surfaces)[surfaceCount } } - if (HwHelperHw::isBlitAuxTranslationRequired(device->getHardwareInfo(), multiDispatchInfo)) { + if (ClHwHelperHw::isBlitAuxTranslationRequired(device->getHardwareInfo(), multiDispatchInfo)) { setupBlitAuxTranslation(multiDispatchInfo); } @@ -182,7 +183,7 @@ void CommandQueueHw::enqueueHandler(Surface **surfacesForResidency, CsrDependencies csrDeps; BlitPropertiesContainer blitPropertiesContainer; - bool enqueueWithBlitAuxTranslation = HwHelperHw::isBlitAuxTranslationRequired(device->getHardwareInfo(), multiDispatchInfo); + bool enqueueWithBlitAuxTranslation = ClHwHelperHw::isBlitAuxTranslationRequired(device->getHardwareInfo(), multiDispatchInfo); if (getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled()) { eventsRequest.fillCsrDependencies(csrDeps, getGpgpuCommandStreamReceiver(), CsrDependencies::DependenciesType::OnCsr); @@ -210,7 +211,7 @@ void CommandQueueHw::enqueueHandler(Surface **surfacesForResidency, blockedCommandsData, surfacesForResidency, numSurfaceForResidency); auto commandStreamStart = commandStream.getUsed(); - if (HwHelperHw::isBlitAuxTranslationRequired(device->getHardwareInfo(), multiDispatchInfo)) { + if (ClHwHelperHw::isBlitAuxTranslationRequired(device->getHardwareInfo(), multiDispatchInfo)) { processDispatchForBlitAuxTranslation(multiDispatchInfo, blitPropertiesContainer, timestampPacketDependencies, eventsRequest, blockQueue); } diff --git a/opencl/source/helpers/cl_hw_helper.h b/opencl/source/helpers/cl_hw_helper.h index 7a9a17d768..1151e32573 100644 --- a/opencl/source/helpers/cl_hw_helper.h +++ b/opencl/source/helpers/cl_hw_helper.h @@ -11,7 +11,9 @@ namespace NEO { +struct HardwareInfo; struct KernelInfo; +struct MultiDispatchInfo; class ClHwHelper { public: @@ -33,6 +35,7 @@ class ClHwHelperHw : public ClHwHelper { return clHwHelper; } + static bool isBlitAuxTranslationRequired(const HardwareInfo &hwInfo, const MultiDispatchInfo &multiDispatchInfo); bool requiresAuxResolves(const KernelInfo &kernelInfo) const override; protected: diff --git a/opencl/source/helpers/cl_hw_helper_base.inl b/opencl/source/helpers/cl_hw_helper_base.inl index 292bd7633c..4c04f12998 100644 --- a/opencl/source/helpers/cl_hw_helper_base.inl +++ b/opencl/source/helpers/cl_hw_helper_base.inl @@ -5,11 +5,22 @@ * */ +#include "shared/source/helpers/hw_helper.h" + #include "opencl/source/helpers/cl_hw_helper.h" +#include "opencl/source/helpers/dispatch_info.h" #include "opencl/source/program/kernel_info.h" namespace NEO { +template +bool ClHwHelperHw::isBlitAuxTranslationRequired(const HardwareInfo &hwInfo, const MultiDispatchInfo &multiDispatchInfo) { + return (HwHelperHw::getAuxTranslationMode() == AuxTranslationMode::Blit) && + hwInfo.capabilityTable.blitterOperationsSupported && + multiDispatchInfo.getMemObjsForAuxTranslation() && + (multiDispatchInfo.getMemObjsForAuxTranslation()->size() > 0); +} + template inline bool ClHwHelperHw::requiresAuxResolves(const KernelInfo &kernelInfo) const { return hasStatelessAccessToBuffer(kernelInfo); diff --git a/opencl/test/unit_test/command_queue/blit_enqueue_tests.cpp b/opencl/test/unit_test/command_queue/blit_enqueue_tests.cpp index 9d33792fe7..947b85f6b0 100644 --- a/opencl/test/unit_test/command_queue/blit_enqueue_tests.cpp +++ b/opencl/test/unit_test/command_queue/blit_enqueue_tests.cpp @@ -16,6 +16,7 @@ #include "shared/test/unit_test/utilities/base_object_utils.h" #include "opencl/source/event/user_event.h" +#include "opencl/source/mem_obj/buffer.h" #include "opencl/test/unit_test/helpers/unit_test_helper.h" #include "opencl/test/unit_test/mocks/mock_cl_device.h" #include "opencl/test/unit_test/mocks/mock_command_queue.h" diff --git a/opencl/test/unit_test/command_queue/enqueue_command_without_kernel_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_command_without_kernel_tests.cpp index d58f4f8f94..037c8f0372 100644 --- a/opencl/test/unit_test/command_queue/enqueue_command_without_kernel_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_command_without_kernel_tests.cpp @@ -12,6 +12,7 @@ #include "opencl/source/event/event_builder.h" #include "opencl/source/event/user_event.h" #include "opencl/source/helpers/enqueue_properties.h" +#include "opencl/source/mem_obj/buffer.h" #include "opencl/test/unit_test/fixtures/dispatch_flags_fixture.h" #include "opencl/test/unit_test/fixtures/enqueue_handler_fixture.h" #include "opencl/test/unit_test/mocks/mock_command_queue.h" diff --git a/opencl/test/unit_test/command_stream/tbx_command_stream_tests.cpp b/opencl/test/unit_test/command_stream/tbx_command_stream_tests.cpp index 8190b0e9d4..ed93e5aa21 100644 --- a/opencl/test/unit_test/command_stream/tbx_command_stream_tests.cpp +++ b/opencl/test/unit_test/command_stream/tbx_command_stream_tests.cpp @@ -21,6 +21,7 @@ #include "opencl/source/command_stream/command_stream_receiver_with_aub_dump.h" #include "opencl/source/command_stream/tbx_command_stream_receiver_hw.h" #include "opencl/source/helpers/hardware_context_controller.h" +#include "opencl/source/mem_obj/buffer.h" #include "opencl/source/mem_obj/mem_obj.h" #include "opencl/source/platform/platform.h" #include "opencl/test/unit_test/command_queue/command_queue_fixture.h" diff --git a/opencl/test/unit_test/helpers/hw_helper_tests.cpp b/opencl/test/unit_test/helpers/hw_helper_tests.cpp index f6c93f2c0c..bfecff3a28 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests.cpp @@ -20,6 +20,7 @@ #include "shared/test/unit_test/helpers/debug_manager_state_restore.h" #include "shared/test/unit_test/helpers/variable_backup.h" +#include "opencl/source/helpers/cl_hw_helper.h" #include "opencl/source/helpers/dispatch_info.h" #include "opencl/source/helpers/hardware_commands_helper.h" #include "opencl/source/mem_obj/image.h" @@ -743,20 +744,20 @@ HWTEST_F(HwHelperTest, givenMultiDispatchInfoWhenAskingForAuxTranslationThenChec DebugManager.flags.ForceAuxTranslationMode.set(static_cast(AuxTranslationMode::Blit)); - EXPECT_FALSE(HwHelperHw::isBlitAuxTranslationRequired(hwInfo, multiDispatchInfo)); + EXPECT_FALSE(ClHwHelperHw::isBlitAuxTranslationRequired(hwInfo, multiDispatchInfo)); multiDispatchInfo.setMemObjsForAuxTranslation(memObjects); - EXPECT_FALSE(HwHelperHw::isBlitAuxTranslationRequired(hwInfo, multiDispatchInfo)); + EXPECT_FALSE(ClHwHelperHw::isBlitAuxTranslationRequired(hwInfo, multiDispatchInfo)); memObjects.insert(&buffer); - EXPECT_TRUE(HwHelperHw::isBlitAuxTranslationRequired(hwInfo, multiDispatchInfo)); + EXPECT_TRUE(ClHwHelperHw::isBlitAuxTranslationRequired(hwInfo, multiDispatchInfo)); hwInfo.capabilityTable.blitterOperationsSupported = false; - EXPECT_FALSE(HwHelperHw::isBlitAuxTranslationRequired(hwInfo, multiDispatchInfo)); + EXPECT_FALSE(ClHwHelperHw::isBlitAuxTranslationRequired(hwInfo, multiDispatchInfo)); hwInfo.capabilityTable.blitterOperationsSupported = true; DebugManager.flags.ForceAuxTranslationMode.set(static_cast(AuxTranslationMode::Builtin)); - EXPECT_FALSE(HwHelperHw::isBlitAuxTranslationRequired(hwInfo, multiDispatchInfo)); + EXPECT_FALSE(ClHwHelperHw::isBlitAuxTranslationRequired(hwInfo, multiDispatchInfo)); } HWTEST_F(HwHelperTest, givenDebugVariableSetWhenAskingForAuxTranslationModeThenReturnCorrectValue) { diff --git a/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.cpp b/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.cpp index cb7f51e3dc..bee3a40668 100644 --- a/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/ocloc_fatbinary_tests.cpp @@ -9,6 +9,7 @@ #include "shared/source/helpers/hw_helper.h" +#include #include namespace NEO { diff --git a/opencl/test/unit_test/os_interface/linux/drm_neo_create.cpp b/opencl/test/unit_test/os_interface/linux/drm_neo_create.cpp index d52c594a65..a43f321207 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_neo_create.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_neo_create.cpp @@ -5,6 +5,7 @@ * */ +#include "shared/source/debug_settings/debug_settings_manager.h" #include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/helpers/hw_helper.h" #include "shared/test/unit_test/helpers/default_hw_info.h" diff --git a/opencl/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp b/opencl/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp index 65704c3dbe..9fe042dba0 100644 --- a/opencl/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp @@ -12,6 +12,8 @@ #include "shared/test/unit_test/helpers/debug_manager_state_restore.h" #include "shared/test/unit_test/helpers/default_hw_info.h" +#include "opencl/extensions/public/cl_ext_private.h" + #include namespace NEO { diff --git a/shared/source/helpers/hw_helper.cpp b/shared/source/helpers/hw_helper.cpp index 86f8d648be..eeafe1d48a 100644 --- a/shared/source/helpers/hw_helper.cpp +++ b/shared/source/helpers/hw_helper.cpp @@ -9,6 +9,8 @@ #include "shared/source/debug_settings/debug_settings_manager.h" +#include + namespace NEO { HwHelper *hwHelperFactory[IGFX_MAX_CORE] = {}; diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index 53f3cdac46..922b908f19 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -12,8 +12,7 @@ #include "shared/source/commands/bxml_generator_glue.h" #include "shared/source/helpers/aux_translation.h" #include "shared/source/helpers/engine_node_helper.h" - -#include "opencl/source/mem_obj/buffer.h" +#include "shared/source/utilities/stackvec.h" #include "hw_cmds.h" @@ -26,6 +25,7 @@ class GmmHelper; class GraphicsAllocation; struct AllocationData; struct AllocationProperties; +struct EngineControl; struct HardwareCapabilities; struct RootDeviceEnvironment; struct PipeControlArgs; @@ -262,8 +262,6 @@ class HwHelperHw : public HwHelper { static AuxTranslationMode getAuxTranslationMode(); - static bool isBlitAuxTranslationRequired(const HardwareInfo &hwInfo, const MultiDispatchInfo &multiDispatchInfo); - uint32_t getHwRevIdFromStepping(uint32_t stepping, const HardwareInfo &hwInfo) const override; uint32_t getSteppingFromHwRevId(uint32_t hwRevId, const HardwareInfo &hwInfo) const override; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index a9f3bee78a..e5f752a963 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -19,8 +19,6 @@ #include "shared/source/memory_manager/graphics_allocation.h" #include "shared/source/os_interface/os_interface.h" -#include "opencl/source/helpers/dispatch_info.h" - #include "pipe_control_args.h" namespace NEO { @@ -183,14 +181,6 @@ AuxTranslationMode HwHelperHw::getAuxTranslationMode() { return HwHelperHw::defaultAuxTranslationMode; } -template -bool HwHelperHw::isBlitAuxTranslationRequired(const HardwareInfo &hwInfo, const MultiDispatchInfo &multiDispatchInfo) { - return (HwHelperHw::getAuxTranslationMode() == AuxTranslationMode::Blit) && - hwInfo.capabilityTable.blitterOperationsSupported && - multiDispatchInfo.getMemObjsForAuxTranslation() && - (multiDispatchInfo.getMemObjsForAuxTranslation()->size() > 0); -} - template void MemorySynchronizationCommands::addPipeControlAndProgramPostSyncOperation( LinearStream &commandStream,