Implement ppm_specs
pass
#14144
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Catalyst Build | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
determine_runner: | |
if: github.event.pull_request.draft == false | |
name: Determine runner type to use | |
uses: ./.github/workflows/determine-workflow-runner.yml | |
with: | |
default_runner: ubuntu-24.04 | |
constants: | |
name: "Set build matrix" | |
uses: ./.github/workflows/constants.yaml | |
needs: [determine_runner] | |
with: | |
multiple_compilers: ${{ github.trigger == 'push' && github.ref_name == 'main' }} | |
runs_on: ${{ needs.determine_runner.outputs.runner_group }} | |
runtime: | |
name: Catalyst-Runtime Build | |
needs: [constants, determine_runner] | |
runs-on: ${{ needs.determine_runner.outputs.runner_group }} | |
strategy: | |
matrix: | |
compiler: ${{ fromJson(needs.constants.outputs.compilers) }} | |
steps: | |
- name: Checkout Catalyst repo | |
uses: actions/checkout@v4 | |
- name: Set up Python # Ensure python3.10 is used | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ needs.constants.outputs.primary_python_version }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -y -q install ninja-build make cmake clang libomp-dev | |
python3 -m pip install nanobind pybind11 | |
- name: Get Cached LLVM Source | |
id: cache-llvm-source | |
uses: actions/cache@v4 | |
with: | |
path: mlir/llvm-project | |
key: llvm-${{ needs.constants.outputs.llvm_version }}-default-source | |
enableCrossOsArchive: true | |
- name: Clone LLVM Submodule | |
if: steps.cache-llvm-source.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: llvm/llvm-project | |
ref: ${{ needs.constants.outputs.llvm_version }} | |
path: mlir/llvm-project | |
- name: Build Catalyst-Runtime | |
run: | | |
COMPILER_LAUNCHER="" \ | |
C_COMPILER=$(which ${{ needs.constants.outputs[format('c_compiler.{0}', matrix.compiler)] }}) \ | |
CXX_COMPILER=$(which ${{ needs.constants.outputs[format('cxx_compiler.{0}', matrix.compiler)] }}) \ | |
RT_BUILD_DIR="$(pwd)/runtime-build" \ | |
LLVM_DIR="$(pwd)/mlir/llvm-project" \ | |
ENABLE_ASAN=OFF \ | |
ENABLE_OQD=ON \ | |
make runtime | |
COMPILER_LAUNCHER="" \ | |
C_COMPILER=$(which ${{ needs.constants.outputs[format('c_compiler.{0}', matrix.compiler)] }}) \ | |
CXX_COMPILER=$(which ${{ needs.constants.outputs[format('cxx_compiler.{0}', matrix.compiler)] }}) \ | |
RT_BUILD_DIR="$(pwd)/runtime-build" \ | |
OQC_BUILD_DIR="$(pwd)/oqc-build" \ | |
LLVM_DIR="$(pwd)/mlir/llvm-project" \ | |
make oqc | |
- name: Upload Catalyst-Runtime Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: runtime-build-${{ matrix.compiler }} | |
path: | | |
runtime-build/lib/*.so | |
runtime-build/lib/backend/*.toml | |
retention-days: 1 | |
- name: Upload OQC-Runtime Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: oqc-build-${{ matrix.compiler }} | |
path: | | |
oqc-build/*.so | |
oqc-build/backend/*.toml | |
retention-days: 1 | |
llvm: | |
name: LLVM Build | |
needs: [constants, determine_runner] | |
runs-on: ${{ needs.determine_runner.outputs.runner_group }} | |
strategy: | |
matrix: | |
compiler: ${{ fromJson(needs.constants.outputs.compilers) }} | |
steps: | |
- name: Checkout Catalyst repo | |
uses: actions/checkout@v4 | |
# Both the LLVM source and build folder are required for further dialect builds. | |
# Caching is significantly faster than git cloning since LLVM is such a large repository. | |
- name: Cache LLVM Source | |
id: cache-llvm-source | |
uses: actions/cache@v4 | |
with: | |
path: mlir/llvm-project | |
key: llvm-${{ needs.constants.outputs.llvm_version }}-default-source | |
enableCrossOsArchive: true | |
- name: Clone LLVM Submodule | |
if: steps.cache-llvm-source.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: llvm/llvm-project | |
ref: ${{ needs.constants.outputs.llvm_version }} | |
path: mlir/llvm-project | |
- name: Cache LLVM Build | |
id: cache-llvm-build | |
uses: actions/cache@v4 | |
with: | |
path: llvm-build | |
key: ${{ runner.os }}-llvm-${{ needs.constants.outputs.llvm_version }}-ci-build-${{ matrix.compiler }} | |
- name: Set up Python # Ensure python3.10 is used | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{needs.constants.outputs.primary_python_version}} | |
- name: Install Deps | |
if: steps.cache-llvm-build.outputs.cache-hit != 'true' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y python3 python3-pip cmake ninja-build clang lld | |
python3 --version | grep ${{ needs.constants.outputs.primary_python_version }} | |
python3 -m pip install numpy pybind11 nanobind PyYAML | |
- name: Build LLVM | |
if: steps.cache-llvm-build.outputs.cache-hit != 'true' | |
# Note: Disable instrumentation for the mlir runtime support library, | |
# as user programs aren't instrumented. | |
run: | | |
# echo 'target_compile_options(mlir_c_runner_utils PRIVATE "-fno-sanitize=all")' \ | |
# >> mlir/llvm-project/mlir/lib/ExecutionEngine/CMakeLists.txt | |
C_COMPILER=$(which ${{ needs.constants.outputs[format('c_compiler.{0}', matrix.compiler)] }}) \ | |
CXX_COMPILER=$(which ${{ needs.constants.outputs[format('cxx_compiler.{0}', matrix.compiler)] }}) \ | |
LLVM_BUILD_DIR="$(pwd)/llvm-build" \ | |
COMPILER_LAUNCHER="" \ | |
make llvm | |
mhlo: | |
name: MHLO Dialect Build | |
needs: [constants, llvm, determine_runner] | |
runs-on: ${{ needs.determine_runner.outputs.runner_group }} | |
strategy: | |
matrix: | |
compiler: ${{ fromJson(needs.constants.outputs.compilers) }} | |
steps: | |
- name: Checkout Catalyst repo | |
uses: actions/checkout@v4 | |
- name: Set up Python # Ensure python3.10 is used | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ needs.constants.outputs.primary_python_version }} | |
- name: Cache MHLO Source | |
id: cache-mhlo-source | |
uses: actions/cache@v4 | |
with: | |
path: mlir/mlir-hlo | |
key: mhlo-${{ needs.constants.outputs.mhlo_version }}-default-source | |
enableCrossOsArchive: true | |
- name: Clone MHLO Submodule | |
if: steps.cache-mhlo-source.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: tensorflow/mlir-hlo | |
ref: ${{ needs.constants.outputs.mhlo_version }} | |
path: mlir/mlir-hlo | |
- name: Cache MHLO Build | |
id: cache-mhlo | |
uses: actions/cache@v4 | |
with: | |
path: mhlo-build | |
key: ${{ runner.os }}-mhlo-${{ needs.constants.outputs.mhlo_version }}-ci-build-${{ matrix.compiler }}-0 | |
- name: Get Cached LLVM Source | |
id: cache-llvm-source | |
if: steps.cache-mhlo.outputs.cache-hit != 'true' | |
uses: actions/cache@v4 | |
with: | |
path: mlir/llvm-project | |
key: llvm-${{ needs.constants.outputs.llvm_version }}-default-source | |
enableCrossOsArchive: true | |
fail-on-cache-miss: true | |
- name: Get Cached LLVM Build | |
id: cache-llvm-build | |
if: steps.cache-mhlo.outputs.cache-hit != 'true' | |
uses: actions/cache@v4 | |
with: | |
path: llvm-build | |
key: ${{ runner.os }}-llvm-${{ needs.constants.outputs.llvm_version }}-ci-build-${{ matrix.compiler }} | |
fail-on-cache-miss: true | |
- name: Install Deps | |
if: steps.cache-mhlo.outputs.cache-hit != 'true' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y cmake ninja-build clang lld | |
- name: Build MHLO Dialect | |
if: steps.cache-mhlo.outputs.cache-hit != 'true' | |
run: | | |
C_COMPILER=$(which ${{ needs.constants.outputs[format('c_compiler.{0}', matrix.compiler)] }}) \ | |
CXX_COMPILER=$(which ${{ needs.constants.outputs[format('cxx_compiler.{0}', matrix.compiler)] }}) \ | |
LLVM_BUILD_DIR="$(pwd)/llvm-build" \ | |
MHLO_BUILD_DIR="$(pwd)/mhlo-build" \ | |
COMPILER_LAUNCHER="" \ | |
make mhlo | |
enzyme: | |
name: Enzyme Build | |
needs: [constants, llvm, determine_runner] | |
runs-on: ${{ needs.determine_runner.outputs.runner_group }} | |
strategy: | |
matrix: | |
compiler: ${{ fromJson(needs.constants.outputs.compilers) }} | |
steps: | |
- name: Checkout Catalyst repo | |
uses: actions/checkout@v4 | |
- name: Set up Python # Ensure python3.10 is used | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ needs.constants.outputs.primary_python_version }} | |
- name: Cache Enzyme Source | |
id: cache-enzyme-source | |
uses: actions/cache@v4 | |
with: | |
path: mlir/Enzyme | |
key: enzyme-${{ needs.constants.outputs.enzyme_version }}-default-source | |
enableCrossOsArchive: true | |
- name: Clone Enzyme Submodule | |
if: steps.cache-enzyme-build.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: EnzymeAD/Enzyme | |
ref: ${{ needs.constants.outputs.enzyme_version }} | |
path: mlir/Enzyme | |
- name: Cache Enzyme Build | |
id: cache-enzyme-build | |
uses: actions/cache@v4 | |
with: | |
path: enzyme-build | |
key: ${{ runner.os }}-enzyme-${{ needs.constants.outputs.llvm_version }}-${{ needs.constants.outputs.enzyme_version }}-ci-build-${{ matrix.compiler }} | |
- name: Get Cached LLVM Source | |
id: cache-llvm-source | |
if: steps.cache-enzyme-build.outputs.cache-hit != 'true' | |
uses: actions/cache@v4 | |
with: | |
path: mlir/llvm-project | |
key: llvm-${{ needs.constants.outputs.llvm_version }}-default-source | |
enableCrossOsArchive: true | |
fail-on-cache-miss: true | |
- name: Get Cached LLVM Build | |
id: cache-llvm-build | |
if: steps.cache-enzyme-build.outputs.cache-hit != 'true' | |
uses: actions/cache@v4 | |
with: | |
path: llvm-build | |
key: ${{ runner.os }}-llvm-${{ needs.constants.outputs.llvm_version }}-ci-build-${{ matrix.compiler }} | |
fail-on-cache-miss: true | |
- name: Install Deps | |
if: steps.cache-enzyme-build.outputs.cache-hit != 'true' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y cmake ninja-build clang lld | |
- name: Build Enzyme | |
if: steps.cache-enzyme-build.outputs.cache-hit != 'true' | |
run: | | |
C_COMPILER=$(which ${{ needs.constants.outputs[format('c_compiler.{0}', matrix.compiler)] }}) \ | |
CXX_COMPILER=$(which ${{ needs.constants.outputs[format('cxx_compiler.{0}', matrix.compiler)] }}) \ | |
LLVM_BUILD_DIR="$(pwd)/llvm-build" \ | |
ENZYME_BUILD_DIR="$(pwd)/enzyme-build" \ | |
COMPILER_LAUNCHER="" \ | |
make enzyme | |
quantum: | |
name: Quantum Dialects Build | |
needs: [constants, llvm, mhlo, enzyme, determine_runner] | |
runs-on: ${{ needs.determine_runner.outputs.runner_group }} | |
strategy: | |
matrix: | |
compiler: ${{ fromJson(needs.constants.outputs.compilers) }} | |
steps: | |
- name: Checkout Catalyst repo | |
uses: actions/checkout@v4 | |
- name: Set up Python # Ensure python3.10 is used | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ needs.constants.outputs.primary_python_version }} | |
- name: Install Deps | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y python3 python3-pip cmake ninja-build ccache clang lld | |
python3 --version | grep ${{ needs.constants.outputs.primary_python_version }} | |
python3 -m pip install numpy nanobind pybind11 | |
- name: Get Cached LLVM Source | |
id: cache-llvm-source | |
uses: actions/cache/restore@v4 | |
with: | |
path: mlir/llvm-project | |
key: llvm-${{ needs.constants.outputs.llvm_version }}-default-source | |
enableCrossOsArchive: true | |
fail-on-cache-miss: true | |
- name: Get Cached LLVM Build | |
id: cache-llvm-build | |
uses: actions/cache/restore@v4 | |
with: | |
path: llvm-build | |
key: ${{ runner.os }}-llvm-${{ needs.constants.outputs.llvm_version }}-ci-build-${{ matrix.compiler }} | |
fail-on-cache-miss: true | |
- name: Get Cached MHLO Source | |
id: cache-mhlo-source | |
uses: actions/cache/restore@v4 | |
with: | |
path: mlir/mlir-hlo | |
key: mhlo-${{ needs.constants.outputs.mhlo_version }}-default-source | |
enableCrossOsArchive: true | |
fail-on-cache-miss: true | |
- name: Get Cached MHLO Build | |
id: cache-mhlo | |
uses: actions/cache/restore@v4 | |
with: | |
path: mhlo-build | |
key: ${{ runner.os }}-mhlo-${{ needs.constants.outputs.mhlo_version }}-ci-build-${{ matrix.compiler }}-0 | |
fail-on-cache-miss: true | |
- name: Get Cached Enzyme Source | |
id: cache-enzyme-source | |
uses: actions/cache/restore@v4 | |
with: | |
path: mlir/Enzyme | |
key: enzyme-${{ needs.constants.outputs.enzyme_version }}-default-source | |
enableCrossOsArchive: true | |
fail-on-cache-miss: true | |
- name: Get Cached Enzyme Build | |
id: cache-enzyme-build | |
uses: actions/cache/restore@v4 | |
with: | |
path: enzyme-build | |
key: ${{ runner.os }}-enzyme-${{ needs.constants.outputs.llvm_version }}-${{ needs.constants.outputs.enzyme_version }}-ci-build-${{ matrix.compiler }} | |
fail-on-cache-miss: true | |
- name: Restore CCache on feature branches | |
id: restore-ccache | |
if: ${{ github.ref != 'refs/heads/main' }} | |
uses: actions/cache/restore@v4 | |
with: | |
path: .ccache | |
key: ${{ runner.os }}-ccache-${{ github.run_id }} | |
restore-keys: ${{ runner.os }}-ccache- | |
- name: Build MLIR Dialects | |
run: | | |
CCACHE_DIR="$(pwd)/.ccache" \ | |
C_COMPILER=$(which ${{ needs.constants.outputs[format('c_compiler.{0}', matrix.compiler)] }}) \ | |
CXX_COMPILER=$(which ${{ needs.constants.outputs[format('cxx_compiler.{0}', matrix.compiler)] }}) \ | |
LLVM_BUILD_DIR="$(pwd)/llvm-build" \ | |
MHLO_BUILD_DIR="$(pwd)/mhlo-build" \ | |
ENZYME_BUILD_DIR="$(pwd)/enzyme-build" \ | |
DIALECTS_BUILD_DIR="$(pwd)/quantum-build" \ | |
make dialects | |
- name: Build Standalone Plugin | |
run: | | |
CCACHE_DIR="$(pwd)/.ccache" \ | |
C_COMPILER=$(which ${{ needs.constants.outputs[format('c_compiler.{0}', matrix.compiler)] }}) \ | |
CXX_COMPILER=$(which ${{ needs.constants.outputs[format('cxx_compiler.{0}', matrix.compiler)] }}) \ | |
LLVM_BUILD_DIR="$(pwd)/llvm-build" \ | |
MLIR_DIR="$(pwd)/llvm-build/lib/cmake/mlir" \ | |
make plugin | |
mkdir -p $(pwd)/quantum-build/lib | |
mv mlir/standalone/build/lib/StandalonePlugin.so "$(pwd)/quantum-build/lib" | |
- name: Upload Quantum Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: quantum-build-${{ matrix.compiler }} | |
path: | | |
quantum-build/bin | |
quantum-build/python_packages/* | |
quantum-build/lib/StandalonePlugin.so | |
retention-days: 1 | |
- name: Cache CCache on main branch | |
id: save-ccache | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: actions/cache/save@v4 | |
with: | |
path: .ccache | |
key: ${{ runner.os }}-ccache-${{ github.run_id }} | |
frontend-tests: | |
name: Frontend Tests | |
needs: [constants, llvm, runtime, quantum, determine_runner] | |
runs-on: ${{ needs.determine_runner.outputs.runner_group }} | |
strategy: | |
matrix: | |
compiler: ${{ fromJson(needs.constants.outputs.compilers) }} | |
steps: | |
- name: Checkout Catalyst repo | |
uses: actions/checkout@v4 | |
- name: Set up Python # Ensure python3.10 is used | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ needs.constants.outputs.primary_python_version }} | |
- name: Install Deps | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libomp-dev libasan6 make ninja-build | |
python3 --version | grep ${{ needs.constants.outputs.primary_python_version }} | |
python3 -m pip install -r requirements.txt | |
# cuda-quantum is added manually here. | |
# It can't be in requirements.txt as that will break | |
# macOS requirements.txt | |
python3 -m pip install cuda-quantum==0.6.0 | |
python3 -m pip install oqc-qcaas-client | |
make frontend | |
- name: Get Cached LLVM Build | |
id: cache-llvm-build | |
uses: actions/cache@v4 | |
with: | |
path: llvm-build | |
key: ${{ runner.os }}-llvm-${{ needs.constants.outputs.llvm_version }}-ci-build-${{ matrix.compiler }} | |
fail-on-cache-miss: true | |
- name: Download Quantum Build Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: quantum-build-${{ matrix.compiler }} | |
path: quantum-build | |
- name: Download Catalyst-Runtime Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: runtime-build-${{ matrix.compiler }} | |
path: runtime-build/lib | |
- name: Download OQC-Runtime Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: oqc-build-${{ matrix.compiler }} | |
path: oqc-build | |
- name: Add Frontend Dependencies to PATH | |
run: | | |
echo "$(pwd)/llvm-build/bin" >> $GITHUB_PATH | |
echo "PYTHONPATH=$PYTHONPATH:$(pwd)/quantum-build/python_packages/quantum" >> $GITHUB_ENV | |
echo "RUNTIME_LIB_DIR=$(pwd)/runtime-build/lib" >> $GITHUB_ENV | |
echo "MLIR_LIB_DIR=$(pwd)/llvm-build/lib" >> $GITHUB_ENV | |
echo "OQC_LIB_DIR=$(pwd)/oqc-build" >> $GITHUB_ENV | |
echo "OQD_LIB_DIR=$(pwd)/runtime-build/lib" >> $GITHUB_ENV | |
echo "CATALYST_BIN_DIR=$(pwd)/quantum-build/bin" >> $GITHUB_ENV | |
chmod +x $(pwd)/quantum-build/bin/catalyst # artifact upload does not preserve permissions | |
- name: Run Python Lit Tests | |
run: | | |
python3 llvm-build/bin/llvm-lit -sv frontend/test/lit -j$(nproc) | |
- name: Run Python Pytest Tests | |
run: | | |
COVERAGE_REPORT="xml:coverage.xml -p no:warnings" \ | |
make coverage-frontend ENABLE_OQD=ON | |
mv coverage.xml coverage-${{ github.job }}.xml | |
- name: Upload to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Check Catalyst Demos | |
run: | # Do not run demos in parallel, seems to cause package issues with numpy. | |
MDD_BENCHMARK_PRECISION=1 \ | |
python3 -m pytest demos --nbmake | |
frontend-tests-lightning-kokkos: | |
name: Frontend Tests (backend="lightning.kokkos") | |
needs: [constants, llvm, runtime, quantum, determine_runner] | |
runs-on: ${{ needs.determine_runner.outputs.runner_group }} | |
strategy: | |
matrix: | |
compiler: ${{ fromJson(needs.constants.outputs.compilers) }} | |
steps: | |
- name: Checkout Catalyst repo | |
uses: actions/checkout@v4 | |
- name: Set up Python # Ensure python3.10 is used | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ needs.constants.outputs.primary_python_version }} | |
- name: Install Deps | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libomp-dev libasan6 make ninja-build | |
python3 --version | grep ${{ needs.constants.outputs.primary_python_version }} | |
python3 -m pip install -r requirements.txt | |
make frontend | |
- name: Get Cached LLVM Build | |
id: cache-llvm-build | |
uses: actions/cache@v4 | |
with: | |
path: llvm-build | |
key: ${{ runner.os }}-llvm-${{ needs.constants.outputs.llvm_version }}-ci-build-${{ matrix.compiler }} | |
fail-on-cache-miss: true | |
- name: Download Quantum Build Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: quantum-build-${{ matrix.compiler }} | |
path: quantum-build | |
- name: Download Catalyst-Runtime Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: runtime-build-${{ matrix.compiler }} | |
path: runtime-build/lib | |
- name: Add Frontend Dependencies to PATH | |
run: | | |
echo "PYTHONPATH=$PYTHONPATH:$(pwd)/quantum-build/python_packages/quantum" >> $GITHUB_ENV | |
echo "RUNTIME_LIB_DIR=$(pwd)/runtime-build/lib" >> $GITHUB_ENV | |
echo "MLIR_LIB_DIR=$(pwd)/llvm-build/lib" >> $GITHUB_ENV | |
echo "CATALYST_BIN_DIR=$(pwd)/quantum-build/bin" >> $GITHUB_ENV | |
chmod +x $(pwd)/quantum-build/bin/catalyst # artifact upload does not preserve permissions | |
- name: Run Python Pytest Tests (backend=lightning.kokkos) | |
run: | | |
make pytest TEST_BACKEND="lightning.kokkos" | |
frontend-tests-openqasm-device: | |
name: Frontend Tests (backend="openqasm3") | |
needs: [constants, llvm, runtime, quantum, determine_runner] | |
runs-on: ${{ needs.determine_runner.outputs.runner_group }} | |
strategy: | |
matrix: | |
compiler: ${{ fromJson(needs.constants.outputs.compilers) }} | |
steps: | |
- name: Checkout Catalyst repo | |
uses: actions/checkout@v4 | |
- name: Set up Python # Ensure python3.10 is used | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ needs.constants.outputs.primary_python_version }} | |
- name: Install device dependencies (OpenQasm device) | |
run: | | |
pip install amazon-braket-pennylane-plugin | |
echo "AWS_DEFAULT_REGION=us-east-1" >> $GITHUB_ENV | |
- name: Install Deps | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libomp-dev libasan6 make ninja-build | |
python3 --version | grep ${{ needs.constants.outputs.primary_python_version }} | |
python3 -m pip install -r requirements.txt | |
make frontend | |
- name: Get Cached LLVM Build | |
id: cache-llvm-build | |
uses: actions/cache@v4 | |
with: | |
path: llvm-build | |
key: ${{ runner.os }}-llvm-${{ needs.constants.outputs.llvm_version }}-ci-build-${{ matrix.compiler }} | |
fail-on-cache-miss: true | |
- name: Download Quantum Build Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: quantum-build-${{ matrix.compiler }} | |
path: quantum-build | |
- name: Download Catalyst-Runtime Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: runtime-build-${{ matrix.compiler }} | |
path: runtime-build/lib | |
- name: Add Frontend Dependencies to PATH | |
run: | | |
echo "PYTHONPATH=$PYTHONPATH:$(pwd)/quantum-build/python_packages/quantum" >> $GITHUB_ENV | |
echo "RUNTIME_LIB_DIR=$(pwd)/runtime-build/lib" >> $GITHUB_ENV | |
echo "MLIR_LIB_DIR=$(pwd)/llvm-build/lib" >> $GITHUB_ENV | |
echo "CATALYST_BIN_DIR=$(pwd)/quantum-build/bin" >> $GITHUB_ENV | |
chmod +x $(pwd)/quantum-build/bin/catalyst # artifact upload does not preserve permissions | |
runtime-device-tests: | |
name: Third-Party Device Tests (C++) | |
needs: [constants, runtime, determine_runner] | |
runs-on: ${{ needs.determine_runner.outputs.runner_group }} | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: ${{ fromJson(needs.constants.outputs.compilers) }} | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
- name: Set up Python # Ensure python3.10 is used | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ needs.constants.outputs.primary_python_version }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -y -q install cmake ninja-build | |
python3 -m pip install nanobind pybind11 | |
- name: Download Catalyst-Runtime Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: runtime-build-${{ matrix.compiler }} | |
path: runtime-build/lib | |
- name: Build Runtime test suite for OQC device | |
run: | | |
C_COMPILER=$(which ${{ needs.constants.outputs[format('c_compiler.{0}', matrix.compiler)] }}) \ | |
CXX_COMPILER=$(which ${{ needs.constants.outputs[format('cxx_compiler.{0}', matrix.compiler)] }}) \ | |
RT_BUILD_DIR="$(pwd)/runtime-build" \ | |
make test-oqc | |
runtime-code-cov: | |
name: Runtime Tests & Coverage | |
needs: [constants, determine_runner] | |
runs-on: ${{ needs.determine_runner.outputs.runner_group }} | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
- name: Set up Python # Ensure python3.10 is used | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ needs.constants.outputs.primary_python_version }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -y -q install cmake ninja-build | |
python3 -m pip install nanobind pybind11 | |
- name: Install lcov # Manually install lcov_1.15-1_all | |
run: | | |
wget http://archive.ubuntu.com/ubuntu/pool/universe/l/lcov/lcov_1.15-1_all.deb | |
sudo apt-get install -y ./lcov_1.15-1_all.deb | |
lcov --version | |
- name: Install additional dependencies for OpenQasm device | |
run: | | |
pip install numpy pybind11 amazon-braket-sdk PyYAML | |
echo "AWS_DEFAULT_REGION=us-east-1" >> $GITHUB_ENV | |
- name: Get Cached LLVM Source | |
id: cache-llvm-source | |
uses: actions/cache@v4 | |
with: | |
path: mlir/llvm-project | |
key: llvm-${{ needs.constants.outputs.llvm_version }}-default-source | |
enableCrossOsArchive: true | |
- name: Clone LLVM Submodule | |
if: steps.cache-llvm-source.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: llvm/llvm-project | |
ref: ${{ needs.constants.outputs.llvm_version }} | |
path: mlir/llvm-project | |
- name: Run the main runtime test suite for coverage | |
run: | | |
C_COMPILER=$(which gcc) \ | |
CXX_COMPILER=$(which g++) \ | |
COMPILER_LAUNCHER="" \ | |
ENABLE_OQD=ON \ | |
LLVM_DIR="$(pwd)/mlir/llvm-project" \ | |
make coverage-runtime | |
mv runtime/build_cov/coverage.info coverage-${{ github.job }}.info | |
- name: Upload to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} |