Skip to content

Commit

Permalink
make & CI & CIRCT: Adapted to jlm build system
Browse files Browse the repository at this point in the history
Updated Makefile to work with jlm's new build framework
The CI has been updated in accordance with the updated Makefile
CIRCT has been removed since jlm now has support for building CIRCT

Bumped jlm
  • Loading branch information
sjalander committed Jan 26, 2024
1 parent fdf78a4 commit 4561051
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 97 deletions.
22 changes: 11 additions & 11 deletions .github/actions/BuildCirct/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ description: "Builds CIRCT, which is used for the HLS backend"
runs:
using: "composite"
steps:
# Extract the CIRCT submodule hash for use in the cache key
- name: Get CIRCT hash
- name: "Get the commit used for building CIRCT and use it as the cache key"
id: get-circt-hash
run: |
echo "hash=$(git rev-parse @:./circt)" >> $GITHUB_OUTPUT
echo "hash=$(./jlm/scripts/build-circt.sh --get-commit-hash)" >> $GITHUB_OUTPUT
shell: bash

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

# Build CIRCT if we didn't hit in the cache
- name: Rebuild and Install CIRCT
- name: "Install LLVM, Clang, MLIR, and Ninja"
uses: ./.github/actions/InstallLlvmDependencies

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

3 changes: 1 addition & 2 deletions .github/actions/InstallLlvmDependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ runs:
sudo ln -s /usr/lib/llvm-16/lib/libMLIR.so.16 /usr/lib/x86_64-linux-gnu/libMLIR.so
shell: bash

- name: "Instal llvm-lit"
- name: "Install lit"
run: sudo python3 /usr/lib/llvm-16/build/utils/lit/setup.py install
shell: bash

37 changes: 0 additions & 37 deletions .github/workflows/hls.yml

This file was deleted.

80 changes: 57 additions & 23 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,76 @@ on:

jobs:

