teak-llvm/openmp/runtime/cmake/CommonFlags.cmake
Jim Cownie 4cc4bb4c60 I apologise in advance for the size of this check-in. At Intel we do
understand that this is not friendly, and are working to change our
internal code-development to make it easier to make development
features available more frequently and in finer (more functional)
chunks. Unfortunately we haven't got that in place yet, and unpicking
this into multiple separate check-ins would be non-trivial, so please
bear with me on this one. We should be better in the future.

Apologies over, what do we have here?

GGC 4.9 compatibility
--------------------
* We have implemented the new entrypoints used by code compiled by GCC
4.9 to implement the same functionality in gcc 4.8. Therefore code
compiled with gcc 4.9 that used to work will continue to do so.
However, there are some other new entrypoints (associated with task
cancellation) which are not implemented. Therefore user code compiled
by gcc 4.9 that uses these new features will not link against the LLVM
runtime. (It remains unclear how to handle those entrypoints, since
the GCC interface has potentially unpleasant performance implications
for join barriers even when cancellation is not used)

--- new parallel entry points ---
new entry points that aren't OpenMP 4.0 related
These are implemented fully :-
      GOMP_parallel_loop_dynamic()
      GOMP_parallel_loop_guided()
      GOMP_parallel_loop_runtime()
      GOMP_parallel_loop_static()
      GOMP_parallel_sections()
      GOMP_parallel()

--- cancellation entry points ---
Currently, these only give a runtime error if OMP_CANCELLATION is true
because our plain barriers don't check for cancellation while waiting
        GOMP_barrier_cancel()
        GOMP_cancel()
        GOMP_cancellation_point()
        GOMP_loop_end_cancel()
        GOMP_sections_end_cancel()

--- taskgroup entry points ---
These are implemented fully.
      GOMP_taskgroup_start()
      GOMP_taskgroup_end()

--- target entry points ---
These are empty (as they are in libgomp)
     GOMP_target()
     GOMP_target_data()
     GOMP_target_end_data()
     GOMP_target_update()
     GOMP_teams()

Improvements in Barriers and Fork/Join
--------------------------------------
* Barrier and fork/join code is now in its own file (which makes it
easier to understand and modify).
* Wait/release code is now templated and in its own file; suspend/resume code is also templated
* There's a new, hierarchical, barrier, which exploits the
cache-hierarchy of the Intel(r) Xeon Phi(tm) coprocessor to improve
fork/join and barrier performance.

***BEWARE*** the new source files have *not* been added to the legacy
Cmake build system. If you want to use that fixes wil be required.

Statistics Collection Code
--------------------------
* New code has been added to collect application statistics (if this
is enabled at library compile time; by default it is not). The
statistics code itself is generally useful, the lightweight timing
code uses the X86 rdtsc instruction, so will require changes for other
architectures.
The intent of this code is not for users to tune their codes but
rather 
1) For timing code-paths inside the runtime
2) For gathering general properties of OpenMP codes to focus attention
on which OpenMP features are most used. 

Nested Hot Teams
----------------
* The runtime now maintains more state to reduce the overhead of
creating and destroying inner parallel teams. This improves the
performance of code that repeatedly uses nested parallelism with the
same resource allocation. Set the new KMP_HOT_TEAMS_MAX_LEVEL
envirable to a depth to enable this (and, of course, OMP_NESTED=true
to enable nested parallelism at all).

Improved Intel(r) VTune(Tm) Amplifier support
---------------------------------------------
* The runtime provides additional information to Vtune via the
itt_notify interface to allow it to display better OpenMP specific
analyses of load-imbalance.

Support for OpenMP Composite Statements
---------------------------------------
* Implement new entrypoints required by some of the OpenMP 4.1
composite statements.

Improved ifdefs
---------------
* More separation of concepts ("Does this platform do X?") from
platforms ("Are we compiling for platform Y?"), which should simplify
future porting.


ScaleMP* contribution
---------------------
Stack padding to improve the performance in their environment where
cross-node coherency is managed at the page level.

Redesign of wait and release code
---------------------------------
The code is simplified and performance improved.

Bug Fixes
---------
    *Fixes for Windows multiple processor groups.
    *Fix Fortran module build on Linux: offload attribute added.
    *Fix entry names for distribute-parallel-loop construct to be consistent with the compiler codegen.
    *Fix an inconsistent error message for KMP_PLACE_THREADS environment variable.

llvm-svn: 219214
2014-10-07 16:25:50 +00:00

143 lines
6.4 KiB
CMake

