[Mlir-commits] [mlir] Added free-threading CPython mode support in MLIR Python bindings (PR #107103)
Stella Laurenzo
llvmlistbot at llvm.org
Fri Dec 27 21:14:16 PST 2024
stellaraccident wrote:
> I've been testing free threading in JAX and found that this something very close to this change (see my branch above) was sufficient to eliminate all the TSAN errors I saw from MLIR Python bindings, outside things that I believe are false positives or intentionally not thread-safe (e.g., IR dumping).
>
> I'd propose we land and iterate? I don't think any of the substantive changes here are likely to be surprising or controversial, and while they may not fix all possible races they certainly fix enough to be useful. They should also have little downside if you aren't enabling free-threading, since, e.g. `nb::ft_lock_guard` expands to nothing at all if free-threading isn't enabled.
>
> I suspect the test here may be the most interesting piece to discuss (it uses pytest, which is new, and is best run under TSAN, which you may or may not have in your CI infrastructure for MLIR Python), but if that is going to prove a matter for a long debate I'd suggest iterating on it in a separate PR.
Works for me. Iirc, I got hung up on this needing a pybind version bump and then just got too busy and forgot. But your upgrade to nanobind handled the compatibility issue.
Once landed, one of us should update the docs to call out the level status and known pointy bits. Not blocking, though.
https://github.com/llvm/llvm-project/pull/107103
More information about the Mlir-commits
mailing list