Skip to content

Hermetic python, TorchDynamo/FX frontend and TorchToTcp conversion for dynamo exported models #42

Hermetic python, TorchDynamo/FX frontend and TorchToTcp conversion for dynamo exported models

Hermetic python, TorchDynamo/FX frontend and TorchToTcp conversion for dynamo exported models #42

# Licensed 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
# Also available under a BSD-style license. See LICENSE.
name: Bazel Build and Test (stablehlo)
# Only run when stablehlo hash changes (deps.bzl)
on:
pull_request:
branches:
- main
paths:
- 'deps.bzl'
- '.github/workflows/bazelBuildAndTestStablehlo.yml'
push:
branches:
- main
paths:
- 'deps.bzl'
- '.github/workflows/bazelBuildAndTestStablehlo.yml'
workflow_dispatch:
# Ensure that only a single job or workflow using the same
# concurrency group will run at a time. This would cancel
# any in-progress jobs in the same github workflow and github
# ref (e.g. refs/heads/main or refs/pull/<pr_number>/merge).
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ubuntu-build:
name: ubuntu-x86_64 / stablehlo
runs-on: ubuntu-latest
steps:
- name: Checkout mlir-tcp
uses: actions/checkout@v4
- name: Setup workspace
uses: ./.github/actions/setup-build
# Continually update cache even if there's a "hit" during
# restore to avoid the cache going stale over time
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
- name: Setup cache for bazel
uses: actions/cache@v4
with:
path: ~/.cache/bazel
key: stablehlo-bazel-build-cache-${{ runner.os }}-${{ github.sha }}
restore-keys: |
stablehlo-bazel-build-cache-${{ runner.os }}
- name: Create bazel cache dir when not found
run: |
if [ ! -d "${HOME}/.cache/bazel" ]; then
mkdir -p "${HOME}/.cache/bazel"
fi
- name: Build docker image
run: |
docker build -f docker/Dockerfile \
-t mlir-tcp:ci \
--build-arg GROUP=$(id -gn) \
--build-arg GID=$(id -g) \
--build-arg USER=$(id -un) \
--build-arg UID=$(id -u) \
.
- name: Bazel build and test stablehlo
run: |
docker run --rm \
-v "$(pwd)":"/opt/src/mlir-tcp" \
-v "${HOME}/.cache/bazel":"${HOME}/.cache/bazel" \
mlir-tcp:ci \
bazel test --test_output=errors @stablehlo//...