[![CI](https://github.com/exo-lang/exo/actions/workflows/main.yml/badge.svg)](https://github.com/exo-lang/exo/actions/workflows/main.yml)
![GitHub last commit](https://img.shields.io/github/last-commit/exo-lang/exo)
[![codecov](https://codecov.io/gh/exo-lang/exo/branch/master/graph/badge.svg?token=BFIZ0WKP4I)](https://codecov.io/gh/exo-lang/exo)
# Basics
## Install Exo
We support Python versions 3.9 and above.
If you're just using Exo, install it using `pip`:
```sh
$ pip install exo-lang
```
In case of `ModuleNotFoundError: No module named 'attrs'` please upgrade your attrs module by `pip install --upgrade attrs`.
## Compile Exo
Exo files can be directly excuted with Python:
```sh
$ python exo_file.py
```
To generate generate C and header files, use `exocc` command:
```sh
$ exocc exo_file.py
```
Running the command will generate two files: `exo_file.c` and `exo_file.h`. These files will be created in a directory called `exo_file/` by default.
You can use optional arguments to customize the output:
- The `-o` argument allows you to specify a different directory name.
- The `--stem` argument allows you to specify custom names for the C file and header file.
# Build Exo from source
We make active use of newer Python 3.x features. Please use Python 3.9 or 3.10 if you're getting errors about unsupported features.
Setting up Exo for development is like any other Python project. We
_strongly_ recommend you use a virtual environment.
```
$ git clone git@github.com:exo-lang/exo.git
$ cd exo/
$ git submodule update --init --recursive
$ python -m venv ~/.venv/exo
$ source ~/.venv/exo/bin/activate
(exo) $ python -m pip install -U pip setuptools wheel
(exo) $ python -m pip install -r requirements.txt
(exo) $ pre-commit install
```
This will make sure you have the submodules checked out and that the pre-commit
scripts (that run an autoformatter, maybe other tools in the future) run.
Finally, you can build and install Exo.
```
(exo) $ python -m build .
(exo) $ pip install dist/*.whl
```
## PySMT
Depending on your setup, getting PySMT to work correctly may be difficult. You
need to independently install a solver such as Z3 or CVC4, and even then getting
the PySMT library to correctly locate that solver may be difficult. We have
included the `z3-solver` package as a requirement, which will hopefully avoid
this issue, but you can also install z3 (or your choice of solver)
independently.
# Notes for Testing
## Dependencies
### Build system (required)
The Exo test harness generates C code and as such needs to compile and link
using an unknown (i.e. system) compiler. To do this, it generates CMake build
files and invokes CMake behind the scenes.
Therefore, you must have CMake **3.21** or newer installed.
By default, CMake will use [Ninja](https://ninja-build.org) as its backend, but
this may be overridden by setting the environment variable `CMAKE_GENERATOR`
to `Unix Makefiles`, in case you do not wish to install Ninja.
### SDE (optional)
For testing x86 features on processors which don't support them (e.g., AVX-512
or AMX), we rely on
the [Intel Software Development Emulator](https://www.intel.com/content/www/us/en/developer/articles/tool/software-development-emulator.html)
as an optional dependency. Tests which rely on this (namely for AMX) look
for `sde64` either in the path defined by the `SDE_PATH` environment variable or
in the system `PATH`, and are skipped if it is not available.
## Running tests
To run the tests, simply type
```
pytest
```
in the root of the project.
## Running Coverage Testing
To run pytest with coverage tests, execute
```
pytest --cov=./ --cov-report=html
```
Then, if you want to see annotated source files, open `./htmlcov/index.html`.
---
# Learn about Exo
Take a look at the [examples](examples/README.md) directory for scheduling examples and the [documentation](docs/README.md) directory for various documentation about Exo.
# Contact
Please contact [exo@mit.edu](mailto:exo@mit.edu) or [yuka@csail.mit.edu](mailto:yuka@csail.mit.edu) if you have any questions.
# Publication
The first paper on Exo was published at PLDI '22. You can download the
paper [from ACM Digital Library](https://dl.acm.org/doi/abs/10.1145/3519939.3523446).
If you use Exo, please cite both the compiler and the paper!
```
@inproceedings{pldi22:exo,
title = {Exocompilation for Productive Programming of Hardware Accelerators},
author = {
Ikarashi, Yuka and Bernstein, Gilbert Louis and Reinking, Alex and Genc,
Hasan and Ragan-Kelley, Jonathan
},
year = 2022,
booktitle = {
Proceedings of the 43rd ACM SIGPLAN International Conference on Programming
Language Design and Implementation
},
location = {San Diego, CA, USA},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
series = {PLDI 2022},
pages = {703–718},
doi = {10.1145/3519939.3523446},
isbn = 9781450392655,
url = {https://doi.org/10.1145/3519939.3523446},
abstract = {
High-performance kernel libraries are critical to exploiting accelerators
and specialized instructions in many applications. Because compilers are
difficult to extend to support diverse and rapidly-evolving hardware
targets, and automatic optimization is often insufficient to guarantee
state-of-the-art performance, these libraries are commonly still coded and
optimized by hand, at great expense, in low-level C and assembly. To better
support development of high-performance libraries for specialized hardware,
we propose a new programming language, Exo, based on the principle of
exocompilation: externalizing target-specific code generation support and
optimization policies to user-level code. Exo allows custom hardware
instructions, specialized memories, and accelerator configuration state to
be defined in user libraries. It builds on the idea of user scheduling to
externalize hardware mapping and optimization decisions. Schedules are
defined as composable rewrites within the language, and we develop a set of
effect analyses which guarantee program equivalence and memory safety
through these transformations. We show that Exo enables rapid development
of state-of-the-art matrix-matrix multiply and convolutional neural network
kernels, for both an embedded neural accelerator and x86 with AVX-512
extensions, in a few dozen lines of code each.
},
numpages = 16,
keywords = {
program optimization, user-schedulable languages, user-extensible backend
& scheduling, instruction abstraction, scheduling, hardware
accelerators
}
}
```
Raw data
{
"_id": null,
"home_page": "https://exo-lang.dev/",
"name": "exo-lang",
"maintainer": "Yuka Ikarashi",
"docs_url": null,
"requires_python": null,
"maintainer_email": "yuka@csail.mit.edu",
"keywords": "exo, exocompilation, array, dsl, language, performance",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/df/68/8aa21152c1867093b27799d327a2a09150897679d81b753dc1ecf78ee29b/exo_lang-1.0.0.tar.gz",
"platform": null,
"description": "[![CI](https://github.com/exo-lang/exo/actions/workflows/main.yml/badge.svg)](https://github.com/exo-lang/exo/actions/workflows/main.yml)\n![GitHub last commit](https://img.shields.io/github/last-commit/exo-lang/exo)\n[![codecov](https://codecov.io/gh/exo-lang/exo/branch/master/graph/badge.svg?token=BFIZ0WKP4I)](https://codecov.io/gh/exo-lang/exo)\n\n# Basics\n\n## Install Exo\n\nWe support Python versions 3.9 and above.\nIf you're just using Exo, install it using `pip`:\n```sh\n$ pip install exo-lang\n```\nIn case of `ModuleNotFoundError: No module named 'attrs'` please upgrade your attrs module by `pip install --upgrade attrs`.\n\n## Compile Exo\n\nExo files can be directly excuted with Python:\n```sh\n$ python exo_file.py\n```\n\nTo generate generate C and header files, use `exocc` command:\n```sh\n$ exocc exo_file.py\n```\nRunning the command will generate two files: `exo_file.c` and `exo_file.h`. These files will be created in a directory called `exo_file/` by default.\nYou can use optional arguments to customize the output:\n- The `-o` argument allows you to specify a different directory name.\n- The `--stem` argument allows you to specify custom names for the C file and header file.\n\n\n# Build Exo from source\n\nWe make active use of newer Python 3.x features. Please use Python 3.9 or 3.10 if you're getting errors about unsupported features.\n\nSetting up Exo for development is like any other Python project. We\n_strongly_ recommend you use a virtual environment.\n\n```\n$ git clone git@github.com:exo-lang/exo.git\n$ cd exo/\n$ git submodule update --init --recursive\n$ python -m venv ~/.venv/exo\n$ source ~/.venv/exo/bin/activate\n(exo) $ python -m pip install -U pip setuptools wheel\n(exo) $ python -m pip install -r requirements.txt\n(exo) $ pre-commit install\n```\n\nThis will make sure you have the submodules checked out and that the pre-commit\nscripts (that run an autoformatter, maybe other tools in the future) run.\n\nFinally, you can build and install Exo.\n\n```\n(exo) $ python -m build .\n(exo) $ pip install dist/*.whl\n```\n\n## PySMT\n\nDepending on your setup, getting PySMT to work correctly may be difficult. You\nneed to independently install a solver such as Z3 or CVC4, and even then getting\nthe PySMT library to correctly locate that solver may be difficult. We have\nincluded the `z3-solver` package as a requirement, which will hopefully avoid\nthis issue, but you can also install z3 (or your choice of solver)\nindependently.\n\n# Notes for Testing\n\n## Dependencies\n\n### Build system (required)\n\nThe Exo test harness generates C code and as such needs to compile and link\nusing an unknown (i.e. system) compiler. To do this, it generates CMake build\nfiles and invokes CMake behind the scenes.\n\nTherefore, you must have CMake **3.21** or newer installed.\n\nBy default, CMake will use [Ninja](https://ninja-build.org) as its backend, but\nthis may be overridden by setting the environment variable `CMAKE_GENERATOR`\nto `Unix Makefiles`, in case you do not wish to install Ninja.\n\n### SDE (optional)\n\nFor testing x86 features on processors which don't support them (e.g., AVX-512\nor AMX), we rely on\nthe [Intel Software Development Emulator](https://www.intel.com/content/www/us/en/developer/articles/tool/software-development-emulator.html)\nas an optional dependency. Tests which rely on this (namely for AMX) look\nfor `sde64` either in the path defined by the `SDE_PATH` environment variable or\nin the system `PATH`, and are skipped if it is not available.\n\n## Running tests\n\nTo run the tests, simply type\n\n```\npytest\n```\n\nin the root of the project.\n\n## Running Coverage Testing\n\nTo run pytest with coverage tests, execute\n\n```\npytest --cov=./ --cov-report=html\n```\n\nThen, if you want to see annotated source files, open `./htmlcov/index.html`.\n\n---\n\n# Learn about Exo\n\nTake a look at the [examples](examples/README.md) directory for scheduling examples and the [documentation](docs/README.md) directory for various documentation about Exo.\n\n\n# Contact\n\nPlease contact [exo@mit.edu](mailto:exo@mit.edu) or [yuka@csail.mit.edu](mailto:yuka@csail.mit.edu) if you have any questions.\n\n\n# Publication\n\nThe first paper on Exo was published at PLDI '22. You can download the\npaper [from ACM Digital Library](https://dl.acm.org/doi/abs/10.1145/3519939.3523446).\nIf you use Exo, please cite both the compiler and the paper!\n\n```\n@inproceedings{pldi22:exo,\n title = {Exocompilation for Productive Programming of Hardware Accelerators},\n author = {\n Ikarashi, Yuka and Bernstein, Gilbert Louis and Reinking, Alex and Genc,\n Hasan and Ragan-Kelley, Jonathan\n },\n year = 2022,\n booktitle = {\n Proceedings of the 43rd ACM SIGPLAN International Conference on Programming\n Language Design and Implementation\n },\n location = {San Diego, CA, USA},\n publisher = {Association for Computing Machinery},\n address = {New York, NY, USA},\n series = {PLDI 2022},\n pages = {703\u2013718},\n doi = {10.1145/3519939.3523446},\n isbn = 9781450392655,\n url = {https://doi.org/10.1145/3519939.3523446},\n abstract = {\n High-performance kernel libraries are critical to exploiting accelerators\n and specialized instructions in many applications. Because compilers are\n difficult to extend to support diverse and rapidly-evolving hardware\n targets, and automatic optimization is often insufficient to guarantee\n state-of-the-art performance, these libraries are commonly still coded and\n optimized by hand, at great expense, in low-level C and assembly. To better\n support development of high-performance libraries for specialized hardware,\n we propose a new programming language, Exo, based on the principle of\n exocompilation: externalizing target-specific code generation support and\n optimization policies to user-level code. Exo allows custom hardware\n instructions, specialized memories, and accelerator configuration state to\n be defined in user libraries. It builds on the idea of user scheduling to\n externalize hardware mapping and optimization decisions. Schedules are\n defined as composable rewrites within the language, and we develop a set of\n effect analyses which guarantee program equivalence and memory safety\n through these transformations. We show that Exo enables rapid development\n of state-of-the-art matrix-matrix multiply and convolutional neural network\n kernels, for both an embedded neural accelerator and x86 with AVX-512\n extensions, in a few dozen lines of code each.\n },\n numpages = 16,\n keywords = {\n program optimization, user-schedulable languages, user-extensible backend\n & scheduling, instruction abstraction, scheduling, hardware\n accelerators\n }\n}\n```\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Exo: Exocompiled Array Language",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://exo-lang.dev/"
},
"split_keywords": [
"exo",
" exocompilation",
" array",
" dsl",
" language",
" performance"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "47cc4d9b476166e82f580f8a2f34fea02a0bc898282d9493cd5623dc110a14e4",
"md5": "def2a7c2cd04328f0d7dd0d1386f5fa5",
"sha256": "5688f9f260c30c1375a353f9e7a1f80aa4ea679aa147c037c21566a90facf4b3"
},
"downloads": -1,
"filename": "exo_lang-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "def2a7c2cd04328f0d7dd0d1386f5fa5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 228347,
"upload_time": "2024-11-05T21:05:22",
"upload_time_iso_8601": "2024-11-05T21:05:22.983232Z",
"url": "https://files.pythonhosted.org/packages/47/cc/4d9b476166e82f580f8a2f34fea02a0bc898282d9493cd5623dc110a14e4/exo_lang-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "df688aa21152c1867093b27799d327a2a09150897679d81b753dc1ecf78ee29b",
"md5": "babb5d2a26e31e37fcb318b45d36e509",
"sha256": "18d5216e6c7908d2b7be6c7a3c0206805742937596fb4738522ffa4b88b9a060"
},
"downloads": -1,
"filename": "exo_lang-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "babb5d2a26e31e37fcb318b45d36e509",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 265261,
"upload_time": "2024-11-05T21:05:24",
"upload_time_iso_8601": "2024-11-05T21:05:24.460708Z",
"url": "https://files.pythonhosted.org/packages/df/68/8aa21152c1867093b27799d327a2a09150897679d81b753dc1ecf78ee29b/exo_lang-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-05 21:05:24",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "exo-lang"
}