Re: Circular references (was Re: [Algorithms] Reference counting hell... what is a good paradigm.)
Brought to you by:
vexxed72
From: Gil G. <gg...@ra...> - 2000-12-29 03:05:27
|
> Gil Gribb wrote: > > >> Jim Offerman wrote: > >> >The overhead of using smart pointers or id<->pointer mappings is > becoming > >> >negligiable these days ... > >> > >> Careful, not everyone on here targets (Intel-based) PCs. > >> > >> While your statement might be true for a PC sporting a CPU with a large > L2 > >> cache, it can (read will) be quite detrimental on, say, a PS2 that > doesn't > >> have one. > > > >Well, you offer no alternative. As I have pointed out pointers simply > don't > >work for game entity cross references. I have a constant time scheme that > >takes perhaps a dozen cycles, and it has exactly the same cache behaviour > as > >a pointers. Not much is going on today, so I will show a detailed example. > > > I merely meant to point out that on e.g. the PS2, hardly any memory > accesses > are "negligible". As it only has an 8K 2-way associative data cache, you > really should go to great lengths to avoid ever reading outside the cache > (by making use of the 16K scratchpad RAM, using tight data structures, > etc). What sort of games have you written? You have a 32 MB machine and you are telling me to avoid EVER reading outside of 8K? Crazy talk. > This drastically conflicts with programming a PC with a large L2-cache > and has serious repercussions on how you design things. Well, again, you have offered no alternatives other than "write you program to fit in 8K of L1 cache". The lack of an L2 cache was one of the most surprising things I noticed when I first review the psx2 docs. For example, this is an email I sent to my team on march 15th: <Looking at the psx2 docs, I noticed alot of discussion of avoiding L1 cache <misses. It just occured to me, the psx2 has no L2 cache! This is really <going to change the notion of what is reasonably fast. Consider for example <that a P3 could be produced for about 40% of the current cost if it didn't <have a L2 cache. The original celeron had no L2 cache and it was a <performance disaster. <I'm really starting to question if a huge C++ codebase like UT can ever run <reasonably on the psx2. So it isn't like I am unaware of the issues. > I'm sure this is one reason why we initially heard lots of PC developers > complain about how hard the PS2 was to program for. Nope, not at all. We found it difficult because the sony sample code for the graphics end of things is total garbage. The fastest graphics code, written by someone whos full time job it is to write such code, was simply wrong, in at least 3 ways. We figured it out thought, mostly. I still don't have good mip mapping, but we are close. I must say the hardware is very very cool, but sony has not provided the code needed to take advantage of it. Our graphics code is essentially from scratch and is much much better than anything sony provided, writing that is what was hard. > I didn't mean to comment on the smart pointers vs. ID-to-pointer issue > at all. Just to point out that on the PS2 any level of memory indirection > can be quite expensive and should be avoided (if possible, of course). Well, indirection is absolutely critical to algortihm design. I'm not writing tetris here, I fully expect to have more than 5MB of source code. > Of course, there will always be things such as time-memory trade-offs, > but thinking about how to stay in cache should be the #1 thing in a > PS2 programmer's mind. So, you are saying "don't use any algorithm that goes outside the 8K L1 cache?"....nonsense. You seem to be saying that the ps2 is crippled by the lack of an L2 cache....I don't see that. Just like they taught us in school, algorithms are good or bad regardless of the hardware. Sorry for the harshness. -Gil > I'm not really at liberty to discuss the PS2 hardware further here (due to > NDAs and all that crap), but the above info is all available on the net, > at e.g. > > http://www.anarchists.co.uk/html/isscc.html > > for anyone who is interested in more detail. > > > Christer Ericson > SCEA, Santa Monica > > > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list |