<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.xna.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>XNA Framework</title><link>http://forums.xna.com/forums/56.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 0.0)</generator><item><title>Re: Vector2 maths slow on 360</title><link>http://forums.xna.com/forums/thread/73120.aspx</link><pubDate>Sun, 06 Jul 2008 22:14:46 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:73120</guid><dc:creator>Bruno Evangelista</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/73120.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=73120</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://forums.xna.com//Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;ShawMishrak:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;The ref version of Matrix.Multiply comes in at 521 instructions. :)&lt;/div&gt;&lt;/BLOCKQUOTE&gt; That&amp;#39;s really a lot of instructions for just a matrix multiply where everything is passed on the stack.&lt;br /&gt;
&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://forums.xna.com//Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;jwatte:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;Although ideally in a new thread, as the poor guy at the top probably isn&amp;#39;t being helped so much more in this thread :-)&lt;/div&gt;&lt;/BLOCKQUOTE&gt; So, can anyone create a new thread?&amp;nbsp; =)&lt;/p&gt;</description></item><item><title>Re: Vector2 maths slow on 360</title><link>http://forums.xna.com/forums/thread/73118.aspx</link><pubDate>Sun, 06 Jul 2008 21:54:04 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:73118</guid><dc:creator>jwatte</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/73118.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=73118</wfw:commentRss><description>Once you have some disassembly, you can diassemble a function that calls a delegate (and one that creates a delegate) to figure out the precise calling convention, rather than guessing. Unfortunately, blr can come in the middle of the function, too, for early returns and stuff. Some compilers also hoist things like switch tables to after the main return code. I suppose you can just keep fetching until you run into an address not valid exception :-)&lt;br /&gt;
&lt;p&gt;Oh, and please do post more findings such as the Matrix.Multiply instruction count! Although ideally in a new thread, as the poor guy at the top probably isn&amp;#39;t being helped so much more in this thread :-)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Vector2 maths slow on 360</title><link>http://forums.xna.com/forums/thread/73107.aspx</link><pubDate>Sun, 06 Jul 2008 21:05:40 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:73107</guid><dc:creator>ShawMishrak</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/73107.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=73107</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://forums.xna.com//Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;jwatte:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;I would create a delegate for the function, and then cast the delegate to int*, and dump some first and second level indirections from that and see what comes out. I e, dump the first 8 words of the address of the delegate, then the first 8 words of each of those words treated as a pointer. Perhaps follow another level, too, just for good measure.
&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;br /&gt;
&lt;br /&gt;
Good call, that worked.&amp;nbsp; You just need three indirections from the delegate pointer on the stack to get the address of the first instruction of the target method.&amp;nbsp; I still need to figure out the layout of the data structures in the intermediate indirections, but using the first word in each seems to do the trick for both static and instance methods.&amp;nbsp; The real problem is determining code size.&amp;nbsp; At the moment I just make a guess of the number of instructions in the function, and keep going until I hit a blr instruction.&amp;nbsp; If &amp;#39;blr&amp;#39; is guaranteed to be the last instruction in every method, then it may be possible to just dump until you see 0x4E800020 (the encoding for blr).&amp;nbsp; This is turning out to be quite educational!&lt;br /&gt;
&lt;p&gt;The ref version of Matrix.Multiply comes in at 521 instructions. :)&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;</description></item><item><title>Re: Vector2 maths slow on 360</title><link>http://forums.xna.com/forums/thread/73066.aspx</link><pubDate>Sun, 06 Jul 2008 14:35:39 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:73066</guid><dc:creator>ajmiles</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/73066.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=73066</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://forums.xna.com//Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;jwatte:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;
&lt;p&gt;I bet you could use unsafe code to do a memory dump of the entire memory image of the executing .NET CLR, and somehow get it back to the PC. Probably through Console.WriteLine() (ugh!) and then take a disassembler to that to see what&amp;#39;s going on. Would be very slow. Perhaps an alternative would be to see if Xbox/PC Live! were interoperable, and try to get data out that way, although I think that&amp;#39;s not going to work.&lt;br /&gt;
&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t see what the problem is with just using the Network API... put them both in a System Link game and away you go... (at 39KB/s), no need to use Console.WriteLine() for that (or screenshots) any more.&lt;/p&gt;</description></item><item><title>Re: Vector2 maths slow on 360</title><link>http://forums.xna.com/forums/thread/73043.aspx</link><pubDate>Sun, 06 Jul 2008 06:33:30 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:73043</guid><dc:creator>jwatte</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/73043.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=73043</wfw:commentRss><description>I would create a delegate for the function, and then cast the delegate to int*, and dump some first and second level indirections from that and see what comes out. I e, dump the first 8 words of the address of the delegate, then the first 8 words of each of those words treated as a pointer. Perhaps follow another level, too, just for good measure.
&lt;p&gt;Then try to disassemble each of those dumps (assuming you get valid addresses at all) and see which one looks like good instructions :-)&lt;/p&gt;
&lt;p&gt;To get the address of a delegate, create a local variable holding it, with some ints or something you can take the address of around it, and hope that it shows up in the middle on the stack. You can probably do this by just looking at the memory window in the debugger.&lt;/p&gt;</description></item><item><title>Re: Vector2 maths slow on 360</title><link>http://forums.xna.com/forums/thread/73037.aspx</link><pubDate>Sun, 06 Jul 2008 04:50:16 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:73037</guid><dc:creator>ShawMishrak</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/73037.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=73037</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://forums.xna.com//Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;jwatte:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;I bet you could use unsafe code to do a memory dump of the entire memory image of the executing .NET CLR, and somehow get it back to the PC. Probably through Console.WriteLine() (ugh!) and then take a disassembler to that to see what&amp;#39;s going on. Would be very slow. Perhaps an alternative would be to see if Xbox/PC Live! were interoperable, and try to get data out that way, although I think that&amp;#39;s not going to work.&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;br /&gt;
&lt;br /&gt;
I don&amp;#39;t know why I have not thought of that before!&amp;nbsp; Sure enough:&amp;nbsp; unsafe code for stack inspection + Debug.WriteLine (in formatted hex) + Hex Workshop + IDA = &amp;quot;static void Main(string[ args)&amp;quot; disassembled. :)&lt;br /&gt;
&lt;br /&gt;
It&amp;#39;s a pain in the behind to figure out the actual function start addresses, but nothing a big memory dump and an IDA analysis can&amp;#39;t solve.&lt;br /&gt;
&lt;br /&gt;
If anyone knows how to get the address of a method in C#, please let me know. :)&lt;br /&gt;</description></item><item><title>Re: Vector2 maths slow on 360</title><link>http://forums.xna.com/forums/thread/73034.aspx</link><pubDate>Sun, 06 Jul 2008 04:24:04 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:73034</guid><dc:creator>jwatte</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/73034.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=73034</wfw:commentRss><description>I only worked on the Mac and BeOS versions, and only back right before it was released, and a little bit after. I did not have much to do with the Windows version of the NetYarouze version or any other such version, honest! (And it certainly rocked compared to the then quite buggy Symantec C++ or the command-line-only MPW)&lt;br /&gt;</description></item><item><title>Re: Vector2 maths slow on 360</title><link>http://forums.xna.com/forums/thread/73023.aspx</link><pubDate>Sun, 06 Jul 2008 03:37:23 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:73023</guid><dc:creator>David Weller</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/73023.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=73023</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://forums.xna.com//Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;Adam Miles:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;You worked for the company responsible for CodeWarrior...! That IDE is the bane of my existance, it is so so poor. Long live Visual Studio.&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m guessing he wasn&amp;#39;t responsible for your pain.&amp;nbsp; And if he was, he certainly didn&amp;#39;t mean it :-)&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s not beat up on the MVPs too much though -- those guys are the backbone of these forums (because the XNA Community Manager got all uppity and quit Microsoft because he put his family first :-)&lt;/p&gt;
&lt;p&gt;Hopefully Shawn Hargreaves or somebody else on the framework team will offer some ideas on what to do.&amp;nbsp; In the meantime, you might want to look/listen to Frank Savage&amp;#39;s talk from last year on &lt;a href="http://www.microsoft.com/downloads/thankyou.aspx?familyId=8450db46-283f-4924-b35c-3ccd1db7e97e&amp;amp;displayLang=en"&gt;CLR optimizations&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Re: Vector2 maths slow on 360</title><link>http://forums.xna.com/forums/thread/73013.aspx</link><pubDate>Sun, 06 Jul 2008 01:44:18 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:73013</guid><dc:creator>ajmiles</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/73013.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=73013</wfw:commentRss><description>You worked for the company responsible for CodeWarrior...! That IDE is the bane of my existance, it is so so poor. Long live Visual Studio.</description></item><item><title>Re: Vector2 maths slow on 360</title><link>http://forums.xna.com/forums/thread/72990.aspx</link><pubDate>Sat, 05 Jul 2008 21:18:59 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:72990</guid><dc:creator>jwatte</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/72990.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=72990</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;learning about PowerPC&lt;/div&gt;&lt;/BLOCKQUOTE&gt;
&lt;p&gt;Most I know I learned from reading the &amp;quot;PowerPC Architecture Compiler Writers Guide&amp;quot; and the &amp;quot;PowerPC System Architecture&amp;quot; documentation -- this was 10-15 years ago, though, when I worked on compilers and debuggers for PowerPC at a company called Metrowerks, and later worked on an OS for multi-CPU PowerPC systems called BeOS. The Xenon is somewhat different, as it&amp;#39;s a later generation embedded chip, but it&amp;#39;s surprisingly similar to the 40x series and the PowerPC 603 core in many of its basics (such as being in-order, etc).&lt;/p&gt;
&lt;p&gt;I bet you could use unsafe code to do a memory dump of the entire memory image of the executing .NET CLR, and somehow get it back to the PC. Probably through Console.WriteLine() (ugh!) and then take a disassembler to that to see what&amp;#39;s going on. Would be very slow. Perhaps an alternative would be to see if Xbox/PC Live! were interoperable, and try to get data out that way, although I think that&amp;#39;s not going to work.&lt;/p&gt;
&lt;br /&gt;</description></item><item><title>Re: Vector2 maths slow on 360</title><link>http://forums.xna.com/forums/thread/72980.aspx</link><pubDate>Sat, 05 Jul 2008 19:17:41 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:72980</guid><dc:creator>Bruno Evangelista</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/72980.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=72980</wfw:commentRss><description>Hum, interesting point.&lt;br /&gt;
&lt;p&gt;Anyway, I feel so clueless in this thread!At least I am learning a lot of things! =P&lt;/p&gt;</description></item><item><title>Re: Vector2 maths slow on 360</title><link>http://forums.xna.com/forums/thread/72976.aspx</link><pubDate>Sat, 05 Jul 2008 19:06:09 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:72976</guid><dc:creator>ShawMishrak</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/72976.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=72976</wfw:commentRss><description>Something else to keep in mind about leaf functions is that it may be impossible to have them in user C# code.&amp;nbsp; I have not looked at the Xbox CLR implementation so I cannot say for certain, but the Desktop CLR does some per-method call validation that compiles down to call instructions in the preamble of each method, even with JIT optimizations enabled.&amp;nbsp; If the same occurs on the Xbox CLR, then user C# methods may never compile to leaf functions.&lt;br /&gt;</description></item><item><title>Re: Vector2 maths slow on 360</title><link>http://forums.xna.com/forums/thread/72971.aspx</link><pubDate>Sat, 05 Jul 2008 18:42:50 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:72971</guid><dc:creator>Bruno Evangelista</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/72971.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=72971</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://forums.xna.com//Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;jwatte:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;calling a leaf function (one that doesn&amp;#39;t call other functions) is actually &amp;quot;free,&amp;quot; through the magic of the link register and branch prediction (call and blr are always predicted taken, so no pipeline bubbles).&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp; Jon, can you point out a good reference where I can find this kind of information?
&lt;p&gt;Sometime ago I read these articles, which contains good knowledge about the Xeon architecture:&lt;br /&gt;
&lt;a href="http://arstechnica.com/articles/paedia/cpu/xbox360-1.ars"&gt; http://arstechnica.com/articles/paedia/cpu/xbox360-1.ars&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://arstechnica.com/articles/paedia/cpu/xbox360-2.ars"&gt;http://arstechnica.com/articles/paedia/cpu/xbox360-2.ars&lt;/a&gt;&lt;/p&gt;
&lt;br /&gt;</description></item><item><title>Re: Vector2 maths slow on 360</title><link>http://forums.xna.com/forums/thread/72892.aspx</link><pubDate>Fri, 04 Jul 2008 19:53:14 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:72892</guid><dc:creator>ShawMishrak</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/72892.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=72892</wfw:commentRss><description>This is just another time when PPC assembly dumps would prove very valuable, if for no other reason than to see exactly what the JIT&amp;#39;er is doing and how to massage your code to help it.&lt;br /&gt;</description></item><item><title>Re: Vector2 maths slow on 360</title><link>http://forums.xna.com/forums/thread/72886.aspx</link><pubDate>Fri, 04 Jul 2008 18:35:14 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:72886</guid><dc:creator>jwatte</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/72886.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=56&amp;PostID=72886</wfw:commentRss><description>Note that using macros only removes function call overhead, not the bad FP code generation.
&lt;p&gt;Part of removing function call overhead is the removal of parameter passing, true, but on the PowerPC, calling a leaf function (one that doesn&amp;#39;t call other functions) is actually &amp;quot;free,&amp;quot; through the magic of the link register and branch prediction (call and blr are always predicted taken, so no pipeline bubbles). The reason I put &amp;quot;free&amp;quot; in quotes is, again, that I&amp;#39;ve heard that the PowerPC Compact CLR passes arguments on the stack rather than in registers, so there&amp;#39;s still stack spill going on which isn&amp;#39;t free.&lt;/p&gt;
&lt;br /&gt;</description></item></channel></rss>