Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
332 changes: 332 additions & 0 deletions .github/workflows/build_test_release_eudsl_tile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,332 @@
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Copyright (c) 2024.

name: "Build, test, release eudsl-tile"

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
workflow_call:
inputs:
wheel_version:
description: 'wheel version'
type: string
required: false
default: ''
workflow_call:
description: 'To distinguish workflow_call from regular push'
type: boolean
required: false
default: true
workflow_caller_run_id:
description: ''
type: string
required: false
default: ''
pull_request:
branches:
- main
paths:
- ".github/workflows/build_test_release_eudsl_tile.yml"
- "projects/eudsl-tile/**"
push:
branches:
- main
paths:
- ".github/workflows/build_test_release_eudsl_tile.yml"
- "projects/eudsl-tile/**"

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

jobs:
build-eudsl-tile:

strategy:
fail-fast: false
matrix:
include:
- name: "ubuntu_x86_64"
runs-on: "ubuntu-22.04"
os: "ubuntu"
host-arch: "x86_64"
target-arch: "x86_64"

- name: "ubuntu_aarch64"
runs-on: "ubuntu-22.04-arm"
os: "ubuntu"
host-arch: "aarch64"
target-arch: "aarch64"

- name: "windows_amd64"
runs-on: "windows-2022"
os: "windows"
host-arch: "amd64"
target-arch: "amd64"

- name: "macos_arm64"
runs-on: "macos-14"
os: "macos"
host-arch: "arm64"
target-arch: "arm64"

runs-on: ${{ matrix.runs-on }}

name: "Build eudsl-tile ${{ matrix.name }}"

defaults:
run:
shell: bash

permissions:
id-token: write
contents: write

env:
# either the PR number or `branch-N` where N always increments
cache-key: eudsl_tile_${{ matrix.name }}_clang_${{ format('{0}-{1}', github.ref_name, github.run_number) }}

steps:
- name: "Check out repository"
uses: actions/checkout@v4.2.2
with:
submodules: false

- name: "Get submodules"
run: git submodule update --init --depth=1

- name: "Setup base"
uses: ./.github/actions/setup_base
id: setup_base
with:
cache-key: ${{ env.cache-key }}
restore-key: "eudsl_tile_${{ matrix.name }}_clang"
os: ${{ matrix.os }}
host-arch: ${{ matrix.host-arch }}
target-arch: ${{ matrix.target-arch }}
runs-on: ${{ matrix.runs-on }}

- name: "Pip download MLIR from releases"
if: ${{ !inputs.workflow_call }}
run: |

pip download mlir-wheel -f https://llvm.github.io/eudsl
WHEEL_NAME=$(ls mlir_wheel*)
$python3_command -m pip install pkginfo
WHEEL_VERSION=$($python3_command -c "from pkginfo import Wheel; print(Wheel('$WHEEL_NAME').version)")
echo "WHEEL_VERSION=$WHEEL_VERSION" >> $GITHUB_ENV

- name: Download LLVM distro artifacts
if: ${{ inputs.workflow_call }}
uses: dawidd6/action-download-artifact@v11
with:
name: mlir_wheel_${{ (matrix.name == 'ubuntu_x86_64' || matrix.name == 'ubuntu_aarch64') && 'manylinux' || matrix.os }}_${{ matrix.target-arch }}_artifact
path: "./"
run_id: ${{ inputs.workflow_caller_run_id }}

- name: "Set WHEEL_VERSION env var"
if: ${{ inputs.workflow_call }}
run: |

echo "WHEEL_VERSION=${{ inputs.wheel_version }}" >> $GITHUB_ENV

- name: "Configure build"
run: |

unzip -q mlir_wheel*.whl
mv mlir_wheel llvm-install

if [[ "${{ matrix.os }}" == "ubuntu" ]]; then
echo "LLVM_DIR=/host/$PWD/llvm-install/lib/cmake/llvm" >> $GITHUB_ENV
echo "MLIR_DIR=/host/$PWD/llvm-install/lib/cmake/mlir" >> $GITHUB_ENV
echo "Clang_DIR=/host/$PWD/llvm-install/lib/cmake/clang" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=/host/$PWD/llvm-install" >> $GITHUB_ENV
else
echo "LLVM_DIR=$PWD/llvm-install/lib/cmake/llvm" >> $GITHUB_ENV
echo "MLIR_DIR=$PWD/llvm-install/lib/cmake/mlir" >> $GITHUB_ENV
echo "Clang_DIR=$PWD/llvm-install/lib/cmake/clang" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=$PWD/llvm-install" >> $GITHUB_ENV
fi

$python3_command -m pip install cibuildwheel

if [[ "${{ matrix.os }}" == "ubuntu" ]] && [[ "${{ matrix.host-arch }}" == "aarch64" ]]; then
sudo apt-get install libarchive-dev antlr libxml2-dev libxslt-dev libcurl4-openssl-dev
fi
if [[ "${{ matrix.os }}" == "macos" ]]; then
brew install antlr boost libarchive
fi

- name: "Build eudsl-tile"
run: |

