XNA Creators Club Online
Page 1 of 1 (8 items)
Sort Posts: Previous Next

request for stackalloc support (xbox360)

Last post 05-12-2008 9:13 AM by ShawMishrak. 7 replies.
  • 05-07-2008 8:59 PM

    request for stackalloc support (xbox360)

    hello, i run a small game studio (7 devs) and while it's not a problem yet, i do firmly belive that stackalloc functionality would be very benificial to my team.

    On the PC, of course we already have this, but in the development of our first game (Biology Battle) we have found that we need to be extremely lean and fast on the xbox360 to ensure good performance.

    Since performance tuning matters so much more on the xbox, this is *the* system where stackalloc would benifit the most, so it is rather disapointing that it is not enabled.

    And yes, so far I worked around the problem, but in our one (fairly simple) game my performance profiler identified this as a bottleneck, so I am sure as more professional teams (such as mine) move into XNA, this will become more and more of a barrier to them (us?) creating highly performant games on the xbox360.

    Thank you,

    -Jason
    Novaleaf Studios

     

     

     

  • 05-07-2008 9:23 PM In reply to

    Re: request for stackalloc support (xbox360)

    fyi, just added to the connect site, (thanks for the suggestion boki)
  • 05-08-2008 9:32 AM In reply to

    Re: request for stackalloc support (xbox360)

    It's only supported on the PC because it uses the 'full' .Net Framework, not the Compact Framework like the 360, and since it's the CF that doesn't support stackalloc, that is why it doesn't work on the 360. (Not because there's something inherent to the 360 that makes it not work). The two ways to solve it would be either to stop using the Compact Framework on the 360, or to get the .Net team to add it to the .Net CF, both rather large tasks I should imagine.

    I'm interested personally in what you would use it for, since its typical use seems to be passing a pointer off to an unmanaged function without the use of the 'fixed' syntax. Since you can't run any unmanaged code of your own on the 360, I'm just curious how you would be using it to help performance.

  • 05-10-2008 4:55 AM In reply to

    Re: request for stackalloc support (xbox360)

    FYI, stackalloc is supported by CF.NET.  it is not supported on the xbox360 however.

    As for the reason why it is important, sorry for the 'leet' reply but go read the docs on stackalloc, because your though on it's use is fairly inaccurate.  

    The reason is ultimatly one of performance.  On the xbox360 each object you allocate will slow down the GC.  having a single "temp value" allocated that is reused each method call works, but only for single threaded applications.  using the ThreadStatic attribute is slow, and not supported in CF.NET. 

    Writing my own threadstatic architecture  is indeed the current workaround I am using, which is not graceful at all.

    checkout the bug filed on the connect site for more info:   https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=342609&SiteID=226

  • 05-10-2008 8:31 AM In reply to

    Re: request for stackalloc support (xbox360)

    Novaleaf Software:

    FYI, stackalloc is supported by CF.NET.  it is not supported on the xbox360 however.

    Unless theres been an update to IL engine v3.0 for Compact.NET (I don't track the compact framework except what used on X360), this blog disagrees with you and is indeed accurate for the X360.

    Note the lack of support for the localloc IL instruction (stackalloc inserts this into the IL)

    http://blogs.msdn.com/bluecollar/archive/2006/09/27/773065.aspx

    Edit:
    Its worth noting it will happily generate the IL instruction, and it will only die at execution time with a Compact IL Engine V2.0 trys to execute. I.e. it will only crash on a X360 or a Compact IL device (not sure what the compact emulator on PC uses with regard IL execution engine)



  • 05-10-2008 8:37 AM In reply to

    Re: request for stackalloc support (xbox360)

    Its very useful for things like physics engine, which need to pass data back from various bits but ideally have non garbage collected variable sized allocations.

    JigLibX has support for stackalloc, but has to 'fake' it (currently not multi-threaded safe) to work on the 360.
    So i've voted, its a very useful IL instruction for performance code.
  • 05-12-2008 5:18 AM In reply to

    Re: request for stackalloc support (xbox360)

    guess i'm wrong about the "works in CF.NET" part, but yeah, performance tuning for the xbox360 is a critical aspect for serious development.

     

    Though i thought it was enabled on CF.NET, disabled on XBOX...    if stackalloc was never supported on CF, then i guess that signficantly decreases the chances msft will enable it on the xbox..  :(

  • 05-12-2008 9:13 AM In reply to

    Re: request for stackalloc support (xbox360)

    You have my vote on Connect.

    I'm not surprised that this functionality is missing from the Compact Framework, which targets primarily embedded systems.  You often have very little stack space on these devices, so it's tricky to make something like this work well.  The Xbox is a different story, though.
    New Microsoft DirectX/XNA MVP  (*evil laugh*)
Page 1 of 1 (8 items) Previous Next