Skip to content

Hosting jit_stencils.h #115869

Description

@brandtbucher

While this is probably desirable, I'm not quite sure if it's feasible. With that said, several people (@vstinner at the sprint and @zooba during PR review) both expressed a desire to remove the LLVM build-time dependency for JIT builds. Let's have that conversation here.

Background

When building CPython with the JIT enabled, LLVM 16 LLVM 18 is used to compile Tools/jit/template.c many times, and process the resulting object files into a file called jit_stencils.h in the build directory.

A useful analogy

Because this file depends on Python.h (and thus pyconfig.h and many build-specific configuration options, including things like _DEBUG/NDEBUG/Py_DEBUG/etc.) and contains binary code, it is probably most useful to think of jit_stencils.h as a binary extension module.

If we could build, host, and manage compiled versions of, say, itertoolsmodule.c somewhere and have it work correctly for those who need it, then such a scheme would probably work for jit_stencils.h.

Open questions

  • Can this be done in a way that actually works correctly and is worth the trouble (the status quo being "download LLVM 18 if you want to build the JIT").
  • Should we just try to host these for the most common build configurations? Or "everything"?
  • Should all platforms be in one file (with each platform guarded by #ifdefs), or many files?
  • Should these files be checked in? Or hosted somewhere? Who/what builds them? How often?
  • Does this introduce any new attack vectors?
  • What should the workflow look like for:
    • ...those developing the JIT?
    • ...those changing header files that the JIT depends on?
    • ...those building CPython with a JIT from a random commit?
    • ...those building CPython with a JIT from a release tag?

Linked PRs

Activity

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

Metadata

Metadata

Labels

3.13bugs and security fixesbuildThe build process and cross-builddependenciesPull requests that update a dependency filetopic-JIT

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions