Skip to content

Commit

Permalink
Merge branch 'master' into AndersenRegionAwareCI
Browse files Browse the repository at this point in the history
# Conflicts:
#	scripts/run-llvm-test-suite.sh
  • Loading branch information
phate committed Feb 14, 2025
2 parents 4b9e5d5 + 36fa389 commit 9141c20
Show file tree
Hide file tree
Showing 437 changed files with 34,145 additions and 23,043 deletions.
16 changes: 16 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
Checks: '-*,
bugprone-move-forwarding-reference,
misc-unused-parameters,
misc-unused-using-decls,
modernize-deprecated-headers,
modernize-redundant-void-arg,
'

WarningsAsErrors: '
bugprone-move-forwarding-reference,
misc-unused-parameters,
misc-unused-using-decls,
modernize-deprecated-headers,
modernize-redundant-void-arg,
'
32 changes: 20 additions & 12 deletions .github/actions/BuildCirct/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,40 @@ description: "Builds CIRCT, which is used for the HLS backend"
runs:
using: "composite"
steps:
- name: "Install LLVM, Clang, MLIR, and Ninja"
uses: ./.github/actions/InstallPackages
with:
install-llvm: true
install-mlir: true
install-ninja: true

- name: "Get the commit used for building CIRCT and use it as the cache key"
id: get-circt-hash
run: |
echo "hash=$(./scripts/build-circt.sh --get-commit-hash)" >> $GITHUB_OUTPUT
shell: bash

- name: "Try to fetch CIRCT from the cache"
id: cache-circt
uses: actions/cache@v4
id: restore-cache-circt
uses: actions/cache/restore@v4
with:
path: |
${{ github.workspace }}/build-circt/circt
key: ${{ runner.os }}-circt-${{ steps.get-circt-hash.outputs.hash }}

- name: "Install LLVM, Clang, MLIR, and Ninja"
uses: ./.github/actions/InstallPackages
with:
install-llvm: true
install-mlir: true
install-ninja: true

- name: "Build CIRCT if we didn't hit in the cache"
if: steps.cache-circt.outputs.cache-hit != 'true'
if: steps.restore-cache-circt.outputs.cache-hit != 'true'
run: |
./scripts/build-circt.sh \
--build-path ${{ github.workspace }}/build-circt \
--install-path ${{ github.workspace }}/build-circt/circt \
--llvm-lit-path ~/.local/bin/lit
--install-path ${{ github.workspace }}/build-circt/circt
shell: bash

- name: "Save CIRCT to the cache"
if: steps.restore-cache-circt.outputs.cache-hit != 'true'
id: save-cache-circt
uses: actions/cache/save@v4
with:
path: |
${{ github.workspace }}/build-circt/circt
key: ${{ steps.restore-cache-circt.outputs.cache-primary-key }}
4 changes: 2 additions & 2 deletions .github/actions/BuildJlm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ runs:
run: |
export JLM_CONFIGURE_ARGUMENTS="--target release --enable-asserts"
if [[ "${{inputs.enable-hls}}" == "true" ]]; then
JLM_CONFIGURE_ARGUMENTS="$JLM_CONFIGURE_ARGUMENTS --enable-hls ${{ github.workspace }}/build-circt/circt"
JLM_CONFIGURE_ARGUMENTS="$JLM_CONFIGURE_ARGUMENTS --enable-hls=${{ github.workspace }}/build-circt/circt"
fi
if [[ "${{inputs.enable-mlir}}" == "true" ]]; then
JLM_CONFIGURE_ARGUMENTS="$JLM_CONFIGURE_ARGUMENTS --enable-mlir ${{ github.workspace }}/lib/mlir-rvsdg"
JLM_CONFIGURE_ARGUMENTS="$JLM_CONFIGURE_ARGUMENTS --enable-mlir=${{ github.workspace }}/build-mlir/usr"
fi
if [[ "${{inputs.enable-coverage}}" == "true" ]]; then
JLM_CONFIGURE_ARGUMENTS="$JLM_CONFIGURE_ARGUMENTS --enable-coverage"
Expand Down
38 changes: 21 additions & 17 deletions .github/actions/BuildMlirDialect/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,40 @@ description: "Restore MLIR RVSDG Dialect from cache and build if it's not in the
runs:
using: "composite"
steps:
- name: "Clone MLIR RVSDG dialect"
run: git clone https://github.com/EECS-NTNU/mlir_rvsdg.git ${{ github.workspace }}/mlir-rvsdg
shell: bash
- name: "Install LLVM, MLIR and Ninja"
uses: ./.github/actions/InstallPackages
with:
install-llvm: true
install-mlir: true
install-ninja: true

