Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fall back to cr_sin and cr_cos in our implementation of Sin and Cos #4114

Merged
merged 11 commits into from
Oct 15, 2024

Conversation

pleroy
Copy link
Member

@pleroy pleroy commented Oct 14, 2024

The fallback happens:

  1. When the sum of the main result and its perturbation exhibits the dangerous bit configurations 1000... or 0111....
  2. When the angle is too large or too hard to reduce.

Benchmarks:

2024-10-22T19:22:41+02:00
Running C:\Users\phl\Projects\GitHub\Principia\Principia\Release\x64\benchmarks.exe
Run on (48 X 3793 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x24)
  L1 Instruction 32 KiB (x24)
  L2 Unified 512 KiB (x24)
  L3 Unified 32768 KiB (x4)
------------------------------------------------------------------------------------------------------
Benchmark                                                            Time             CPU   Iterations
------------------------------------------------------------------------------------------------------
BM_EvaluateElementaryFunction<Metric::Latency, std::sin>          13.4 ns         13.4 ns     56000000 cycles: 50.7822
BM_EvaluateElementaryFunction<Metric::Throughput, std::sin>       3.87 ns         3.84 ns    179200000 cycles: 14.6495
BM_EvaluateElementaryFunction<Metric::Latency, cr_sin>            94.5 ns         94.2 ns      7467000 cycles: 358.553
BM_EvaluateElementaryFunction<Metric::Throughput, cr_sin>         92.4 ns         92.1 ns      7467000 cycles: 350.505
BM_EvaluateElementaryFunction<Metric::Latency, Sin>               16.6 ns         16.5 ns     40728000 cycles: 62.9482
BM_EvaluateElementaryFunction<Metric::Throughput, Sin>            9.28 ns         9.21 ns     74667000 cycles: 35.1488
BM_EvaluateElementaryFunction<Metric::Latency, std::cos>          13.8 ns         13.8 ns     49778000 cycles: 52.239
BM_EvaluateElementaryFunction<Metric::Throughput, std::cos>       3.96 ns         3.92 ns    179200000 cycles: 14.9813
BM_EvaluateElementaryFunction<Metric::Latency, cr_cos>            94.9 ns         96.3 ns      7467000 cycles: 359.769
BM_EvaluateElementaryFunction<Metric::Throughput, cr_cos>         92.4 ns         92.1 ns      7467000 cycles: 350.24
BM_EvaluateElementaryFunction<Metric::Latency, Cos>               16.7 ns         16.9 ns     40728000 cycles: 63.1369
BM_EvaluateElementaryFunction<Metric::Throughput, Cos>            9.44 ns         9.42 ns     74667000 cycles: 35.7906

#1760.

@eggrobin eggrobin added the LGTM label Oct 14, 2024
@pleroy pleroy merged commit 6afb36e into mockingbirdnest:master Oct 15, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants