[fpc-pascal] FPC Graphics options?

Karoly Balogh (Charlie/SGR) charlie at scenergy.dfmk.hu
Fri May 19 16:39:37 CEST 2017


Hi,

On Fri, 19 May 2017, Reimar Grabowski wrote:

> Final: The render function takes about 90%, the cast-to-int about 5%. No
> other interesting functions shown. So the missing time must be spent
> doing floating point math and branching (ifs), as that's all the render
> function does.

Well, if I comment out the three additions where the ray is actually
traced and the tex := line, it's actually 60fps on my macbook. But
actually the real difference is made with the additions. If i comment out
everything, but those 3 (4 in fact) additions are in still there, it's
still slow.

Which made me thinking. I think you can vectorize that quite easily, and
use some packed SIMD instruction, maybe that will make a difference. C/C++
has some compiler intrinsics for that. I can't remember from the top of my
head if it's doable with FPC. Someone who feels like fiddling with this,
might want to try some assembly magic there, if it's possible somehow...

And actually, when looking at the generated code, it's a typical code
which suffers from the fact that FPC's SSA is switched off in loops right
now. So the registers are reused in a way, which are a recipe for a
pipeline stall, especially with SIMD, plus it has a few unnecessary moves.
So guess what. See my previous mail.

Charlie

(Ps: Yeah, talking about code generated with fastmath optimizations on,
and SSE3.)



More information about the fpc-pascal mailing list