name old cpu/op new cpu/op delta BM_mlir_Log2_f32/10 134ns ±15% 45ns ± 4% -66.39% (p=0.000 n=20+17) BM_mlir_Log2_f32/100 1.03µs ±16% 0.12µs ±10% -88.78% (p=0.000 n=20+18) BM_mlir_Log2_f32/1k 10.3µs ±16% 0.7µs ± 5% -93.24% (p=0.000 n=20+17) BM_mlir_Log2_f32/10k 104µs ±15% 7µs ±14% -93.25% (p=0.000 n=20+20) BM_eigen_s_Log2_f32/10 95.3ns ±17% 90.9ns ± 6% ~ (p=0.228 n=20+18) BM_eigen_s_Log2_f32/100 907ns ± 3% 911ns ± 6% ~ (p=0.539 n=16+20) BM_eigen_s_Log2_f32/1k 9.88µs ± 4% 9.85µs ± 3% ~ (p=0.790 n=16+17) BM_eigen_s_Log2_f32/10k 105µs ±10% 110µs ±16% ~ (p=0.459 n=16+20) BM_eigen_v_Log2_f32/10 32.5ns ±31% 33.9ns ±14% +4.31% (p=0.028 n=17+20) BM_eigen_v_Log2_f32/100 176ns ± 8% 180ns ± 7% +2.19% (p=0.045 n=16+17) BM_eigen_v_Log2_f32/1k 1.44µs ± 4% 1.50µs ± 9% +3.91% (p=0.001 n=16+17) BM_eigen_v_Log2_f32/10k 14.5µs ±10% 15.0µs ± 8% +3.92% (p=0.002 n=16+19)
Details
- Reviewers
ezhulenev - Commits
- rGc0891706bc9f: [mlir] Add polynomial approximation for math::Log2
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Update D98282: [mlir] Add polynomial approximation for math::Log2
Wrap the benchmark results in `quotes```.
mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp | ||
---|---|---|
273 | I am having trouble understanding what you are suggesting. Can you please elaborate? |
mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp | ||
---|---|---|
273 | Can you document the API? (in particular the base2 parameter). Also the convention in MLIR is to not put free functions in anonymous namespaces but have them static outside. | |
mlir/test/Dialect/Math/polynomial-approximation.mlir | ||
12–14 | Nit: this check is not useful considering the one above. | |
13 | What is different here compared to the math.log two lines above? Did you mean math.log2 here? | |
23–25 | Similarly, you can omit this check, it is redundant with above. |
mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp | ||
---|---|---|
273 | template<typename Op> class LogApproximationBase : public OpRewritePattern<Op> class Log2Approximation : public LogApproximationBase<math::Log2Op> |
- Test fixes as suggested by mehdi_amini.
- Log base class as suggested by ezhulenev.
mlir/test/Dialect/Math/polynomial-approximation.mlir | ||
---|---|---|
13 | Yes, I meant log2. Fixed, thanks! |
Maybe just inherit template from OpRewritePattern and instantiate log/log2 rewrites from it?