Author: Dann Corbit
Date: 13:45:25 09/17/01
Go up one level in this thread
On September 17, 2001 at 16:38:39, Heiner Marxen wrote: >On September 17, 2001 at 04:19:20, Vincent Diepeveen wrote: > >[snip] >>However the problem is that the compiler rewrites those branches! What >>i would need is a single option in the compiler to not rewrite the >>fallthrough principle of a branch. So use an extra instruction like >>unconditional jumps to garantuee the branch. >> >>I'm not a compiler expert of course to know this, but even better >>for and perhaps doable would be a special statement inside the code >>letting the compiler know that this branch must follow fallthrough >>principle and shouldn't get rewritten. That's even better! > >I have thought about this kind of optimization (and its possible failure) >myself repeatedly over the years. >While I'm not exactly a "compiler expert", I've seen and extended C compiler >code generations and optimizers. > >What you suggest is a "pragma", an explicit hint by the programmer. >The statement basically is that a certain condition very rarely evaluates >to TRUE (or FALSE). That sounds fine. But it can be improved. >Sometimes it is important exactly how rare that condition is, in order >to determine the best code for it. I.e. I would like to express a >numeric frequency, like 1 in 4, 1 in 10 or even 1 in 10000. > >Taking this a step further I come to the conclusion, that I (the programmer) >do NOT want to state these frequencies, but rather want the computer >to gather this kind of statistical information (how rare are some branches). >The idea is to have an instrumented executable which gatheres this data, >and us it for a second compiler run. > >In fact, I have seen such an optimization sceme in place on a HP-UX machine. >When I tried to use it, it resulted in an additional speedup between >5% and 23% (!) over normal optimization. That was for Chest on a >HPPA machine, HP's RISC architecture. > >Instead of a pragma, which I have to provide (and which may be wrong), >I much rather would like to have a data collection phase, and an optimization >based on such profiling data. > >I'm not sure what plans the gcc guys have in their pipeline, but I would >not be surprised if there were plans to do something along the above idea. The Intel compiler also does this. They call it PGO (Program Guided Optimization).
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.