I have some newbie questions

Discussion in 'CellPerformance@B3D' started by Shai, Oct 9, 2007.

  1. Shai

    Newcomer

    Joined:
    Oct 9, 2007
    Messages:
    12
    Likes Received:
    0
    After a day's worth of reading documentation and figuring out tutorials, I've got a few questions.

    1. Am I correct in assuming that volatile memory on the SPE refers to the Local Store and that non-volatile memory refers to the 128x128bit register file? So that when I write 'int i' in the SPU code, this integer takes up one of the 128 available registers?

    2. Could someone please explain barriers and fences (for DMA transfers) to me and give me some short example code and point out why I'd want to use them. I've read the definitions of barriers and fences in the manual a dozen times already and I'm still not sure if I get it. So please, don't just quote the manual, but help me understand.
     
  2. OzzyBC42

    Newcomer

    Joined:
    Jul 8, 2007
    Messages:
    25
    Likes Received:
    0
    1. Nope.

    Register usage in the SPU ABI
    Register Range Type Purpose
    0 Dedicated Link Register
    1 Dedicated Stack Pointer
    2 Volatile Environment Pointer (for languages that need one)
    3-79 Volatile Function arguments, return values, and general usage.
    80-127 Non-volatile Used for local variables. Must be preserved across function calls.

    This is only of interest for you if you're going to program in assembler, if not, the compiler is going to handle this for you.

    See http://www.ibm.com/developerworks/power/library/pa-linuxps3-2/index.html?S_TACT=105AGX16&S_CMP=EDU

    2.

    Fence:

    Do all other DMA Jobs in this tag group first, even if they were issued after this fence command and then do this DMA Job I marked with Fence


    Barrier:
    Do all other DMA Jobs in this tag group first, but only if they were issued before this barrier command, then do the DMA Job I marked as Barrier.


    You use these commands to synchronize your DMA Transfers.
    Sry, no example code at hand atm.
     
    #2 OzzyBC42, Oct 9, 2007
    Last edited by a moderator: Oct 9, 2007
  3. Sousuke

    Newcomer

    Joined:
    Jan 16, 2006
    Messages:
    17
    Likes Received:
    1
    One barrier example I'm using with my current project:
    (I'm using doublebuffering but to keep it simple here's just an example with singlebuffering)
    Code:
    getData();
    loop:
      waitForData();
      processData();
      putData();
      getDataWithBarrier();
      // with barrier so put is finished before next data is read into same buffer
    branch loop
    
     
  4. Shai

    Newcomer

    Joined:
    Oct 9, 2007
    Messages:
    12
    Likes Received:
    0
    Thanks for the help guys. I think I understand it now. :)
     
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...