<br><tt><font size=2>> On Tuesday 29 May 2007, Brian Watt wrote:<br>
> > OK. I think I understand.<br>
> <br>
> I think you don't ;-)<br>
> <br>
> > > The registers are only accessible in saved state, so in
order to<br>
> > > change them, the context needs to be suspended and written
back<br>
> > > into kernel memory.<br>
> > <br>
> > That is fine, because I have no need to modify the registers
while the <br>
> > context is executing. Instead I would only need to update the
registers <br>
> > when the context is in a saved state prior to execution. Then
the context <br>
> > would be executed which would execute the SPE program until it
returns <br>
> > (though a completion stop and signal, 0x2000) whereby I assume
the context <br>
> > is suspended and written back - therefore in a saved state. After
this the <br>
> > registers could be read to get the results, and the process would
repeat <br>
> > itself for the next call again by setting up the registers. So
maybe I'm <br>
> > not understanding what the issue is that you are trying to explain
to me, <br>
> > because I think the context is in the correct state as you suggest.<br>
> <br>
> There are four different states that a context can be in:<br>
> <br>
> 1. saved and idle<br>
> 2. saved and trying to run<br>
> 3. loaded and running<br>
> 4. loaded and idle<br>
> <br>
> Initially, it is in state 1, where you can easily modify the registers.<br>
> When you call spe_context_run, it goes through state 2 in the scheduler<br>
> to state 3, where it actually executes code.<br>
> <br>
> When it returns by the means of stop-and-signal, and there is no other<br>
> context in state 2, it will be in state 4, waiting to be called again.<br>
> This is an important performance optimization. When you call<br>
> spe_context_run the next time, it can quickly go from state 4 to state
3<br>
> again, without ever having to be saved into memory.<br>
> <br>
> Accessing the registers of a loaded context forces it to be saved
into<br>
> state 1 or 2, and then loaded again as it tries to run.<br>
> <br>
> Arnd <><<br>
</font></tt>
<br><tt><font size=2>Thanks Arnd, that was excellent, and yes, I didn't
fully understand</font></tt>
<br><tt><font size=2>the states. So what I take away is to keep the context
moving from</font></tt>
<br><tt><font size=2>loaded and idle to loaded and running is the best.
And to do that</font></tt>
<br><tt><font size=2>I should not use registers, but rather communicate
through local</font></tt>
<br><tt><font size=2>store. Is this correct?</font></tt>