From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 102b75,45b50f14dadfce5b X-Google-Attributes: gid102b75,public X-Google-Thread: 110292,45b50f14dadfce5b X-Google-Attributes: gid110292,public X-Google-Thread: 1164f8,45b50f14dadfce5b X-Google-Attributes: gid1164f8,public From: Patrick F. McGehearty Subject: Re: Final kick at the "Merced Guessing Game" Date: 1997/10/02 Message-ID: <610gbg$k3t@deadzone.rsn.hp.com>#1/1 X-Deja-AN: 277339338 Sender: patrick@rsn.hp.com References: <3431A2DB.4273@EasyInternet.net> <60uek7$fon$1@lyra.csx.cam.ac.uk> <60ui2q$33a$1@cdn-news.telecom.com.au> <60vj9p$7mg@vidar.diku.dk> Organization: Convex Technology Center of Hewlett Packard, Richardson, Tx USA Reply-To: patrick@convex.COM (Patrick F. McGehearty) Newsgroups: comp.sys.intel,comp.arch,comp.sys.dec In article <60vj9p$7mg@vidar.diku.dk>, Torben AEgidius Mogensen wrote: >pcm@vus002.telecom.com.au (P Murray) writes: > >>Nick Maclaren (nmm1@cus.cam.ac.uk) wrote: > >>: For efficient use of modern architectures, we need languages in which we >>: programmers can express what we want to say in a fashion that can be >>: converted to the sort of instruction stream that executes fast. And >>: the current trends are in exactly the opposite direction. > >>Any suggestions on what such a language would look like? Hopefully >>it will not look like ASM. Would it be possible to modify C/C++ in >>such a way as to allow this? > >A possibility is SML using the region-based memory model. You would >still do pointer cahsing, but the regions model keep a fairly good >locality (elements of the same list stay close, even when other data >is allocated in-between). In SML you also avoid most of the aliasing >problems of C/C++. The technology still needs a few years to be >competitive with C. One problem is that the polymorphic type system in >SML introduces extra indirections (boxing). This can be solved if you >compile the entire program in one job, as the polymorphism can be >eliminated when all uses are known. Though, theoretically, this can >give an exponetial blow-up in code size, experiments show that the >code expansion is usually small. > Code expansion is not the problem. Compile time is. Large development projects involve 100's of modules of code in the 100,000 to 1,000,000 lines of code range. It only takes one unbounded non-linear optimization algorithm to cause full-program compiles to take so long that you start worrying about the halting problem. That is, after a couple of days of computing, you don't know if the compiler is in an infinite loop or still computing. The "couple of days" is not an exaggeration. I've seen a 1000 line program take over a day due to a single unbounded non-linear optimization algorithm. As someone working professionally in compiler performance for the last few years, I'll take any help I can get from language definition to bound the amount of code that must be examined to determine if an optimization is safe. Since I've been in graduate school (over 20 years ago), I've been hearing about how this language feature or that can be optimized, but I've seldom seen these optimizations actually be performed. It takes a lot of work to cover all the cases, and rarely used language features are often ignored when it comes time to enhance optimizers. Nick is absolutely dead-on when he identifies the aliasing problem as one of the most troubling in C. Fortran avoids that problem by defining it away. Users are seldom aware of the compiler switches which say "ignore aliasing". In addition, the switches are different for different platforms, so standard make files for multiplatform products don't use them. A plausible compromise for future languages would be to have a default that assumes Fortran aliasing rules and to require a declaration to allow aliasing when it is needed. Then most of the time, the compiler can generate fast code and only when aliasing is strictly needed will optimization be degraded. On the C++ virtual function issue, what is needed is more training of C++ programmers to avoid inefficient constructs except when they are really necessary, and to provide whatever language advisories possible to help the compiler along. While processor speeds continue to increase at exponential rates, memory latencies are improving much more slowly. Ten years ago, the cost of a non-cache memory access was less than 10 instructions. Four years ago, it was less than 40 instructions. Now it is well over 100 instructions on super-scalar architectures. The exact numbers will vary depending on which architectural family you look at, but the trend line is clear. And everything I'm aware of indicates that it will only get worse in the future. Virtual functions that cannot be optimized to static addresses at compile or link time are the enemy of performance, and future processor speed improvements will only make situation more extreme. - Patrick McGehearty patrick@convex.hp.com