Skip to content

cmake: support CPU_DISPATCH=ALL - #14486

Merged
opencv-pushbot merged 1 commit into
opencv:3.4from
alalek:cmake_dispatch_all
May 7, 2019
Merged

opencv-pushbot merged 1 commit into
opencv:3.4from
alalek:cmake_dispatch_all

Conversation

@alalek

@alalek alalek commented May 5, 2019 •

Copy link
Copy Markdown
Member
  • fix misused CPU_DISPATCH, CPU_DISPATCH_FINAL should be used for filtering

Usage:

cmake -DCPU_DISPATCH=ALL ...

Main purpose of ALL value is enable testing of all available CPU configurations (even if they are not in default list).

Result:
--   CPU/HW features:
--     Baseline:                    SSE SSE2 SSE3
--       requested:                 SSE3
--     Dispatched code generation:  SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CNL AVX512_CEL AVX512_ICL
--       requested:                 SSE SSE2 SSE3 SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CNL AVX512_CEL AVX512_ICL
--       SSSE3 (1 files):           + SSSE3
--       SSE4_1 (13 files):         + SSSE3 SSE4_1
--       POPCNT (0 files):          + SSSE3 SSE4_1 POPCNT
--       SSE4_2 (2 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
--       FP16 (1 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
--       FMA3 (0 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
--       AVX (6 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
--       AVX2 (28 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
--       AVX_512F (0 files):        + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F
--       AVX512_COMMON (0 files):   + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON
--       AVX512_KNL (0 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_KNL
--       AVX512_KNM (0 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_KNL AVX512_KNM
--       AVX512_SKX (2 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
--       AVX512_CNL (0 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX AVX512_CNL
--       AVX512_CEL (0 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX AVX512_CNL AVX512_CEL
--       AVX512_ICL (0 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX AVX512_CNL AVX512_CEL AVX512_ICL

continues #14007

force_builders_only=Custom
CPU_DISPATCH:Custom=ALL
build_image:Custom=ubuntu:18.04
buildworker:Custom=linux-5

- CPU_DISPATCH_FINAL should be used for filtering
@alalek

alalek commented May 5, 2019

Copy link
Copy Markdown
Member Author

/cc @seiko2plus

set(CPU_DISPATCH_REQUIRE "")
endif()

if("x${CPU_DISPATCH}" STREQUAL "xALL")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to if we add an option to exclude specific optimization,
something like that
usage -DCPU_DISPATCH=ALL-AVX512_SKX-SSE4_1

if("${CPU_DISPATCH}" MATCHES "^(ALL)")
  string(REPLACE "-" ";" _exclude_opt ${CPU_DISPATCH})
  set(CPU_DISPATCH "${CPU_KNOWN_OPTIMIZATIONS}")
  foreach(_exopt ${_exclude_opt})
    list(REMOVE_ITEM CPU_DISPATCH ${_exopt})
  endforeach()
endif()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to store excluded entries in a separate variables, like CPU_BASELINE_DISABLE - due better flexibility.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excluded entries in a separate variable like CPU_BASELINE_DISABLE is reasonable since we force implies baseline opts but when it comes to dispatch ALL with unary minus and also DEFAULT! with unary addition seems more practical to me

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seiko2plus That makes sense.

Actually real use cases of excluding from ALL is still not clear to me (except some debugging).

Main purpose of ALL value is enable testing of all available CPU configurations (even if they are not in the default list).

Anyway feel free to prepare separate PR for that.

@alalek

alalek commented May 7, 2019

Copy link
Copy Markdown
Member Author

👍

@opencv-pushbot
opencv-pushbot merged commit 6b6222b into opencv:3.4 May 7, 2019
@alalek alalek mentioned this pull request May 7, 2019
SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants