From 4e3679b8ae9a197bc351169c467d8c6a7885c2d6 Mon Sep 17 00:00:00 2001 From: Zbigniew Zdanowicz Date: Wed, 7 Oct 2020 15:09:42 +0200 Subject: [PATCH] Move local ids generation code to shared directory Change-Id: I5b0486ceae8d67d0c1d1be56a756c102226d7e2a Signed-off-by: Zbigniew Zdanowicz --- manifests/manifest.yml | 2 +- opencl/source/CMakeLists.txt | 8 -------- opencl/source/command_queue/CMakeLists.txt | 5 ----- opencl/source/command_queue/gpgpu_walker_base.inl | 2 +- opencl/source/helpers/CMakeLists.txt | 2 -- opencl/source/helpers/hardware_commands_helper_base.inl | 2 +- opencl/source/helpers/per_thread_data.h | 2 +- opencl/test/unit_test/command_queue/local_id_tests.cpp | 2 +- .../enqueue_execution_model_kernel_tests.cpp | 2 +- opencl/test/unit_test/helpers/per_thread_data_tests.cpp | 2 +- opencl/test/unit_test/helpers/uint16_sse4_tests.cpp | 3 +-- shared/source/CMakeLists.txt | 9 +++++++++ shared/source/helpers/CMakeLists.txt | 7 +++++++ .../source/helpers}/local_id_gen.cpp | 2 +- .../source/helpers}/local_id_gen.h | 0 .../source/helpers}/local_id_gen.inl | 2 +- .../source/helpers}/local_id_gen_avx2.cpp | 4 ++-- .../source/helpers}/local_id_gen_sse4.cpp | 4 ++-- {opencl => shared}/source/helpers/uint16_avx2.h | 0 {opencl => shared}/source/helpers/uint16_sse4.h | 0 20 files changed, 30 insertions(+), 30 deletions(-) rename {opencl/source/command_queue => shared/source/helpers}/local_id_gen.cpp (99%) rename {opencl/source/command_queue => shared/source/helpers}/local_id_gen.h (100%) rename {opencl/source/command_queue => shared/source/helpers}/local_id_gen.inl (98%) rename {opencl/source/command_queue => shared/source/helpers}/local_id_gen_avx2.cpp (85%) rename {opencl/source/command_queue => shared/source/helpers}/local_id_gen_sse4.cpp (88%) rename {opencl => shared}/source/helpers/uint16_avx2.h (100%) rename {opencl => shared}/source/helpers/uint16_sse4.h (100%) diff --git a/manifests/manifest.yml b/manifests/manifest.yml index bee07f98c0..0e16d01478 100644 --- a/manifests/manifest.yml +++ b/manifests/manifest.yml @@ -14,7 +14,7 @@ components: infra: branch: infra dest_dir: infra - revision: eaa19ddf81e8b620c7f87ca50230120905e7c679 + revision: 5ae873aa3d60f55f53ff7bfb63e0895a70015b67 type: git internal: branch: master diff --git a/opencl/source/CMakeLists.txt b/opencl/source/CMakeLists.txt index cf13302d65..dfb66e43e5 100644 --- a/opencl/source/CMakeLists.txt +++ b/opencl/source/CMakeLists.txt @@ -32,14 +32,6 @@ add_library(${NEO_STATIC_LIB_NAME} STATIC EXCLUDE_FROM_ALL add_subdirectories() include(enable_gens.cmake) -# Enable SSE4/AVX2 options for files that need them -if(MSVC) - set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/command_queue/local_id_gen_avx2.cpp PROPERTIES COMPILE_FLAGS /arch:AVX2) -else() - set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/command_queue/local_id_gen_avx2.cpp PROPERTIES COMPILE_FLAGS -mavx2) - set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/command_queue/local_id_gen_sse4.cpp PROPERTIES COMPILE_FLAGS -msse4.2) -endif() - if(WIN32) if("${IGDRCL_OPTION__BITS}" STREQUAL "32") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") diff --git a/opencl/source/command_queue/CMakeLists.txt b/opencl/source/command_queue/CMakeLists.txt index 0ec2540652..aa49e02a58 100644 --- a/opencl/source/command_queue/CMakeLists.txt +++ b/opencl/source/command_queue/CMakeLists.txt @@ -40,11 +40,6 @@ set(RUNTIME_SRCS_COMMAND_QUEUE ${CMAKE_CURRENT_SOURCE_DIR}/hardware_interface.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware_interface_base.inl ${CMAKE_CURRENT_SOURCE_DIR}/hardware_interface_bdw_plus.inl - ${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.h - ${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.inl - ${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_avx2.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_sse4.cpp ${CMAKE_CURRENT_SOURCE_DIR}/local_work_size.cpp ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/resource_barrier.h ) diff --git a/opencl/source/command_queue/gpgpu_walker_base.inl b/opencl/source/command_queue/gpgpu_walker_base.inl index 893449934d..a6f0ea9aec 100644 --- a/opencl/source/command_queue/gpgpu_walker_base.inl +++ b/opencl/source/command_queue/gpgpu_walker_base.inl @@ -11,6 +11,7 @@ #include "shared/source/helpers/debug_helpers.h" #include "shared/source/helpers/engine_node_helper.h" #include "shared/source/helpers/hw_helper.h" +#include "shared/source/helpers/local_id_gen.h" #include "shared/source/indirect_heap/indirect_heap.h" #include "shared/source/memory_manager/graphics_allocation.h" #include "shared/source/os_interface/os_context.h" @@ -19,7 +20,6 @@ #include "opencl/source/command_queue/command_queue.h" #include "opencl/source/command_queue/command_queue_hw.h" #include "opencl/source/command_queue/gpgpu_walker.h" -#include "opencl/source/command_queue/local_id_gen.h" #include "opencl/source/event/perf_counter.h" #include "opencl/source/event/user_event.h" #include "opencl/source/helpers/hardware_commands_helper.h" diff --git a/opencl/source/helpers/CMakeLists.txt b/opencl/source/helpers/CMakeLists.txt index 4047943cd6..0109d94dff 100644 --- a/opencl/source/helpers/CMakeLists.txt +++ b/opencl/source/helpers/CMakeLists.txt @@ -48,8 +48,6 @@ set(RUNTIME_SRCS_HELPERS_BASE ${CMAKE_CURRENT_SOURCE_DIR}/task_information.cpp ${CMAKE_CURRENT_SOURCE_DIR}/task_information.h ${CMAKE_CURRENT_SOURCE_DIR}/task_information.inl - ${CMAKE_CURRENT_SOURCE_DIR}/uint16_avx2.h - ${CMAKE_CURRENT_SOURCE_DIR}/uint16_sse4.h ${CMAKE_CURRENT_SOURCE_DIR}/validators.cpp ${CMAKE_CURRENT_SOURCE_DIR}/validators.h ) diff --git a/opencl/source/helpers/hardware_commands_helper_base.inl b/opencl/source/helpers/hardware_commands_helper_base.inl index 2e300dbdb4..08da487429 100644 --- a/opencl/source/helpers/hardware_commands_helper_base.inl +++ b/opencl/source/helpers/hardware_commands_helper_base.inl @@ -13,12 +13,12 @@ #include "shared/source/helpers/aligned_memory.h" #include "shared/source/helpers/basic_math.h" #include "shared/source/helpers/hw_helper.h" +#include "shared/source/helpers/local_id_gen.h" #include "shared/source/helpers/ptr_math.h" #include "shared/source/helpers/string.h" #include "shared/source/indirect_heap/indirect_heap.h" #include "opencl/source/cl_device/cl_device.h" -#include "opencl/source/command_queue/local_id_gen.h" #include "opencl/source/context/context.h" #include "opencl/source/helpers/dispatch_info.h" #include "opencl/source/kernel/kernel.h" diff --git a/opencl/source/helpers/per_thread_data.h b/opencl/source/helpers/per_thread_data.h index 5310dea11c..712ddb5bc4 100644 --- a/opencl/source/helpers/per_thread_data.h +++ b/opencl/source/helpers/per_thread_data.h @@ -6,7 +6,7 @@ */ #pragma once -#include "opencl/source/command_queue/local_id_gen.h" +#include "shared/source/helpers/local_id_gen.h" #include "patch_shared.h" diff --git a/opencl/test/unit_test/command_queue/local_id_tests.cpp b/opencl/test/unit_test/command_queue/local_id_tests.cpp index 6f32af1f4e..c9331b5793 100644 --- a/opencl/test/unit_test/command_queue/local_id_tests.cpp +++ b/opencl/test/unit_test/command_queue/local_id_tests.cpp @@ -7,9 +7,9 @@ #include "shared/source/helpers/aligned_memory.h" #include "shared/source/helpers/basic_math.h" +#include "shared/source/helpers/local_id_gen.h" #include "shared/source/helpers/ptr_math.h" -#include "opencl/source/command_queue/local_id_gen.h" #include "opencl/test/unit_test/helpers/unit_test_helper.h" #include "test.h" diff --git a/opencl/test/unit_test/execution_model/enqueue_execution_model_kernel_tests.cpp b/opencl/test/unit_test/execution_model/enqueue_execution_model_kernel_tests.cpp index f44ad71ded..6c69a5a6a7 100644 --- a/opencl/test/unit_test/execution_model/enqueue_execution_model_kernel_tests.cpp +++ b/opencl/test/unit_test/execution_model/enqueue_execution_model_kernel_tests.cpp @@ -6,6 +6,7 @@ */ #include "shared/source/helpers/engine_node_helper.h" +#include "shared/source/helpers/local_id_gen.h" #include "shared/test/unit_test/cmd_parse/hw_parse.h" #include "shared/test/unit_test/helpers/debug_manager_state_restore.h" #include "shared/test/unit_test/utilities/base_object_utils.h" @@ -13,7 +14,6 @@ #include "opencl/source/built_ins/builtins_dispatch_builder.h" #include "opencl/source/builtin_kernels_simulation/scheduler_simulation.h" #include "opencl/source/command_queue/gpgpu_walker.h" -#include "opencl/source/command_queue/local_id_gen.h" #include "opencl/source/device_queue/device_queue_hw.h" #include "opencl/source/event/user_event.h" #include "opencl/source/helpers/per_thread_data.h" diff --git a/opencl/test/unit_test/helpers/per_thread_data_tests.cpp b/opencl/test/unit_test/helpers/per_thread_data_tests.cpp index aa70b53baa..318dbf2b2a 100644 --- a/opencl/test/unit_test/helpers/per_thread_data_tests.cpp +++ b/opencl/test/unit_test/helpers/per_thread_data_tests.cpp @@ -7,8 +7,8 @@ #include "shared/source/command_stream/linear_stream.h" #include "shared/source/helpers/aligned_memory.h" +#include "shared/source/helpers/local_id_gen.h" -#include "opencl/source/command_queue/local_id_gen.h" #include "opencl/source/helpers/per_thread_data.h" #include "opencl/source/program/kernel_info.h" #include "opencl/test/unit_test/fixtures/cl_device_fixture.h" diff --git a/opencl/test/unit_test/helpers/uint16_sse4_tests.cpp b/opencl/test/unit_test/helpers/uint16_sse4_tests.cpp index ac767f500a..8ec5221eb2 100644 --- a/opencl/test/unit_test/helpers/uint16_sse4_tests.cpp +++ b/opencl/test/unit_test/helpers/uint16_sse4_tests.cpp @@ -6,8 +6,7 @@ */ #include "shared/source/helpers/aligned_memory.h" - -#include "opencl/source/helpers/uint16_sse4.h" +#include "shared/source/helpers/uint16_sse4.h" #include "gtest/gtest.h" diff --git a/shared/source/CMakeLists.txt b/shared/source/CMakeLists.txt index dda5bc72b8..7ddf1b4450 100644 --- a/shared/source/CMakeLists.txt +++ b/shared/source/CMakeLists.txt @@ -52,6 +52,15 @@ function(generate_shared_lib LIB_NAME MOCKABLE) endif() create_project_source_tree(${LIB_NAME}) + + # Enable SSE4/AVX2 options for files that need them + if(MSVC) + set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/helpers/local_id_gen_avx2.cpp PROPERTIES COMPILE_FLAGS /arch:AVX2) + else() + set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/helpers/local_id_gen_avx2.cpp PROPERTIES COMPILE_FLAGS -mavx2) + set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/helpers/local_id_gen_sse4.cpp PROPERTIES COMPILE_FLAGS -msse4.2) + endif() + endfunction() set(NEO_CORE_COMPILE_DEFS "") diff --git a/shared/source/helpers/CMakeLists.txt b/shared/source/helpers/CMakeLists.txt index 7d939cefe2..b9e6933b29 100644 --- a/shared/source/helpers/CMakeLists.txt +++ b/shared/source/helpers/CMakeLists.txt @@ -64,6 +64,11 @@ set(NEO_CORE_HELPERS ${CMAKE_CURRENT_SOURCE_DIR}/kernel_helpers.h ${CMAKE_CURRENT_SOURCE_DIR}/kmd_notify_properties.cpp ${CMAKE_CURRENT_SOURCE_DIR}/kmd_notify_properties.h + ${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.h + ${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.inl + ${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_avx2.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_sse4.cpp ${CMAKE_CURRENT_SOURCE_DIR}/non_copyable_or_moveable.h ${CMAKE_CURRENT_SOURCE_DIR}/options.h ${CMAKE_CURRENT_SOURCE_DIR}/pause_on_gpu_properties.h @@ -89,6 +94,8 @@ set(NEO_CORE_HELPERS ${CMAKE_CURRENT_SOURCE_DIR}/timestamp_packet.cpp ${CMAKE_CURRENT_SOURCE_DIR}/timestamp_packet.h ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/timestamp_packet_extra.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/uint16_avx2.h + ${CMAKE_CURRENT_SOURCE_DIR}/uint16_sse4.h ${CMAKE_CURRENT_SOURCE_DIR}/vec.h ${CMAKE_CURRENT_SOURCE_DIR}/definitions/${BRANCH_DIR_SUFFIX}/hw_cmds.h ${CMAKE_CURRENT_SOURCE_DIR}/definitions/pipe_control_args_base.h diff --git a/opencl/source/command_queue/local_id_gen.cpp b/shared/source/helpers/local_id_gen.cpp similarity index 99% rename from opencl/source/command_queue/local_id_gen.cpp rename to shared/source/helpers/local_id_gen.cpp index e2246d1c69..6bf1c76c0b 100644 --- a/opencl/source/command_queue/local_id_gen.cpp +++ b/shared/source/helpers/local_id_gen.cpp @@ -5,7 +5,7 @@ * */ -#include "opencl/source/command_queue/local_id_gen.h" +#include "shared/source/helpers/local_id_gen.h" #include "shared/source/helpers/aligned_memory.h" #include "shared/source/utilities/cpu_info.h" diff --git a/opencl/source/command_queue/local_id_gen.h b/shared/source/helpers/local_id_gen.h similarity index 100% rename from opencl/source/command_queue/local_id_gen.h rename to shared/source/helpers/local_id_gen.h diff --git a/opencl/source/command_queue/local_id_gen.inl b/shared/source/helpers/local_id_gen.inl similarity index 98% rename from opencl/source/command_queue/local_id_gen.inl rename to shared/source/helpers/local_id_gen.inl index 83fdd150d6..27f821455d 100644 --- a/opencl/source/command_queue/local_id_gen.inl +++ b/shared/source/helpers/local_id_gen.inl @@ -5,7 +5,7 @@ * */ -#include "opencl/source/command_queue/local_id_gen.h" +#include "shared/source/helpers/local_id_gen.h" #include diff --git a/opencl/source/command_queue/local_id_gen_avx2.cpp b/shared/source/helpers/local_id_gen_avx2.cpp similarity index 85% rename from opencl/source/command_queue/local_id_gen_avx2.cpp rename to shared/source/helpers/local_id_gen_avx2.cpp index 3e8eaccf67..50036f2dee 100644 --- a/opencl/source/command_queue/local_id_gen_avx2.cpp +++ b/shared/source/helpers/local_id_gen_avx2.cpp @@ -6,8 +6,8 @@ */ #if __AVX2__ -#include "opencl/source/command_queue/local_id_gen.inl" -#include "opencl/source/helpers/uint16_avx2.h" +#include "shared/source/helpers/local_id_gen.inl" +#include "shared/source/helpers/uint16_avx2.h" #include diff --git a/opencl/source/command_queue/local_id_gen_sse4.cpp b/shared/source/helpers/local_id_gen_sse4.cpp similarity index 88% rename from opencl/source/command_queue/local_id_gen_sse4.cpp rename to shared/source/helpers/local_id_gen_sse4.cpp index 148e4ac89d..3963e37fa1 100644 --- a/opencl/source/command_queue/local_id_gen_sse4.cpp +++ b/shared/source/helpers/local_id_gen_sse4.cpp @@ -5,8 +5,8 @@ * */ -#include "opencl/source/command_queue/local_id_gen.inl" -#include "opencl/source/helpers/uint16_sse4.h" +#include "shared/source/helpers/local_id_gen.inl" +#include "shared/source/helpers/uint16_sse4.h" #include diff --git a/opencl/source/helpers/uint16_avx2.h b/shared/source/helpers/uint16_avx2.h similarity index 100% rename from opencl/source/helpers/uint16_avx2.h rename to shared/source/helpers/uint16_avx2.h diff --git a/opencl/source/helpers/uint16_sse4.h b/shared/source/helpers/uint16_sse4.h similarity index 100% rename from opencl/source/helpers/uint16_sse4.h rename to shared/source/helpers/uint16_sse4.h