numba-mlir

POC work on MLIR backend

https://github.com/numba/numba-mlir

Science Score: 31.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.5%) to scientific vocabulary
Last synced: 11 months ago · JSON representation ·

Repository

POC work on MLIR backend

Basic Info
  • Host: GitHub
  • Owner: numba
  • License: other
  • Language: C++
  • Default Branch: main
  • Size: 4.99 MB
Statistics
  • Stars: 56
  • Watchers: 8
  • Forks: 10
  • Open Issues: 10
  • Releases: 0
Created over 3 years ago · Last pushed almost 2 years ago
Metadata Files
Readme License Citation

README.md

MLIR-based numba backend

The goal of this project is to provide efficient code generation for CPUs and GPUs using Multi-Level Intermediate Representation (MLIR) infrastructure. It uses Numba infrastructure as a frontend but have completely separate codepaths through MLIR infrastructure for low level code generation.

Package provides set of decorators similar to Numba decorators to compile python code.

Example: ```Python from numba_mlir import njit import numpy as np

@njit def foo(a, b): return a + b

result = foo(np.array([1,2,3]), np.array([4,5,6])) print(result) ```

Building and testing

You will need LLVM built from specific commit, found in llvm-sha.txt.

Linux

Building llvm Bash git clone https://github.com/llvm/llvm-project.git cd llvm-project git checkout $SHA cd .. mkdir llvm-build cd llvm-build cmake ../llvm-project/llvm -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=mlir -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_USE_LINKER=gold -DLLVM_INSTALL_UTILS=ON -DCMAKE_INSTALL_PREFIX=../llvm-install ninja install

Building and testing Python package Bash cd numba_mlir conda create -n test-env python=3.11 --file ../scripts/numba-mlir.env -c conda-forge conda activate test-env conda install dpcpp_linux-64=2024.2 --file ../scripts/mkl.env -c https://software.repos.intel.com/python/conda/ export LLVM_PATH=<...>/llvm-install export NUMBA_MLIR_USE_SYCL=ON # Optional python setup.py develop pytest -n8 --capture=tee-sys -rXF

Windows

TBD

Using GPU offload

  • Install Intel GPU drivers: https://dgpu-docs.intel.com/installation-guides/index.html
  • Install dpctl conda install dpctl -c dppy/label/dev -c https://software.repos.intel.com/python/conda/

Kernel offload example: ```Python from numbamlir.kernel import kernel, getglobalid, DEFAULTLOCAL_SIZE import numpy as np import dpctl.tensor as dpt

@kernel def foo(a, b, c): i = getglobalid(0) j = getglobalid(1) c[i, j] = a[i, j] + b[i, j]

a = np.array([[1,2,3],[4,5,6]]) b = np.array([[7,8,9],[-1,-2,-3]])

print(a + b)

device = "gpu" a = dpt.asarray(a, device=device) b = dpt.asarray(b, device=device) c = dpt.empty(a.shape, dtype=a.dtype, device=device)

fooa.shape, DEFAULTLOCALSIZE

result = dpt.asnumpy(c) print(result) ```

Numpy offload example: ```Python from numba_mlir import njit import numpy as np import dpctl.tensor as dpt

@njit(parallel=True) def foo(a, b): return a + b

a = np.array([[1,2,3],[4,5,6]]) b = np.array([[1,2,3]])

print(a + b)

a = dpt.asarray(a, device="gpu") b = dpt.asarray(b, device="gpu")

result = foo(a, b) print(result) ```

Contributing

We are using github issues to report issues and github pull requests for development.

Code of Conduct

Owner

  • Name: Numba
  • Login: numba
  • Kind: organization
  • Location: Virtual

Array-oriented Python JIT compiler

Citation (CITATION.bib)

@software{numbamlir,
  author = {Ivan Butygin, Diptorup Deb, Alexander Kalistratov},
  title = {{numba-mlir}: MLIR-based numba backend},
  url = {https://github.com/numba/numba-mlir},
  year = {2023},
}

GitHub Events

Total
  • Watch event: 11
Last Year
  • Watch event: 11

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 1,369
  • Total Committers: 18
  • Avg Commits per committer: 76.056
  • Development Distribution Score (DDS): 0.507
Past Year
  • Commits: 3
  • Committers: 1
  • Avg Commits per committer: 3.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Ivan Butygin i****n@g****m 675
Butygin i****n@i****m 549
Alexander-Makaryev a****v@g****m 54
Alexander Kalistratov a****v@i****m 24
geexie m****a@i****m 20
Diptorup Deb d****b@i****m 13
Nishant Patel n****l@i****m 9
Vyacheslav-Smirnov v****v@i****m 8
Frank Schlimbach f****h@i****m 4
Sang Ik Lee s****e@i****m 4
Yevhenii Havrylko e****o@g****m 2
David 1****h 1
Dimple Prajapati d****i@i****m 1
Liangliang Chang 1****2 1
alexander.kalistratov a****r@n****m 1
chudur-budur 1****r 1
petterinteon 6****n 1
Longsheng Du l****2@o****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 12 months ago

All Time
  • Total issues: 0
  • Total pull requests: 170
  • Average time to close issues: N/A
  • Average time to close pull requests: 3 days
  • Total issue authors: 0
  • Total pull request authors: 3
  • Average comments per issue: 0
  • Average comments per pull request: 0.09
  • Merged pull requests: 166
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • AlexanderKalistratov (1)
  • mocusez (1)
  • dlee992 (1)
Pull Request Authors
  • Hardcode84 (104)
  • AlexanderKalistratov (10)
  • chudur-budur (1)
Top Labels
Issue Labels
enhancement (1)
Pull Request Labels
task (1)

Dependencies

.github/workflows/build.yml actions
  • actions/cache v3 composite
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/download-artifact v2 composite
  • actions/upload-artifact v2 composite
  • conda-incubator/setup-miniconda v2 composite
  • ilammy/msvc-dev-cmd v1 composite
  • styfle/cancel-workflow-action 0.6.0 composite
.github/workflows/pre-commit.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • pre-commit/action v2.0.0 composite
numba_mlir/setup.py pypi
  • numba >=0.56,<0.57