<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 9, 2013 at 1:09 AM, Nadav Rotem <span dir="ltr"><<a href="mailto:nrotem@apple.com" target="_blank" class="cremed">nrotem@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="im"><div>On May 8, 2013, at 4:00 PM, Eric Christopher <<a href="mailto:echristo@gmail.com" target="_blank" class="cremed">echristo@gmail.com</a>> wrote:</div>
<br><blockquote type="cite"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Thinking that a masked store is conservatively a store of the full</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">width of the store right?</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
</blockquote><div><br></div></div>It depends on the optimization. Consider this example:</div><div><br></div><div>masked_store(Val, Ptr , M)</div><div>X = masked_load(Ptr, M2)</div><div><br></div><div>If you assume that your store actually overwrites everything in that memory location then you don't need to load that memory location again. You can simply use the stored value. However, in our example X != Val. </div>
</blockquote></div><br></div><div class="gmail_extra" style>I'm not sure I understand the full impact of this example, and I would like to.</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>
What are the desired memory model semantics for a masked store? Specifically, let me suppose a simplified vector model of <2 x i64> on an i64-word-size platform.</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>
  masked_store(<42, 42>, Ptr, <true, false>)</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>Does this write to the entier <2 x i64> object stored at Ptr or not? Put another way, consider:</div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>  thread A:</div><div class="gmail_extra" style>    ...</div><div class="gmail_extra" style>    masked_store(<42, 42>, Ptr, <true, false>)</div>
<div class="gmail_extra" style>    ...</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>  thread B:</div><div class="gmail_extra" style>    ...</div><div class="gmail_extra" style>    masked_store(<42, 42>, Ptr, <false, true>)</div>
<div class="gmail_extra" style>    ...</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>Assuming there is no specific synchronization relevant to Ptr between these two threads and their masked stores, does this form a data race or not?</div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style>From a memory model perspective, if this does *not* form a data race, that makes this tremendously more complex to implement, analyze, and optimize... I'm somewhat hopeful that the desired semantics are for this to form a datarace (and thus require synchronization when occurring in different threads like this).</div>
</div>