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

Mitigate catastrophic cancellation in cross products and other code #435

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Commits on Apr 21, 2020

  1. Math: benchmark vector dot() and cross().

    Have to do some precision improvements, so a baseline is needed. The
    debug perf is beyond awful, actually.
    mosra committed Apr 21, 2020
    Configuration menu
    Copy the full SHA
    341a497 View commit details
    Browse the repository at this point in the history
  2. Math: make cross() 10x faster in Debug.

    And the Vector3 version 5% slower in Release, on GCC at least. FFS,
    what was I thinking with the gather() things. Nice in user code,
    extremely bad in library code.
    mosra committed Apr 21, 2020
    Configuration menu
    Copy the full SHA
    573125d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    fc3382e View commit details
    Browse the repository at this point in the history
  4. [wip] Math: improve precision of cross().

    While this makes 32-bit float cross product precision basically
    equivalent to a 64-bit calculation casted back to 32-bit, it stays with
    the speed halfway between the straightforward 32- and 64-bit
    implementation.
    
    However only on platforms that actually have a FMA instruction. For
    example on Emscripten the code is TEN TIMES slower than the baseline
    implementation, which is not an acceptable tradeoff -- there simply
    using doubles to calculate the result is faster. And enabling the more
    precise variant only on some platforms doesn't seem like a good idea for
    portability.
    
    Stashing this aside until I'm clearer what to do with this.
    mosra committed Apr 21, 2020
    Configuration menu
    Copy the full SHA
    b76a1a0 View commit details
    Browse the repository at this point in the history