Skip to content

Commit

Permalink
cmake: aarch64: Defaults to a generic cpu target
Browse files Browse the repository at this point in the history
This is equivalent to setting -mtune=generic -march=armv8-a.
This ensures no implementation specific tuning, or architectural
features beyond armv8-a are used,for portability across
AArch64 systems.The DNNL_ARCH_OPT_FLAGS build option can be used
to override these defaults to optimise for a specific cpu,
or revision of the Armv8 architecture.
  • Loading branch information
snadampal authored and igorsafo committed Nov 18, 2023
1 parent 3e15c61 commit 8829c24
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cmake/platform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,13 @@ elseif(UNIX OR MINGW)
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
set(DEF_ARCH_OPT_FLAGS "-O3")
endif()
# For native compilation tune for the host processor
if (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR)
append(DEF_ARCH_OPT_FLAGS "-mcpu=native")
# Defaults to a generic cpu target, equivalent to setting -mtune=generic -march=armv8-a.
# This ensures no implementation specific tuning, or architectural features beyond
# armv8-a are used, for portability across AArch64 systems.
# The DNNL_ARCH_OPT_FLAGS build option can be used to override these defaults
# to optimise for a specific cpu, or revision of the Armv8 architecture.
append(DEF_ARCH_OPT_FLAGS "-mcpu=generic")
endif()
elseif(DNNL_TARGET_ARCH STREQUAL "PPC64")
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
Expand Down Expand Up @@ -307,9 +311,13 @@ elseif(UNIX OR MINGW)
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
set(DEF_ARCH_OPT_FLAGS "-O3")
endif()
# For native compilation tune for the host processor
if (CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR)
append(DEF_ARCH_OPT_FLAGS "-mcpu=native")
# Defaults to a generic cpu target, equivalent to setting -mtune=generic -march=armv8-a.
# This ensures no implementation specific tuning, or architectural features beyond
# armv8-a are used, for portability across AArch64 systems.
# The DNNL_ARCH_OPT_FLAGS build option can be used to override these defaults
# to optimise for a specific cpu, or revision of the Armv8 architecture.
append(DEF_ARCH_OPT_FLAGS "-mcpu=generic")
endif()
elseif(DNNL_TARGET_ARCH STREQUAL "PPC64")
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
Expand Down

0 comments on commit 8829c24

Please sign in to comment.