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

[mypyc] Use a native unboxed representation for floats #14880

Merged
merged 56 commits into from
Mar 14, 2023
Merged

Commits on Mar 11, 2023

  1. [mypyc] Use an unboxed representation for floats

    Instead of each float value being a heap-allocated Python object, use
    unboxed C doubles to represent floats. This makes float operations
    much faster, and this also significantly reduces memory use of floats
    (when not stored in Python containers, which always use a boxed
    representation).
    
    Update IR to support float arithmetic and comparison ops, and float
    literals.
    
    Also add a few primitives corresponding to common math functions, such
    as `math.sqrt`. These don't require any boxing or unboxing. (I will add
    more of these in follow-up PRs.)
    
    Use -113.0 as an overlapping error value for floats. This is similar
    to native ints. Reuse much of the infrastructure we have to support
    overlapping error values with native ints (e.g. various bitmaps).
    
    Also improve support for negative float literals.
    
    There are two backward compatibility breaks worth highlighting. First,
    assigning an int value to a float variable is disallowed within mypyc,
    since narrowing down to a different value representation is
    inefficient and can lose precision. Second, information about float
    subclasses is lost during unboxing.
    
    This makes the bm_float benchmark about 5x faster and the
    raytrace benchmark about 3x faster.
    
    Closes mypyc/mypyc#966 (I'll create separate issues for remaining open
    issues).
    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    5620f68 View commit details
    Browse the repository at this point in the history
  2. Fix after rebase

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    0ea696d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3d5f397 View commit details
    Browse the repository at this point in the history
  4. Support float default args

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    8954cc9 View commit details
    Browse the repository at this point in the history
  5. WIP mixed operations test case

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    62abec1 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c8214d0 View commit details
    Browse the repository at this point in the history
  7. Add run tests

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    f222c1f View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    80ebe04 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    8ae9c98 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    9d874ce View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    916cda9 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    3bbc76a View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    c208066 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    218def2 View commit details
    Browse the repository at this point in the history
  15. Improve run tests

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    de5dd64 View commit details
    Browse the repository at this point in the history
  16. Make +x a no-op for floats

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    c1cdda1 View commit details
    Browse the repository at this point in the history
  17. Fix float negation

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    47acc06 View commit details
    Browse the repository at this point in the history
  18. More tests

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    8dbd05a View commit details
    Browse the repository at this point in the history
  19. Fix float abs

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    fc5cd16 View commit details
    Browse the repository at this point in the history
  20. Add more test cases

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    0b2a642 View commit details
    Browse the repository at this point in the history
  21. Add primitive for math.exp

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    1cb15ca View commit details
    Browse the repository at this point in the history
  22. Add primitive for math.floor

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    987d93e View commit details
    Browse the repository at this point in the history
  23. Add primitive for math.ceil

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    1054d4a View commit details
    Browse the repository at this point in the history
  24. Add primitive for math.fabs

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    f54e618 View commit details
    Browse the repository at this point in the history
  25. Add primitive for math.log

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    d7e044e View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    2d3b7a3 View commit details
    Browse the repository at this point in the history
  27. Add more float values to test

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    289bc29 View commit details
    Browse the repository at this point in the history
  28. Black

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    2de8e0b View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    2141f4d View commit details
    Browse the repository at this point in the history
  30. Refactor test cases

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    c98c043 View commit details
    Browse the repository at this point in the history
  31. Add primitive for math.pow

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    40e991a View commit details
    Browse the repository at this point in the history
  32. Refactor test case

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    fd117e6 View commit details
    Browse the repository at this point in the history
  33. Add docstrings

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    d721828 View commit details
    Browse the repository at this point in the history
  34. Fix test cases

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    6205767 View commit details
    Browse the repository at this point in the history
  35. Fix math.pow on Python 3.11

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    9a4db2d View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    4c89337 View commit details
    Browse the repository at this point in the history
  37. Update i64 test case

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    71d8568 View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    1462b9f View commit details
    Browse the repository at this point in the history
  39. isort and lint

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    0d710b1 View commit details
    Browse the repository at this point in the history
  40. Configuration menu
    Copy the full SHA
    4b4b7a1 View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    72db9fc View commit details
    Browse the repository at this point in the history
  42. Update test case

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    4a4376c View commit details
    Browse the repository at this point in the history
  43. Configuration menu
    Copy the full SHA
    bdca8ab View commit details
    Browse the repository at this point in the history
  44. Fix type check

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    cc2aedf View commit details
    Browse the repository at this point in the history
  45. Add test case

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    937df67 View commit details
    Browse the repository at this point in the history
  46. Fix test case

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    e8e694f View commit details
    Browse the repository at this point in the history
  47. Add test case

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    00fd468 View commit details
    Browse the repository at this point in the history
  48. Configuration menu
    Copy the full SHA
    01f670b View commit details
    Browse the repository at this point in the history
  49. Update test case

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    6cd75b8 View commit details
    Browse the repository at this point in the history
  50. Configuration menu
    Copy the full SHA
    6384c03 View commit details
    Browse the repository at this point in the history
  51. Configuration menu
    Copy the full SHA
    a177197 View commit details
    Browse the repository at this point in the history
  52. Configuration menu
    Copy the full SHA
    3c5931d View commit details
    Browse the repository at this point in the history
  53. Work around mypyc bug

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    8ab5e25 View commit details
    Browse the repository at this point in the history
  54. Work around another issue

    JukkaL committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    e85f057 View commit details
    Browse the repository at this point in the history

Commits on Mar 12, 2023

  1. Fix test on 3.11

    JukkaL committed Mar 12, 2023
    Configuration menu
    Copy the full SHA
    e45dba5 View commit details
    Browse the repository at this point in the history

Commits on Mar 14, 2023

  1. Add subnormal values

    JukkaL committed Mar 14, 2023
    Configuration menu
    Copy the full SHA
    c9d7147 View commit details
    Browse the repository at this point in the history