Skip to content

About

Infernux-maintained llvmlite fork for CPU JIT compilation and LLVM resource management.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

3,144 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

llvmlite

Infernux maintenance fork

This is an upstream-derived dependency of the Infernux game engine's CPU JIT work. It is not a Taichi backend or an Infernux plugin. The original llvmlite API, copyright notices and license remain in place; upstream documentation follows.

The infernux-support branch is the sole maintained Infernux mainline. It is based on the upstream v0.49.0 release, matching Numba 0.67's llvmlite>=0.49,<0.50 requirement. Infernux builds use a local version suffix (0.49.0+infernux.N), not a renamed import package. Other upstream branches and tags are reference snapshots, not additional Infernux release lines. This CPU dependency is not a substitute for the GPU compiler.

Build wheels with the upstream python setup.py bdist_wheel command and LLVM 22's CMake package on CMAKE_PREFIX_PATH. Run the binding tests and Infernux CPU JIT tests against the installed wheel before promotion. Do not copy an experimental DLL into an existing editor environment. These wheels retain the llvmlite distribution name; they are not published into the upstream project's PyPI namespace. Engine dependency/channel integration and non-Windows validation remain separate release gates.

Release wheels also carry NOTICE.runtime and the licenses of the native compression libraries included by wheel repair. Windows wheels include the Microsoft runtime license separately; it is not covered by the fork's BSD license. Keep this inventory aligned with the actual repaired wheel when updating the LLVM toolchain.

Windows packaging reads UTF-8 metadata explicitly. DLL load diagnostics keep the UTF-8 filename separate from LLVM 22's ANSI system-error suffix, so localized Windows installations report the original load failure without a decoding error.

The changes here repair native optimization-pass disposal and release the instrumentation callbacks owned by each PassBuilder. Regression tests check that closing a pass manager invokes its native destructor exactly once. MCJIT engines also expose memory_statistics: current and peak mapped bytes for code/data pages, including allocator padding. Both existing memory-manager choices retain their allocation behavior; the counters follow the engine's lifetime without a process-global tracking table. These are not total RSS or compiler IR measurements. The original C creation entry point is retained. These fixes do not by themselves implement an executable-code memory budget. Infernux's dispatcher retirement work is separate. The fork is not yet the dependency installed by the public Infernux wheel.

这是 Infernux 游戏引擎 为 CPU JIT 维护的 llvmlite 分支,不是插件,也不参与 Taichi 的 Vulkan 编译路径。 当前修改针对 LLVM 优化资源的释放问题,保留上游 API、版权与许可证。 MCJIT 新增实际代码/数据映射页的当前与峰值字节统计,包含分配器对齐开销; 沿用现有两种内存管理器,不另建全局对象表。统计不等于进程总内存或编译器 IR 占用。 这些修复不等于完整的机器码内存管理已经完成;公开的引擎 wheel 暂未切换到此分支。

Upstream: numba/llvmlite.

Azure Pipelines Coveralls.io Readthedocs.io

A Lightweight LLVM Python Binding for Writing JIT Compilers

llvmlite is a project originally tailored for Numba's needs, using the following approach:

  • A small C wrapper around the parts of the LLVM C++ API we need that are not already exposed by the LLVM C API.
  • A ctypes Python wrapper around the C API.
  • A pure Python implementation of the subset of the LLVM IR builder that we need for Numba.

Why llvmlite

The old llvmpy binding exposes a lot of LLVM APIs but the mapping of C++-style memory management to Python is error prone. Numba and many JIT compilers do not need a full LLVM API. Only the IR builder, optimizer, and JIT compiler APIs are necessary.

Key Benefits

  • The IR builder is pure Python code and decoupled from LLVM's frequently-changing C++ APIs.
  • Materializing a LLVM module calls LLVM's IR parser which provides better error messages than step-by-step IR building through the C++ API (no more segfaults or process aborts).
  • Most of llvmlite uses the LLVM C API which is small but very stable (low maintenance when changing LLVM version).
  • The binding is not a Python C-extension, but a plain DLL accessed using ctypes (no need to wrestle with Python's compiler requirements and C++ 11 compatibility).
  • The Python binding layer has sane memory management.
  • llvmlite is faster than llvmpy thanks to a much simpler architecture (the Numba test suite is twice faster than it was).

Compatibility

llvmlite has been tested with Python 3.10 -- 3.14 and is likely to work with greater versions.

As of version 0.48.0, llvmlite requires LLVM 22.x.x on all architectures

Historical compatibility table:

llvmlite versions compatible LLVM versions
0.48.0 - ...... 22.x.x
0.45.0 - 0.47.x 20.x.x
0.44.0 15.x.x and 16.x.x
0.41.0 - 0.43.0 14.x.x
0.40.0 - 0.40.1 11.x.x and 14.x.x (12.x.x and 13.x.x untested but may work)
0.37.0 - 0.39.1 11.x.x
0.34.0 - 0.36.0 10.0.x (9.0.x for aarch64 only)
0.33.0 9.0.x
0.29.0 - 0.32.0 7.0.x, 7.1.x, 8.0.x
0.27.0 - 0.28.0 7.0.x
0.23.0 - 0.26.0 6.0.x
0.21.0 - 0.22.0 5.0.x
0.17.0 - 0.20.0 4.0.x
0.16.0 - 0.17.0 3.9.x
0.13.0 - 0.15.0 3.8.x
0.9.0 - 0.12.1 3.7.x
0.6.0 - 0.8.0 3.6.x
0.1.0 - 0.5.1 3.5.x

Documentation

You'll find the documentation at http://llvmlite.pydata.org

Pre-built binaries

We recommend you use the binaries provided by the Numba team for the Conda package manager. You can find them in Numba's anaconda.org channel. For example:

$ conda install --channel=numba llvmlite

(or, simply, the official llvmlite package provided in the Anaconda distribution)

Other build methods

If you don't want to use our pre-built packages, you can compile and install llvmlite yourself. The documentation will teach you how: http://llvmlite.pydata.org/en/latest/install/index.html

About

Infernux-maintained llvmlite fork for CPU JIT compilation and LLVM resource management.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages