Skip to content

Commit

Permalink
Merge pull request #114 from tum-ei-eda/develop
Browse files Browse the repository at this point in the history
Merge Develop
  • Loading branch information
PhilippvK authored Oct 20, 2024
2 parents 5775d8d + 8b0934b commit cf80445
Show file tree
Hide file tree
Showing 87 changed files with 1,310 additions and 725 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ on:
description: "Enable progress bars (0/1)"
required: true
default: "1"
# ccache:
# description: "Enable ccache (0/1)"
# required: true
# default: "0"
clone_depth:
description: "Clone Depth (-1 for full clone)"
required: true
Expand All @@ -50,7 +54,7 @@ on:
build_config:
description: "Build Config (debug/release/...)"
required: true
default: "release"
default: "release_assertions"
test:
description: "Run LLVM tests"
required: true
Expand All @@ -77,16 +81,25 @@ on:

jobs:
demo:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.10"]
os: ["ubuntu-latest"]
ccache: ["1"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup ccache
if: ${{ matrix.ccache == '1' }}
uses: hendrikmuhs/ccache-action@v1
with:
max-size: 2G
key: ${{ matrix.os }}-${{ github.event.inputs.script }}-${{ github.event.inputs.build_config }}
variant: sccache
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install APT packages
Expand Down Expand Up @@ -121,7 +134,7 @@ jobs:
- name: Run the demo
run: |
source .venv/bin/activate
VERBOSE=${{ github.event.inputs.verbose }} PROGESS=${{ github.event.inputs.progress }} CLONE_DEPTH=${{ github.event.inputs.clone_depth }} BUILD_CONFIG=${{ github.event.inputs.build_config }} IGNORE_ERROR=${{ github.event.inputs.ignore_error }} TEST=${{ github.event.inputs.test }} INSTALL=${{ github.event.inputs.install }} DEPLOY=${{ github.event.inputs.deploy }} EXPORT=${{ github.event.inputs.export }} DEST=/tmp/seal5_llvm ${{ steps.ctx.outputs.program }} examples/${{ github.event.inputs.script }}
VERBOSE=${{ github.event.inputs.verbose }} PROGRESS=${{ github.event.inputs.progress }} CCACHE=${{ matrix.ccache }} CLONE_DEPTH=${{ github.event.inputs.clone_depth }} BUILD_CONFIG=${{ github.event.inputs.build_config }} IGNORE_ERROR=${{ github.event.inputs.ignore_error }} TEST=${{ github.event.inputs.test }} INSTALL=${{ github.event.inputs.install }} DEPLOY=${{ github.event.inputs.deploy }} EXPORT=${{ github.event.inputs.export }} DEST=/tmp/seal5_llvm ${{ steps.ctx.outputs.program }} examples/${{ github.event.inputs.script }}
- uses: actions/upload-artifact@v4
if: "${{ github.event.inputs.export == '1' }}"
with:
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/demo_weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,22 @@ jobs:
- "1"
export:
- "1"
ccache:
- "1"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup ccache
if: ${{ matrix.ccache == '1' }}
uses: hendrikmuhs/ccache-action@v1
with:
max-size: 2G
key: ${{ matrix.os }}-${{ matrix.script }}-${{ matrix.build_config }}
variant: sccache
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install APT packages
Expand Down Expand Up @@ -118,7 +127,7 @@ jobs:
- name: Run the demo
run: |
source .venv/bin/activate
VERBOSE=${{ matrix.verbose }} PROGRES=${{ matrix.progress }} CLONE_DEPTH=${{ matrix.clone_depth }} BUILD_CONFIG=${{ matrix.build_config }} IGNORE_ERROR=${{ matrix.ignore_error }} TEST=${{ matrix.test }} INSTALL=${{ matrix.install }} DEPLOY=${{ matrix.deploy }} EXPORT=${{ matrix.export }} DEST=/tmp/seal5_llvm ${{ steps.ctx.outputs.program }} examples/${{ matrix.script }}
VERBOSE=${{ matrix.verbose }} PROGRESS=${{ matrix.progress }} CCACHE=${{ matrix.ccache }} CLONE_DEPTH=${{ matrix.clone_depth }} BUILD_CONFIG=${{ matrix.build_config }} IGNORE_ERROR=${{ matrix.ignore_error }} TEST=${{ matrix.test }} INSTALL=${{ matrix.install }} DEPLOY=${{ matrix.deploy }} EXPORT=${{ matrix.export }} DEST=/tmp/seal5_llvm ${{ steps.ctx.outputs.program }} examples/${{ matrix.script }}
- uses: actions/upload-artifact@v4
if: "${{ matrix.export == '1' }}"
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Initialize Virtualenv
Expand All @@ -42,12 +42,12 @@ jobs:
cd docs
make html
- name: Store docs as an artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: html-docs
path: docs/_build/html
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
if: ${{ github.repository == 'tum-ei-eda/seal5' }}
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Generate changelog
id: changelog
uses: metcalfc/changelog-generator@v4.3.1
Expand All @@ -40,7 +40,7 @@ jobs:
if: ${{ github.repository == 'tum-ei-eda/seal5' }}
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build package
run: |
python -m pip install -r requirements_dev.txt
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: "3.10"

- name: Install Python dependencies
run: pip install black flake8

- name: Run linters
uses: wearerequired/lint-action@v1
uses: wearerequired/lint-action@v2
with:
black: true
# black_args: "--line-length=120"
Expand All @@ -33,7 +33,7 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python dependencies
run: pip install licenseheaders
Expand Down
13 changes: 13 additions & 0 deletions examples/cfg/example/intrinsics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
intrinsics:
intrinsics:
- args:
- arg_name: rd
arg_type: i32
- arg_name: rs1
arg_type: i32
- arg_name: rs2
arg_type: i32
instr_name: xexample.subincacc
intrinsic_name: subincacc
ret_type: i32
3 changes: 3 additions & 0 deletions examples/cfg/llvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ llvm:
LLVM_OPTIMIZED_TABLEGEN: true
LLVM_ENABLE_PROJECTS: [clang, lld]
# LLVM_TARGETS_TO_BUILD: [X86, RISCV]
LLVM_DEFAULT_TARGET_TRIPLE: "riscv32-unknown-elf"
LLVM_TARGETS_TO_BUILD: [RISCV]
release_assertions:
options:
Expand All @@ -21,6 +22,7 @@ llvm:
LLVM_OPTIMIZED_TABLEGEN: true
LLVM_ENABLE_PROJECTS: [clang, lld]
# LLVM_TARGETS_TO_BUILD: [X86, RISCV]
LLVM_DEFAULT_TARGET_TRIPLE: "riscv32-unknown-elf"
LLVM_TARGETS_TO_BUILD: [RISCV]
LLVM_FORCE_ENABLE_STATS: true
debug:
Expand All @@ -32,6 +34,7 @@ llvm:
LLVM_ENABLE_PROJECTS: [clang, lld]
# LLVM_TARGETS_TO_BUILD: [X86, RISCV]
LLVM_TARGETS_TO_BUILD: [RISCV]
LLVM_DEFAULT_TARGET_TRIPLE: "riscv32-unknown-elf"
# LLVM_PARALLEL_COMPILE_JOBS: ?
LLVM_PARALLEL_LINK_JOBS: 8
# LLVM_PARALLEL_TABLEGEN_JOBS: ?
Expand Down
16 changes: 9 additions & 7 deletions examples/corev_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@
EXPORT = bool(int(os.environ.get("EXPORT", 1)))
CLEANUP = bool(int(os.environ.get("CLEANUP", 0)))
PROGRESS = bool(int(os.environ.get("PROGRESS", 1)))
CCACHE = bool(int(os.environ.get("CCACHE", 0)))
CLONE_DEPTH = bool(int(os.environ.get("CLONE_DEPTH", 1)))
DEST = os.environ.get("DEST", "/tmp/seal5_llvm_corev").rstrip("/")
DEST_DIR = os.environ.get("DEST_DIR", "/tmp")
DEST = os.environ.get("DEST", DEST_DIR + "/seal5_llvm_corev").rstrip("/")
NAME = os.environ.get("NAME", "corev")

seal5_flow = Seal5Flow(DEST, name=NAME)
Expand Down Expand Up @@ -117,7 +119,7 @@
seal5_flow.patch(verbose=VERBOSE, stages=[PatchStage.PHASE_0])

# Build initial LLVM
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG)
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG, enable_ccache=CCACHE)

