Skip to content

Commit

Permalink
github.workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Nov 12, 2024
1 parent 690f0d5 commit eaca753
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 20 deletions.
50 changes: 37 additions & 13 deletions .github/workflows/build_llvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ name: "Build LLVM and MLIR"

on:
workflow_dispatch:
inputs:
force_debug_with_tmate:
type: boolean
description: 'Run the build with tmate session'
required: false
default: false
debug_with_tmate:
type: boolean
description: 'Run the build with a tmate session ONLY in case of failure'
required: false
default: false
pull_request:
paths:
- ".github/workflows/build_llvm.yml"
Expand Down Expand Up @@ -121,12 +132,24 @@ jobs:
$python3_command -m pip install -r third_party/llvm-project/mlir/python/requirements.txt
echo "Python3_EXECUTABLE=$(which $python3_command)" >> $GITHUB_ENV
- name: "Canonicalize workspace"
id: canonicalize-workspace
run: |
if [[ "${{ matrix.runs-on }}" == ubuntu* ]]; then
echo "workspace=$GITHUB_WORKSPACE" >> $GITHUB_OUTPUT
else
echo "workspace=${{ github.workspace }}" >> $GITHUB_OUTPUT
fi
- name: "Build LLVM and MLIR"
id: build
run: |
export CCACHE_DIR="${{ env.CACHE_DIR }}"
export CCACHE_MAXSIZE=700M
export CCACHE_COMPILERCHECK="string:$($CC --version)"
export CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros
mkdir -p "${{ env.CACHE_DIR }}"
ccache --set-config=cache_dir="${{ env.CACHE_DIR }}"
ccache --set-config=max_size=700M
ccache --set-config=compiler_check="string:$($CC --version | head -n 1)"
ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime,file_stat_matches
ccache --set-config=umask=002
export CMAKE_C_COMPILER_LAUNCHER=ccache
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
Expand All @@ -135,22 +158,23 @@ jobs:
export CMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld"
export Python3_EXECUTABLE="$Python3_EXECUTABLE"
export LLVM_SOURCE_DIR="$PWD/third_party/llvm-project"
export LLVM_BUILD_DIR="$PWD/llvm-build"
export LLVM_INSTALL_DIR="$PWD/llvm-install"
export LLVM_SOURCE_DIR="${{ steps.canonicalize-workspace.outputs.workspace }}/third_party/llvm-project"
export LLVM_BUILD_DIR="${{ steps.canonicalize-workspace.outputs.workspace }}/llvm-build"
export LLVM_INSTALL_DIR="${{ steps.canonicalize-workspace.outputs.workspace }}/llvm-install"
pushd $LLVM_SOURCE_DIR && llvm_sha_short=$(git rev-parse --short HEAD) && popd
ccache -p
ccache -z
build_tools/cmake/build_llvm.sh
ccache -s
pushd $LLVM_SOURCE_DIR && echo "llvm_sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT && popd
rm -rf $LLVM_BUILD_DIR $LLVM_SOURCE_DIR
tar cf llvm-dist-${{ matrix.name }}-$llvm_sha_short.tar $LLVM_INSTALL_DIR
rm -rf $LLVM_INSTALL_DIR
- name: "Upload dist"
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}_llvm_packages
path: llvm-dist-*.tar
name: ${{ matrix.name }}_llvm_${{ steps.build.outputs.llvm_sha_short }}
path: ${{ steps.canonicalize-workspace.outputs.workspace }}/llvm-install
if-no-files-found: error

- name: "Save cache"
Expand All @@ -162,7 +186,7 @@ jobs:
key: ${{ env.CACHE_KEY }}

- name: "Setup tmate session"
if: ${{ failure() }}
if: ${{ (failure() && inputs.debug_with_tmate) || inputs.force_debug_with_tmate }}
uses: mxschmitt/[email protected]
with:
limit-access-to-actor: true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Embedded Universal DSL: a good DSL for us by us
# Embedded Universal DSL: a good DSL for us, by us

This repository contains the source code for `EUDSL`, a toolkit for the construction of
embedded DSLs, in arbitrary languages, for targeting [MLIR](https://mlir.llvm.org).
Expand Down
11 changes: 5 additions & 6 deletions build_tools/cmake/llvm_cache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set(LLVM_INSTALL_UTILS ON CACHE BOOL "")
# All the tools will use libllvm shared library
set(LLVM_BUILD_LLVM_DYLIB ON CACHE BOOL "")
set(LLVM_LINK_LLVM_DYLIB ON CACHE BOOL "")
set(LLVM_BUILD_LLVM_DYLIB_VIS ON CACHE BOOL "")

# useful things
set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
Expand Down Expand Up @@ -56,14 +57,12 @@ set(LLVM_INSTALL_TOOLCHAIN_ONLY OFF CACHE BOOL "")

set(LLVM_DISTRIBUTIONS MlirDevelopment CACHE STRING "")
set(LLVM_MlirDevelopment_DISTRIBUTION_COMPONENTS
Remarks
LLVM
LLVMTableGen
LLVMDemangle
LLVMSupport
cmake-exports
llvm-config
llvm-headers
llvm-libraries
opt
FileCheck
count
not
mlir-opt
mlir-reduce
Expand Down

0 comments on commit eaca753

Please sign in to comment.