#
#//===----------------------------------------------------------------------===//
#//
#// The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#
# This file holds the common flags independent of compiler
# The flag types are:
# 1) Assembly flags (append_asm_flags_common)
# 2) C/C++ Compiler flags (append_c_and_cxx_flags_common)
# 3) Fortran Compiler flags (append_fort_flags_common)
# 4) Linker flags (append_linker_flags_common)
# 5) Archiver flags (append_archiver_flags_common)
# These append_* macros all append to the corresponding list variable holding the flags.
macro(append_c_flags new_flag)
list(APPEND local_c_flags "${new_flag}")
endmacro()
macro(append_cxx_flags new_flag)
list(APPEND local_cxx_flags "${new_flag}")
endmacro()
macro(append_c_and_cxx_flags new_flag)
append_c_flags("${new_flag}")
append_cxx_flags("${new_flag}")
endmacro()
macro(append_asm_flags new_flag)
list(APPEND local_asm_flags "${new_flag}")
endmacro()
macro(append_fort_flags new_flag)
list(APPEND local_fort_flags "${new_flag}")
endmacro()
# The difference between linker_flags and linker_flags_libs is linker_flags_libs
# is put at the end of the linker command where linking libraries should be done.
macro(append_linker_flags new_flag)
list(APPEND local_ld_flags "${new_flag}")
endmacro()
macro(append_linker_flags_library new_flag)
list(APPEND local_ld_flags_libs "${new_flag}")
endmacro()
macro(append_archiver_flags new_flag)
list(APPEND local_ar_flags "${new_flag}")
endmacro()
#########################################################
# Global Assembly flags
function(append_asm_flags_common input_asm_flags)
set(local_asm_flags)
set(${input_asm_flags} "${${input_asm_flags}}" "${local_asm_flags}" "${USER_ASM_FLAGS}" PARENT_SCOPE)
endfunction()
#########################################################
# Global C/C++ Compiler flags
function(append_c_and_cxx_flags_common input_c_flags input_cxx_flags)
set(local_c_flags)
set(local_cxx_flags)
set(${input_c_flags} "${${input_c_flags}}" "${local_c_flags}" "${USER_C_FLAGS}" PARENT_SCOPE)
set(${input_cxx_flags} "${${input_cxx_flags}}" "${local_cxx_flags}" "${USER_CXX_FLAGS}" PARENT_SCOPE)
endfunction()
#########################################################
# Global Fortran Compiler flags (for creating .mod files)
function(append_fort_flags_common input_fort_flags)
set(local_fort_flags)
set(${input_fort_flags} "${${input_fort_flags}}" "${local_fort_flags}" "${USER_F_FLAGS}" PARENT_SCOPE)
endfunction()
#########################################################
# Linker flags
function(append_linker_flags_common input_ld_flags input_ld_flags_libs)
set(local_ld_flags)
set(local_ld_flags_libs)
if(${USE_PREDEFINED_LINKER_FLAGS})
#################################
# Windows linker flags
if(${WINDOWS})
##################
# MAC linker flags
elseif(${MAC})
append_linker_flags("-single_module")
append_linker_flags("-current_version ${version}.0")
append_linker_flags("-compatibility_version ${version}.0")
#####################################################################################
# Intel(R) Many Integrated Core Architecture (Intel(R) MIC Architecture) linker flags
elseif(${MIC})
append_linker_flags("-Wl,-x")
append_linker_flags("-Wl,--warn-shared-textrel") # Warn if the linker adds a DT_TEXTREL to a shared object.
append_linker_flags("-Wl,--as-needed")
append_linker_flags("-Wl,--version-script=${src_dir}/exports_so.txt") # Use exports_so.txt as version script to create versioned symbols for ELF libraries
if(NOT ${STUBS_LIBRARY})
append_linker_flags_library("-pthread") # link in pthread library
append_linker_flags_library("-ldl") # link in libdl (dynamic loader library)
endif()
if(${STATS_GATHERING})
append_linker_flags_library("-Wl,-lstdc++") # link in standard c++ library (stats-gathering needs it)
endif()
#########################
# Unix based linker flags
else()
# For now, always include --version-script flag on Unix systems.
append_linker_flags("-Wl,--version-script=${src_dir}/exports_so.txt") # Use exports_so.txt as version script to create versioned symbols for ELF libraries
append_linker_flags("-Wl,-z,noexecstack") # Marks the object as not requiring executable stack.
append_linker_flags("-Wl,--as-needed") # Only adds library dependencies as they are needed. (if libiomp5 actually uses a function from the library, then add it)
if(NOT ${STUBS_LIBRARY})
append_linker_flags("-Wl,--warn-shared-textrel") # Warn if the linker adds a DT_TEXTREL to a shared object.
append_linker_flags("-Wl,-fini=__kmp_internal_end_fini") # When creating an ELF executable or shared object, call NAME when the
# executable or shared object is unloaded, by setting DT_FINI to the
# address of the function. By default, the linker uses "_fini" as the function to call.
append_linker_flags_library("-pthread") # link pthread library
if(NOT ${FREEBSD})
append_linker_flags_library("-Wl,-ldl") # link in libdl (dynamic loader library)
endif()
endif()
endif() # if(${OPERATING_SYSTEM}) ...
endif() # USE_PREDEFINED_LINKER_FLAGS
set(${input_ld_flags} "${${input_ld_flags}}" "${local_ld_flags}" "${USER_LD_FLAGS}" PARENT_SCOPE)
set(${input_ld_flags_libs} "${${input_ld_flags_libs}}" "${local_ld_flags_libs}" "${USER_LD_LIB_FLAGS}" PARENT_SCOPE)
endfunction()
#########################################################
# Archiver Flags
function(append_archiver_flags_common input_ar_flags)
set(local_ar_flags)
set(${input_ar_flags} "${${input_ar_flags}}" "${local_ar_flags}" PARENT_SCOPE)
endfunction()