Skip to content

Commit

Permalink
add dev docs
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Dec 14, 2023
1 parent d308549 commit 3edf924
Show file tree
Hide file tree
Showing 15 changed files with 271 additions and 113 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup_base/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ runs:

- uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.10'

- name: Install Ninja
uses: llvm/actions/install-ninja@6a57890d0e3f9f35dfc72e7e48bc5e1e527cdd6c # Jan 17
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/buildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:

- name: Install Python packages
run: |
pip install cmake numpy psutil pybind11 rich pkginfo lit PyYAML
pip install cmake==3.27.9 numpy psutil pybind11 rich pkginfo lit PyYAML
pip install -r python/requirements.txt
- name: Install packages
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lintAndFormat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

- name: Install Python packages
run: |
pip install cmake numpy psutil pybind11 rich pkginfo lit PyYAML requests
pip install cmake==3.27.9 numpy psutil pybind11 rich pkginfo lit PyYAML requests
pip install -r python/requirements.txt
- name: Get MLIR
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
- name: Setup Python env
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.10'

- name: Install black
run: pip install black[jupyter]
Expand Down Expand Up @@ -196,7 +196,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.10'

- name: Install Python and other packages
run: |
Expand Down
52 changes: 32 additions & 20 deletions .github/workflows/mlirAIEDistro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ on:
# comment it out when you're not working on these yamls
pull_request:

concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit).
group: ci-build-mlir-aie-distro-${{ github.event.number || github.sha }}
cancel-in-progress: true
# conversely you want to comment this out so that you can have multiple runs going concurrently
# which is useful here for flushing all bugs out
#concurrency:
# # A PR number if a pull request and otherwise the commit hash. This cancels
# # queued and in-progress runs for the same PR (presubmit) or commit
# # (postsubmit).
# group: ci-build-mlir-aie-distro-${{ github.event.number || github.sha }}
# cancel-in-progress: true

jobs:

Expand Down Expand Up @@ -71,7 +73,7 @@ jobs:

needs: get_aie_project_commit

name: ${{ matrix.OS }} ${{ matrix.ARCH }}
name: ${{ matrix.OS }} ${{ matrix.ARCH }} rtti=${{ matrix.ENABLE_RTTI }}

continue-on-error: true

Expand All @@ -86,18 +88,24 @@ jobs:
include:
- OS: ubuntu-20.04
ARCH: x86_64
ENABLE_RTTI: ON

- OS: windows-2019
ARCH: AMD64
ENABLE_RTTI: ON

# Can't figure it out but cmake segfault when building on mac on the runners
- OS: macos-11
ARCH: x86_64
ENABLE_RTTI: ON

- OS: macos-11
ARCH: arm64
ENABLE_RTTI: ON

- OS: ubuntu-20.04
ARCH: aarch64
ENABLE_RTTI: ON

steps:

Expand Down Expand Up @@ -125,7 +133,7 @@ jobs:
with:
MATRIX_OS: ${{ matrix.OS }}
MATRIX_ARCH: ${{ matrix.ARCH }}
EXTRA_KEY: mlir-aie-distro
EXTRA_KEY: mlir-aie-distro-rtti-${{ matrix.ENABLE_RTTI }}