- name: "Extract the hash for latest commit for use in the cache key"
- name: "Extract the commit hash for building the MLIR Dialect"
id: get-mlir-hash
run: |
cd ${{ github.workspace }}/mlir-rvsdg
echo "hash=$(git rev-parse main)" >> $GITHUB_OUTPUT
echo "hash=$(./scripts/build-mlir.sh --get-commit-hash)" >> $GITHUB_OUTPUT
shell: bash

- name: "Try to fetch Dialect from the cache"
id: cache-mlir
id: restore-cache-mlir
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/lib/mlir-rvsdg
${{ github.workspace }}/build-mlir/usr
key: ${{ runner.os }}-mlir-${{ steps.get-mlir-hash.outputs.hash }}

- name: "Install LLVM and Clang"
uses: ./.github/actions/InstallPackages
with:
install-llvm: true
install-mlir: true
install-ninja: true

- name: "Build MLIR RVSDG Dialect if we didn't hit in the cache"
if: steps.cache-mlir.outputs.cache-hit != 'true'
if: steps.restore-cache-mlir.outputs.cache-hit != 'true'
run: |
./scripts/build-mlir.sh \
--install-path ${{ github.workspace }}/lib/mlir-rvsdg
--build-path ${{ github.workspace }}/build-mlir \
--install-path ${{ github.workspace }}/build-mlir/usr
shell: bash

- name: "Save MLIR to the cache"
if: steps.rstore-cache-mlir.outputs.cache-hit != 'true'
id: save-cache-mlir
uses: actions/cache/save@v4
with:
path: |
${{ github.workspace }}/build-mlir/usr
key: ${{ runner.os }}-mlir-${{ steps.get-mlir-hash.outputs.hash }}
36 changes: 26 additions & 10 deletions .github/actions/InstallPackages/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: "Install packages"
description: "Installs packages that the jlm framework depends on."

inputs:
llvm-version:
description: "LLVM/MLIR version that is installed"
default: 18
required: false

install-llvm:
description: "Install LLVM package. Default is 'false'."
default: "false"
Expand All @@ -22,6 +27,11 @@ inputs:
default: "false"
required: false

install-clang-tidy:
description: "Install clang-tidy package. Default is 'false'."
default: "false"
required: false

install-ninja:
description: "Install ninja package. Default is 'false'."
default: "false"
Expand Down Expand Up @@ -49,12 +59,13 @@ runs:
if: ${{inputs.install-llvm == 'true'
|| inputs.install-clang == 'true'
|| inputs.install-mlir == 'true'
|| inputs.install-clang-format == 'true'}}
|| inputs.install-clang-format == 'true'
|| inputs.install-clang-tidy == 'true'}}
run: |
export HAS_LLVM_REPOSITORY=$(find /etc/apt/ -name *.list | xargs cat | grep llvm-toolchain-jammy-17)
export HAS_LLVM_REPOSITORY=$(find /etc/apt/ -name *.list | xargs cat | grep llvm-toolchain-jammy-${{inputs.llvm-version}})
if [[ -z $HAS_LLVM_REPOSITORY ]]; then
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo add-apt-repository --no-update deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main
sudo add-apt-repository --no-update deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${{inputs.llvm-version}} main
fi
shell: bash

Expand All @@ -65,29 +76,34 @@ runs:
- name: "Install LLVM package"
if: ${{inputs.install-llvm == 'true'}}
run: |
sudo apt-get install llvm-17-dev
pip install "lit~=17.0"
sudo apt-get install llvm-${{inputs.llvm-version}}-dev
pip install "lit~=${{inputs.llvm-version}}.0"
pip show lit
shell: bash

- name: "Install clang package"
if: ${{inputs.install-clang == 'true'}}
run: sudo apt-get install clang-17
run: sudo apt-get install clang-${{inputs.llvm-version}}
shell: bash

