[Mlir-commits] [mlir] [mlir][IR] Turn `FloatType` into a type interface (PR #118891)

Matthias Springer llvmlistbot at llvm.org
Fri Dec 6 11:25:17 PST 2024


matthias-springer wrote:

I wrote a micro benchmark that parses + prints 32768 floats with random floating-point type: https://gist.github.com/matthias-springer/d22cc02b6097553b78bbba39fed8ca1e

Going through the type interface causes a slowdown compared to the hard-coded sequence of `if` checks in `getFloatSemantics`.

```
Benchmark 1: mlir-opt test.mlir -allow-unregistered-dialect
  BEFORE
  Time (mean ± σ):      43.3 ms ±   1.8 ms    [User: 31.9 ms, System: 11.4 ms]
  Range (min … max):    39.8 ms …  48.3 ms    200 runs

  AFTER
  Time (mean ± σ):      50.3 ms ±   1.8 ms    [User: 38.8 ms, System: 11.5 ms]
  Range (min … max):    47.3 ms …  55.1 ms    200 runs
```


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


More information about the Mlir-commits mailing list