# Transform inputs
# 1. Create M2-ISA-R metamodel
Expand All @@ -132,12 +134,12 @@
seal5_flow.patch(verbose=VERBOSE, stages=[PatchStage.PHASE_1, PatchStage.PHASE_2])

# Build patched LLVM
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG)
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG, enable_ccache=CCACHE)

if not SKIP_PATTERNS:
# Build PatternGen & llc
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG, target="pattern-gen")
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG, target="llc")
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG, target="pattern-gen", enable_ccache=CCACHE)
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG, target="llc", enable_ccache=CCACHE)

# Generate remaining patches
seal5_flow.generate(verbose=VERBOSE, only=["pattern_gen"])
Expand All @@ -146,15 +148,15 @@
seal5_flow.patch(verbose=VERBOSE, stages=list(range(PatchStage.PHASE_3, PatchStage.PHASE_5 + 1)))

# Build patched LLVM
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG)
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG, enable_ccache=CCACHE)

if TEST:
# Test patched LLVM
seal5_flow.test(verbose=VERBOSE, ignore_error=IGNORE_ERROR)

if INSTALL:
# Install final LLVM
seal5_flow.install(verbose=VERBOSE, config=BUILD_CONFIG)
seal5_flow.install(verbose=VERBOSE, config=BUILD_CONFIG, enable_ccache=CCACHE)

if DEPLOY:
# Deploy patched LLVM (export sources)
Expand Down
17 changes: 10 additions & 7 deletions examples/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@
EXPORT = bool(int(os.environ.get("EXPORT", 1)))
CLEANUP = bool(int(os.environ.get("CLEANUP", 0)))
PROGRESS = bool(int(os.environ.get("PROGRESS", 1)))
CCACHE = bool(int(os.environ.get("CCACHE", 0)))
CLONE_DEPTH = bool(int(os.environ.get("CLONE_DEPTH", 1)))
DEST = os.environ.get("DEST", "/tmp/seal5_llvm_demo").rstrip("/")
DEST_DIR = os.environ.get("DEST_DIR", "/tmp")
DEST = os.environ.get("DEST", DEST_DIR + "/seal5_llvm_demo").rstrip("/")
NAME = os.environ.get("NAME", "demo")

seal5_flow = Seal5Flow(DEST, name=NAME)
Expand Down Expand Up @@ -93,6 +95,7 @@
EXAMPLES_DIR / "cfg" / "tests.yml",
EXAMPLES_DIR / "cfg" / "passes.yml",
EXAMPLES_DIR / "cfg" / "git.yml",
EXAMPLES_DIR / "cfg" / "example/intrinsics.yml",
]
seal5_flow.load(cfg_files, verbose=VERBOSE, overwrite=False)

Expand All @@ -108,7 +111,7 @@
seal5_flow.patch(verbose=VERBOSE, stages=[PatchStage.PHASE_0])

# Build initial LLVM
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG)
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG, enable_ccache=CCACHE)

# Transform inputs
# 1. Create M2-ISA-R metamodel
Expand All @@ -123,12 +126,12 @@
seal5_flow.patch(verbose=VERBOSE, stages=[PatchStage.PHASE_1, PatchStage.PHASE_2])

# Build patched LLVM
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG)
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG, enable_ccache=CCACHE)

if not SKIP_PATTERNS:
# Build PatternGen & llc
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG, target="pattern-gen")
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG, target="llc")
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG, target="pattern-gen", enable_ccache=CCACHE)
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG, target="llc", enable_ccache=CCACHE)

