Skip to content

Inline bytecode caches #90997

Description

@brandtbucher
BPO 46841
Nosy @markshannon, @corona10, @pablogsal, @brandtbucher, @neonene, @iritkatriel, @penguin-wwy
PRs
  • bpo-46841: Use *inline* caching for BINARY_OP #31543
  • bpo-46841: Add (undocumented) _co_quickened attribute for code object. #31552
  • bpo-46841: Move the cache for LOAD_GLOBAL inline. #31575
  • bpo-46841: Use inline caching for UNPACK_SEQUENCE #31591
  • bpo-46841: Inline cache for BINARY_SUBSCR. #31618
  • bpo-46841: Use inline caching for COMPARE_OP #31622
  • bpo-46841: Use inline caching for attribute accesses #31640
  • bpo-46841: Improve the failure stats for COMPARE_OP #31663
  • bpo-46841: Fix error message hacks in GET_AWAITABLE #31664
  • bpo-46841: Fix BINARY_OP's handling of inline caches #31671
  • bpo-46841: Use inline caching for calls #31709
  • bpo-46841: Don't use an oparg counter for STORE_SUBSCR #31742
  • bpo-46841: Add a _Py_SET_OPCODE macro #31780
  • bpo-46841: Update adaptive.md for inline caching #31817
  • bpo-46841: Quicken code in-place #31888
  • bpo-46841: Don't scan backwards in bytecode. #31901
  • bpo-46841: Don't jump during throw()  #31968
  • gh-90997: bpo-46841: Disassembly of quickened code #32099
  • bpo-46841: remove no-longer-used macro UPDATE_PREV_INSTR_OPARG #32100
  • bpo-46841: Use a bytes object for _co_code_adaptive #32205
  • bpo-46841: Avoid unnecessary allocations in code object comparisons #32222
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/brandtbucher'
    closed_at = None
    created_at = <Date 2022-02-24.02:17:14.449>
    labels = ['interpreter-core', 'deferred-blocker', '3.11', 'performance']
    title = 'Inline bytecode caches'
    updated_at = <Date 2022-04-01.11:29:28.677>
    user = 'https://github.com/brandtbucher'

    bugs.python.org fields:

    activity = <Date 2022-04-01.11:29:28.677>
    actor = 'Mark.Shannon'
    assignee = 'brandtbucher'
    closed = False
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2022-02-24.02:17:14.449>
    creator = 'brandtbucher'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46841
    keywords = ['patch']
    message_count = 29.0
    messages = ['413875', '413901', '413987', '413988', '414188', '414194', '414261', '414277', '414343', '414349', '414358', '414359', '414364', '414371', '414372', '414378', '414391', '414461', '414490', '414523', '414547', '414696', '414763', '414955', '415307', '415676', '415969', '416482', '416483']
    nosy_count = 7.0
    nosy_names = ['Mark.Shannon', 'corona10', 'pablogsal', 'brandtbucher', 'neonene', 'iritkatriel', 'penguin_wwy']
    pr_nums = ['31543', '31552', '31575', '31591', '31618', '31622', '31640', '31663', '31664', '31671', '31709', '31742', '31780', '31817', '31888', '31901', '31968', '32099', '32100', '32205', '32222']
    priority = 'deferred blocker'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue46841'
    versions = ['Python 3.11']

    Linked PRs

    Activity

    1. brandtbucher commented on Feb 24, 2022

      @brandtbucher
      MemberAuthor

      ...as discussed in faster-cpython/ideas#263.

      My plan is for this initial PR to lay the groundwork, then to work on porting over the existing opcode caches one-by-one. Once that's done, we can clean up lots of the "old" machinery.

    2. self-assigned this
      on Feb 24, 2022
    3. added
      interpreter-core(Objects, Python, Grammar, and Parser dirs)
      performancePerformance or resource usage
      3.11only security fixes
      on Feb 24, 2022
    4. self-assigned this
      on Feb 24, 2022
    5. markshannon commented on Feb 24, 2022

      @markshannon
      Member

      We need to decide what to do about dis.

      I don't think we should have a show_cache option, as the caches are meaningless junk without quickening (maybe we should drop the CACHE opcode, and just use zeroes).

      Instead we should have a show_quickened option, to show the quickened form, which we need to make clear is very much implementation defined.
      E.g. Cinder might show the machine code as well.

      That way, we can present the cache information as extra data on the quickened form, rather than junk instructions.

    6. markshannon commented on Feb 25, 2022

      @markshannon
      Member

      New changeset 0f41aac by Brandt Bucher in branch 'main':
      bpo-46841: Use inline caching for BINARY_OP (GH-31543)
      0f41aac

    7. markshannon commented on Feb 25, 2022

      @markshannon
      Member

      Making this a release blocker, as we really cannot leave this half finished for the release.

      Shouldn't be a problem, as we'll have it done in a week or so.

    8. markshannon commented on Feb 28, 2022

      @markshannon
      Member

      New changeset 424ecab by Brandt Bucher in branch 'main':
      bpo-46841: Use inline caching for UNPACK_SEQUENCE (GH-31591)
      424ecab

    9. 35 remaining items

    10. added a commit that references this issue on Aug 5, 2022
    11. added a commit that references this issue on Aug 5, 2022
    12. added a commit that references this issue on Aug 5, 2022
    13. added a commit that references this issue on Aug 11, 2022
    14. added a commit that references this issue on Aug 19, 2022
    15. iritkatriel commented on Sep 7, 2022

      @iritkatriel
      Member

      Is there anything left to do here?

    16. markshannon commented on Sep 7, 2022

      @markshannon
      Member

      No. This is done.

    17. added a commit that references this issue on Sep 15, 2022
    18. added a commit that references this issue on Mar 11, 2023
    19. added a commit that references this issue on Mar 12, 2023
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    3.11only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usage

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions