Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: flang-compiler/flang
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: pawosm-arm/flang
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 19 commits
  • 102 files changed
  • 2 contributors

Commits on Aug 31, 2018

  1. libflangrti.so should depend on libompstub.so instead of libomp.so

    This commit drops unfortunate dependency of libflangrti.so
    on libomp.so.
    
    For non-OpenMP programs (built without -fopenmp flag) frontend
    driver instructs the linker to link against libompstub.so library,
    which exports stubs for all OpenMP runtime library symbols. This is
    because Flang runtime library contains calls to those symbols
    (for OpenMP programs, final binary is linked against libomp.so
    instead).
    
    Apart form above, all of the Fortran programs are linked against
    libflang.so and libflangrti.so. Unfortunately, before this change
    libflangrti.so was depending on full blown OpenMP runtime library
    (libomp.so).
    
    This commit creates two sets of Flang runtime shared objects with
    following chains of dependencies:
    
    1. libflang.so -> libflangrti.so -> libompstub.so
    2. libflang-omp.so -> libflangrti-omp.so -> libomp.so
    
    Note that in order for this change to be in effect, relevant commit
    must be also applied on the clang repository.
    
    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    2ceef5a View commit details
  2. towards architectural neutrality

    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    ec81fee View commit details
  3. runtime: PoC: generate call to LLVM intrinsic instead of calling runt…

    …ime functions when possible; handling NINT for a beginning
    
    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    85f1cf8 View commit details
  4. Introduce weak symbols in the libompstub library

    Flang compiler, when started without -fopenmp links the final
    executable binary with libompstub - a small library which
    contains all the symbols of OpenMP runtime library with
    empty implementations. This is because certain places
    in Flang runtime library make use of OpenMP runtime in order
    to use its mechanisms for handling concurret code execution.
    For example, all malloc() calls in Flang runtime library
    are wrapped by __kmpc_critical()/__kmpc_end_critical() calls.
    
    The problems start to appear when Fortran program built
    without -fopenmp (and therefore linked against libompstub)
    is also linked against some library that was dynamically
    linked against real OpenMP runtime library, resulting in
    unexpected behaviour.
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    263411f View commit details
  5. runtime: remove locks around malloc()/free() in mpmalloc.c for glibc-…

    …based systems
    
    This is due to following statement in the glibc manual:
    
        To  avoid  corruption in multithreaded applications,
        mutexes are used internally to protect the memory-management
        data structures employed by these functions. In a multithreaded
        application in which threads simultaneously allocate and free
        memory, there could be contention for these mutexes. To scalably
        handle memory allocation in multithreaded applications,
        glibc creates additional memory  allocation arenas if mutex
        contention is detected.  Each arena is a large region of memory
        that is internally allocated by the system (using brk(2)
        or mmap(2)), and managed with its own mutexes.
    
    Having locks around them in the flang runtime library
    can ruin optimization effort when tcmalloc is preloaded
    to replace standard malloc()/free() implementation with the one
    optimized for reducing lock contention.
    
    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    6cbbbf9 View commit details
  6. Automatically SAVE module variable marked as THREADPRIVATE

    Without this change compiler segfaults on COPYIN of module variables.
    
    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    4e828b9 View commit details
  7. runtime: fix parallel build of omp_lib

    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    3be14c2 View commit details
  8. machreg: architecture specific initializations

    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    1de5859 View commit details
  9. machreg: in order to ease further arch specific improvements, remove …

    …unused functions
    
    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    cf6c25c View commit details
  10. machreg: AArch64 has 64-bit registers, no need to pack

    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    0e80485 View commit details
  11. AArch64: disable test cases invalid on aarch64

    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    4266049 View commit details
  12. runtime: remove duplicate files

    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    39c41e5 View commit details
  13. compatibility: rename x86 files to mach files

    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    7815c7d View commit details
  14. compatibility: loosen ties to x86.

    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    553d5c5 View commit details
  15. missing assignment in _mm_min_sd and _mm_max_sd

    Fix for missing assignment in _mm_min_sd and _mm_max_sd.
    Stefan Teleman authored and pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    661739f View commit details
  16. libpgmath: respect LIBPGMATH_WITH_GENERIC setting; fixes #559

    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    e3e9566 View commit details
  17. libpgmath: make it clang friendly

    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    c3288bf View commit details
  18. libpgmath: move includes to separate include directory, plus remove u…

    …nfortunate duplication of mthdecls.h file
    
    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    e17c170 View commit details
  19. OpenMP: make test cases pass with LLVM's omp_lib.h

    Signed-off-by: Paul Osmialowski <[email protected]>
    pawosm-arm committed Aug 31, 2018
    Copy the full SHA
    dc6ca7d View commit details