# Generate remaining patches
seal5_flow.generate(verbose=VERBOSE, only=["pattern_gen"])
Expand All @@ -137,15 +140,15 @@
seal5_flow.patch(verbose=VERBOSE, stages=list(range(PatchStage.PHASE_3, PatchStage.PHASE_5 + 1)))

# Build patched LLVM
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG)
seal5_flow.build(verbose=VERBOSE, config=BUILD_CONFIG, enable_ccache=CCACHE)

if TEST:
# Test patched LLVM
seal5_flow.test(verbose=VERBOSE, ignore_error=IGNORE_ERROR)

if INSTALL:
# Install final LLVM
seal5_flow.install(verbose=VERBOSE, config=BUILD_CONFIG)
seal5_flow.install(verbose=VERBOSE, config=BUILD_CONFIG, enable_ccache=CCACHE)

if DEPLOY:
# Deploy patched LLVM (export sources)
Expand Down
23 changes: 15 additions & 8 deletions examples/demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ DEPLOY=${DEPLOY:-1}
EXPORT=${EXPORT:-1}
CLEANUP=${CLEANUP:-0}
PROGRESS=${PROGRESS:-1}
CCACHE=${PROGRESS:-0}
CLONE_DEPTH=${CLONE_DEPTH:-1}
DEST=${DEST:-"/tmp/seal5_llvm_cli_demo"}
NAME=${NAME:-"cli_demo"}
Expand All @@ -58,30 +59,36 @@ fi
INTERACTIVE_ARGS=""
if [[ $INTERACTIVE -eq 0 ]]
then
PROGRESS_ARGS="--non-interactive"
INTERACTIVE_ARGS="--non-interactive"
fi

CCACHE_ARGS=""
if [[ $CCACHE -eq 1 ]]
then
CCACHE_ARGS="--ccache"
fi


seal5 --verbose --dir ${SEAL5_HOME} reset --settings
seal5 --verbose --dir ${SEAL5_HOME} clean --temp --patches --models --inputs
seal5 --verbose --dir ${SEAL5_HOME} init $INTERACTIVE_ARGS -c --clone-depth $CLONE_DEPTH $PROGRESS_ARGS
seal5 --verbose --dir ${SEAL5_HOME} init $INTERACTIVE_ARGS -c --clone-depth $CLONE_DEPTH $PROGRESS_ARGS -f
seal5 --verbose load --files ${Example_files}
seal5 --verbose load --files ${Config_files[@]}
seal5 --verbose setup $PROGRESS_ARGS
seal5 --verbose patch -s 0
seal5 --verbose build --config $BUILD_CONFIG
seal5 --verbose build --config $BUILD_CONFIG $CCACHE_ARGS
seal5 --verbose transform
seal5 --verbose generate --skip pattern_gen
seal5 --verbose patch -s 1 2
if [[ $SKIP_PATTERNS -eq 0 ]]
then
seal5 --verbose build --config $BUILD_CONFIG
seal5 --verbose build --config $BUILD_CONFIG -t pattern-gen
seal5 --verbose build --config $BUILD_CONFIG -t llc
seal5 --verbose build --config $BUILD_CONFIG $CCACHE_ARGS
seal5 --verbose build --config $BUILD_CONFIG -t pattern-gen $CCACHE_ARGS
seal5 --verbose build --config $BUILD_CONFIG -t llc $CCACHE_ARGS
seal5 --verbose generate --only pattern_gen
fi
seal5 --verbose patch -s 3 4 5
seal5 --verbose build --config $BUILD_CONFIG
seal5 --verbose build --config $BUILD_CONFIG $CCACHE_ARGS

if [[ $TEST -eq 1 ]]
then
Expand All @@ -95,7 +102,7 @@ fi

if [[ $INSTALL -eq 1 ]]
then
seal5 --verbose install --config $BUILD_CONFIG
seal5 --verbose install --config $BUILD_CONFIG $CCACHE_ARGS
fi

if [[ $DEPLOY -eq 1 ]]
Expand Down
Loading

0 comments on commit cf80445

Please sign in to comment.