build-jlm:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Cache build
id: cache-build
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/jlm/*
key: ${{ runner.os }}-${{ github.sha }}-jlm
- name: "Update jlm submodule"
run: git submodule update --init jlm/
- name: "Build CIRCT"
uses: ./.github/actions/BuildCirct
- name: "Configure jlm"
run: |
cd jlm && \
./configure.sh --enable-asserts --enable-hls ${{ github.workspace }}/build-circt/circt CXX=clang++-16
- name: "Compile jlm"
run: make jlm-build

polybench:
runs-on: ubuntu-22.04
needs: build-jlm
steps:
- uses: actions/checkout@v3
- name: "Install LLVM and Clang"
- name: "Cache"
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/jlm/*
key: ${{ runner.os }}-${{ github.sha }}-jlm
- name: "Install LLVM, Clang, MLIR, and Ninja"
uses: ./.github/actions/InstallLlvmDependencies
- name: Update jlm submodule
run: git submodule update --init jlm/
- name: Checkout master of jlm
run: cd jlm && git checkout master
- name: Compile jlm
run: make jlm-release -j `nproc`
- name: Update polybench submodule
- name: "Update polybench submodule"
run: git submodule update --init polybench/
- name: Checkout master of polybench
run: cd polybench && git checkout master
- name: Check polybench
- name: "Check polybench"
run: make polybench-check -j `nproc`

llvm-test-suite:
runs-on: ubuntu-22.04
needs: build-jlm
steps:
- uses: actions/checkout@v3
- name: "Install LLVM and Clang"
- name: "Cache"
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/jlm/*
key: ${{ runner.os }}-${{ github.sha }}-jlm
- name: "Install LLVM, Clang, MLIR, and Ninja"
uses: ./.github/actions/InstallLlvmDependencies
- name: Update jlm submodule
run: git submodule update --init jlm/
- name: Checkout master of jlm
run: cd jlm && git checkout master
- name: Compile jlm
run: make jlm-release -j `nproc`
- name: Update llvm-test-suite submodule
- name: "Update llvm-test-suite submodule"
run: git submodule update --init llvm-test-suite/llvm-test-suite.git
- name: Install lit
run: make install-lit
- name: Apply patch
- name: "Apply patch"
run: make apply-llvm-git-patch
- name: Run llvm-test-suite
- name: "Run llvm-test-suite"
run: make llvm-run-opt

hls-test-suite:
runs-on: ubuntu-22.04
needs: build-jlm
steps:
- uses: actions/checkout@v3
- name: "Cache"
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/jlm/*
key: ${{ runner.os }}-${{ github.sha }}-jlm
- name: "Install LLVM, Clang, MLIR, and Ninja"
uses: ./.github/actions/InstallLlvmDependencies
- name: "Install verilator"
run: sudo apt-get install verilator
- name: "Run HLS test suite"
run: make hls-test-run
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@
[submodule "llvm-test-suite/llvm-test-suite.git"]
path = llvm-test-suite/llvm-test-suite.git
url = https://github.com/llvm/llvm-test-suite.git
[submodule "circt"]
path = circt
url = https://github.com/EECS-NTNU/circt.git
61 changes: 42 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ echo "submodule Initializes all the dependent git submodules except
echo " cpu2017 since it requires private access"
echo "submodule-2017 Initializes all the dependent git submodules including"
echo " cpu2017"
echo "all Compiles jlm"
echo "all Compiles CIRCT and the release version of jlm with the"
echo " HLS backend enabled"
echo "jlm-configure-debug Configure jlm to build the debug version"
echo "jlm-configure-release Configure jlm to build the release version"
echo "jlm-build Builds the configured version of jlm"
echo "jlm-clean Calls clean for jlm"
echo "clean Calls clean for jlm, polybench, cpu2017, csmith,"
echo " and llvm-test."
endef
Expand All @@ -22,7 +27,6 @@ help:
@$(HELP_TEXT_JLM)
@$(HELP_TEXT_CSMITH)
@$(HELP_TEXT_HLS_TEST)
@$(HELP_TEXT_CIRCT)

SHELL=/bin/bash

Expand All @@ -35,28 +39,20 @@ CXX=$(CLANG_BIN)/clang++
# Necessary variables
DIR := $(PWD)
JLM_ROOT := $(DIR)/jlm
JLM_BIN := $(JLM_ROOT)/bin
JLM_BIN := $(JLM_ROOT)/build
JLC := $(JLM_BIN)/jlc
HLS := $(JLM_BIN)/jhls
POLYBENCH_ROOT := $(DIR)/polybench
CPU2017_ROOT := $(DIR)/cpu2017
CSMITH_ROOT := $(DIR)/csmith
LLVM_TEST_ROOT := $(DIR)/llvm-test-suite
CIRCT_ROOT := $(DIR)/circt
VERILATOR_ROOT := $(DIR)/verilator
HLS_TEST_ROOT := $(DIR)/hls-test-suite

# Set necessary paths
export PATH := $(JLM_BIN):$(PATH)
export JLMROOT := $(JLM_ROOT)

# Include Makefiles for the tools, libraries, and benchmarks to be built
ifneq ("$(wildcard Makefile-circt.sub)","")
include Makefile-circt.sub
endif
ifneq ("$(wildcard $(JLM_ROOT)/Makefile.sub)","")
include $(JLM_ROOT)/Makefile.sub
endif
ifneq ("$(wildcard $(POLYBENCH_ROOT)/Makefile.sub)","")
include $(POLYBENCH_ROOT)/Makefile.sub
endif
Expand All @@ -80,26 +76,21 @@ endif
export LC_CTYPE=en_US.UTF-8

.PHONY: all
all: jlm-release
all: circt-build jlm-configure-release jlm-build

### SUBMODULE

.PHONY: submodule
submodule:
git -c submodule.cpu2017.update=none \
-c submodule.circt.update=none \
submodule update --init --recursive

.PHONY: submodule-cpu2017
submodule-cpu2017:
git -c submodule update --init --recursive $(CPU2017_ROOT)

.PHONY: submodule-circt
submodule-circt:
git submodule update --init $(CIRCT_ROOT)

.PHONY: submodule-all
submodule-all: submodule submodule-cpu2017 submodule-circt
submodule-all: submodule submodule-cpu2017

### GENERIC

Expand All @@ -114,7 +105,39 @@ submodule-all: submodule submodule-cpu2017 submodule-circt
ar cqv $@ $^
ranlib $@

### JLM

CIRCT_PATH = $(JLM_ROOT)/build-circt/circt

.PHONY: jlm-configure-debug
jlm-configure-debug:
@cd $(JLM_ROOT) && \
./configure.sh --enable-asserts --enable-hls $(CIRCT_PATH) --target debug CXX=clang++-16

.PHONY: jlm-configure-release
jlm-configure-release:
@cd $(JLM_ROOT) && \
./configure.sh --enable-asserts --enable-hls $(CIRCT_PATH) --target release CXX=clang++-16

.PHONY: jlm-build
jlm-build: $(JLM_ROOT)/Makefile.config
@make -C $(JLM_ROOT) -j `nproc` -O

### CIRCT

.PHONY: circt-build
circt-build: $(CIRCT_PATH)

$(CIRCT_PATH):
$(JLM_ROOT)/scripts/build-circt.sh \
--build-path $(JLM_ROOT)/build-circt \
--install-path $(CIRCT_PATH)

### CLEAN

.PHONY: clean
clean: jlm-clean polybench-purge cpu2017-clean csmith-clean llvm-test
clean: jlm-clean polybench-purge cpu2017-clean csmith-clean llvm-clean

.PHONY: jlm-clean
jlm-clean:
@make -C $(JLM_ROOT) distclean
1 change: 0 additions & 1 deletion circt
Submodule circt deleted from 093cdf
2 changes: 1 addition & 1 deletion jlm
Submodule jlm updated 125 files

0 comments on commit 4561051

Please sign in to comment.