This is an archive of the discontinued LLVM Phabricator instance.

[libc] Implement sincosf function correctly rounded to all rounding modes.
ClosedPublic

Authored by lntue on Aug 1 2022, 7:03 AM.

Details

Summary

Refactor common range reductions and evaluations for sinf, cosf, and
sincosf. Added exhaustive tests for sincosf.

Performance before the patch:

System LIBC reciprocal throughput : 30.205
LIBC reciprocal throughput        : 30.533

System LIBC latency : 67.961
LIBC latency        : 61.564

Performance after the patch:

System LIBC reciprocal throughput : 30.409
LIBC reciprocal throughput        : 20.273

System LIBC latency : 67.527
LIBC latency        : 61.959

Diff Detail

Event Timeline

lntue created this revision.Aug 1 2022, 7:03 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 1 2022, 7:03 AM
lntue requested review of this revision.Aug 1 2022, 7:03 AM
lntue updated this revision to Diff 449034.Aug 1 2022, 8:46 AM

Add an exceptional value from exhaustive testing.

orex accepted this revision.Aug 1 2022, 3:45 PM
This revision is now accepted and ready to land.Aug 1 2022, 3:45 PM
lntue updated this revision to Diff 449190.Aug 1 2022, 11:12 PM

Add performance numbers.

lntue edited the summary of this revision. (Show Details)Aug 1 2022, 11:15 PM
lntue updated this revision to Diff 450086.Aug 4 2022, 11:36 AM

Move cos exceptional values to cos.cpp and add missing dependency in bazel.

This revision was landed with ongoing or failed builds.Aug 5 2022, 6:58 AM
This revision was automatically updated to reflect the committed changes.

are the performance numbers for sinf, for cosf, or for random calls?

lntue added a comment.Aug 23 2022, 4:30 PM

are the performance numbers for sinf, for cosf, or for random calls?

The performance is for the following unary function that I added to a local copy of the perf.sh tool from CORE_MATH project:

float scf(float x) {
  float sf, cf;
  sincosf(x, &sf, &cf);
  return sf;
}
libc/src/math/generic/sincosf.cpp