A lightweight LLVM python binding for writing JIT compilers
 
 
 
 
 
 
Go to file
Kaustubh 78ebf9bf18
Merge pull request #1069 from yashssh/pic-callback-bug
Add instrumentation callback hook for new pass managers
2024-07-24 15:29:28 +05:30
.github Add conda-forge pre-tag testing to release checklist 2024-05-10 18:15:16 +01:00
buildscripts Use LLVM 15 by default, add experimental LLVM 16 support 2024-07-05 13:49:32 +01:00
conda-recipes Replace llvmlite LLVM 14 recipe with LLVM 15 recipe 2024-07-15 11:58:19 +01:00
docs Merge pull request #1046 from yashssh/npm-numba 2024-07-08 15:28:29 -05:00
examples Rename opt_level to speed_level and typos 2024-05-31 11:53:21 +05:30
ffi Query PIC directly from PB object, instead of managing it seperately 2024-07-23 12:07:10 +05:30
llvmlite review comments in tests 2024-07-23 12:19:53 +05:30
.clang-format Format C++ at 4 columns 2022-04-12 10:15:15 -04:00
.codeclimate.yml More tweaks 2016-05-02 14:57:15 +02:00
.coveragerc Codecov tweaks 2016-03-09 10:19:41 +01:00
.flake8 Fix flake8 config and style for flake8 6 2023-02-06 11:04:22 +00:00
.gitattributes update .gitattributes for patch files for Windows 2020-12-15 18:54:27 +01:00
.gitignore Add YouCompleteMe configuration file and ignore vim swap files 2023-02-14 13:03:30 +00:00
.pre-commit-config.yaml Add pre-commit hooks for clang-format 2022-04-27 11:23:52 -04:00
.readthedocs.yaml Try editing build.py on RTD instead 2024-07-05 15:09:10 +01:00
.scrutinizer.yml Exclude tests too 2016-03-09 12:43:30 +01:00
.ycm_extra_conf.py Add YouCompleteMe configuration file and ignore vim swap files 2023-02-14 13:03:30 +00:00
CHANGE_LOG port changelog for 0.43.0 to main 2024-06-14 14:43:46 +02:00
LICENSE Add a setup.py and a LICENSE, and move the shared library file into llvmlite.binding package 2014-10-23 14:34:45 +02:00
LICENSE.thirdparty Add LLVM license 2023-12-06 16:51:48 +00:00
MANIFEST.in MAINT: ensure no CMakeCache.txt file is included in sdist. 2016-03-09 10:33:06 +00:00
README.rst Bump minimum supported Python version to 3.9 2023-12-04 16:45:58 +05:30
azure-pipelines.yml Use LLVM 15 by default, add experimental LLVM 16 support 2024-07-05 13:49:32 +01:00
codecov.yml Add comment to top of file 2016-05-02 16:35:46 +02:00
run_coverage.py Codecov tweaks 2016-03-09 10:19:41 +01:00
runtests.py gep issue test 2017-06-26 16:32:17 +01:00
setup.py Bump minimum supported Python version to 3.9 2023-12-04 16:45:58 +05:30
versioneer.py Update versioneer for PEP 440 version strings 2015-04-28 20:12:28 +02:00

README.rst

========
llvmlite
========

.. image:: https://dev.azure.com/numba/numba/_apis/build/status/numba.llvmlite?branchName=main
   :target: https://dev.azure.com/numba/numba/_build/latest?definitionId=2&branchName=main
   :alt: Azure Pipelines
.. image:: https://codeclimate.com/github/numba/llvmlite/badges/gpa.svg
   :target: https://codeclimate.com/github/numba/llvmlite
   :alt: Code Climate
.. image:: https://coveralls.io/repos/github/numba/llvmlite/badge.svg
   :target: https://coveralls.io/github/numba/llvmlite
   :alt: Coveralls.io
.. image:: https://readthedocs.org/projects/llvmlite/badge/
   :target: https://llvmlite.readthedocs.io
   :alt: Readthedocs.io

A Lightweight LLVM Python Binding for Writing JIT Compilers
-----------------------------------------------------------

.. _llvmpy: https://github.com/llvmpy/llvmpy

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 <https://anaconda.org/numba>`_.  For example::

   $ conda install --channel=numba llvmlite

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

.. _Numba: http://numba.pydata.org/
.. _Conda: http://conda.pydata.org/
.. _Anaconda: http://docs.continuum.io/anaconda/index.html


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