hrubin@pop.stat.purdue.edu (Herman Rubin) (05/07/91)
In article <820@cadlab.sublink.ORG>, martelli@cadlab.sublink.ORG (Alex Martelli) writes: > mccalpin@perelandra.cms.udel.edu (John D. McCalpin) writes: ... > :theory, but all too often I find that the various machine's > :optimizers require *slightly* different code --- there is no one piece > :of code (even a nice block-mode version) that optimizes well on a > :broad range of scalar platforms.... Matrix multiply is a good example > Yes, I do agree with that - which speaks well for Dan Bernstein's idea > of having a language construct to say to the compiler: here are 2/3/N > different implementations of the SAME programming semantics, now please > choose the one that's fastest on THIS machine! This way we would still have > to do the hand-tweaking initially, but once ouur code performs well o, say, > half a dozen platforms, we stand a far better chance to be able to just > compile and run fast on any new platform... and this holds not only for > numerical codes, but for much bread and butter stuff as well, e.g. an > explicit 'strcpy(a,b);' versus 'while(*a++=*b++);' where some machines and > compilers might be able to inline the call, and others might not, just to > give a trivial example. Now how do we get the idea across to the computer people? One does not need something as complicated as matrix multiply, vector add is enough. The idea that there is a good language, and all the information the user needs to supply to the compiler is made available by machine-independent programming in that language, is what is debilitating. The user who understands the capabilities of the machine instructions is also likely to think of these things. This includes the addition of "primitive" operations to the language. It is true that any operation on any computer can be emulated in any of the present languages, but not necessarily well. Even more than inlining is making intrinsic. This is effectively doing a macro expansion of the instruction into machine primitives, with the full capabilities of register assignment, etc., so that full optimization can be carried out. -- Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399 Phone: (317)494-6054 hrubin@l.cc.purdue.edu (Internet, bitnet) {purdue,pur-ee}!l.cc!hrubin(UUCP)