Skip to content

ENH: testing.lazy_xp_function: torch.compile support? #664

Description

@lucascolley

Hey @crusaderky @rgommers , how feasible is it to add support for torch.compile to xpx.lazy_xp_function, such that we could have a torch_compile=True like jax_jit=True in SciPy?

cc @steppi perhaps you have also thought about this.

Activity

  1. lucascolley commented on Mar 31, 2026

    @lucascolley
    Author
  2. steppi commented on Mar 31, 2026

    @steppi
    Contributor

    cc @steppi perhaps you have also thought about this.

    It's something I've been planning to look into but I haven't gotten to it yet. Thanks for taking the initiative on this.

  3. crusaderky commented on Mar 31, 2026

    @crusaderky
    Contributor

    I am utterly ignorant of how torch.compile works, so I cannot answer this question without substantial analysis.

  4. lucascolley commented on Apr 2, 2026

    @lucascolley
    MemberAuthor

    Had a quick chat with claude and it was optimistic that pretty much the same approach as jax_autojit would work, using torch.utils._pytree.register_pytree_node instead.

  5. lucascolley commented on Apr 3, 2026

    @lucascolley
    MemberAuthor

    I opened a draft PR at gh-668, would be grateful if anyone could take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions