seal5


Nameseal5 JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/tum-ei-eda/seal5
SummarySeal5 Project
upload_time2024-06-26 07:14:01
maintainerNone
docs_urlNone
authorTUM Department of Electrical and Computer Engineering - Chair of Electronic Design Automation
requires_python>=3.8
licenseApache License 2.0
keywords seal5
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Seal5

> [!NOTE]  
> Starting **July 11, 2024** we will be offering (monthly) Seal5 Development/User meetings. Click [here](https://github.com/tum-ei-eda/seal5/discussions/104) for details, if you are interested!

[![pypi package](https://badge.fury.io/py/seal5.svg)](https://pypi.org/project/seal5)
[![readthedocs](https://readthedocs.org/projects/seal5/badge/?version=latest)](https://seal5.readthedocs.io/en/latest/?version=latest)
[![GitHub license](https://img.shields.io/github/license/tum-ei-eda/seal5.svg)](https://github.com/tum-ei-eda/seal5/blob/main/LICENSE)

[![demo workflow](https://github.com/tum-ei-eda/seal5/actions/workflows/demo.yml/badge.svg)](https://github.com/tum-ei-eda/seal5/actions/workflows/demo.yml)

## Overview

The RISC-V instruction set architecture (ISA) is popular for its extensibility. However, a quick exploration of instruction candidates fails due to the lack of tools to auto-generate embedded software toolchain support. Seal5 work establishes a semi-automated flow to generate LLVM compiler support for custom instructions based on the CoreDSL2 ISA description language. Seal5 is capable of generating support for functionalities ranging from baseline assembler-level support, over builtin functions to compiler code generation patterns for scalar as well as vector instructions, while requiring no deeper compiler know-how. 

Eliminating manual efforts for Retargeting is crutial for the automated exploration of custom RISC-V instructions as depicted in the following image. Seal5's code-generation support allows to make use of custom instructions without needing to make changes to the programs/benchmarks source code (i.e. adding inline-assembly calls).

![ISADSESeal5](https://github.com/tum-ei-eda/seal5/assets/7712605/f387f13f-fc26-4efb-b6e0-d0802ac08200)

## Prerequisites

To be able to run the examples, make sure to clone the Seal5 repo using the `--recursive` flag. Otherwise run the following command to fetch (and update) the referenced submodules.

```sh
git submodule update --init --recursive
```

### Ubuntu Packages

First, a set of APT packages needs to be installed:

```sh
sudo apt install python3-pip python3-venv cmake make ninja-build
```

### Python Requirements

First, setup a virtual environment with Python v3.8 or newer.

Install all required python packages using the follow8n* command:

`pip install -r requirements.txt`.

For development (linting, packaging,...) there are a few more dependencies which can be installed via:

`pip install -r requirements_dev.txt`.

### Installation

**Warning:** It is highly recommended to install `seal5` into a new virtual environment. Follow these steps to initialize and enter a venv in your seal5 repo directory:

```sh
# alternative: python3 -m venv venv
virtualenv -p python3.8 venv
source venv/bin/activate
```

#### From PyPI

```
pip install seal5
```

#### Local Development Version

First prepare your shell by executing `export PYTHONPATH=$(pwd):$PYTHONPATH` inside the seal5 repository. Then you should be able to use Seal5 without needing to reinstall it.

Alternatively you should be able to use `pip install -e .`.

## Usage

### Python API

The flow can be sketched as follows (see Example below for functional code!):

```python
# Create flow
seal5_flow = Seal5Flow(...)
# Initialize LLVM repo and .seal5 directories
seal5_flow.initialize(...)
# Optional: remove artifacts from previous builds
seal5_flow.reset(...)
# Install Seal5 dependencies (CDSL2LLVM/PatternGen)
seal5_flow.setup(...)
# Load CoreDSL2+CFG files (Git config, filters,...)
seal5_flow.load(...)
# Transform Seal5 model (Extract side effects, operands,...)
seal5_flow.transform(...)
# Generate patches based on Seal5 model (ISel patterns, RISC-V features,...)
seal5_flow.generate(...)
# Apply generated (and manual) patches to LLVM codebase
seal5_flow.patch(...)
# Build patches LLVM (This will take a while)
seal5_flow.build(...)
# Run LLVM+Seal5 tests to verify functionality
seal5_flow.test(...)
# Combine patches and install LLVM
seal5_flow.deploy(...)
# Archive final LLVM (optionally inclusing logs, reports,...)
seal5_flow.export(...)
# Optional: Cleanup all artifacts
seal5_flow.cleanup(...)
```

### Command-Line Interface

Command line interface is aligned with the Python API. See `examples/demo.sh` for an full usage example

```sh
export SEAL5_HOME=...
seal5 --dir $SEAL5_HOME reset  --settings
seal5 init [--non-interactive] [-c]
seal5 load --files ...
seal5 setup ...
seal5 transform ...
seal5 generate ...
seal5 patch ...
seal5 build ...
seal5 test ...
seal5 deploy ...
seal5 export ...
seal5 clean [--temp] [--patches] [--models] [--inputs]
```

## Examples

See [`examples/demo.py`](https://github.com/tum-ei-eda/seal5/blob/main/examples/demo.py) for example of end-to-end flow!

## Documentation

Checkout [Seal5's ReadTheDocs Page](https://seal5.readthedocs.io/en/latest/?version=latest)!

## Limitations

See [here](https://github.com/tum-ei-eda/seal5/blob/main/LIMITATIONS.md).

## CI/CD Flow

We added a (manual) CI job to run the `examples/demo.py` script via GitHub actions.

## Contributions

Seal5 issue tracker: https://github.com/tum-ei-eda/seal5/issues

CoreDSL2LLVM/PatternGen issue tracker: https://github.com/mathis-s/CoreDSL2LLVM/issues

## References

N/A

## Acknowledgment

<img src="./BMBF_gefoerdert_2017_en.jpg" alt="drawing" height="75" align="left" >

This research is partially funded by the German Federal Ministry of Education and Research (BMBF) within
the projects [Scale4Edge](https://www.edacentrum.de/scale4edge/) (grant number 16ME0465) and [MANNHEIM-FlexKI](https://www.edacentrum.de/projekte/MANNHEIM-FlexKI) (grant number 01IS22086L).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tum-ei-eda/seal5",
    "name": "seal5",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "seal5",
    "author": "TUM Department of Electrical and Computer Engineering - Chair of Electronic Design Automation",
    "author_email": "philipp.van-kempen@tum.de",
    "download_url": "https://files.pythonhosted.org/packages/e6/3c/9880ee9653d2ccda10caa8cb05c3675b079b9aab5c9857bb7ddda237add7/seal5-0.1.3.tar.gz",
    "platform": null,
    "description": "# Seal5\n\n> [!NOTE]  \n> Starting **July 11, 2024** we will be offering (monthly) Seal5 Development/User meetings. Click [here](https://github.com/tum-ei-eda/seal5/discussions/104) for details, if you are interested!\n\n[![pypi package](https://badge.fury.io/py/seal5.svg)](https://pypi.org/project/seal5)\n[![readthedocs](https://readthedocs.org/projects/seal5/badge/?version=latest)](https://seal5.readthedocs.io/en/latest/?version=latest)\n[![GitHub license](https://img.shields.io/github/license/tum-ei-eda/seal5.svg)](https://github.com/tum-ei-eda/seal5/blob/main/LICENSE)\n\n[![demo workflow](https://github.com/tum-ei-eda/seal5/actions/workflows/demo.yml/badge.svg)](https://github.com/tum-ei-eda/seal5/actions/workflows/demo.yml)\n\n## Overview\n\nThe RISC-V instruction set architecture (ISA) is popular for its extensibility. However, a quick exploration of instruction candidates fails due to the lack of tools to auto-generate embedded software toolchain support. Seal5 work establishes a semi-automated flow to generate LLVM compiler support for custom instructions based on the CoreDSL2 ISA description language. Seal5 is capable of generating support for functionalities ranging from baseline assembler-level support, over builtin functions to compiler code generation patterns for scalar as well as vector instructions, while requiring no deeper compiler know-how. \n\nEliminating manual efforts for Retargeting is crutial for the automated exploration of custom RISC-V instructions as depicted in the following image. Seal5's code-generation support allows to make use of custom instructions without needing to make changes to the programs/benchmarks source code (i.e. adding inline-assembly calls).\n\n![ISADSESeal5](https://github.com/tum-ei-eda/seal5/assets/7712605/f387f13f-fc26-4efb-b6e0-d0802ac08200)\n\n## Prerequisites\n\nTo be able to run the examples, make sure to clone the Seal5 repo using the `--recursive` flag. Otherwise run the following command to fetch (and update) the referenced submodules.\n\n```sh\ngit submodule update --init --recursive\n```\n\n### Ubuntu Packages\n\nFirst, a set of APT packages needs to be installed:\n\n```sh\nsudo apt install python3-pip python3-venv cmake make ninja-build\n```\n\n### Python Requirements\n\nFirst, setup a virtual environment with Python v3.8 or newer.\n\nInstall all required python packages using the follow8n* command:\n\n`pip install -r requirements.txt`.\n\nFor development (linting, packaging,...) there are a few more dependencies which can be installed via:\n\n`pip install -r requirements_dev.txt`.\n\n### Installation\n\n**Warning:** It is highly recommended to install `seal5` into a new virtual environment. Follow these steps to initialize and enter a venv in your seal5 repo directory:\n\n```sh\n# alternative: python3 -m venv venv\nvirtualenv -p python3.8 venv\nsource venv/bin/activate\n```\n\n#### From PyPI\n\n```\npip install seal5\n```\n\n#### Local Development Version\n\nFirst prepare your shell by executing `export PYTHONPATH=$(pwd):$PYTHONPATH` inside the seal5 repository. Then you should be able to use Seal5 without needing to reinstall it.\n\nAlternatively you should be able to use `pip install -e .`.\n\n## Usage\n\n### Python API\n\nThe flow can be sketched as follows (see Example below for functional code!):\n\n```python\n# Create flow\nseal5_flow = Seal5Flow(...)\n# Initialize LLVM repo and .seal5 directories\nseal5_flow.initialize(...)\n# Optional: remove artifacts from previous builds\nseal5_flow.reset(...)\n# Install Seal5 dependencies (CDSL2LLVM/PatternGen)\nseal5_flow.setup(...)\n# Load CoreDSL2+CFG files (Git config, filters,...)\nseal5_flow.load(...)\n# Transform Seal5 model (Extract side effects, operands,...)\nseal5_flow.transform(...)\n# Generate patches based on Seal5 model (ISel patterns, RISC-V features,...)\nseal5_flow.generate(...)\n# Apply generated (and manual) patches to LLVM codebase\nseal5_flow.patch(...)\n# Build patches LLVM (This will take a while)\nseal5_flow.build(...)\n# Run LLVM+Seal5 tests to verify functionality\nseal5_flow.test(...)\n# Combine patches and install LLVM\nseal5_flow.deploy(...)\n# Archive final LLVM (optionally inclusing logs, reports,...)\nseal5_flow.export(...)\n# Optional: Cleanup all artifacts\nseal5_flow.cleanup(...)\n```\n\n### Command-Line Interface\n\nCommand line interface is aligned with the Python API. See `examples/demo.sh` for an full usage example\n\n```sh\nexport SEAL5_HOME=...\nseal5 --dir $SEAL5_HOME reset  --settings\nseal5 init [--non-interactive] [-c]\nseal5 load --files ...\nseal5 setup ...\nseal5 transform ...\nseal5 generate ...\nseal5 patch ...\nseal5 build ...\nseal5 test ...\nseal5 deploy ...\nseal5 export ...\nseal5 clean [--temp] [--patches] [--models] [--inputs]\n```\n\n## Examples\n\nSee [`examples/demo.py`](https://github.com/tum-ei-eda/seal5/blob/main/examples/demo.py) for example of end-to-end flow!\n\n## Documentation\n\nCheckout [Seal5's ReadTheDocs Page](https://seal5.readthedocs.io/en/latest/?version=latest)!\n\n## Limitations\n\nSee [here](https://github.com/tum-ei-eda/seal5/blob/main/LIMITATIONS.md).\n\n## CI/CD Flow\n\nWe added a (manual) CI job to run the `examples/demo.py` script via GitHub actions.\n\n## Contributions\n\nSeal5 issue tracker: https://github.com/tum-ei-eda/seal5/issues\n\nCoreDSL2LLVM/PatternGen issue tracker: https://github.com/mathis-s/CoreDSL2LLVM/issues\n\n## References\n\nN/A\n\n## Acknowledgment\n\n<img src=\"./BMBF_gefoerdert_2017_en.jpg\" alt=\"drawing\" height=\"75\" align=\"left\" >\n\nThis research is partially funded by the German Federal Ministry of Education and Research (BMBF) within\nthe projects [Scale4Edge](https://www.edacentrum.de/scale4edge/) (grant number 16ME0465) and [MANNHEIM-FlexKI](https://www.edacentrum.de/projekte/MANNHEIM-FlexKI) (grant number 01IS22086L).\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Seal5 Project",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/tum-ei-eda/seal5"
    },
    "split_keywords": [
        "seal5"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "94d4a9b1351d4c3be9bf047399e73bdb194b895090c6bb6f0cca2c933b683da7",
                "md5": "645d631bc67eeaca76fbf1809660a98c",
                "sha256": "80a45fc4689ced54fb3e2b8afec57af7022e41393ba8bd8a09d9c7c0da607f26"
            },
            "downloads": -1,
            "filename": "seal5-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "645d631bc67eeaca76fbf1809660a98c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 153281,
            "upload_time": "2024-06-26T07:14:00",
            "upload_time_iso_8601": "2024-06-26T07:14:00.397131Z",
            "url": "https://files.pythonhosted.org/packages/94/d4/a9b1351d4c3be9bf047399e73bdb194b895090c6bb6f0cca2c933b683da7/seal5-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e63c9880ee9653d2ccda10caa8cb05c3675b079b9aab5c9857bb7ddda237add7",
                "md5": "e005b65a866ae2145bf45fd4dbea16b7",
                "sha256": "cc4c9841d4ccd2a41e06c13a345c68b46163ffee1be28f1eb646e98c7b460469"
            },
            "downloads": -1,
            "filename": "seal5-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "e005b65a866ae2145bf45fd4dbea16b7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 82744,
            "upload_time": "2024-06-26T07:14:01",
            "upload_time_iso_8601": "2024-06-26T07:14:01.900400Z",
            "url": "https://files.pythonhosted.org/packages/e6/3c/9880ee9653d2ccda10caa8cb05c3675b079b9aab5c9857bb7ddda237add7/seal5-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-26 07:14:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tum-ei-eda",
    "github_project": "seal5",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "seal5"
}
        
Elapsed time: 0.26868s