- name: "Install MLIR packages"
if: ${{inputs.install-mlir == 'true'}}
run: |
sudo apt-get install libmlir-17-dev mlir-17-tools
sudo apt-get install libmlir-${{inputs.llvm-version}}-dev mlir-${{inputs.llvm-version}}-tools
if ! [ -f /usr/lib/x86_64-linux-gnu/libMLIR.so ]; then
sudo ln -s /usr/lib/llvm-17/lib/libMLIR.so.17 /usr/lib/x86_64-linux-gnu/
sudo ln -s /usr/lib/llvm-17/lib/libMLIR.so.17 /usr/lib/x86_64-linux-gnu/libMLIR.so
sudo ln -s /usr/lib/llvm-${{inputs.llvm-version}}/lib/libMLIR.so.${{inputs.llvm-version}}* /usr/lib/x86_64-linux-gnu/
sudo ln -s /usr/lib/llvm-${{inputs.llvm-version}}/lib/libMLIR.so.${{inputs.llvm-version}}* /usr/lib/x86_64-linux-gnu/libMLIR.so
fi
shell: bash

- name: "Install clang-format package"
if: ${{inputs.install-clang-format == 'true'}}
run: sudo apt-get install clang-format-17
run: sudo apt-get install clang-format-${{inputs.llvm-version}}
shell: bash

- name: "Install clang-tidy package"
if: ${{inputs.install-clang-tidy == 'true'}}
run: sudo apt-get install clang-tidy-${{inputs.llvm-version}}
shell: bash

- name: "Install ninja package"
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/CheckHeaders.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CheckHeaders

on:
pull_request:
branches: [ master ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
CheckHeaders:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: "Install LLVM"
uses: ./.github/actions/InstallPackages
with:
install-llvm: true # Needed to configure jlm
- name: "Configure jlm with HLS and MLIR enabled"
run: ./configure.sh --enable-mlir --enable-hls
- name: "Check headers"
run: make check-headers
4 changes: 4 additions & 0 deletions .github/workflows/ClangFormat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
pull_request:
branches: [ master ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
CheckFormat:
runs-on: ubuntu-22.04
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/ClangTidy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: ClangTidy

on:
pull_request:
branches: [ master ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
CheckTidy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: "Install clang tidy"
uses: ./.github/actions/InstallPackages
with:
install-clang-tidy: true

- name: "Install HLS dialect dependencies"
uses: ./.github/actions/BuildCirct

- name: "Install MLIR dialect dependencies"
uses: ./.github/actions/BuildMlirDialect

- name: "Configure jlm with HLS and MLIR enabled"
run: ./configure.sh --enable-mlir=${{ github.workspace }}/build-mlir/usr --enable-hls=${{ github.workspace }}/build-circt/circt

- name: "Run clang tidy"
run: make tidy
20 changes: 20 additions & 0 deletions .github/workflows/DefaultCache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: DefaultCache

on:
push:
branches: [ master ]

jobs:
DefaultCache:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: "Install dependencies"
uses: ./.github/actions/InstallPackages
with:
install-llvm: true
install-clang: true
- name: "Build CIRCT to generate cache"
uses: ./.github/actions/BuildCirct
- name: "Build MLIR to generate cache"
uses: ./.github/actions/BuildMlirDialect
4 changes: 4 additions & 0 deletions .github/workflows/Doxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
pull_request:
branches: [ master ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
GenerateDocumentation:
runs-on: ubuntu-22.04
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/hls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
pull_request:
branches: [ master ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:

hls-test-suite:
Expand All @@ -21,4 +25,18 @@ jobs:
with:
install-verilator: true
- name: "Run hls-test-suite"
run: ./scripts/run-hls-test.sh --firtool ${{ github.workspace }}/build-circt/circt/bin/firtool
run: ./scripts/run-hls-test.sh
- name: "Create comment if cycles differ"
if: ${{ hashFiles('./usr/hls-test-suite/build/cycle-diff.log') != '' }}
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const fs = require("fs");
const comment = fs.readFileSync("./usr/hls-test-suite/build/cycle-diff.log", { encoding: "utf8" });
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "```\n" + comment + "```"
});
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
pull_request:
branches: [ master ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-22.04
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Makefile.custom
.idea
docs/html
build
build-*
build-*/
usr
Loading

0 comments on commit 9141c20

Please sign in to comment.