Skip to content

Commit

Permalink
Merge branch 'master' into simd
Browse files Browse the repository at this point in the history
  • Loading branch information
LChenGit authored Aug 25, 2023
2 parents 775af04 + a0a5f0e commit bde3dd5
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 9 deletions.
5 changes: 5 additions & 0 deletions check-data-races.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ help () {
echo "--tsan-gcc : compile and test all benchmarks with gcc ThreadSanitizer"
echo "--archer : compile and test all benchmarks with Archer"
echo "--coderrect : compile and test all benchmarks with Coderrect Scanner"
echo "--openrace : compile and test all benchmarks with Openrace Scanner"
echo "--inspector : compile and test all benchmarks with Intel Inspector"
echo "--romp : compile and test all benchmarks with Romp"
echo "--llov : compile and test all benchmarks with LLVM OpenMP Verifier (LLOVE)"
Expand Down Expand Up @@ -246,6 +247,10 @@ if [[ "$OPTION" == "--coderrect" ]]; then
scripts/test-harness.sh -t 8 -n 1 -d 32 -l $LANGUAGE -x coderrect
fi

if [[ "$OPTION" == "--openrace" ]]; then
scripts/test-harness.sh -t 8 -n 1 -d 32 -l $LANGUAGE -x openrace
fi

if [[ "$OPTION" == "--tsan-clang" ]]; then
scripts/test-harness.sh -t 8 -n 5 -d 32 -l $LANGUAGE -x tsan-clang
fi
Expand Down
5 changes: 3 additions & 2 deletions micro-benchmarks/DRB018-plusplus-orig-yes.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ Adding private (outLen) can avoid race condition. But it is wrong semantically.
Data races on outLen also cause output[outLen++] to have data races.
Data race pairs (we allow two pairs to preserve the original code pattern):
1. outLen@72:12:W vs. outLen@72:12:W
2. output[]@72:5:W vs. output[]@72:5:W
1. outLen@73:12:W vs. outLen@73:12:W
2. output[]@73:5:W vs. output[]@73:5:W
output[outLen++]@73:5:W vs. output[outLen++]@73:5:W
*/
#include <stdlib.h>
#include <stdio.h>
Expand Down
5 changes: 3 additions & 2 deletions micro-benchmarks/DRB019-plusplus-var-yes.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ Race condition on outLen due to unprotected writes.
Adding private (outLen) can avoid race condition. But it is wrong semantically.
Data race pairs: we allow two pair to preserve the original code pattern.
1. outLen@72:12:W vs. outLen@72:12:W
2. output[]@72:5:W vs. output[]@72:5:W
1. outLen@73:12:W vs. outLen@73:12:W
2. output[]@73:5:W vs. output[]@73:5:W
output[outLen++]@73:5:W vs. output[outLen++]@73:5:W
*/
#include <stdlib.h>
#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion micro-benchmarks/DRB116-target-teams-orig-yes.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
/*
use of omp target + teams
Without protection, master threads from two teams cause data races.
Data race pair: a@66:5:W vs. a@66:5:W
Data race pair: a[50]@66:5:W vs. a[50]@66:5:W
*/
int main(int argc, char* argv[])
{
Expand Down
2 changes: 1 addition & 1 deletion micro-benchmarks/DRB156-missingordered-orig-gpu-yes.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

/*This example is referred from DRACC by Adrian Schmitz et al.
Missing ordered directive causes data race pairs var@28:5:W vs. var@28:13:R
Missing ordered directive causes data race pairs var[i]@28:5:W vs. var[i-1]@28:12:R
*/

#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion micro-benchmarks/DRB157-missingorderedsimd-orig-gpu-yes.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
This kernel is modified version from “DataRaceOnAccelerator A Micro-benchmark Suite for Evaluating
Correctness Tools Targeting Accelerators” by Adrian Schmitz et al.
Due to distribute parallel for simd directive at line 31, there is a data race at line 33.
Data Rae Pairs, var@33:5:W vs. var@33:12:R
Data Race Pairs, var[i]@33:5:W vs. var[i-C]@33:12:R
.*/

#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion micro-benchmarks/DRB161-nolocksimd-orig-gpu-yes.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/*
This example is from DRACC by Adrian Schmitz et al.
Concurrent access on a counter with no lock with simd. Atomicity Violation. Intra Region.
Data Race Pairs: var@33:7:W vs. var@33:7:W
Data Race Pairs: var[i]@33:7:W vs. var[i]@33:7:W
*/

#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion micro-benchmarks/DRB164-simdmissinglock1-orig-gpu-yes.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
This kernel is referred from “DataRaceOnAccelerator A Micro-benchmark Suite for Evaluating
Correctness Tools Targeting Accelerators” by Adrian Schmitz et al.
Concurrent access of var@35:7 without acquiring locks causes atomicity violation. Data race present.
Data Race Pairs, var@35:7:W vs. var@35:7:W
Data Race Pairs, var[i]@35:7:W vs. var[i]@35:7:W
*/

#include <stdio.h>
Expand Down
9 changes: 9 additions & 0 deletions scripts/test-harness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ valid_tool_name () {
helgrind) return 0 ;;
archer) return 0 ;;
coderrect) return 0 ;;
openrace) return 0 ;;
tsan-clang) return 0 ;;
tsan-gcc) return 0 ;;
inspector) return 0 ;;
Expand Down Expand Up @@ -361,6 +362,7 @@ for tool in "${TOOLS[@]}"; do
helgrind) g++ $VALGRIND_COMPILE_CPP_FLAGS $additional_compile_flags $test -o $exname -lm ;;
archer) clang-archer++ $ARCHER_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;;
coderrect) coderrect -XbcOnly clang++ -fopenmp -fopenmp-version=45 -g ${OPTIMIZATION} $additional_compile_flags $test -o $exname -lm > /dev/null 2>&1 ;;
openrace) clang++ -fopenmp -fopenmp-version=45 -Dmasked=master -g -S -emit-llvm $test -o $exname ;;
tsan-clang) clang++ $TSAN_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;;
tsan-gcc) g++ $TSAN_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;;
llov) $LLOV_COMPILER/bin/clang++ $LLOV_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm 2> $compilelog;;
Expand All @@ -377,6 +379,7 @@ for tool in "${TOOLS[@]}"; do
helgrind) gcc $VALGRIND_COMPILE_C_FLAGS $additional_compile_flags $test -o $exname -lm ;;
archer) clang-archer $ARCHER_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;;
coderrect) coderrect -XbcOnly clang -fopenmp -fopenmp-version=45 -g ${OPTIMIZATION} $additional_compile_flags $test -o $exname -lm > /dev/null 2>&1 ;;
openrace) clang -fopenmp -fopenmp-version=45 -Dmasked=master -g -S -emit-llvm $test -o $exname ;;
tsan-clang) clang $TSAN_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;;
tsan-gcc) gcc $TSAN_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;;
llov) $LLOV_COMPILER/bin/clang $LLOV_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm 2> $compilelog;;
Expand Down Expand Up @@ -458,6 +461,12 @@ for tool in "${TOOLS[@]}"; do
echo "$testname return $testreturn"
races=$(grep -ce 'Found a data race' tmp.log)
cat tmp.log >> "$LOG_DIR/$logname" || >tmp.log ;;
openrace)
openrace $exname &> tmp.log;
check_return_code $?;
echo "$testname return $testreturn"
races=$(grep -ce '= Races =' tmp.log)
cat tmp.log >> "$LOG_DIR/$logname" || >tmp.log ;;
tsan-clang)
# races=$($MEMCHECK -f "%M" -o "$MEMLOG" "./$exname" $size 2>&1 | tee -a "$LOG_DIR/$logname" | grep -ce 'WARNING: ThreadSanitizer: data race') ;;
$TIMEOUTCMD $TIMEOUTMIN"m" $MEMCHECK -f "%M" -o "$MEMLOG" env TSAN_OPTIONS="exitcode=0 ignore_noninstrumented_modules=1" "./$exname" $size &> tmp.log;
Expand Down

0 comments on commit bde3dd5

Please sign in to comment.