# combine eudsl-python-extras and eudsl-tile
cp -R "$PWD/projects/eudsl-python-extras/mlir/extras" "$PWD/projects/eudsl-tile/eudsl-tile"
$python3_command -m cibuildwheel "$PWD/projects/eudsl-tile" --output-dir wheelhouse

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: eudsl_tile_${{ matrix.name }}_artifact
path: wheelhouse/*.whl
if-no-files-found: error

- name: "Setup tmate session"
if: (failure() && inputs.debug_with_tmate) || inputs.force_debug_with_tmate
uses: mxschmitt/action-tmate@v3.18
with:
limit-access-to-actor: true
install-dependencies: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'ubuntu') }}

test-eudsl-tile:

if: github.event_name == 'pull_request'

needs: [build-eudsl-tile]

strategy:
fail-fast: false
matrix:
runs-on: [
"ubuntu-22.04",
"ubuntu-22.04-arm",
"macos-14",
"windows-2022"
]
python-version: [
"3.10", "3.11", "3.12",
"3.13", "3.14", "3.14t"
]
include: [
{runs-on: "ubuntu-22.04", name: "ubuntu_x86_64", os: "ubuntu"},
{runs-on: "ubuntu-22.04-arm", name: "ubuntu_aarch64", os: "ubuntu"},
{runs-on: "windows-2022", name: "windows_amd64", os: "windows"},
{runs-on: "macos-14", name: "macos_arm64", os: "macos"},
]
exclude:
# <frozen importlib._bootstrap>:491: Warning: Numpy built with MINGW-W64 on Windows 64 bits is experimental, and only available for testing. You are advised not to use it for production.
- runs-on: windows-2022
python-version: "3.14"

- runs-on: windows-2022
python-version: "3.14t"

- runs-on: macos-14
python-version: "3.10"

- runs-on: macos-14
python-version: "3.11"

- runs-on: macos-14
python-version: "3.12"

- runs-on: macos-14
python-version: "3.13"

- runs-on: macos-14
python-version: "3.14"

runs-on: ${{ matrix.runs-on }}

name: "Test eudsl-tile ${{ matrix.name }} ${{ matrix.python-version }}"

defaults:
run:
shell: bash

steps:
- name: "Check out repository"
uses: actions/checkout@v4.2.2
with:
submodules: false

- name: "Get submodules"
run: git submodule update --init --depth=1

- name: "Install Python"
uses: actions/setup-python@v6.0.0
with:
python-version: "${{ matrix.python-version }}"

- uses: actions/download-artifact@v4
with:
name: eudsl_tile_${{ matrix.name }}_artifact
path: wheelhouse

- name: "Test eudsl-tile"
run: |

python -m pip install pytest mlir-native-tools -f https://llvm.github.io/eudsl
python -m pytest $PWD/projects/eudsl-tile/tests

release-eudsl-tile:

if: (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'

needs: [build-eudsl-tile]

runs-on: "ubuntu-22.04"

permissions:
id-token: write
contents: write

strategy:
fail-fast: false
matrix:
name: [
"ubuntu_x86_64",
"ubuntu_aarch64",
"ubuntu_wasm32",
"macos_arm64",
"windows_amd64"
]

name: "Release eudsl-tile ${{ matrix.name }}"

steps:

- uses: actions/download-artifact@v4
with:
name: eudsl_tile_${{ matrix.name }}_artifact
path: wheelhouse

- name: Release current commit
uses: ncipollo/release-action@v1.12.0
with:
artifacts: "wheelhouse/eudsl_tile*.whl"
token: "${{ secrets.GITHUB_TOKEN }}"
tag: eudsl-tile
name: eudsl-tile
removeArtifacts: false
allowUpdates: true
replacesArtifacts: true
makeLatest: true
omitBody: true

call-deploy-pip-page:

if: (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'

needs: [release-eudsl-tile]

permissions:
contents: read
id-token: write
pages: write

uses: ./.github/workflows/deploy_pip_page.yml
secrets: inherit # pass all secrets
2 changes: 2 additions & 0 deletions .github/workflows/deploy_pip_page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ jobs:
wget https://github.com/llvm/eudsl/releases/expanded_assets/eudsl
wget https://github.com/llvm/eudsl/releases/expanded_assets/llvm
wget https://github.com/llvm/eudsl/releases/expanded_assets/eudsl-python-extras
wget https://github.com/llvm/eudsl/releases/expanded_assets/eudsl-tile

cat mlir-python-bindings eudsl llvm eudsl-python-extras > index.html
sed -i.bak 's/\/llvm\/eudsl/https:\/\/github.com\/llvm\/eudsl/g' index.html
mkdir -p page && mv index.html page
Expand Down
12 changes: 0 additions & 12 deletions projects/eudsl-python-extras/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,6 @@ jax[cpu]
eudsl-python-extras; --config-settings=EUDSL_PYTHON_EXTRAS_HOST_PACKAGE_PREFIX=jaxlib.mlir
```

or

```toml
# pyproject.toml
[project]
name = ...
dependencies = [
"jax[cpu]",
"eudsl-python-extras; --config-settings=EUDSL_PYTHON_EXTRAS_HOST_PACKAGE_PREFIX=jaxlib.mlir"
]
```

## Examples/Demo

Check [examples](examples) and [tests](tests) for a plethora of example code.
Loading
Loading