Skip to content

BUG: free-threaded dynamic loop addition and ideally loop replacements in ufuncs #31083

@seberg

Description

@seberg

I didn't think this would get back so quickly, but we should allow dynamic addition of loops in ufuncs.
Previously, this was OK at least when done during promotion (which is to me the interesting part -- other times could add their own lock, but this path cannot).

Now, we could just disable the duplicate addition check and things will probably work, but not sure what is best.
I am not sure there is much of a point to not just lock everything when we do promotion (promotion should be very rare!).

I also would like to allow loop replacement eventually, and this has come around a bit quicker now as well.
Now, that requires clearing the cache, which is already similar to what is happening when growing, but the trivial way to add it requires leaking the cache buckets (which growing also currently does?!).

We can just move back the locking one level up, but I do wonder a bit if all of this is actually worth it compared to an RWlock?

Right now, I added dynamic loops for imag/real, but it is internal, so there is the "ignore that it is already added" flag public already.

CC @kumaraditya303 and @ngoldbaum.

Metadata

Metadata

Assignees

No one assigned

    Labels

    00 - Bug39 - free-threadingPRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions