Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

JIT: Implement unique reference tracking in Tier 2 for reference count optimizations #143414

Copy link
Copy link
@cocolato

Description

@cocolato
Issue body actions

Feature or enhancement

Proposal:

Motivation

We should implement unique reference tracking in Tier 2 to facilitate optimizations that reduce reference counting overhead. For example, when a tuple is known to be uniquely referenced, we can "steal" its element references during unpacking without performing any reference counting operations.

For reference: discussion in #142952

Technical Approach

  1. Reference Tracking Infrastructure
    • Add an REF_IS_UNIQUE bit (bit 1) to the JitOptRef union in pycore_optimizer.h (code reference).
    • Implement PyJitRef_MakeUnique() and PyJitRef_IsUnique() helper functions.
    • Update helper utilities including PyJitRef_StripReferenceInfo and JIT_BITS_TO_PTR_MASKED to support this unique reference bit.
  2. Apply unique reference tracking to UNPACK_SEQUENCE uops
  3. Expand support to more uops
    • After verifying performance and correctness, extend the use of unique reference tracking to additional uops and optimizations as identified.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-JITtype-featureA feature request or enhancementA feature request or enhancement
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.