Skip to content

Commit

Permalink
Merge branch 'master' into AndersenRegionAwareCI
Browse files Browse the repository at this point in the history
  • Loading branch information
haved committed Jan 8, 2025
2 parents 4b9e5d5 + 14268ac commit 0fd0ea0
Show file tree
Hide file tree
Showing 378 changed files with 25,413 additions and 17,080 deletions.
14 changes: 14 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
Checks: '-*,
bugprone-move-forwarding-reference,
misc-unused-parameters,
modernize-deprecated-headers,
modernize-redundant-void-arg,
'

WarningsAsErrors: '
bugprone-move-forwarding-reference,
misc-unused-parameters,
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 }}/lib/mlir-rvsdg"
fi
if [[ "${{inputs.enable-coverage}}" == "true" ]]; then
JLM_CONFIGURE_ARGUMENTS="$JLM_CONFIGURE_ARGUMENTS --enable-coverage"
Expand Down
8 changes: 8 additions & 0 deletions .github/actions/BuildMlirDialect/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,11 @@ runs:
--install-path ${{ github.workspace }}/lib/mlir-rvsdg
shell: bash

- name: "Save MLIR to the cache"
if: steps.cache-mlir.outputs.cache-hit != 'true'
id: save-cache-circt
uses: actions/cache/save@v4
with:
path: |
${{ github.workspace }}/lib/mlir-rvsdg
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 }}/lib/mlir-rvsdg --enable-hls=${{ github.workspace }}/build-circt/circt

- name: "Run clang tidy"
run: make tidy
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
17 changes: 11 additions & 6 deletions Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ endif
echo-depends:
echo $(DEPEND)

check-headers: depend
@scripts/check_headers.sh $(DEPEND) -h $(HEADERS) -s $(SOURCES)

################################################################################
# Unit testing rules

Expand Down Expand Up @@ -176,11 +179,13 @@ docs: .PHONY
# Clang format rules

format:
@for FILE in $(SOURCES) $(HEADERS) ; do \
clang-format-$(LLVM_VERSION) --Werror --style="file:.clang-format" --verbose -i $$FILE ;\
done
clang-format-$(LLVM_VERSION) --Werror --style="file:.clang-format" --verbose -i $(SOURCES) $(HEADERS)

format-dry-run:
@for FILE in $(SOURCES) $(HEADERS) ; do \
clang-format-$(LLVM_VERSION) --dry-run --Werror --style="file:.clang-format" --verbose -i $$FILE ;\
done
clang-format-$(LLVM_VERSION) --dry-run --Werror --style="file:.clang-format" --verbose -i $(SOURCES) $(HEADERS)

#################################################################################
# Clang tidy rules

tidy: $(COMMANDPATHSFILE)
clang-tidy-$(LLVM_VERSION) --config-file=.clang-tidy $(HEADERS) $(SOURCES) -- $(CXXFLAGS) $(CPPFLAGS) -I$(BUILD_OUT_PREFIX)
Loading

0 comments on commit 0fd0ea0

Please sign in to comment.