- name: Shift workspace root
id: workspace_root
Expand Down Expand Up @@ -216,7 +224,7 @@ jobs:
shell: bash
run: |
pip install pkginfo
WHL=$(ls wheelhouse/mlir_aie_*whl)
WHL=$(ls wheelhouse/mlir_aie*whl)
echo "MLIR_AIE_WHEEL_VERSION=$(python -c "import pkginfo; w = pkginfo.Wheel('$WHL'); print(w.version.split('+')[0] + '+' + w.version.split('+')[1].rsplit('.', 1)[-1])")" | tee -a $GITHUB_OUTPUT
- name: Download cache from container ubuntu
Expand Down Expand Up @@ -248,26 +256,24 @@ jobs:
# The wheels important parts of the wheels (all the LLVM/MLIR archives) have nothing to do with the
# python version. With py3-none you can pip install them in any python venv. Unfortunately though this does
# mean that the python bindings themselves will confusingly not work in other envs (!=3.11)
# mean that the python bindings themselves will confusingly not work in other envs (!=3.10)
- name: rename non-windows
if: ${{ matrix.OS == 'ubuntu-20.04' || matrix.OS == 'macos-11' }}
working-directory: ${{ steps.workspace_root.outputs.WORKSPACE_ROOT }}
shell: bash
run: |
rename 's/cp310-cp310/py3-none/' wheelhouse/mlir_aie_*whl
rename 's/cp311-cp311/py3-none/' wheelhouse/mlir_aie_*whl
rename 's/cp310-cp310/py3-none/' wheelhouse/mlir_aie*whl
if [ x"${{ matrix.OS }}" == x"ubuntu-20.04" ] && [ x"${{ matrix.ARCH }}" == x"aarch64" ]; then
rename 's/x86_64/aarch64/' wheelhouse/mlir_aie_*whl
rename 's/x86_64/aarch64/' wheelhouse/mlir_aie*whl
fi
- name: rename windows
if: ${{ matrix.OS == 'windows-2019' }}
working-directory: ${{ steps.workspace_root.outputs.WORKSPACE_ROOT }}
run: |
ls wheelhouse/mlir_aie_*whl | Rename-Item -NewName {$_ -replace 'cp310-cp310', 'py3-none' }
ls wheelhouse/mlir_aie_*whl | Rename-Item -NewName {$_ -replace 'cp311-cp311', 'py3-none' }
ls wheelhouse/mlir_aie*whl | Rename-Item -NewName {$_ -replace 'cp310-cp310', 'py3-none' }
- name: build python bindings
shell: bash
Expand All @@ -278,11 +284,12 @@ jobs:
export PIP_NO_BUILD_ISOLATION=false
cp requirements.txt python_bindings
cp wheelhouse/mlir-aie-*.whl python_bindings/
cp wheelhouse/mlir_aie*.whl python_bindings/
cp -r scripts python_bindings/scripts
pushd python_bindings
unzip -q mlir-aie-*.whl
unzip -q mlir_aie*.whl
rm -rf mlir_aie*.whl
CIBW_ARCHS=${{ matrix.ARCH }} \
CMAKE_GENERATOR="Ninja" \
Expand Down Expand Up @@ -388,7 +395,7 @@ jobs:
cp requirements.txt python_bindings
cp -R scripts python_bindings/scripts
pushd python_bindings
unzip -q ../wheelhouse/mlir-aie-*-linux_aarch64.whl
unzip -q ../wheelhouse/mlir_aie*-linux_aarch64.whl
CIBW_ARCHS=${{ matrix.ARCH }} \
CIBW_BUILD=${{ matrix.PY_VERSION }}-manylinux_aarch64 \
Expand Down Expand Up @@ -431,19 +438,24 @@ jobs:
ARCH: x86_64

steps:
- name: Checkout reqs
uses: actions/checkout@v3
with:
sparse-checkout: python/requirements.txt

- uses: actions/download-artifact@v3
with:
name: build_artifact
path: dist

- uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.10'

- name: test
shell: bash
run: |
pip install numpy PyYAML
pip install -r python/requirements.txt
pip install aie -f dist --no-index
python -c 'import aie.dialects.aie'
Expand Down
92 changes: 68 additions & 24 deletions .github/workflows/mlirDistro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ on:
# At minute 0 past every 4th hour. (see https://crontab.guru)
- cron: '0 */4 * * *'

concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit).
group: ci-build-mlir-distro-${{ github.event.number || github.sha }}
cancel-in-progress: true
# conversely you want to comment this out so that you can have multiple runs going concurrently
# which is useful here for flushing all bugs out
#concurrency:
# # A PR number if a pull request and otherwise the commit hash. This cancels
# # queued and in-progress runs for the same PR (presubmit) or commit
# # (postsubmit).
# group: ci-build-mlir-distro-${{ github.event.number || github.sha }}
# cancel-in-progress: true

jobs:

Expand Down Expand Up @@ -280,15 +282,14 @@ jobs:
# The wheels important parts of the wheels (all the LLVM/MLIR archives) have nothing to do with the
# python version. With py3-none you can pip install them in any python venv. Unfortunately though this does
# mean that the python bindings themselves will confusingly not work in other envs (!=3.11)
# mean that the python bindings themselves will confusingly not work in other envs (!=3.10)
- name: rename non-windows
if: ${{ matrix.OS == 'ubuntu-20.04' || matrix.OS == 'macos-11' }}
working-directory: ${{ steps.workspace_root.outputs.WORKSPACE_ROOT }}
shell: bash
run: |
rename 's/cp310-cp310/py3-none/' wheelhouse/mlir*whl
rename 's/cp311-cp311/py3-none/' wheelhouse/mlir*whl
if [ x"${{ matrix.OS }}" == x"ubuntu-20.04" ] && [ x"${{ matrix.ARCH }}" == x"aarch64" ]; then
rename 's/x86_64/aarch64/' wheelhouse/mlir*whl
Expand All @@ -299,7 +300,6 @@ jobs:
working-directory: ${{ steps.workspace_root.outputs.WORKSPACE_ROOT }}
run: |
ls wheelhouse/mlir*whl | Rename-Item -NewName {$_ -replace 'cp310-cp310', 'py3-none' }
ls wheelhouse/mlir*whl | Rename-Item -NewName {$_ -replace 'cp311-cp311', 'py3-none' }
# The "native tools" MLIR utilities that are necessary for cross-compiling MLIR - basically just tblgen.
# Now if you build a whole distro you naturally do get those utilities but it's easier to just bundle them
Expand Down Expand Up @@ -338,16 +338,14 @@ jobs:
# done

