<br><br><div class="gmail_quote">On Wed, Nov 21, 2012 at 8:36 PM, Mihael Hategan <span dir="ltr"><<a href="mailto:hategan@mcs.anl.gov" target="_blank">hategan@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Wed, 2012-11-21 at 18:50 -0600, Tim Armstrong wrote:<br>
<br>
> I don't see why this example necessarily deadlocks - it doesn't in<br>
> Swift/T since there isn't a true data dependence loop.<br>
><br>
> foreach i in [0:10] {<br>
>   a[i] = 1;<br>
>   f(a);<br>
> }<br>
<br>
</div>It shouldn't deadlock. Nothing should. It just does in the current<br>
swift/k implementation.<br>
<div class="im"><br>
><br>
> In Swift/T it does the same thing as:<br>
> foreach i in [0:10] {<br>
>   a[i] = 1;<br>
> }<br>
> foreach i in [0:10] {<br>
>   f(a);<br>
> }<br>
<br>
</div>I don't know if I'd expect that if I wrote that code. Another<br>
possibility is that I want f to be invoked successively with [1], [1,<br>
1], [1, 1, 1], etc. So I don't think it's obvious what that code should<br>
do, and I'd be inclined to have it forbidden. If the required behaviour<br>
is f([10x1]) ten times, then the user can state that explicitly by<br>
writing the equivalent code you mention.<br>
<div class="im"><br>
> I understand in Swift/K there is some sort of dependence loop ( scope<br>
> exiting <- f(a) executing <- a being closed <- scope exiting).  In<br>
> Swift/T the statements a[i] = 1 and f(a) are forked off separately,<br>
> then the writers count is decremented after each insertion succeeds.<br>
<br>
</div>I'm guessing the total writer count is determined at run-time by<br>
incrementing every time an iteration starts?<br>
<br>
Can I steal that? I mean we favored doing this analysis statically in<br>
swift/k, but I don't see why that should necessarily be the case.<br></blockquote><div><br>Of course.  <br><br>Currently we do the dumb thing of incrementing once per loop iteration, but I'm going to make a change soon where, if we know how many loop iterations there are at the time the loop is started, we'll just increment the count by that amount at the start and decrement as each iteration finishes (or actually, since we chunk loops up and distribute them, as each chunk of the loop finishes).  This works well enough.  <br>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
>   There isn't an explicit runtime event corresponding to all<br>
> statements in a block finishing.<br>
<br>
</div>Right. But if there was, it would be equivalent to the event of all<br>
writes to a[] having been completed, at least in the case above. Here's<br>
where it wouldn't:<br>
<div class="im"><br>
foreach i in [0:10] {<br>
   a[i] = 1;<br>
</div>   f(a[i]);<br>
}<br>
<br>
Which is why dynamic tracking would be better.<br>
<span class="HOEnZb"><font color="#888888"><br>
Mihael<br>
<br>
</font></span></blockquote></div><br>