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