+2016-12-01 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR target/68945
+ Merge from upstream, version 2.0.4467.0.
+ Fix typo in git URL.
+ * aclocal.m4, configure, Makefile.in: Regenerate.
+
2016-11-15 Matthias Klose <doko@ubuntu.com>
* configure: Regenerate.
# Enable Intel Cilk Plus extension
GENERAL_FLAGS += -fcilkplus
-# Always generate unwind tables
+#Always generate unwind tables
GENERAL_FLAGS += -funwind-tables
AM_CFLAGS = $(XCFLAGS) $(GENERAL_FLAGS) -std=c99
# Enable Intel Cilk Plus extension
-# Always generate unwind tables
+#Always generate unwind tables
GENERAL_FLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/runtime \
-I$(top_srcdir)/runtime/config/$(config_dir) \
-I$(top_srcdir)/runtime/sslib -DIN_CILK_RUNTIME=1 -fcilkplus \
runtime/sysdep-unix.c \
runtime/worker_mutex.c
-CILK_REVISION = 4420
+CILK_REVISION = 4467
# Load the $(REVISION) value.
-Intel(R) Cilk(TM) Plus runtime library
+Intel(R) Cilk(TM) Plus Runtime Library
Index:
-1. BUILDING
-2. USING
-3. DOXYGEN DOCUMENTATION
-4. QUESTIONS OR BUGS
-5. CONTRIBUTIONS
+1. BUILDING WITH AUTOMAKE
+2. BUILDING WITH CMAKE
+3. INSTALLING TO VXWORKS
+4. USING
+5. DOXYGEN DOCUMENTATION
+6. QUESTIONS OR BUGS
+7. CONTRIBUTIONS
#
-# 1. BUILDING:
+# 1. BUILDING WITH AUTOMAKE:
#
To distribute applications that use the Intel Cilk Plus language
% ./configure --prefix=/your/path/to/lib
-It is also possible to use CMake if the above method does not apply
-well in your environment. Instruction is available in CMakeLists.txt.
+#
+# 2. BUILDING WITH CMAKE:
+#
+
+To distribute applications that use the Intel Cilk Plus language
+extensions to non-development systems, you need to build the Intel
+Cilk Plus runtime library and distribute it with your application.
+This instruction describes the build process using CMake*, which
+supports Linux*, Windows*, and OS X*. It is fine to use this process
+to build a Linux library, but it is highly recommended to use the
+more mature build process described above when building on Linux.
+
+You need the CMake tool and a C/C++ compiler that supports the Intel
+Cilk Plus language extensions, and the requirements for each operating
+systems are:
+
+Common:
+ CMake 3.0.0 or later
+ Make tools such as make (Linux, OS X) or nmake (Windows)
+Linux:
+ GCC* 4.9.2 or later, or Intel(R) C++ Compiler v12.1 or later
+Windows:
+ Intel C++ Compiler v12.1 or later
+ Visual Studio* 2010 or later
+OS X:
+ Cilk-enabled branch of Clang*/LLVM* (http://cilkplus.github.io),
+ or Intel C++ Compiler v12.1 or later
+
+The common steps to build the libraries are 1) invoke cmake with
+appropriate options, 2) invoke a make tool available on the system.
+The following examples show build processes on OS X and Windows.
+
+OS X:
+ % mkdir ./build && cd ./build
+ % cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
+ -DCMAKE_INSTALL_PREFIX=./install ..
+ % make && make install
+
+Windows:
+ % mkdir .\build && cd .\build
+ % cmake -G "NMake Makefiles" -DCMAKE_C_COMPILER=icl \
+ -DCMAKE_CXX_COMPILER=icl -DCMAKE_INSTALL_PREFIX=.\install ..
+ % nmake && nmake install
+
+#
+# 3. INSTALLING TO VXWORKS OS
+#
+
+For Windows host, run VxWorks_Install.bat.
+For Linux host, run VxWorks_Install.sh.
+
+You may need to give environment variable WIND_BASE to indicate VxWorks
+installation path.
+
+Create a VSB project, and you will see a layer named "CILKPLUS_KERNEL".
+Enable it and build the project.
+
+Create a VIP project with ICC and add component INCLUDE_CILKPLUS, then you
+will get support of Intel Cilk Plus features in VxWorks.
#
-# 2. USING:
+# 4. USING:
#
The Intel(R) C++ Compiler will automatically try to bring in the
Intel Cilk Plus runtime in any program that uses the relevant
-features. GCC requires explicit linking of both the library and
-its dependencies (libpthread, libdl). For example:
+features. GCC and Clang requires an explicit compiler option,
+-fcilkplus, to enable Intel Cilk Plus language extensions.
+For example,
+
+% gcc -fcilkplus -o foo.exe foo.c
+% clang -fcilkplus -o foo.exe foo.c
+
+Older GCC versions (e.g., 4.8 cilkplus branch) requires explicit linking
+of both the library and its dependencies (libpthread, libdl).
+For example:
% gcc foo.c -lcilkrts -lpthread -ldl
#
-# 3. DOXYGEN DOCUMENTATION:
+# 5. DOXYGEN DOCUMENTATION:
#
The library source has Doxygen markup. Generate HTML documentation
% doxygen doxygen.cfg
#
-# 4. QUESTIONS OR BUGS:
+# 6. QUESTIONS OR BUGS:
#
Issues with the Intel Cilk Plus runtime can be addressed in the Intel
http://software.intel.com/en-us/forums/intel-cilk-plus/
#
-# 5. CONTRIBUTIONS:
+# 7. CONTRIBUTIONS:
#
The Intel Cilk Plus runtime library is dual licensed. The upstream copy
Thanks to Tobias Burnus for showing us the magic to make gcc and g++
automatically include the Cilk Plus runtime.
+Thanks to Eric Olson for sharing his patch for Raspberry Pi* with us.
+
+Thanks to Rainer Orth for submitting patches for exception handling and
+enabling Cilk Plus on the SPARC* architecture.
+
------------------------
Intel and Cilk are trademarks of Intel Corporation in the U.S. and/or
other countries.
+
+*Other names and brands may be claimed as the property of others.
fi
+# Check for dl functions
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dladdr in -ldl" >&5
+$as_echo_n "checking for dladdr in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dladdr+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dladdr ();
+int
+main ()
+{
+return dladdr ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dladdr=yes
+else
+ ac_cv_lib_dl_dladdr=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dladdr" >&5
+$as_echo "$ac_cv_lib_dl_dladdr" >&6; }
+if test "x$ac_cv_lib_dl_dladdr" = x""yes; then :
+
+$as_echo "#define HAVE_DLADDR 1" >>confdefs.h
+
+fi
+
+
# Check whether the target supports protected visibility.
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
# contains information on what's needed
case "${target}" in
- x86_64-*-*)
- config_dir="x86"
- ;;
-
- i?86-*-*)
+ i?86-*-* | x86_64-*-*)
config_dir="x86"
;;
config_dir="arm"
;;
+ sparc*-*-*)
+ config_dir="sparc"
+ ;;
+
*)
config_dir="generic"
;;
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11896 "configure"
+#line 11940 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12002 "configure"
+#line 12046 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
AC_CONFIG_FILES([Makefile libcilkrts.spec])
AC_FUNC_ALLOCA
+# Check for dl functions
+AC_CHECK_LIB(dl, dladdr,
+ [AC_DEFINE(HAVE_DLADDR, 1, [Define if you have dladdr()])])
+
# Check whether the target supports protected visibility.
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
# contains information on what's needed
case "${target}" in
- x86_64-*-*)
- config_dir="x86"
- ;;
-
- i?86-*-*)
+ i?86-*-* | x86_64-*-*)
config_dir="x86"
;;
config_dir="arm"
;;
+ sparc*-*-*)
+ config_dir="sparc"
+ ;;
+
*)
config_dir="generic"
;;
# Disable Cilk Runtime library for unsupported architectures.
case "${target}" in
- x86_64-*-*)
- ;;
- i?86-*-*)
+ i?86-*-* | x86_64-*-*)
;;
arm-*-*)
;;
+ sparc*-*-*)
+ ;;
*-*-*)
UNSUPPORTED=1
;;
CILK_EXPORT __CILKRTS_NOTHROW
void __cilkrts_dump_stats(void);
-CILK_EXPORT __CILKRTS_NOTHROW
-int __cilkrts_irml_version(void);
-
struct __cilk_tbb_unwatch_thunk;
struct __cilk_tbb_stack_op_thunk;
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
-#define VERSION_BUILD 4420
+#define VERSION_BUILD 4467
#define VERSION_REV 0
-#define VERSION_STRING "2,0,4420,0"
-#define VERSION_HASH "3b2d6aa9059c"
+#define VERSION_STRING "2,0,4467,0"
+#define VERSION_HASH "b7e54d87bd17"
#define VERSION_BRANCH "eng"
-#define TBB_REV_NUMBER "14788"
-#define VERSION_YEAR "2015"
+#define TBB_REV_NUMBER ""
+#define VERSION_YEAR "2016"
#
# It was automatically generated by cilkrts/include/internal/Makefile
-CILK_REVISION = 4420
+CILK_REVISION = 4467
return 0; /* Success! */
}
-
// This function must be called only within a continuation, within the stack
// frame of the continuation itself.
CILK_API_INT __cilkrts_synched(void)
// enough extra space from the top of the stack we are
// switching to for any temporaries required for this run()
// function.
- JMPBUF_SP(m_resume_jmpbuf) = m_stack_base - frame_size;
+ JMPBUF_SP(m_resume_jmpbuf) = CILK_ADJUST_SP(m_stack_base - frame_size);
// GCC doesn't allow us to call __builtin_longjmp in the same function
// that calls __builtin_setjmp, so it's been moved into it's own
*
* A value of 0 means no debugging.
* Higher values generate more debugging output.
+ *
*/
-#define FIBER_DEBUG 0
+#ifndef FIBER_DEBUG
+#define FIBER_DEBUG 0
+#endif
/**
* @brief Flag for validating reference counts.
*
* for your assistance in helping us improve Cilk Plus.
**************************************************************************/
+// __atomic_* intrinsics are available since GCC 4.7.
+#define HAVE_ATOMIC_INTRINSICS defined(__GNUC__) && \
+ (__GNUC__ * 10 + __GNUC_MINOR__ >= 47)
+
+// GCC before 4.4 does not implement __sync_synchronize properly
+#define HAVE_SYNC_INTRINSICS defined(__GNUC__) && \
+ (__GNUC__ * 10 + __GNUC_MINOR__ >= 44)
+
/*
* void __cilkrts_fence(void)
*
* the CPUID instruction).
*/
-// COMMON_SYSDEP void __cilkrts_fence(void); ///< MFENCE instruction
-# define __cilkrts_fence() __asm__ __volatile__ ("mcr p15,0,%[t],c7,c10,4\n" :: [t] "r" (0) : "memory");
+#if HAVE_ATOMIC_INTRINSICS
+# define __cilkrts_fence() __atomic_thread_fence(__ATOMIC_SEQ_CST)
+#elif HAVE_SYNC_INTRINSICS
+# define __cilkrts_fence() __sync_synchronize()
+#else
+# define __cilkrts_fence()
+// Leaving this code just in case.
+//# define __cilkrts_fence() __asm__ __volatile__ ("mcr p15,0,%[t],c7,c10,4\n" :: [t] "r" (0) : "memory");
+#endif
--- /dev/null
+/* cilk-abi-vla.cpp -*-C++-*-
+ *
+ *************************************************************************
+ *
+ * Copyright (C) 2013-2016, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+ * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
+ *
+ **************************************************************************/
+
+/*
+ * Implementation of Variable Length Array (VLA) ABI.
+ *
+ * The compiler calls these functions to allocate Variable Length Arrays
+ * at runtime. The compiler must guarantee that __cilkrts_stack_free() is
+ * called to cleanup any memory allocated by __cilkrts_stack_alloc().
+ *
+ * This generic implementation always allocates the memory from the heap.
+ * Optimally, the implementation should expand the frame of the calling
+ * function if possible, since that will be faster. See the x86 version
+ * for one possible implementation.
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+#include "internal/abi.h"
+#include "cilk-abi-vla-internal.h"
+
+// Allocate space for a variable length array
+CILK_ABI(__cilkrts_void_ptr)
+__cilkrts_stack_alloc(
+ __cilkrts_stack_frame *sf,
+ size_t size,
+ size_t distance_from_sp_to_alloca_area,
+ uint32_t align, // align is always >= minimum stack alignment and
+ // >= ptr_size as well, and must be a power of 2.
+ uint32_t needs_tag // non-zero if the pointer being returned needs to
+ // be tagged
+)
+{
+ // full_size will be a multiple of align, and contains
+ // enough extra space to allocate a marker.
+ size_t full_size = (size + align - 1) & ~(align - 1);
+
+ // Allocate memory from the heap. The compiler is responsible
+ // for guaranteeing us a chance to free it before the function
+ // exits
+
+ return (void *)vla_internal_heap_alloc(sf, full_size, align);
+}
+
+// Free the space allocated for a variable length array.
+CILK_ABI(void)
+__cilkrts_stack_free(
+ __cilkrts_stack_frame *sf,
+ void *p,
+ size_t size,
+ size_t distance_from_sp_to_alloca_area,
+ uint32_t align, // same requirements as for align in allocation,
+ // and must match alignment that was passed when
+ // doing the allocation
+ uint32_t known_from_stack // non-zero if this is known to be allocated
+ // on the stack, and therefore has no tag
+)
+{
+ // full_size will be a multiple of align, and contains
+ // enough extra space to allocate a marker if one was needed.
+ size_t full_size = (size + align - 1) & ~(align - 1);
+
+ // Just free the allocated memory to the heap since we don't know
+ // how to expand/contract the calling frame
+ vla_internal_heap_free(p, full_size);
+}
--- /dev/null
+/* os.h -*-C++-*-
+ *
+ *************************************************************************
+ *
+ * Copyright (C) 2009-2016, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+ * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
+ **************************************************************************/
+
+// GCC before 4.4 does not implement __sync_synchronize properly
+#define HAVE_SYNC_INTRINSICS defined(__GNUC__) && \
+ (__GNUC__ * 10 + __GNUC_MINOR__ >= 44)
+
+/*
+ * void __cilkrts_fence(void)
+ */
+
+#if HAVE_SYNC_INTRINSICS
+# define __cilkrts_fence() __sync_synchronize()
+#elif defined(__GNUC__)
+# define __cilkrts_fence() __asm__ volatile ("membar #StoreLoad" ::: "memory")
+#else
+COMMON_SYSDEP void __cilkrts_fence(void);
+#endif
--- /dev/null
+/* os-unix-sysdep.c -*-C-*-
+ *
+ *************************************************************************
+ *
+ * Copyright (C) 2009-2016, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+ * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * *********************************************************************
+ *
+ * PLEASE NOTE: This file is a downstream copy of a file mainitained in
+ * a repository at cilkplus.org. Changes made to this file that are not
+ * submitted through the contribution process detailed at
+ * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
+ * time that a new version is released. Changes only submitted to the
+ * GNU compiler collection or posted to the git repository at
+ * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
+ * not tracked.
+ *
+ * We welcome your contributions to this open source project. Thank you
+ * for your assistance in helping us improve Cilk Plus.
+ *************************************************************************
+ *
+ * This file contains system-specific code for sparc-based systems
+ */
+
+#include "os.h"
+#include "sysdep.h"
+
+/*
+ * The cycle counter is used for debugging. This function is only called if
+ * CILK_PROFILE is defined when the runtime is built.
+ */
+COMMON_SYSDEP unsigned long long __cilkrts_getticks(void)
+{
+ unsigned long long tick;
+#ifdef __sparcv9
+ __asm__ volatile("rd %%tick, %0" : "=r"(tick));
+#else
+ __asm__ volatile("rd %%tick, %L0\n"
+ "srlx %L0, 32, %H0"
+ : "=r"(tick));
+#endif
+ return tick;
+}
+
+/*
+ * A "short pause" - called from the Cilk runtime's spinloops.
+ */
+COMMON_SYSDEP void __cilkrts_short_pause(void)
+{
+ /* Spin around for 8 cycles. */
+ __asm__ volatile("rd %ccr, %g0");
+ __asm__ volatile("rd %ccr, %g0");
+ __asm__ volatile("rd %ccr, %g0");
+ __asm__ volatile("rd %ccr, %g0");
+}
+
+/*
+ * Interlocked exchange - used to implement the Cilk runtime's spinloops
+ */
+COMMON_SYSDEP int __cilkrts_xchg(volatile int *ptr, int x)
+{
+ x = __sync_lock_test_and_set(ptr, x);
+ return x;
+}
+
+
+/*
+ * Restore the floating point state that is stored in a stack frame at each
+ * spawn. This should be called each time a frame is resumed.
+ *
+ * Only valid for IA32 and Intel64 processors.
+ */
+void restore_x86_fp_state (__cilkrts_stack_frame *sf)
+{
+}
+
+
+/*
+ * Save the floating point state to the __cilkrts_stack_frame at each spawn.
+ *
+ * Architecture-specific - Should only be needed on IA32 and Intel64
+ * processors.
+ */
+void sysdep_save_fp_ctrl_state(__cilkrts_stack_frame *sf)
+{
+}
+
#include <stdint.h>
#include <typeinfo>
+#ifndef DEBUG_EXCEPTIONS
#define DEBUG_EXCEPTIONS 0
+#endif
struct pending_exception_info
{
g->stack_size = cilkos_validate_stack_size(g->stack_size);
g->failure_to_allocate_stack = 0;
-
return g;
}
/// Global fiber pool
cilk_fiber_pool fiber_pool;
-
/**
* @brief Track whether the runtime has failed to allocate a
* stack.
*/
#define SP(SF) JMPBUF_SP((SF)->ctx)
+/**
+ * @brief Some architecture-dependent stack adjustment.
+ */
+#if defined(__sparcv9)
+ // Subtract sparc v9 stack bias so the actual stack starts at the
+ // allocated area.
+# define CILK_ADJUST_SP(SP) ((SP) - 2047)
+# define CILK_UNADJUST_SP(SP) ((SP) + 2047)
+#else
+# define CILK_ADJUST_SP(SP) (SP)
+# define CILK_UNADJUST_SP(SP) (SP)
+#endif
__CILKRTS_BEGIN_EXTERN_C
*/
inline char *__cilkrts_get_sp(__cilkrts_stack_frame *sf)
{
- return (char *)SP(sf);
+ return (char *)CILK_UNADJUST_SP(SP(sf));
}
/**
__cilkrts_hyperobject_dealloc;
__cilkrts_hyperobject_noop_destroy;
__cilkrts_init;
- __cilkrts_irml_version;
__cilkrts_leave_frame;
__cilkrts_metacall;
__cilkrts_rethrow;
*/
unsigned int steal_failure_count;
+ /**
+ * Record indicating that the worker stole work at least once.
+ *
+ * [local read/write]
+ */
+ int has_stolen;
+
/**
* 1 if work was stolen from another worker. When true, this will flag
* setup_for_execution_pedigree to increment the pedigree when we resume
___cilkrts_hyperobject_dealloc
___cilkrts_hyperobject_noop_destroy
___cilkrts_init
-
___cilkrts_leave_frame
___cilkrts_metacall
___cilkrts_resume
#elif defined(__MIC__)
_mm_delay_32(1024);
#elif defined(__linux__) || \
- defined(__APPLE__)
+ defined(__APPLE__) || \
+ defined(__CYGWIN__)
+
usleep(10000);
#else
# error "Unsupported architecture"
{
#if defined(__ANDROID__) || \
defined(__APPLE__) || \
+ defined(__CYGWIN__) || \
defined(__FreeBSD__) || \
defined(__VXWORKS__) || \
(defined(__sun__) && defined(__svr4__))
if (pnode->parent)
{
p = walk_pedigree_nodes(p, pnode->parent);
- p += cilk_snprintf_s(p, PEDIGREE_BUFF_SIZE, "%s", (char *) "_");
+ p += cilk_snprintf_s(p, PEDIGREE_BUFF_SIZE, "%s", (char *)"_");
}
return p + cilk_snprintf_l(p, PEDIGREE_BUFF_SIZE, "%" PRIu64, pnode->rank);
}
if (NULL == ff) {
// Punish the worker for failing to steal.
// No quantum for you!
- if (w->l->steal_failure_count > 30000) {
- // Punish more if the worker has been doing unsuccessful steals
- // for a long time. After return from the idle state, it will
- // be given a grace period to react quickly.
+ unsigned int max_fails = w->g->max_steal_failures << 1;
+ if (w->l->has_stolen == 0 &&
+ w->l->steal_failure_count % max_fails == max_fails - 1) {
+ // Idle briefly if the worker has never stolen anything for
+ // the given grace period
__cilkrts_idle();
- w->l->steal_failure_count -= 300;
} else {
__cilkrts_yield();
}
w->l->steal_failure_count++;
+ if (w->l->steal_failure_count > (max_fails << 8)) {
+ // Reset the flag after certain amount of failures
+ // - This will reduce cpu time in top-level synched regions
+ // - max_fails can be controlled by user (CILK_STEAL_FAILURES)
+ w->l->has_stolen = 0;
+ }
} else {
// Reset steal_failure_count since there is obviously still work to
// be done.
w->l->steal_failure_count = 0;
+ w->l->has_stolen = 1;
}
}
return ff;
w->l->stats = NULL;
#endif
w->l->steal_failure_count = 0;
+ w->l->has_stolen = 0;
w->l->work_stolen = 0;
* Print debugging messages and assertions for parallel reducers. 0 is
* no debugging. A higher value generates more output.
*/
+
+#ifndef REDPAR_DEBUG
#define REDPAR_DEBUG 0
+#endif
/**
* @brief Lock the worker mutex to allow exclusive access to the
CILK_ASSERT(fiber);
void* sp = (void*)get_sp_for_executing_sf(cilk_fiber_get_stack_base(fiber), ff, sf);
- SP(sf) = sp;
+ SP(sf) = CILK_ADJUST_SP(sp);
/* Debugging: make sure stack is accessible. */
((volatile char *)sp)[-1];
#endif
// Set the stack pointer.
- SP(sf) = new_sp;
+ SP(sf) = CILK_ADJUST_SP(new_sp);
#ifdef RESTORE_X86_FP_STATE
if (CILK_FRAME_VERSION_VALUE(sf->flags) >= 1) {
{
// dladdr is a glibc extension. If it's available, use it to find the path
// for libcilkrts.so
-#ifdef _GNU_SOURCE
+#if HAVE_DLADDR
Dl_info info;
if (0 != dladdr(dummy_function, &info))
return info.dli_fname;
// ==================
// System cores: 8
// Cilk workers requested: 8
- // Thread creator: Private
fprintf(fp, "\nThread information\n");
fprintf(fp, "==================\n");
fprintf(fp, "System cores: %d\n", (int)sysconf(_SC_NPROCESSORS_ONLN));
#endif
fprintf(fp, "Cilk workers requested: %d\n", n);
-#if (PARALLEL_THREAD_CREATE)
- fprintf(fp, "Thread creator: Private (parallel)\n");
-#else
- fprintf(fp, "Thread creator: Private\n");
-#endif
if (fp != stderr && fp != stdout) fclose(fp);
else fflush(fp); // flush the handle buffer if it is stdout or stderr.