Skip to content

Commit

Permalink
Added test bench generation tcl as a LLVM pass (#18)
Browse files Browse the repository at this point in the history
* Added memory partitioning pragma for Vitis HLS LLVM

* Added test bench generation tcl as a LLVM pass

* Added pragma insertion for array partitioning

* Removed unsupported func attr by vhls

* Replaced tb tclgen script with llvm pass

* Fixed a typo

* Restored original tbgen in comments

* Removed assertion for debugging

* Switch off -xlnarraypartition if such flag is OFF

* Fixed an issue with removing tile.size

* Fixed unit tests

* Resurrected the unittest workflow

* Just build-phism in the workflow

* Array partition unit test simple cases

* Fixed an issue with the loop bounds

* Rewrite modulo operations

* Further simplifies GEP expressions

* Added loop naming and flattening pass

* Remove loop flattening which stops loop merging

* An issue with GEP optimisation

* Loop redistribution pass

* Loop merge pass

* Loop redis unit tests

* Added unit tests for loop merge

* Makes pb-flow stabler

* Improved pb-flow and unit tests

* Fixed issues with array partition

* Try to restore cache and don't run test

* Don't cmake if it has been built

* Further reduce the chance of cmake runs

* Temporarily removed the python interface

* Try self-hosted

* Added back the python test bits

* Demystifying the python script execution in workflow

* Changes in address calc and inline

* Don't inline in MLIR

* Fixed array partitioning issue for mvt

* Fixed an issue with the array partitioning

* Added cosim run command

* Improved logging

Co-authored-by: Ruizhe Zhao <[email protected]>
  • Loading branch information
Jianyi Cheng and kumasento authored Sep 16, 2021
1 parent 5ae1e77 commit 367bd87
Show file tree
Hide file tree
Showing 16 changed files with 2,038 additions and 159 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/buildAndTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# This is a basic workflow to help you get started with Actions
name: Build and Test
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on: [push, pull_request]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Build Phism and run its tests.
build-phism:
name: Build and Test Phism
runs-on: self-hosted
steps:
# - name: Configure Environment
# run: echo "${GITHUB_WORKSPACE}/llvm/install/bin" >> $GITHUB_PATH
# Disabled for self-hosted
# - name: Get dependences
# run: |
# sudo apt-get update -y
# sudo apt-get install -y build-essential libtool autoconf pkg-config flex bison libgmp-dev clang-9 libclang-9-dev texinfo python3
# - name: Update the LLVM/Clang version to 9
# run: |
# sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-9 100
# sudo update-alternatives --install /usr/bin/FileCheck FileCheck /usr/bin/FileCheck-9 100


# Clone the Phism repo and its submodules. Do shallow clone to save clone
# time.
- name: Get Phism
uses: actions/checkout@v2
with:
submodules: "true"

# --------
# Restore LLVM from cache and build if it's not in there.
# --------
# Extract the LLVM submodule hash for use in the cache key.
- name: Get LLVM Hash
id: get-llvm-hash
run: echo "::set-output name=hash::$(git rev-parse @:./llvm)"
shell: bash
# Try to fetch LLVM from the cache.
- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v2
with:
path: llvm/build
key: ${{ runner.os }}-llvm-${{ steps.get-llvm-hash.outputs.hash }}
# Build LLVM if we didn't hit in the cache. Even though we build it in
# the previous job, there is a low chance that it'll have been evicted by
# the time we get here.
# Need to delete the test directory to avoid caching them.
- name: Rebuild and Install LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
./scripts/build-llvm.sh ci
rm -rf ./llvm/build/test
# --------
# Build and test Phism in both debug and release mode.
# --------
- name: Build and Test Phism (Assert)
run: |
./scripts/build-phism.sh ci
# Build and test Phism with pb-flow.
- name: Build and Test Phism (pb-flow)
run: |
python3 -m venv env
source env/bin/activate
which python3
python3 -m pip install -r requirements.txt
python3 ./scripts/pb-flow.py ./example/polybench --dataset SMALL --skip-vitis
python3 ./scripts/pb-flow.py ./example/polybench --dataset SMALL --polymer --skip-vitis
python3 ./scripts/pb-flow.py ./example/polybench --dataset SMALL --polymer --loop-transforms --skip-vitis
python3 ./scripts/pb-flow.py ./example/polybench --dataset SMALL --polymer --loop-transforms --array-partition --skip-vitis
10 changes: 10 additions & 0 deletions include/phism/mlir/Transforms/Utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//===- Utils.h - Utility functions ------------------ C++-===//

#include "mlir/IR/BuiltinOps.h"

namespace phism {

/// Get the top function for the hardware design.
mlir::FuncOp getTopFunction(mlir::ModuleOp m);

} // namespace phism
Loading

0 comments on commit 367bd87

Please sign in to comment.