3 ms·
ffast-math is not needed when you unroll manually and write your own accumulators. See my benchmarks [1] with fast-math in the middle and the generated assemb
by mratsim 7y ago
ffast-math is not needed when you unroll manually and write your own accumulators.
See my benchmarks [1] with fast-math in the middle and the generated assembly comparison at the bottom.
The base language is Nim but pure C code should generate the same assembly.
[1] https://github.com/numforge/laser/blob/e660eeeb723426e80a7b1187864323d85527d18c/benchmarks/fp_reduction_latency/reduction_bench.nim#L304-L331 https://github.com/numforge/laser/blob/e660eeeb723426e80a7b1....
- keldaris 7y agoThat's absolutely right (and thank you for the reference), but this benchmark starts off with fairly naive code where -ffast-math may still help considerably.
- mratsim 7y agoIf in-between the start and the end, I went up to 8 accumulators and in files in the same folder I have the same with SSE and AVX instructions. I actually wanted to know exactly what ffast-math did, down to the codegen (so you have assembly at the bottom).