From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 110292,45b50f14dadfce5b X-Google-Attributes: gid110292,public X-Google-Thread: 102b75,45b50f14dadfce5b X-Google-Attributes: gid102b75,public X-Google-Thread: 1164f8,45b50f14dadfce5b X-Google-Attributes: gid1164f8,public From: David Chase Subject: Re: Final kick at the "Merced Guessing Game" Date: 1997/10/08 Message-ID: <343BD179.4B0A@world.std.com>#1/1 X-Deja-AN: 278764350 Sender: news@world.std.com (Mr Usenet Himself) References: <61g30t$o2n@news-rocq.inria.fr> Organization: Natural Bridge LLC Reply-To: chase@world.std.com Newsgroups: comp.sys.intel,comp.arch,comp.sys.dec Robert Harley wrote: > I think your problem is that C is too flexible for you. It doesn't > wrongly assume that there is one way of laying out and accessing > arrays that is appropriate for all purposes. For instance you can > choose a flat array, 'float *a', or a hierarchy like 'float ***a'. C's flexibility has two problems: 1. it is mandatory. 2. it is confined to a set of uninteresting choices. In C, can I choose to have the compiler autoparallelize my dusty deck onto a 16-processors SparcServer 2000? In C, can I choose to have my loops automatically interchanged for better cache use? How about cache blocking? Any automatic vectorizers for C? Oh, I guess I don't get those choices. Given detailed knowledge of a particular chip, working in C, my attempt at a too-big-for-the-cache double-precision matrix multiply obtained only 30 Mflops (this was on a 50 or 55 Mhz SuperSparc, back in 1994). The code in Fortran was about 1/10th the size, and ran at 34 Mflops. Both bits of code contained some hand-optimization, but the C code had much more (the Fortran was simply blocked for cache locality; the C code was blocked for both register and cache locality, as well as software pipelined). Keep in mind that most C programmers don't know how to software-pipeline a loop. Most of them are not sure how to do register blocking. Most of them are not exactly sure how many double-precision registers are on the chip they are using. Most of them don't know the size of the cache on the chip (chip? how about box, since ecache sizes can vary). I'll bet most of them don't know what cache blocking is. And, if they do, I'll bet they forget to check to see if the ecache is physically-indexed direct-mapped or not, and whether the OS is taking care to "color" virtual pages so that non-colliding virtual addresses will also be non-colliding in the external cache. This stuff is awful to do by hand. And this, of course, was just matrix multiplication, it wasn't something tricky to optimize for locality, like GEPP or QR (for QR, so I am told, you must use a different algorithm to get your factorization if you wish to block it for locality). This code is really tedious to write. So, this flexibility gets me what? The privilege of writing 10 times as much code, that runs 10% slower, and is harder to port, understand and maintain? It is mind-boggling to me how persistently ignorant some people working in C are. Someone told you once that C is the fastest language, and it grabbed your brain. Maybe it feels like it just must be fast, because you work so hard to make it fast. Maybe you think that all high-level transformations alike, that since (e.g.) SETL generally runs pretty slowly, that all languages which are not "close to the machine" must therefore run slowly. It is not so. -- David Chase, chase@world.std.com