Create a threadscope grade component.

Threadscope grades are enabled by using the grade component 'threadscope'.
They are supported only with low-lavel C parallel grades.  Support for
threadscope in high level C grades is intended in the future but does not work
now.

runtime/mercury_conf_param.h:
    Create the MR_THREADSCOPE macro that is defined if the grade is a
    threadscope grade.

    Define MR_PROFILE_FOR_PARALLEL_EXECUTION if MR_THREADSCOPE is defined.

    Emit an error if MR_LL_PARALLEL_CONJ is defined before it is implied by
    MR_THREADSAFE and ! MR_HIGHLEVEL_CODE

runtime/mercury_grade.h
    Update the grade symbol for the threadscope grade component.

runtime/mercury_atomic_ops.c:
runtime/mercury_atomic_ops.h:
runtime/mercury_context.c:
runtime/mercury_context.h:
runtime/mercury_engine.c:
runtime/mercury_engine.h:
runtime/mercury_thread.c:
runtime/mercury_threadscope.c:
runtime/mercury_threadscope.h:
runtime/mercury_wrapper.c:
    Now that MR_PROFILE_FOR_IMPLICIT_PARALLELISM is implied by MR_THREADSAFE we
    don't need to test for MR_THREADSAFE when we test for
    MR_PROFILE_FOR_IMPLICIT_PARALLELISM.  The same is true for
    MR_LL_PARALLEL_CONJ which is implied by MR_THREADSAFE &&
    !MR_HIGHLEVEL_CODE.

    Replace some occurances of MR_PROFILE_FOR_IMPLICIT_PARALLELISM with
    MR_THREADSCOPE where the conditionally compiled code is used to support
    threadscope profiling.

scripts/init_grade_options.sh-subr:
scripts/canonical_grade.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/mgnuc.in:
compiler/handle_options.m:
compiler/options.m:
compiler/compile_target_code.m:
configure.in:
    Add support for the new grade component.

    Pass -DMR_THREADSCOPE to the C compiler when using a threadscope grade.

    Add assertions to ensure that the 'threadscope' grade component is used
    only with the 'par' grade component.

doc/user_guide.texi:
    Added commented-out documentation for the threadscope greate component.

    Adjusted documentation of the --profile-parallel-execution runtime option
    to describe the correct prerequisite compile time options.

    Added my name to the authors list.

runtime/mercury_context.c:
    Corrected grammar and prose in comments in the MR_do_join_and_continue code.
This commit is contained in:
Paul Bone
2010-01-10 04:53:40 +00:00
parent 79c3f39a68
commit 83a6f14708
21 changed files with 224 additions and 143 deletions

View File

@@ -1,7 +1,7 @@
#---------------------------------------------------------------------------#
# vim: ft=sh
#---------------------------------------------------------------------------#
# Copyright (C) 2000-2007 The University of Melbourne.
# Copyright (C) 2000-2007, 2010 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
@@ -81,9 +81,15 @@ case $gcc_nested_functions,$highlevel_code in
*) ;;
esac
case $thread_safe in
true) GRADE="$GRADE.par" ;;
false) ;;
case $thread_safe,$threadscope in
true,false) GRADE="$GRADE.par" ;;
true,true) GRADE="$GRADE.par.threadscope" ;;
false,false) ;;
*)
echo "$progname: error: The 'threadscope' grade component may only be" 1>&2
echo "$progname: error: used in parallel grades"
exit 1
;;
esac
case $gc_method in

View File

@@ -1,5 +1,5 @@
#---------------------------------------------------------------------------#
# Copyright (C) 1998-2002, 2004-2007, 2009 The University of Melbourne.
# Copyright (C) 1998-2002, 2004-2007, 2009-2010 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
@@ -97,4 +97,12 @@ case $use_regions in false)
;;
esac
#
# threadscope doesn't make sense in non-parallel grades.
#
case $thread_safe in false)
threadscope=false
;;
esac
#---------------------------------------------------------------------------#

View File

@@ -1,5 +1,5 @@
#---------------------------------------------------------------------------#
# Copyright (C) 1997-2007 The University of Melbourne.
# Copyright (C) 1997-2007, 2010 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
@@ -72,6 +72,7 @@ asm_labels=true
non_local_gotos=true
global_regs=true
thread_safe=false
threadscope=false
gc_method=boehm
profile_time=false
profile_calls=false

View File

@@ -2,7 +2,7 @@
# vim: ts=4 sw=4 et
# @configure_input@
#---------------------------------------------------------------------------#
# Copyright (C) 1995-2007 The University of Melbourne.
# Copyright (C) 1995-2007, 2010 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
@@ -286,6 +286,11 @@ case $thread_safe in
false) THREAD_OPTS="" ;;
esac
case $threadscope in
true) THREADSCOPE_OPTS="-DMR_THREADSCOPE" ;;
false) THREADSCOPE_OPTS="" ;;
esac
# Set the correct flags if we're to use the MS Visual C runtime.
use_msvcrt=@USE_MSVCRT@
if test $use_msvcrt = "yes"; then
@@ -648,6 +653,7 @@ ALL_CC_OPTS="$MERC_ALL_C_INCL_DIRS\
$SINGLE_PREC_FLOAT_OPTS\
$SPLIT_OPTS\
$THREAD_OPTS\
$THREADSCOPE_OPTS\
$REGION_OPTS\
$PICREG_OPTS\
$ARCH_OPTS\

View File

@@ -1,7 +1,7 @@
#---------------------------------------------------------------------------#
# vim: ts=4 sw=4 expandtab
#---------------------------------------------------------------------------#
# Copyright (C) 1997-2007 The University of Melbourne.
# Copyright (C) 1997-2007, 2010 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
@@ -392,6 +392,10 @@
thread_safe=true
;;
threadscope)
threadscope=true
;;
agc)
gc_method=accurate
;;