문제

I'm currently measuring the performance of some code in FLOPS. This code presents some arithmetic negate instructions like this one:

d = -a

where d and a are floating point variables. The architecture I'm currently using does have specific negate instructions. Should I have to take into account this kind of operations to measure FLOPS? What kind of operations account for FLOPS? Is there a convention or anything?

도움이 되었습니까?

해결책

As @Andrey said, to be sure you should check the disassembled code.

But in general, yes, the instruction would likely execute on a FPU. It simply flips a bit, so it could be done on an integer unit as well, but since you're operating on floating point values, these are most likely already loaded into FP registers, and so there'd be a fair amount of overhead to moving them to general purpose registers, flipping the bit and moving them back.

I don't know if there is a complete universal guide to "what should be counted as a FLOP", but this is most likely an instruction which executes on a FPU, and so it is competing with other FP instructions for resources on the CPU, so yes, I would include it in a FLOPS count.

다른 팁

try to disassemble the code and check how this operation is performed.

if it uses instruction FCHS (Change sign) then you can consider it floating point operation.

MSVC (Visual Studio 2008)

    double c = -b;
00971397  fld         qword ptr [b] 
0097139A  fchs             
0097139C  fstp        qword ptr [c] 

fchs - see that?

There is a kind of convention to calculate the FLOPS using LINPACK as a kind of standard benchmark.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top