Showing with 801 additions and 2,717 deletions.
  1. +3 −0 runtime/CMakeLists.txt
  2. +62 −3 runtime/flang/CMakeLists.txt
  3. +0 −164 runtime/flang/cvt.c
  4. +1 −1 runtime/flang/gather_cmplx16.F95
  5. +1 −1 runtime/flang/gather_cmplx8.F95
  6. +1 −1 runtime/flang/gather_real4.F95
  7. +1 −1 runtime/flang/gather_real8.F95
  8. +1 −1 runtime/flang/iso_c_bind.F95
  9. +2 −2 runtime/flang/mvmul_cmplx16.F95
  10. +2 −2 runtime/flang/mvmul_cmplx8.F95
  11. +2 −2 runtime/flang/mvmul_real4.F95
  12. +2 −2 runtime/flang/mvmul_real8.F95
  13. +0 −34 runtime/flang/omp_lib.F95
  14. +57 −0 runtime/flang/omp_lib_kinds.F95
  15. +1 −1 runtime/flang/transpose_cmplx16.F95
  16. +1 −1 runtime/flang/transpose_cmplx8.F95
  17. +1 −1 runtime/flang/transpose_real4.F95
  18. +1 −1 runtime/flang/transpose_real8.F95
  19. +2 −2 runtime/flang/vmmul_cmplx16.F95
  20. +2 −2 runtime/flang/vmmul_cmplx8.F95
  21. +2 −2 runtime/flang/vmmul_real4.F95
  22. +2 −2 runtime/flang/vmmul_real8.F95
  23. +41 −9 runtime/flangrti/CMakeLists.txt
  24. +0 −26 runtime/flangrti/idnint.c
  25. +0 −29 runtime/flangrti/kidnnt.c
  26. +0 −27 runtime/flangrti/knint.c
  27. +22 −0 runtime/flangrti/mpmalloc.c
  28. +0 −1,086 runtime/flangrti/mthi64.c
  29. +0 −25 runtime/flangrti/nint.c
  30. +0 −26 runtime/flangrti/round.c
  31. +1 −1 runtime/include/komp.h
  32. +3 −0 runtime/libpgmath/CMakeLists.txt
  33. +7 −7 runtime/libpgmath/{lib/common → include}/arm64intrin.h
  34. 0 runtime/libpgmath/{lib/common → include}/helperavx2.h
  35. 0 runtime/libpgmath/{lib/common → include}/helperavx2_128.h
  36. 0 runtime/libpgmath/{lib/common → include}/helperavx512f.h
  37. 0 runtime/libpgmath/{lib/common → include}/misc.h
  38. 0 runtime/libpgmath/{lib/common → include}/mth_avx512helper.h
  39. 0 runtime/libpgmath/{lib/common → include}/mth_intrinsics.h
  40. 0 runtime/libpgmath/{lib/common → include}/mth_tbldefs.h
  41. 0 runtime/libpgmath/{lib/common → include}/mth_z2yy.h
  42. 0 runtime/libpgmath/{lib/common → include}/mthdecls.h
  43. 0 runtime/libpgmath/{lib/common → include}/pgstdinit.h
  44. 0 runtime/libpgmath/{lib/common → include}/xmm2altivec.h
  45. +2 −3 runtime/libpgmath/lib/CMakeLists.txt
  46. +4 −4 runtime/libpgmath/lib/common/CMakeLists.txt
  47. +3 −3 runtime/libpgmath/lib/common/acos/fma3/CMakeLists.txt
  48. +4 −0 runtime/libpgmath/lib/common/acos/fma3/ssacos.cpp
  49. +8 −0 runtime/libpgmath/lib/common/acos/fma3/vdacos2.cpp
  50. +14 −0 runtime/libpgmath/lib/common/acos/fma3/vsacos4.cpp
  51. +3 −3 runtime/libpgmath/lib/common/asin/fma3/CMakeLists.txt
  52. +9 −0 runtime/libpgmath/lib/common/asin/fma3/vdasin2.cpp
  53. +13 −0 runtime/libpgmath/lib/common/asin/fma3/vsasin4.cpp
  54. +1 −1 runtime/libpgmath/lib/common/cos/CMakeLists.txt
  55. +1 −1 runtime/libpgmath/lib/common/exp/CMakeLists.txt
  56. +3 −3 runtime/libpgmath/lib/common/exp/fma3/CMakeLists.txt
  57. +44 −5 runtime/libpgmath/lib/common/exp/fma3/sdexp.cpp
  58. +44 −6 runtime/libpgmath/lib/common/exp/fma3/vdexp2.cpp
  59. +30 −4 runtime/libpgmath/lib/common/exp/fma3/vsexp4.cpp
  60. +1 −1 runtime/libpgmath/lib/common/log/CMakeLists.txt
  61. +3 −3 runtime/libpgmath/lib/common/log/fma3/CMakeLists.txt
  62. +1 −1 runtime/libpgmath/lib/common/pow/CMakeLists.txt
  63. +3 −3 runtime/libpgmath/lib/common/pow/fma3/CMakeLists.txt
  64. +3 −3 runtime/libpgmath/lib/common/powi/CMakeLists.txt
  65. +1 −1 runtime/libpgmath/lib/common/sin/CMakeLists.txt
  66. +4 −4 runtime/libpgmath/lib/common/sincos/CMakeLists.txt
  67. +0 −712 runtime/libpgmath/lib/x86_64/mthdecls.h
  68. +1 −1 runtime/libpgmath/test/CMakeLists.txt
  69. +140 −220 runtime/ompstub/ompstubs.c
  70. +3 −0 test/f90_correct/daz.f90
  71. +3 −0 test/f90_correct/lit/in19.sh
  72. +3 −0 test/f90_correct/lit/in20.sh
  73. +3 −0 test/f90_correct/lit/in22.sh
  74. +13 −0 test/mp_correct/copyin.f90
  75. +1 −1 test/openmp_examples/makefile
  76. +1 −3 tools/flang1/flang1exe/func.c
  77. +1 −3 tools/flang1/flang1exe/lowerilm.c
  78. +3 −8 tools/flang1/flang1exe/main.c
  79. +2 −0 tools/flang1/flang1exe/semant.c
  80. +1 −1 tools/flang1/flang1exe/semsmp.c
  81. +0 −17 tools/flang2/docs/register.n
  82. +39 −22 tools/flang2/flang2exe/aarch64-Linux/machreg.h
  83. +41 −1 tools/flang2/flang2exe/cgmain.c
  84. +1 −1 tools/flang2/flang2exe/exp_ftn.c
  85. +1 −3 tools/flang2/flang2exe/exp_rte.c
  86. +1 −1 tools/flang2/flang2exe/expsmp.c
  87. +1 −1 tools/flang2/flang2exe/iliutil.c
  88. +1 −1 tools/flang2/flang2exe/ll_ftn.c
  89. +1 −1 tools/flang2/flang2exe/ll_write.c
  90. +1 −1 tools/flang2/flang2exe/llassem.c
  91. +1 −1 tools/flang2/flang2exe/llassem_common.c
  92. +1 −1 tools/flang2/flang2exe/llutil.c
  93. +18 −139 tools/flang2/flang2exe/machreg.c
  94. +1 −1 tools/flang2/flang2exe/main.c
  95. +36 −18 tools/flang2/flang2exe/ppc64le-Linux/machreg.h
  96. +36 −21 tools/flang2/flang2exe/x86_64-Linux/machreg.h
  97. +1 −2 tools/flang2/utils/ilitp/CMakeLists.txt
  98. +1 −1 tools/shared/CMakeLists.txt
  99. +1 −1 tools/shared/direct.c
  100. +11 −11 tools/shared/{x86.c → mach.c}
  101. +10 −10 tools/shared/{x86.h → mach.h}
  102. +2 −2 tools/shared/pragma.c
