Skip to content

Commit

Permalink
Merge branch 'master' into ywang2/fix_the_timing_issue
Browse files Browse the repository at this point in the history
  • Loading branch information
peterchen-intel authored Jan 8, 2025
2 parents b90bbaa + 8a19942 commit ea49b94
Show file tree
Hide file tree
Showing 102 changed files with 812 additions and 1,019 deletions.
18 changes: 7 additions & 11 deletions cmake/developer_package/api_validator/api_validator.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ can't find Windows SDK version. Try to use vcvarsall.bat script")
endif()
endif()

# check that PROGRAMFILES_ENV is defined, because in case of cross-compilation for Windows we don't have such variable
set(PROGRAMFILES_ENV "ProgramFiles\(X86\)")

# check that PROGRAMFILES_ENV is defined, because in case of cross-compilation for Windows
# we don't have such variable
if(DEFINED ENV{${PROGRAMFILES_ENV}})
file(TO_CMAKE_PATH $ENV{${PROGRAMFILES_ENV}} PROGRAMFILES)

set(WDK_PATHS "${PROGRAMFILES}/Windows Kits/10/bin/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}/x64"
"${PROGRAMFILES}/Windows Kits/10/bin/x64")
endif()

if(WDK_PATHS)
message(STATUS "Trying to find apivalidator in: ")
foreach(wdk_path IN LISTS WDK_PATHS)
message(" * ${wdk_path}")
Expand Down Expand Up @@ -90,7 +90,10 @@ endfunction()

set(VALIDATED_TARGETS "" CACHE INTERNAL "")

function(_ov_add_api_validator_post_build_step)
#
# ov_add_api_validator_post_build_step(TARGET <name>)
#
function(ov_add_api_validator_post_build_step)
if((NOT ONECORE_API_VALIDATOR) OR (WINDOWS_STORE OR WINDOWS_PHONE))
return()
endif()
Expand Down Expand Up @@ -212,10 +215,3 @@ function(_ov_add_api_validator_post_build_step)
list(APPEND VALIDATED_TARGETS ${API_VALIDATOR_TARGETS})
set(VALIDATED_TARGETS "${VALIDATED_TARGETS}" CACHE INTERNAL "" FORCE)
endfunction()

#
# ov_add_api_validator_post_build_step(TARGET <name>)
#
function(ov_add_api_validator_post_build_step)
_ov_add_api_validator_post_build_step(${ARGN})
endfunction()
16 changes: 5 additions & 11 deletions cmake/developer_package/compile_flags/os_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -234,22 +234,22 @@ endmacro()
#
macro(ov_arm_neon_fp16_optimization_flags flags)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID} for arm64 platform")
elseif(ANDROID)
if(ANDROID_ABI STREQUAL "arm64-v8a")
set(${flags} -march=armv8.2-a+fp16 -Wno-unused-command-line-argument)
else()
message(WARNING "fp16 is not supported by Android armv7")
message(WARNING "ARM64 fp16 is not supported by Android armv7")
endif()
elseif(AARCH64)
set(${flags} -O2 -march=armv8.2-a+fp16)
if(NOT CMAKE_CL_64)
list(APPEND ${flags} -ftree-vectorize)
endif()
elseif(ARM)
message(WARNING "fp16 is not supported by 32-bit ARM")
message(WARNING "ARM64 fp16 is not supported by 32-bit ARM")
else()
message(WARNING "fp16 is not supported by architecture ${CMAKE_SYSTEM_PROCESSOR}")
message(WARNING "ARM64 fp16 is not supported by architecture ${CMAKE_SYSTEM_PROCESSOR}")
endif()
endmacro()

Expand Down Expand Up @@ -390,13 +390,7 @@ endif()

# to allows to override CMAKE_CXX_STANDARD from command line
if(NOT DEFINED CMAKE_CXX_STANDARD)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_STANDARD 14)
elseif(OV_COMPILER_IS_INTEL_LLVM)
set(CMAKE_CXX_STANDARD 17)
else()
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD 17)
endif()

