Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR CI (in-tree mlir-xten) #67

Merged
merged 7 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 49 additions & 48 deletions .github/workflows/build-llvm-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,68 @@
name: Build x86 LLVM-Nightly Image
josel-amd marked this conversation as resolved.
Show resolved Hide resolved

on:
# Allow manually triggering rebuild.
pull_request:
josel-amd marked this conversation as resolved.
Show resolved Hide resolved
workflow_dispatch:
# Run every week (on Sunday).
schedule:
- cron: '0 0 * * SUN'
josel-amd marked this conversation as resolved.
Show resolved Hide resolved

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build-llvm-image:
buildandtest:
name: Build & Test
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Get Repo
uses: actions/checkout@v2
with:
fetch-depth: 2
submodules: "true"

- name: Ccache for C++ compilation
uses: hendrikmuhs/ccache-action@4687d037e4d7cf725512d9b819137a3af34d39b3
with:
key: ${{ runner.os }}-clangreleaseasserts-${{ steps.get-submodule-hash.outputs.hash }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
steps:
- uses: actions/checkout@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
submodules: true

- name: Extract metadata (tags, labels) for Docker
id: meta-llvm
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
TinaAMD marked this conversation as resolved.
Show resolved Hide resolved
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-llvm
key: ${{ matrix.os }}
variant: sccache

- name: Build and push LLVM image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta-llvm.outputs.tags }}
labels: ${{ steps.meta-llvm.outputs.labels }}
file: .github/workflows/llvmmlir.Dockerfile
- name: Set virtual env
run: |
python3 -m venv .venv
source .venv/bin/activate

# env:
# DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
# run: |
# # Swaps utils/clone-mlir for a different shell script that clones the latest version of llvm/mlir.
# mv $GITHUB_WORKSPACE/utils/clone-mlir.sh $GITHUB_WORKSPACE/utils/clone-mlir-backup.sh
# cp $GITHUB_WORKSPACE/utils/clone-mlir-master.sh $GITHUB_WORKSPACE/utils/clone-mlir.sh
# # Build docker image for x86 arch, with the latest llvm/mlir and subsequently publish it.
# docker build --tag onnxmlirczar/onnx-mlir-llvmimage:x86-nightly -f $GITHUB_WORKSPACE/.github/workflows/prereq.Dockerfile $GITHUB_WORKSPACE/utils
# docker login -u onnxmlirczar -p "$DOCKER_HUB_TOKEN"
# docker push onnxmlirczar/onnx-mlir-llvmimage:x86-nightly
# Reuse the requirements from mlir
# mlir-xten is an extension to mlir and should work under the same environment.
- name: Install requirements.txt
run: |
pip install -r ./llvm-project/mlir/python/requirements.txt

- name: Install Ninja
uses: llvm/actions/install-ninja@main


- name: Build and Test
josel-amd marked this conversation as resolved.
Show resolved Hide resolved
shell: bash
id: build-llvm
run: |
cmake -GNinja \
-Bbuild \
llvm-project/llvm \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_USE_LINKER=lld \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_TARGETS_TO_BUILD=host \
-DLLVM_BUILD_TOOLS=OFF \
-DLLVM_BUILD_UTILS=OFF \
-DLLVM_BUILD_RUNTIMES=OFF \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
-DLLVM_EXTERNAL_PROJECTS=mlir-xten \
-DMLIR_XTEN_ENABLE_TORCH=OFF \
-DLLVM_EXTERNAL_MLIR_XTEN_SOURCE_DIR="$PWD"
ninja -C build check-xten-all
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "llvm-project"]
path = llvm-project
url = https://github.com/Xilinx/llvm-project.git
branch = feature/fused-ops
1 change: 1 addition & 0 deletions lib/Conversion/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ add_mlir_library(XTenConversionPasses

DEPENDS
XTenConversionIncGen
MLIRLinalgOpsIncGen

LINK_COMPONENTS
Core
Expand Down
1 change: 1 addition & 0 deletions llvm-project
Submodule llvm-project added at 647a14