• Stars
    star
    1,832
  • Rank 24,303 (Top 0.5 %)
  • Language
    Python
  • License
    BSD 2-Clause "Sim...
  • Created over 9 years ago
  • Updated 11 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A lightweight LLVM python binding for writing JIT compilers

llvmlite

Code Climate

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.9 -- 3.12 and is likely to work with greater versions.

As of version 0.41.0, llvmlite requires LLVM 14.x.x on all architectures

Historical compatibility table:

llvmlite versions compatible LLVM versions
0.41.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

More Repositories

1

numba

NumPy aware dynamic Python compiler using LLVM
Python
9,435
star
2

numba-scipy

numba_scipy extends Numba to make it aware of SciPy
Python
239
star
3

nvidia-cuda-tutorial

Nvidia contributed CUDA tutorial for Numba
Jupyter Notebook
212
star
4

numba-examples

Example Numba implementations of functions
Jupyter Notebook
160
star
5

pyculib

Pyculib - Python bindings for CUDA libraries
Python
94
star
6

numba-mlir

POC work on MLIR backend
C++
38
star
7

data_profiler

An augmented version of cProfile and Snakeviz
Python
27
star
8

pyculib_sorting

Sorting libraries for pyculib
Cuda
14
star
9

numba-rvsdg

Numba compatible RVSDG (Regionalized Value State Dependence Graph) utilities.
Python
12
star
10

euroscipy2019-numba

EuroSciPy 2019 Numba Tutorial
Jupyter Notebook
12
star
11

texasbbq

Smoke out the bugs that break dependent projects.
Python
10
star
12

numba-benchmark

Python
9
star
13

roctools

Tools for using AMD ROCm with Numba
C++
9
star
14

pixie

8
star
15

roc-examples

Examples for ROC GPUs
Jupyter Notebook
7
star
16

numba-extras

[Archived due to lack of maintainer] A repo for extra and experimental features for Numba
Python
7
star
17

conda-recipe-cudatoolkit

conda recipe for cudatoolkit
Python
6
star
18

numba-integration-testing

Testing Numba 'master' against the latest released versions of dependent libraries.
Python
6
star
19

stacktrace

DO NOT USE. Low-level stacktrace utils.
Python
5
star
20

pyegraphsgood

Rust
5
star
21

llvm-py

The llvm-py project is moved to github.com/llvmpy/llvmpy or www.llvmpy.org
4
star
22

ctflgrdiff

Rust
4
star
23

numba-hatchery

Full-stack build for llvmdev --> llvmlite --> Numba.
Shell
4
star
24

llvm-mirror

LLVM mirror and patches for building llvmlite
C++
3
star
25

rocm_testing_dockers

Dockers for testing numba HSA support and pyroclib on ROCm platforms
Makefile
2
star
26

numba-doc

Documentation pages served from here.
2
star
27

numba-rocm

Numba support for ROCm
2
star
28

llvmlite-doc

llvmlite documentation pages
HTML
1
star
29

dispyatcher

Python
1
star
30

libHLC

A standalone shared library of HLC-LLVM from HSAFoundation for generating HSAIL and BRIG from LLVM
C++
1
star
31

numba-governance

Documentation of the governance of the Numba project and associated subprojects (llvmlite, etc)
1
star
32

numba.github.com

Website served from here
HTML
1
star