<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​​</div>Dear all,<br><br>Here is the plain text version of the proposal:<br><br>Currently, the LLVM IR uses a binary value (SingleThread/CrossThread) to represent synchronization scope on atomic instructions. We would like to enhance the representation of memory scopes in LLVM IR to allow more values than just the current two. The intention of this email is to invite comments on our proposal. There are some discussion before and it can be found here:<br><a href="https://groups.google.com/forum/#!searchin/llvm-dev/hsail/llvm-dev/46eEpS5h0E4/i3T9xw-DNVYJ">https://groups.google.com/forum/#!searchin/llvm-dev/hsail/llvm-dev/46eEpS5h0E4/i3T9xw-DNVYJ</a><br><br>Here is our new proposal:<br><br>=================================================================<br>We still let the bitcode store memory scopes as "unsigned integers", since that is the easiest way to maintain compatibility. The values 0 and 1 are special. All other values are meaningful only within that bc file. In addition, "a global metadata in the file" will provide a map from unsigned integers to string symbols which should be used to interpret all the non-standard integers. If the global metadata is empty or non-existent, then all non-zero values will be mapped to "system", which is the current behavior.<br><br>The proposed syntax for synchronization scope is as follows:<br>* Synchronization scopes are of arbitrary width, but implemented as unsigned in the bitcode, just like address spaces.<br>* Cross-thread is default.<br>* Keyword "singlethread" is unchanged<br>* New syntax "synchscope(n)" for other target-specific scopes. <br>* There is no keyword for cross-thread, but it can be specified as "synchscope(0)".<br><br>The proposed new integer implementation expanded synchronization scopes are as follows: <br>****************************************************************<br>Format        <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​     ​ </div>Single Thread     <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​        ​</div>System (renamed) <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​    ​</div> Intermediate<br>Bitcode      <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​       </div>zero              <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​             </div>one              <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​             </div> unsigned n<br>Assembly    <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​     ​</div>singlethread,     <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​         ​ </div>empty (default),  <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​        ​</div>synchscope(n-1)<br>              <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​        ​  </div>synchscope(~0U)   <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​    ​ </div>synchscope(0)<br>In-memory    <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​    </div>~0U<div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​                            z</div>ero              <div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​            </div>unsigned n-1<br>SelectionDAG<div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​   </div>~0U<div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​                            ​</div>zero<div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(11,83,148);display:inline">​                          </div>unsigned n-1<br>****************************************************************<br><br>The choice of “~0U” for singlethread makes it easy to maintain backward compatibility in the bitcode. The values 0 and 1 remain unchanged in the bitcode, and the reader simply decrements them by one to compute the correct value in the in-memory data-structure.<br><br>Name Mapping<br><br>Now we comes to name mapping from integers to strings. If a CLANG front end wants to map a language that has memory scopes (e.g. OpenCL) to LLVM IR, how does it determine what syncscopes to use? Without any rules, each target can define its own meaning for the scopes, can give them any name, and can map them to the LLVM-IR unit values in any way. In this case, I think each target have to provide a mapping function that maps a specific language’s name for a scope into that targets name for a scope that has conservatively the same semantics. Namely, the act of supporting a new language that has memory scopes requires every target to support that language to be updated accordingly.<br><br>Therefore, in order to allow front end writers to share memory scope definitions when they match to avoid the effort of updating all targets for each language,it's better to define standard memory scope names. A target is free to implement them or not, but if a target does implement them they must have the defined relational semantics (e.g., hierarchical nesting). If a target does implement them then it will be able to support any language that uses them, including languages not yet invented. A new memory scope name can be added if the existing ones are insufficient. <br><br>With the first try, we can define the standard scopes with what a common language that has memory scopes needs, e.g., OpenCL uses system, device, workgroup, workitem. It uses the same approach as LLVM has done for debug information. There are standard debug entities (that a common language (C) needs), and each new language uses those standard entities where there is a match, and subsequently defines only the delta.<br><br>A bitcode example with the proposal<br>*****************************************************************<br>define void  <at> test(i32* %addr) {<br>; forward compatibility<br>  cmpxchg i32* %addr, i32 42, i32 0 singlethread monotonic monotonic<br><br>; new synchscope that will be defined by each backend<br>  cmpxchg i32* %addr, i32 42, i32 0 synchscope(2) monotonic monotonic, 2<br>  cmpxchg i32* %addr, i32 42, i32 0 synchscope(3) monotonic monotonic, 3<br><br>  ret void<br>}<br><br>!synchscope = metadata !{{i32 0, !"SingleThread"}, {i32 2, !"WorkGroup"}, ...}<br>*****************************************************************<br><br>================================================================= </div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 28, 2016 at 12:27 PM, Ke Bai <span dir="ltr"><<a href="mailto:kebai613@gmail.com" target="_blank">kebai613@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><span style="font-family:Arial;white-space:pre-wrap;line-height:1.38">Hi all,</span><br></div><div><span><br><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:16px;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">Currently, the LLVM IR uses a binary value (SingleThread/CrossThread) to represent synchronization scope on atomic instructions. We would like to enhance the representation of memory scopes in LLVM IR to allow more values than just the current two. The intention of this email is to invite comments on our proposal. There are some discussion before and </span><span style="font-size:16px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">it can be found here:</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><a href="https://groups.google.com/forum/#!searchin/llvm-dev/hsail/llvm-dev/46eEpS5h0E4/i3T9xw-DNVYJ" style="text-decoration:none" target="_blank"><span style="font-size:16px;font-family:Arial;color:rgb(17,85,204);text-decoration:underline;vertical-align:baseline;white-space:pre-wrap">https://groups.google.com/forum/#!searchin/llvm-dev/hsail/llvm-dev/46eEpS5h0E4/i3T9xw-DNVYJ</span></a></p><br><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:16px;font-family:Arial;vertical-align:baseline;white-space:pre-wrap">Here is our new proposal:</span></p><div>=================================================================</div></span></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Arial,Helvetica,sans-serif" style="color:rgb(33,33,33)">We still let the bitcode store memory scopes as </font><font face="Arial,Helvetica,sans-serif" style="color:rgb(33,33,33)"><b>unsigned integers</b></font><font face="Arial,Helvetica,sans-serif" style="color:rgb(33,33,33)">, since that is the easiest way to maintain compatibility. The values 0 and 1 are special. All other values are meaningful only within that bc file. In addition, </font><font face="Arial,Helvetica,sans-serif" style="color:rgb(33,33,33)"><b>a global metadata in the </b></font><font face="Arial,Helvetica,sans-serif" style="color:rgb(33,33,33)"><b>file will provide a map</b></font><font face="Arial,Helvetica,sans-serif" style="color:rgb(33,33,33)"> from unsigned integers to string symbols which should be used to interpret all the non-standard integers. If the global metadata is empty or non-existent, then all non-zero values will be mapped to "system", which is the current </font><font face="Arial,Helvetica,sans-serif" style="color:rgb(33,33,33)">behavior</font><font face="Arial,Helvetica,sans-serif" style="color:rgb(33,33,33)">.</font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><div style="margin-top:5.76pt;margin-bottom:10.8pt"><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">The proposed syntax for synchronization scope is as follows:</span></font></font></div></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><ul style="margin-top:14pt;margin-bottom:14pt"><font face="Calibri,Arial,Helvetica,sans-serif"><li><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">Synch</span></font><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">ronization scopes are of arbitrary width, but implemented as unsigned in the bitcode, just like address spaces.</span></font><font face="Arial,Helvetica,sans-serif" size="2"><span style="font-size:11pt"><br></span></font></font></li><li><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">Cross-thread is default.</span></font><font face="Arial,Helvetica,sans-serif" size="2"><span style="font-size:11pt"><br></span></font></font></li><li><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">Keyword "singlethread" is unchanged</span></font><font face="Arial,Helvetica,sans-serif" size="2"><span style="font-size:11pt"><br></span></font></font></li><li><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">New syntax "synchscope(n)" for other target-specific scopes. </span></font><font face="Arial,Helvetica,sans-serif" size="2"><br></font></font></li><li><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">There is no keyword for cross-thread, but it can be specified as "synchscope(0)".</span></font><font face="Arial,Helvetica,sans-serif" size="2"><br></font></font></li></font></ul></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><font face="Arial,Helvetica,sans-serif">The proposed new integer implementation expanded synchronization scopes are as follows: </font></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><font face="Arial,Helvetica,sans-serif"><table width="638" cellspacing="0" cellpadding="7" style="width:638px"><colgroup><col width="154" style="width:154px"></colgroup><colgroup><col width="153" style="width:153px"><col width="156" style="width:156px"><col width="117" style="width:117px"></colgroup><tbody><tr><td width="154" style="width:154px;padding:0px 0px 0px 5.4pt;border-style:solid none none solid;border-top-width:1pt;border-left-width:1pt;border-top-color:rgb(0,0,1);border-left-color:rgb(0,0,1);background-color:black"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3" color="white"><span lang="en-US" style="font-size:12pt"><b>Format</b></span></font></div></td><td width="153" style="width:153px;padding:0px;border-style:solid none none;border-top-width:1pt;border-top-color:rgb(0,0,1);background-color:black"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3" color="white"><span lang="en-US" style="font-size:12pt"><b>Single Thread</b></span></font></div></td><td width="156" style="width:156px;padding:0px;border-style:solid none none;border-top-width:1pt;border-top-color:rgb(0,0,1);background-color:black"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3" color="white"><span lang="en-US" style="font-size:12pt"><b>System (renamed)</b></span></font></div></td><td width="117" style="width:117px;padding:0px 5.76pt 0px 0px;border-style:solid solid none none;border-top-width:1pt;border-right-width:1pt;border-top-color:rgb(0,0,1);border-right-color:rgb(0,0,1);background-color:black"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3" color="white"><span lang="en-US" style="font-size:12pt"><b>Intermediate</b></span></font></div></td></tr><tr><td width="154" style="width:154px;padding:0px 5.76pt 0px 5.4pt;border:1pt solid rgb(0,0,1)"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt"><b>Bitcode</b></span></font></div></td><td width="153" style="width:153px;padding:0px 5.76pt 0px 5.4pt;border:1pt solid rgb(0,0,1)"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt">zero</span></font></div></td><td width="156" style="width:156px;padding:0px 5.76pt 0px 5.4pt;border:1pt solid rgb(0,0,1)"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt">one</span></font></div></td><td width="117" style="width:117px;padding:0px 5.76pt 0px 5.4pt;border:1pt solid rgb(0,0,1)"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt">unsigned n</span></font></div></td></tr><tr><td width="154" style="width:154px;padding:0px 0px 0px 5.4pt;border-style:none none none solid;border-left-width:1pt;border-left-color:rgb(0,0,1)"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt"><b>Assembly</b></span></font></div></td><td width="153" style="width:153px;padding:0px;border-style:none"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt">singlethread,</span></font><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt"><br></span></font><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt">synchscope(~0U)</span></font></div></td><td width="156" style="width:156px;padding:0px;border-style:none"><div align="justify" style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt">empty (default),</span></font><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt"><br></span></font><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt">synchscope(0)</span></font></div></td><td width="117" style="width:117px;padding:0px 5.76pt 0px 0px;border-style:none solid none none;border-right-width:1pt;border-right-color:rgb(0,0,1)"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt">synchscope(n-1)</span></font></div></td></tr><tr><td width="154" style="width:154px;padding:0px 5.76pt 0px 5.4pt;border:1pt solid rgb(0,0,1)"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt"><b>In-memory</b></span></font></div></td><td width="153" style="width:153px;padding:0px 5.76pt 0px 5.4pt;border:1pt solid rgb(0,0,1)"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt">~0U</span></font></div></td><td width="156" style="width:156px;padding:0px 5.76pt 0px 5.4pt;border:1pt solid rgb(0,0,1)"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt">zero</span></font></div></td><td width="117" style="width:117px;padding:0px 5.76pt 0px 5.4pt;border:1pt solid rgb(0,0,1)"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt">unsigned n-1</span></font></div></td></tr><tr><td width="154" style="width:154px;padding:0px 0px 0px 5.4pt;border-style:none none solid solid;border-bottom-width:1pt;border-left-width:1pt;border-bottom-color:rgb(0,0,1);border-left-color:rgb(0,0,1)"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt"><b>SelectionDAG</b></span></font></div></td><td width="153" style="width:153px;padding:0px;border-style:none none solid;border-bottom-width:1pt;border-bottom-color:rgb(0,0,1)"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt">~0U</span></font></div></td><td width="156" style="width:156px;padding:0px;border-style:none none solid;border-bottom-width:1pt;border-bottom-color:rgb(0,0,1)"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt">zero</span></font></div></td><td width="117" style="width:117px;padding:0px 5.76pt 0px 0px;border-style:none solid solid none;border-right-width:1pt;border-bottom-width:1pt;border-right-color:rgb(0,0,1);border-bottom-color:rgb(0,0,1)"><div style="margin-top:0px;margin-bottom:0px"><font face="Arial,Helvetica,sans-serif" size="3"><span lang="en-US" style="font-size:12pt">unsigned n-1</span></font></div></td></tr></tbody></table></font><div style="margin-top:5.76pt;margin-bottom:10.8pt"><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Arial,Helvetica,sans-serif"><span lang="en-US">The choice of “~0U” for singlethread makes it easy to maintain backward compatibility in the bitcode. The values 0 and 1 remain unchanged in the bitcode, and the reader simply decrements them by one to compute the correct value in the in-memory data-structure.</span></font></font></div><div style="margin-top:5.76pt;margin-bottom:10.8pt"><span><p dir="ltr" style="line-height:1.38;margin-top:6pt;margin-bottom:11pt"><span style="font-family:Arial;color:rgb(0,0,0);font-weight:700;vertical-align:baseline;white-space:pre-wrap">Name Mapping</span></p><p dir="ltr" style="line-height:1.38;margin-top:6pt;margin-bottom:11pt"><span style="font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap">Now we comes to name mapping from integers to strings. If a CLANG front end wants to map a language that has memory scopes (e.g. OpenCL) to LLVM IR, how does it determine what syncscopes to use? Without any rules, each target can define its own meaning for the scopes, can give them any name, and can map them to the LLVM-IR unit values in any way. In this case, I think each target have to provide a mapping function that maps a specific language’s name for a scope into that targets name for a scope that has conservatively the same semantics. Namely, the act of supporting a new language that has memory scopes requires every target to support that language to be updated accordingly.</span></p><p dir="ltr" style="line-height:1.38;margin-top:6pt;margin-bottom:11pt"><span style="color:rgb(0,0,0);font-family:Arial;white-space:pre-wrap;line-height:1.38">Therefore, in order to allow front end writers to share memory scope definitions when they match to avoid the effort of updating all targets for each language,it's better to define standard memory scope names. A target is free to implement them or not, but if a target does implement them they must have the defined relational semantics (e.g., hierarchical nesting). If a target does implement them then it will be able to support any language that uses them, including languages not yet invented. A new memory scope name can be added if the existing ones are insufficient. </span></p><p dir="ltr" style="line-height:1.38;margin-top:6pt;margin-bottom:11pt"><span style="color:rgb(0,0,0);font-family:Arial;line-height:1.38;white-space:pre-wrap">With the first try, we can define the standard scopes with what a common language that has memory scopes needs, e.g., OpenCL uses system, device, workgroup, workitem. It uses the same approach as LLVM has done for debug information. There are standard debug entities (that a common language (C) needs), and each new language uses those standard entities where there is a match, and subsequently defines only the delta.</span></p></span></div><div style="margin-top:5.76pt;margin-bottom:10.8pt"><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Arial,Helvetica,sans-serif"><span lang="en-US"><b>A </b></span></font><font face="Arial,Helvetica,sans-serif"><b>bitcode example with the proposal</b></font></font></div></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">define </span></font><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">void  <at> test(i32* %addr) {</span></font></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">; </span></font><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">forward compatibility</span></font><font face="Arial,Helvetica,sans-serif" size="2"><span style="font-size:11pt"><br></span></font></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">  cmpxchg </span></font><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">i32* %addr, i32 42, i32 0 singlethread monotonic monotonic</span></font></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><font face="Arial,Helvetica,sans-serif" size="2"><span style="font-size:11pt"><br></span></font></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">; </span></font><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">new synchscope that will be defined by each backend</span></font></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">  cmpxchg </span></font><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">i32* %addr, i32 42, i32 0 synchscope(2) monotonic monotonic, </span></font><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">2</span></font></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">  cmpxchg </span></font><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">i32* %addr, i32 42, i32 0 synchscope(3) monotonic monotonic, </span></font><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">3</span></font></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><font face="Arial,Helvetica,sans-serif" size="2"><span style="font-size:11pt"><br></span></font></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">  ret </span></font><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">void</span></font></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">}</span></font></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><font face="Arial,Helvetica,sans-serif" size="2"><span style="font-size:11pt"><br></span></font></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><font face="Calibri,Arial,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols" size="2" color="#212121"><span style="font-size:16px"><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">!synchscope </span></font><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">= metadata !{{i32 0, !"SingleThread"}, </span></font><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">{i32 2, !"WorkGroup"}, </span></font><font face="Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">...}</span></font></span></font></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><span style="color:rgb(33,33,33);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:small;line-height:20px">=================================================================</span></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><span style="color:rgb(33,33,33);font-family:Arial;white-space:pre-wrap;line-height:1.38"><br></span></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><span style="color:rgb(33,33,33);font-family:Arial;white-space:pre-wrap;line-height:1.38">Thank you!</span></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><span style="color:rgb(33,33,33);font-family:Arial;white-space:pre-wrap;line-height:1.38"><br></span></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><span style="color:rgb(33,33,33);font-family:Arial;white-space:pre-wrap;line-height:1.38">---</span></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><span style="color:rgb(33,33,33);font-family:Arial;white-space:pre-wrap;line-height:1.38">Best regards,</span><br></div><div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;line-height:normal"><span><span style="font-family:Arial;color:rgb(33,33,33);vertical-align:baseline;white-space:pre-wrap">Ke</span></span><br></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><font color="#0b5394">Best Regard,<br>Ke Bai, Ph.D.</font><br></div></div></div>
</div>