3 changes: 3 additions & 0 deletions runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -33,16 +33,19 @@ if( ${TARGET_ARCHITECTURE} STREQUAL "x86_64" )
add_definitions(
-DTARGET_X8664
-DTARGET_LINUX_X8664
-DTARGET_64
)
elseif( ${TARGET_ARCHITECTURE} STREQUAL "aarch64" )
add_definitions(
-DTARGET_LLVM_ARM64
-DTARGET_LINUX_ARM
-DTARGET_64
)
elseif( ${TARGET_ARCHITECTURE} STREQUAL "ppc64le" )
add_definitions(
-DTARGET_LINUX_POWER
-DLINUX_POWER
-DTARGET_64
)
endif()

65 changes: 62 additions & 3 deletions runtime/flang/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -40,7 +40,6 @@ SET(FTN_INTRINSICS_DESC_INDEP
chmod3f.c
commitqq3f.c
ctime3f.c
cvt.c
date3f.c
dbesj03f.c
dbesj13f.c
@@ -146,6 +145,7 @@ SET(FTN_INTRINSICS_DESC_INDEP
merge.c
mvbits3f.c
nargs3f.c
omp_lib_kinds.F95
omp_lib.F95
outstr3f.c
packtimeqq3f.c
@@ -465,6 +465,16 @@ add_flang_library(flang_static
${SHARED_SOURCES}
)
set_property(TARGET flang_static PROPERTY OUTPUT_NAME flang)
add_flang_library(flang-omp_static
${FTN_INTRINSICS_DESC_INDEP}
${FTN_INTRINSICS_DESC_DEP}
${FTN_INTRINSICS_I8}
${FTN_SUPPORT_DESC_INDEP}
${FTN_SUPPORT_DESC_DEP}
${FTN_SUPPORT_I8}
${SHARED_SOURCES}
)
set_property(TARGET flang-omp_static PROPERTY OUTPUT_NAME flang-omp)

set(SHARED_LIBRARY TRUE)
add_flang_library(flang_shared
@@ -477,9 +487,22 @@ add_flang_library(flang_shared
${SHARED_SOURCES}
)
set_property(TARGET flang_shared PROPERTY OUTPUT_NAME flang)
add_flang_library(flang-omp_shared
${FTN_INTRINSICS_DESC_INDEP}
${FTN_INTRINSICS_DESC_DEP}
${FTN_INTRINSICS_I8}
${FTN_SUPPORT_DESC_INDEP}
${FTN_SUPPORT_DESC_DEP}
${FTN_SUPPORT_I8}
${SHARED_SOURCES}
)
set_property(TARGET flang-omp_shared PROPERTY OUTPUT_NAME flang-omp)

target_link_libraries(flang_shared ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib/libflangrti.so)
target_link_libraries(flang-omp_shared ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib/libflangrti-omp.so)
# Resolve symbols against libm and librt
target_link_libraries(flang_shared m rt)
target_link_libraries(flang-omp_shared m rt)

set(SHARED_LIBRARY FALSE)

@@ -536,6 +559,11 @@ set_source_files_properties(
PROPERTIES
OBJECT_OUTPUTS ${CMAKE_Fortran_MODULE_DIRECTORY}/iso_c_binding.mod
)
set_source_files_properties(
omp_lib_kinds.F95
PROPERTIES
OBJECT_OUTPUTS ${CMAKE_Fortran_MODULE_DIRECTORY}/omp_lib_kinds.mod
)

# State a dependency on the module
set_source_files_properties(
@@ -544,6 +572,11 @@ set_source_files_properties(
PROPERTIES
OBJECT_DEPENDS ${CMAKE_Fortran_MODULE_DIRECTORY}/iso_c_binding.mod
)
set_source_files_properties(
omp_lib.F95
PROPERTIES
OBJECT_DEPENDS ${CMAKE_Fortran_MODULE_DIRECTORY}/omp_lib_kinds.mod
)

# State a dependency on the module
set_source_files_properties(
@@ -554,40 +587,66 @@ set_source_files_properties(
OBJECT_DEPENDS ${CMAKE_Fortran_MODULE_DIRECTORY}/iso_c_binding.mod
)

set_target_properties(flang_static flang_shared
set_target_properties(flang_static flang_shared flang-omp_static flang-omp_shared
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${FLANG_RTE_LIB_DIR}
)

target_include_directories(flang_static
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
target_include_directories(flang-omp_static
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)

target_include_directories(flang_shared
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
target_include_directories(flang-omp_shared
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)

# Make sure the compiler is built before we bootstrap
add_dependencies(flang_static
flang1
flang2
flangrti_static
)
add_dependencies(flang-omp_static
flang1
flang2
flangrti-omp_static
)

# Make sure the compiler is built before we bootstrap
add_dependencies(flang_shared
flang1
flang2
flangrti_shared
)
add_dependencies(flang-omp_shared
flang1
flang2
flangrti-omp_shared
)

target_compile_options(flang_static PRIVATE -fPIC)
target_compile_options(flang-omp_static PRIVATE -fPIC)

target_compile_options(flang_shared PRIVATE -fPIC)
target_compile_options(flang-omp_shared PRIVATE -fPIC)

target_compile_options(flang_static PUBLIC $<$<COMPILE_LANGUAGE:Fortran>:-Mreentrant>)
target_compile_options(flang-omp_static PUBLIC $<$<COMPILE_LANGUAGE:Fortran>:-Mreentrant>)

target_compile_options(flang_shared PUBLIC $<$<COMPILE_LANGUAGE:Fortran>:-Mreentrant>)
target_compile_options(flang-omp_shared PUBLIC $<$<COMPILE_LANGUAGE:Fortran>:-Mreentrant>)

164 changes: 0 additions & 164 deletions runtime/flang/cvt.c

This file was deleted.

2 changes: 1 addition & 1 deletion runtime/flang/gather_cmplx16.F95
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@

subroutine ftn_gather_cmplx16( ta, a, lda, alpha, buffer, bufrows, bufcols )
implicit none
#ifdef TARGET_X8664
#ifdef TARGET_64
integer*8 lda
#else
integer lda
2 changes: 1 addition & 1 deletion runtime/flang/gather_cmplx8.F95
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@

subroutine ftn_gather_cmplx8( ta, a, lda, alpha, buffer, bufrows, bufcols )
implicit none
#ifdef TARGET_X8664
#ifdef TARGET_64
integer*8 lda
#else
integer lda
2 changes: 1 addition & 1 deletion runtime/flang/gather_real4.F95
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@

subroutine ftn_gather_real4( a, lda, alpha, buffer, bufrows, bufcols )
implicit none
#ifdef TARGET_X8664
#ifdef TARGET_64
integer*8 lda
#else
integer lda
2 changes: 1 addition & 1 deletion runtime/flang/gather_real8.F95
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@

subroutine ftn_gather_real8( a, lda, alpha, buffer, bufrows, bufcols )
implicit none
#ifdef TARGET_X8664
#ifdef TARGET_64
integer*8 lda
#else
integer lda
2 changes: 1 addition & 1 deletion runtime/flang/iso_c_bind.F95
Original file line number Diff line number Diff line change
@@ -153,7 +153,7 @@ module ISO_C_BINDING
interface operator (.ne.)
module procedure compare_ne_cfunptrs
end interface
#if defined TARGET_LINUX_X8664 || defined TARGET_LLVM_64
#if defined TARGET_64 || defined TARGET_LLVM_64
! added this to make the data-initializd module common block be at 32 bytes long
! maybe only needed for linux86-64
integer*8 :: __iso_bind_private_i = 11, __iso_bind_private_j = 23
4 changes: 2 additions & 2 deletions runtime/flang/mvmul_cmplx16.F95
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@

subroutine ftn_mvmul_cmplx16( ta, tb, m, k, alpha, a, lda, b, beta, c )
implicit none
#ifdef TARGET_X8664
#ifdef TARGET_64
integer*8 :: m, k, lda
#else
integer :: m, k, lda
@@ -30,7 +30,7 @@ subroutine ftn_mvmul_cmplx16( ta, tb, m, k, alpha, a, lda, b, beta, c )
integer :: ta, tb
! Local variables

#ifdef TARGET_X8664
#ifdef TARGET_64
integer*8 :: i, j, kk
#else
integer :: i, j, kk
Loading