[llvm] [llvm-mca] Round UP when formatting Reciprocal Throughput (PR #159544)

Simon Wallis via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 18 06:30:34 PDT 2025


simonwallis2 wrote:

> This is a hack and not a principled solution to the underlying problem.
> 
> I don't think we're using anything other than the basic arithmetic operators inside of MCA to compute the value, so it should be bitwise identical between platforms assuming they are IEEE754 compliant and implement correct rounding on basic arithmetic operators. It would be good to understand why this platform difference exists (different default rounding modes? `format` implementation differences?) before papering over the issue with more arithmetic.

In llvm/tools/llvm-mca, there are 10 instances of
format("%.2f", …)

9 of these instances explicitly round up, using
floor((X * 100) + 0.5) / 100)

This RT output is the 10th instance. This PR brings llvm-mca/InstructionInfoView.cpp into line with the other 9.

https://github.com/llvm/llvm-project/pull/159544


More information about the llvm-commits mailing list