Changes between Version 73 and Version 74 of Next-GenOpenMPTransformation


Ignore:
Timestamp:
03/31/21 10:36:23 (5 years ago)
Author:
wuwenhao
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Next-GenOpenMPTransformation

    v73 v74  
    4343{{{
    4444void $check_data_race($mem *rs, $mem *ws, int n, int tid) {
     45  rs[tid] = $tracked_reads();
     46  ws[tid] = $tracked_writes();
    4547  $assert(
    4648    $forall (int j: 0 .. nthreads - 1) (j != tid) ==>
     
    4850      $mem_disjoint(...)
    4951  );
    50   rs[tid] = $mem_empty();
    51   ws[tid] = $mem_empty();
    5252}
    5353}}}
     
    8282      $check_data_race(&rs, &ws, nthreads, tid); // 1st check
    8383      $track_clean();
     84      rs[tid] = $mem_empty();
     85      ws[tid] = $mem_empty();
    8486      // RS stack: rs0:={}; WS stack: ws0:={};
    8587      C;
     
    9092}}}
    9193
    92 We denotes Ax as thread x executes statement A.
    93 Assuming there are two threads 0 and 1,
    94 the first $check_data_race()  checks races between:
    95 
    96 A0,A1; A0,B1;  A1,B0; B0,C1; B1,C0;
    97 
    98 Then, the second $check_data_race() checks races between:
    99 
    100 A0,C1; A1,C0; C0,C1;
    101 
    102 Races between B0 and B1 are disabled, because B is in critical block.
     94We denotes that thread x executes statement A as Ax.
     95Assuming there are two threads 0 and 1, two traces shall be explored:
     96
     97Trace1: A0y0 A1y1 B0cdr0C0cdr0 B1cdr1C1cdr1;
     98
     99Trace2: A0y0 A1y1 B1cdr1C1cdr1 B0cdr0C0cdr0;
     100
     101For the first trace, cdr0 following B0 checks data races between
     102
     103A0 and A1;
     104B0 and A1;
     105
     106Then, w/r sets on thread 0 is cleaned.
     107
     108The second cdr0 following C0 checks data races between
     109
     110C0 and A1;
     111
     112An implicit barrier is placed at the end after the second cdr0,
     113thus thread 1 starts executing its remaining part.
     114The first cdr1 checks data races between
     115
     116C0 and A1;
     117C0 and B1;
     118
     119Then, tracked sets on both A1 and B1 are cleaned.
     120
     121Finally, the last cdr1 in the first trace checks data races between
     122
     123C0 and C1;
     124
     125The second trace will complete checking by performing checks between
     126
     127B1 and A0
     128C1 and A0
     129C1 and B0
     130
     131Because B is protected by critical section, races between B0 and B1 are not checked.
     132As a result, all required pairs are checked.
     133
    103134
    104135