if(NOT DEFINED CMAKE_CXX_EXTENSIONS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,32 @@ function(_generate_dispatcher)
")

foreach(_namespace ${PARENT_NAMESPACES})
foreach(_namespace IN LISTS PARENT_NAMESPACES)
string(APPEND DISP_CONTENT
"namespace ${_namespace} {\n")
endforeach()

foreach(_func_name ${XARCH_FUNC_NAMES})
foreach(_func_name IN LISTS XARCH_FUNC_NAMES)
_find_signature_in_file(${XARCH_API_HEADER} ${_func_name} SIGNATURE)
_generate_call_line_from_signature("${SIGNATURE}" CALL_LINE)

foreach(_arch ${XARCH_SET})
foreach(_arch IN LISTS XARCH_SET)
string(APPEND DISP_CONTENT
"namespace ${_arch} {\n ${SIGNATURE}\; \n}\n")
endforeach()

string(APPEND DISP_CONTENT
"namespace ${XARCH_CURRENT_NAMESPACE} {\n\n${SIGNATURE} {\n")

foreach(_arch ${XARCH_SET})
foreach(_arch IN LISTS XARCH_SET)
string(APPEND DISP_CONTENT
" if (${_CPU_CHECK_${_arch}}) {\n return ${_arch}::${CALL_LINE}\;\n }\n")
endforeach()

string(APPEND DISP_CONTENT "}\n\n}\n")
endforeach()

foreach(_namespace ${PARENT_NAMESPACES})
foreach(_namespace IN LISTS PARENT_NAMESPACES)
string(APPEND DISP_CONTENT "} // namespace ${_namespace}\n")
endforeach()

Expand Down
84 changes: 41 additions & 43 deletions cmake/developer_package/cross_compile/cross_compiled_func.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@
#

## list of available instruction sets
set(_ARCH_LIST ANY SSE42 AVX AVX2 AVX512F NEON_FP16 SVE)
set(_AVAILABLE_ARCHS_LIST ANY SSE42 AVX AVX2 AVX512F NEON_FP16 SVE)

set(_ACCEPTED_ARCHS_ANY "^(ANY)$")
set(_ACCEPTED_ARCHS_SSE42 "^(ANY|SSE42)$")
set(_ACCEPTED_ARCHS_AVX "^(ANY|SSE42|AVX)$")
set(_ACCEPTED_ARCHS_AVX2 "^(ANY|SSE42|AVX|AVX2)$")
set(_ACCEPTED_ARCHS_AVX512F "^(ANY|SSE42|AVX|AVX2|AVX512F)$")
set(_ACCEPTED_ARCHS_NEON_FP16 "^(ANY|NEON_FP16)$")
set(_ACCEPTED_ARCHS_SVE "^(ANY|NEON_FP16|SVE)$")
if(ENABLE_SVE)
list(APPEND _ENABLED_ARCHS_LIST SVE)
endif()
if(ENABLE_NEON_FP16)
list(APPEND _ENABLED_ARCHS_LIST NEON_FP16)
endif()
if(ENABLE_AVX512F)
list(APPEND _ENABLED_ARCHS_LIST AVX512F)
endif()
if(ENABLE_AVX2)
list(APPEND _ENABLED_ARCHS_LIST AVX2)
endif()
if(ENABLE_SSE42)
list(APPEND _ENABLED_ARCHS_LIST SSE42)
endif()
list(APPEND _ENABLED_ARCHS_LIST ANY)

## Arch specific definitions
set(_DEFINE_ANY "")
Expand All @@ -23,11 +32,21 @@ set(_DEFINE_NEON_FP16 "HAVE_NEON_FP16" ${_DEFINE_ANY})
set(_DEFINE_SVE "HAVE_SVE" ${_DEFINE_SVE})

## Arch specific compile options
ov_avx512_optimization_flags(_FLAGS_AVX512F)
ov_avx2_optimization_flags (_FLAGS_AVX2)
ov_sse42_optimization_flags (_FLAGS_SSE42)
ov_arm_neon_fp16_optimization_flags(_FLAGS_NEON_FP16)
ov_arm_sve_optimization_flags(_FLAGS_SVE)
if(ENABLE_AVX512F)
ov_avx512_optimization_flags(_FLAGS_AVX512F)
endif()
if(ENABLE_AVX2)
ov_avx2_optimization_flags(_FLAGS_AVX2)
endif()
if(ENABLE_SSE42)
ov_sse42_optimization_flags(_FLAGS_SSE42)
endif()
if(ENABLE_NEON_FP16)
ov_arm_neon_fp16_optimization_flags(_FLAGS_NEON_FP16)
endif()
if(ENABLE_SVE)
ov_arm_sve_optimization_flags(_FLAGS_SVE)
endif()
set(_FLAGS_AVX "") ## TBD is not defined for OV project yet
set(_FLAGS_ANY "") ##

Expand Down Expand Up @@ -75,18 +94,15 @@ function(cross_compiled_file TARGET)
message(FATAL_ERROR "Unknown argument: " ${X_UNPARSED_ARGUMENTS})
endif()
if((NOT TARGET) OR (NOT X_NAME) OR (NOT X_NAMESPACE) OR (NOT X_API) OR (NOT X_ARCH))
message(FATAL_ERROR "Missed arguments")
message(FATAL_ERROR "Missed arguments in 'cross_compiled_file'")
endif()

_currently_requested_top_arch(TOP_ARCH)
set(_CURRENT_ARCH_FILTER "${_ACCEPTED_ARCHS_${TOP_ARCH}}")

## format: ARCH1 ARCH2 <src1> ARCH3 <src2> ...
foreach(_it ${X_ARCH})
if (_it IN_LIST _ARCH_LIST)
foreach(_it IN LISTS X_ARCH)
if(_it IN_LIST _AVAILABLE_ARCHS_LIST)
## that is arch ID
set(_arch ${_it})
if(_arch MATCHES ${_CURRENT_ARCH_FILTER})
if(_arch IN_LIST _ENABLED_ARCHS_LIST)
# make non/less-optimized version coming first
list(INSERT _CUR_ARCH_SET 0 ${_arch})
list(APPEND _FULL_ARCH_SET ${_arch})
Expand All @@ -95,8 +111,11 @@ function(cross_compiled_file TARGET)
## that is source file name
set(_src_name ${_it})
_remove_source_from_target(${TARGET} ${_src_name})
_clone_source_to_target(${TARGET} ${_src_name} "${_CUR_ARCH_SET}")
set(_CUR_ARCH_SET "")

if(_CUR_ARCH_SET)
_clone_source_to_target(${TARGET} ${_src_name} "${_CUR_ARCH_SET}")
unset(_CUR_ARCH_SET)
endif()
endif()
endforeach()

Expand Down Expand Up @@ -181,27 +200,6 @@ function(_add_dispatcher_to_target TARGET HEADER FUNC_NAME NAMESPACE ARCH_SET)
target_sources(${TARGET} PRIVATE ${DISPATCHER_SOURCE})
endfunction()

#######################################
#
# Return currently requested ARCH id
#
function(_currently_requested_top_arch VAR)
if(ENABLE_SVE)
set(RES SVE)
elseif(ENABLE_NEON_FP16)
set(RES NEON_FP16)
elseif(ENABLE_AVX512F)
set(RES AVX512F)
elseif(ENABLE_AVX2)
set(RES AVX2)
elseif(ENABLE_SSE42)
set(RES SSE42)
else()
set(RES ANY)
endif()
set (${VAR} "${RES}" PARENT_SCOPE)
endfunction()

#####################################
#
# Utils to handle with cmake target
Expand Down
2 changes: 2 additions & 0 deletions cmake/developer_package/features.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ ov_option (ENABLE_THREAD_SANITIZER "enable checking data races via ThreadSanitiz

ov_dependent_option (ENABLE_COVERAGE "enable code coverage" OFF "CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG" OFF)

ov_dependent_option (ENABLE_API_VALIDATOR "Enables API Validator usage" ON "WIN32" OFF)

# Defines CPU capabilities

ov_dependent_option (ENABLE_SSE42 "Enable SSE4.2 optimizations" ON "X86_64 OR (X86 AND NOT EMSCRIPTEN)" OFF)
Expand Down
2 changes: 0 additions & 2 deletions cmake/features.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,6 @@ ov_dependent_option(ENABLE_JS "Enables JS API building" ${ENABLE_JS_DEFAULT} "NO

ov_option(ENABLE_OPENVINO_DEBUG "Enable output for OPENVINO_DEBUG statements" OFF)

ov_dependent_option (ENABLE_API_VALIDATOR "Enables API Validator usage" ON "WIN32" OFF)

if(NOT BUILD_SHARED_LIBS AND ENABLE_OV_TF_FRONTEND)
set(FORCE_FRONTENDS_USE_PROTOBUF ON)
else()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ following usage message:
[-api {sync,async}] [-nireq NUMBER_INFER_REQUESTS] [-nstreams NUMBER_STREAMS] [-inference_only [INFERENCE_ONLY]]
[-infer_precision INFER_PRECISION] [-ip {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}]
[-op {bool,f16,f32,f64,i8,i16,i32,i64,u8,u16,u32,u64}] [-iop INPUT_OUTPUT_PRECISION] [--mean_values [R,G,B]] [--scale_values [R,G,B]]
[-nthreads NUMBER_THREADS] [-pin {YES,NO,NUMA,HYBRID_AWARE}] [-latency_percentile LATENCY_PERCENTILE]
[-nthreads NUMBER_THREADS] [-pin {YES,NO}] [-latency_percentile LATENCY_PERCENTILE]
[-report_type {no_counters,average_counters,detailed_counters}] [-report_folder REPORT_FOLDER] [-pc [PERF_COUNTS]]
[-pcsort {no_sort,sort,simple_sort}] [-pcseq [PCSEQ]] [-exec_graph_path EXEC_GRAPH_PATH] [-dump_config DUMP_CONFIG] [-load_config LOAD_CONFIG]
Expand Down Expand Up @@ -462,10 +462,8 @@ following usage message:
-nthreads NUMBER_THREADS, --number_threads NUMBER_THREADS
Number of threads to use for inference on the CPU (including HETERO and MULTI cases).
-pin {YES,NO,NUMA,HYBRID_AWARE}, --infer_threads_pinning {YES,NO,NUMA,HYBRID_AWARE}
Optional. Enable threads->cores ('YES' which is OpenVINO runtime's default for conventional CPUs), threads->(NUMA)nodes ('NUMA'),
threads->appropriate core types ('HYBRID_AWARE', which is OpenVINO runtime's default for Hybrid CPUs) or completely disable ('NO') CPU threads
pinning for CPU-involved inference.
-pin {YES,NO}, --infer_threads_pinning {YES,NO}
Optional. Enable threads->cores pinning for CPU-involved inference.
Statistics dumping options:
Expand Down Expand Up @@ -577,11 +575,7 @@ following usage message:
Device-specific performance options:
-nthreads <integer> Optional. Number of threads to use for inference on the CPU (including HETERO and MULTI cases).
-pin <string> ("YES"|"CORE") / "HYBRID_AWARE" / ("NO"|"NONE") / "NUMA" Optional. Explicit inference threads binding options (leave empty to let the OpenVINO make a choice):
enabling threads->cores pinning("YES", which is already default for any conventional CPU),
letting the runtime to decide on the threads->different core types("HYBRID_AWARE", which is default on the hybrid CPUs)
threads->(NUMA)nodes("NUMA") or
completely disable("NO") CPU inference threads pinning
-pin <string> "YES" / "NO" Optional. Explicit threads->cores pinning for CPU inference tasks (leave empty to let the OpenVINO make a choice).
Statistics dumping options:
-latency_percentile Optional. Defines the percentile to be reported in latency metric. The valid range is [1, 100]. The default value is 50 (median).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ All parameters must be set before calling ``ov::Core::compile_model()`` in order
- ``ov::hint::enable_hyper_threading``
- ``ov::hint::enable_cpu_pinning``
- ``ov::num_streams``
- ``ov::affinity``
- ``ov::inference_num_threads``
- ``ov::cache_dir``
- ``ov::intel_cpu::denormals_optimization``
Expand All @@ -373,8 +372,6 @@ Read-only properties
- ``ov::device::full_name``
- ``ov::device::capabilities``

.. note::
``ov::affinity`` is replaced by ``ov::hint::enable_cpu_pinning``. As such, it is deprecated in the 2024.0 release and will be removed in the 2025 release.

External Dependencies
###########################################################
Expand Down
6 changes: 3 additions & 3 deletions docs/snippets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ endif()
set(TARGET_NAME "ov_integration_snippet")
# [cmake:integration_example_cpp]
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

find_package(OpenVINO REQUIRED)

Expand All @@ -120,7 +120,7 @@ target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime)
set(TARGET_NAME_PY "ov_integration_snippet_py")
# [cmake:integration_example_cpp_py]
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

if(NOT CMAKE_CROSSCOMPILING)
find_package(Python3 QUIET COMPONENTS Interpreter)
Expand All @@ -143,7 +143,7 @@ target_link_libraries(${TARGET_NAME_PY} PRIVATE openvino::runtime)
set(TARGET_NAME_C "ov_integration_snippet_c")
# [cmake:integration_example_c]
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

find_package(OpenVINO REQUIRED)

Expand Down
2 changes: 1 addition & 1 deletion samples/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ endif()
####################################
## to use C++11; can overwritten via cmake command line
if(NOT DEFINED CMAKE_CXX_STANDARD)
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_EXTENSIONS OFF)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
Expand Down
12 changes: 3 additions & 9 deletions samples/cpp/benchmark_app/benchmark_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,8 @@ static const char infer_num_threads_message[] = "Optional. Number of threads to
"(including HETERO and MULTI cases).";

// @brief message for CPU threads pinning option
static const char infer_threads_pinning_message[] =
"Optional. Explicit inference threads binding options (leave empty to let the OpenVINO make a choice):\n"
"\t\t\t\tenabling threads->cores pinning(\"YES\", which is already default for any conventional CPU), \n"
"\t\t\t\tletting the runtime to decide on the threads->different core types(\"HYBRID_AWARE\", which is default on "
"the hybrid CPUs) \n"
"\t\t\t\tthreads->(NUMA)nodes(\"NUMA\") or \n"
"\t\t\t\tcompletely disable(\"NO\") CPU inference threads pinning";
static const char infer_threads_pinning_message[] = "Optional. Explicit threads->cores pinning for CPU inference tasks "
"(leave empty to let the OpenVINO make a choice).";

// @brief message for switching memory allocation type option
static const char use_device_mem_message[] =
Expand Down Expand Up @@ -426,8 +421,7 @@ static void show_usage() {
std::cout << std::endl;
std::cout << "Device-specific performance options:" << std::endl;
std::cout << " -nthreads <integer> " << infer_num_threads_message << std::endl;
std::cout << " -pin <string> (\"YES\"|\"CORE\") / \"HYBRID_AWARE\" / (\"NO\"|\"NONE\") / \"NUMA\" "
<< infer_threads_pinning_message << std::endl;
std::cout << " -pin <string> \"YES\" / \"NO\" " << infer_threads_pinning_message << std::endl;
std::cout << " -use_device_mem " << use_device_mem_message << std::endl;
std::cout << std::endl;
std::cout << "Statistics dumping options:" << std::endl;
Expand Down
Loading

0 comments on commit ea49b94

Please sign in to comment.