Compiler decisions are static, which just cannot be as good as doing it dynamically at runtime.Alpha_Spartan said:With a good compiler, it's not necessary.
while (1)
{
float delta_t=time_since_last_frame();
if (bullet_time_key_down()) delta_t*=0.25f;
world->animate(delta_t);
}
Depends on what kind of virtual machine you're referring to.Aplha_Spartan said:Secondly, virtual machines have alot of overhead. That would do more harm than good.
If a branch hint can be dynamic and if a compiler has enough instructions to schedule ahead to make the hint effective you have win-win situation, the hint is never counterproductive.zeckensack said:A branch hint (which is the best a compiler can do anyway) that works well for one data set might be counterproductive for another.
I'm not sure I understand what you're saying.nAo said:If a branch hint can be dynamic and if a compiler has enough instructions to schedule ahead to make the hint effective you have win-win situation, the hint is never counterproductive.zeckensack said:A branch hint (which is the best a compiler can do anyway) that works well for one data set might be counterproductive for another.
zeckensack said:I'm not sure I understand what you're saying.nAo said:If a branch hint can be dynamic and if a compiler has enough instructions to schedule ahead to make the hint effective you have win-win situation, the hint is never counterproductive.zeckensack said:A branch hint (which is the best a compiler can do anyway) that works well for one data set might be counterproductive for another.
I only know of branch hints that are tied to a dynamic branch instruction. When the machine encounters the instruction, it continues issuing the instructions on the most likely branch, and (later) rolls back if that turned out wrong. I don't know any machines that a)leave any window for further instructions between a branch hint and the corresponding branch nor b)allow the hints themselves to change over time (without resorting to self-modifying code).
Of course you can combine compiler hints with dynamic hardware predictors, to the effect that the hint given by the compiler stacks with the predictor's current idea of the branch outcome. In that context I agree that there wouldn't be much of a misprediction problem. But then, that's not an entirely static model anymore. IMO the adaptive portion is much more important than the compiler hint. It doesn't hurt all that much to omit the hint if you have an adaptive hardware predictor.
I was talking about a hint instruction which takes as arguments dynamic values (registers, of coursezeckensack said:I'm not sure I understand what you're saying.
I only know of branch hints that are tied to a dynamic branch instruction.
I admit I have zero experience in writing compilers but it doesn't seem to me an insurmountable problem to take advance of SPE's hint instruction, am I asking tuo much?ERP said:By that definition of "good compiler" all compilers suck.
Eheh..it takes AGES..I knowLook at how long VCL takes to hide 4 cycle latency in trivial VU programs, and it still doesn't deal with the general case, put a branch inside a loop and it simply fails.
It doesMfA said:It probably just does an exhaustive search.
Ehhe..VCL is just an advanced preprocessor anyway :?They need to start with something like CoSy this time, not gcc.
nAo said:It doesMfA said:It probably just does an exhaustive search.
Ehhe..VCL is just an advanced preprocessor anyway :?They need to start with something like CoSy this time, not gcc.
I still don't get it. To take the correct path, the branch predicate must be known. Likewise, to give the correct hint, the same (?) predicate must be known. I don't understand how that's beneficial. You're just introducing a second dependency on the branch condition. It must be computed anyway for the branch.nAo said:I was talking about a hint instruction which takes as arguments dynamic values (registers, of coursezeckensack said:I'm not sure I understand what you're saying.
I only know of branch hints that are tied to a dynamic branch instruction.) , so it can know in advance if a branch would be taken or not.
CELL's SPE processors should employ a mechanism like that.
Rightzeckensack said:I still don't get it. To take the correct path, the branch predicate must be known. Likewise, to give the correct hint, the same (?) predicate must be known.
To tell the truth the 2 branch predicates are one, they're the same thing, of course.I don't understand how that's beneficial. You're just introducing a second dependency on the branch condition. It must be computed anyway for the branch.
Sure:Can you whip up some (pseudo) code example to shed some light on the situation?