- name: Upload wheels
# TODO(max): remove
# if: github.event_name == 'workflow_dispatch' && (success() || failure())
uses: actions/upload-artifact@v3
with:
path: ${{ steps.workspace_root.outputs.WORKSPACE_ROOT }}/wheelhouse/*.whl
name: build_artifact
name: build_artifact_${{ matrix.OS }}_${{ matrix.ARCH }}_rtti_${{ matrix.ENABLE_RTTI }}

smoke_test_wheels:

name: Smoketest ${{ matrix.OS }} ${{ matrix.ARCH }} rtti=${{ matrix.NO_RTTI }}
name: test ${{ matrix.OS }} ${{ matrix.ARCH }} rtti=${{ matrix.ENABLE_RTTI }}

needs: [build]

Expand All @@ -358,54 +356,100 @@ jobs:
include:
- OS: ubuntu-20.04
ARCH: x86_64
NO_RTTI: ''
ENABLE_RTTI: ON

- OS: windows-2019
ARCH: AMD64
NO_RTTI: ''
ENABLE_RTTI: ON

- OS: macos-11
ARCH: x86_64
NO_RTTI: ''
ENABLE_RTTI: ON

- OS: ubuntu-20.04
ARCH: x86_64
NO_RTTI: '_no_rtti'
ENABLE_RTTI: OFF

- OS: windows-2019
ARCH: AMD64
NO_RTTI: '_no_rtti'
ENABLE_RTTI: OFF

- OS: macos-11
ARCH: x86_64
NO_RTTI: '_no_rtti'
ENABLE_RTTI: OFF

steps:
- uses: actions/download-artifact@v3
with:
name: build_artifact
name: build_artifact_${{ matrix.OS }}_${{ matrix.ARCH }}_rtti_${{ matrix.ENABLE_RTTI }}
path: dist

- uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.10'

- name: test
shell: bash
run: |
pip install numpy PyYAML
unzip mlir${{ matrix.NO_RTTI }}*.whl
unzip -o -q dist/mlir\*.whl
PYTHONPATH=$(find . -name mlir_core) python -c 'import mlir${{ matrix.NO_RTTI }}.ir'
PYTHONPATH=$(find . -name mlir_core) python -c 'import mlir.ir'
upload_distro_wheels:

name: upload ${{ matrix.OS }} ${{ matrix.ARCH }} rtti=${{ matrix.ENABLE_RTTI }}

if: github.event_name == 'workflow_dispatch'

needs: smoke_test_wheels

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- OS: ubuntu-20.04
ARCH: x86_64
ENABLE_RTTI: ON

- OS: ubuntu-20.04
ARCH: aarch64
ENABLE_RTTI: ON

- OS: windows-2019
ARCH: AMD64
ENABLE_RTTI: ON

- OS: macos-11
ARCH: x86_64
ENABLE_RTTI: ON

- OS: macos-11
ARCH: arm64
ENABLE_RTTI: ON

- OS: ubuntu-20.04
ARCH: x86_64
ENABLE_RTTI: OFF

- OS: ubuntu-20.04
ARCH: aarch64
ENABLE_RTTI: OFF

- OS: windows-2019
ARCH: AMD64
ENABLE_RTTI: OFF

- OS: macos-11
ARCH: x86_64
ENABLE_RTTI: OFF

- OS: macos-11
ARCH: arm64
ENABLE_RTTI: OFF

permissions:
id-token: write
contents: write
Expand All @@ -415,7 +459,7 @@ jobs:
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: build_artifact
name: build_artifact_${{ matrix.OS }}_${{ matrix.ARCH }}_rtti_${{ matrix.ENABLE_RTTI }}
path: dist

- name: Release current commit
Expand Down
Loading

0 comments on commit 3edf924

Please sign in to comment.