|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# PyPI's intel-pti wheel is Intel's x86_64 build of the MIT PTI SDK (intel/pti-gpu sdk/, no |
| 5 | +# Python code, libraries installed under <wheel>.data/data/); this builds the same tag with |
| 6 | +# the sdk's own scikit-build-core pyproject, using its linux-gxx-release compiler instead of icpx. |
| 7 | +# Based on: https://github.com/intel/pti-gpu/blob/master/.github/workflows/sdk_build_and_test.yml |
| 8 | +name: Build intel-pti wheels (riscv64) |
| 9 | + |
| 10 | +on: |
| 11 | + workflow_dispatch: |
| 12 | + inputs: |
| 13 | + version: |
| 14 | + description: 'Version glob to (re)build; empty builds every version of docs/packages/intel-pti.yaml not released yet' |
| 15 | + required: false |
| 16 | + default: '' |
| 17 | + pull_request: |
| 18 | + branches: [main] |
| 19 | + paths: |
| 20 | + - '.github/workflows/build-intel-pti.yml' |
| 21 | + - 'docs/packages/intel-pti.yaml' |
| 22 | + push: |
| 23 | + branches: [main] |
| 24 | + paths: |
| 25 | + - '.github/workflows/build-intel-pti.yml' |
| 26 | + - 'docs/packages/intel-pti.yaml' |
| 27 | + |
| 28 | +concurrency: |
| 29 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 30 | + cancel-in-progress: true |
| 31 | + |
| 32 | +permissions: |
| 33 | + contents: read # to fetch code (actions/checkout) |
| 34 | + |
| 35 | +env: |
| 36 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 37 | + |
| 38 | +jobs: |
| 39 | + setup: |
| 40 | + uses: $/.github/workflows/_setup.yml |
| 41 | + with: |
| 42 | + package: intel-pti |
| 43 | + version: ${{ inputs.version }} |
| 44 | + |
| 45 | + build_wheels: |
| 46 | + needs: [setup] |
| 47 | + if: needs.setup.outputs.versions != '[]' |
| 48 | + strategy: |
| 49 | + fail-fast: false |
| 50 | + matrix: |
| 51 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 52 | + name: Build intel-pti ${{ matrix.version }} py3-none-manylinux_riscv64 |
| 53 | + runs-on: ubuntu-24.04-riscv |
| 54 | + timeout-minutes: 120 |
| 55 | + |
| 56 | + env: |
| 57 | + PTI_VERSION: ${{ matrix.version }} |
| 58 | + |
| 59 | + steps: |
| 60 | + - name: Checkout pti-gpu pti-${{ env.PTI_VERSION }} |
| 61 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 62 | + with: |
| 63 | + repository: intel/pti-gpu |
| 64 | + ref: pti-${{ env.PTI_VERSION }} |
| 65 | + persist-credentials: false |
| 66 | + |
| 67 | + - name: Pull manylinux_riscv64 image |
| 68 | + run: docker pull "${MANYLINUX_RISCV64_IMAGE}" |
| 69 | + |
| 70 | + # The image's glibc warns on _FORTIFY_SOURCE without -O, which upstream's -Werror turns |
| 71 | + # into failed (unoptimised) check_cxx_source_compiles probes. |
| 72 | + - name: Write GCC toolchain file |
| 73 | + run: | |
| 74 | + cat > gcc-toolchain.cmake <<'EOF' |
| 75 | + set(CMAKE_C_COMPILER gcc) |
| 76 | + set(CMAKE_CXX_COMPILER g++) |
| 77 | + set(CMAKE_TRY_COMPILE_CONFIGURATION Release) |
| 78 | + set(CMAKE_INSTALL_LIBDIR "${SKBUILD_DATA_DIR}/lib" CACHE PATH "") |
| 79 | + set(CMAKE_INSTALL_INCLUDEDIR "${SKBUILD_DATA_DIR}/include" CACHE PATH "") |
| 80 | + set(CMAKE_INSTALL_BINDIR "${SKBUILD_DATA_DIR}/bin" CACHE PATH "") |
| 81 | + set(CMAKE_INSTALL_DOCDIR "${SKBUILD_DATA_DIR}/share" CACHE PATH "") |
| 82 | + set(CMAKE_INSTALL_RPATH "$ORIGIN" CACHE STRING "") |
| 83 | + EOF |
| 84 | +
|
| 85 | + # libze_loader.so.1 is left to the environment, as in Intel's x86_64 wheel. |
| 86 | + # Only the unit/libload tests run: every other label needs an Intel GPU, as do the |
| 87 | + # hw-metrics tests (upstream's skip_hw_metrics) and the zeInit-based event pool suites. |
| 88 | + - name: Build, test and repair the wheel |
| 89 | + run: | |
| 90 | + docker run --rm -v "$(pwd):/work" -w /work -e PTI_VERSION \ |
| 91 | + -e PTI_RELEASE_WHL=1 \ |
| 92 | + -e SKBUILD_WHEEL_LICENSE_FILES="LICENSE;third-party-programs.txt" \ |
| 93 | + -e PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ \ |
| 94 | + "${MANYLINUX_RISCV64_IMAGE}" bash -c ' |
| 95 | + set -euxo pipefail |
| 96 | + pybin=/opt/python/cp312-cp312/bin |
| 97 | + git config --global --add safe.directory /work |
| 98 | + cp LICENSE third-party-programs.txt sdk/ |
| 99 | + "$pybin/pip" wheel ./sdk --no-deps -w dist-raw -C build-dir=/work/build -C cmake.define.CMAKE_TOOLCHAIN_FILE=/work/gcc-toolchain.cmake |
| 100 | + ctest --test-dir build --output-on-failure -L "unit|libload" -LE "performance|quarantine|hw-metrics" -E "^(ZeEventPool|FlagCombinations/)" |
| 101 | + auditwheel repair --exclude libze_loader.so.1 -w dist dist-raw/*.whl |
| 102 | + "$pybin/pip" install dist/*.whl |
| 103 | + "$pybin/python3" - <<PYEOF |
| 104 | + import ctypes, importlib.metadata, os, sysconfig |
| 105 | + libdir = os.path.join(sysconfig.get_path("data"), "lib") |
| 106 | + pti = ctypes.CDLL(os.path.join(libdir, "libpti_view.so.1")) |
| 107 | + pti.ptiVersionString.restype = ctypes.c_char_p |
| 108 | + version = pti.ptiVersionString().decode() |
| 109 | + assert version == os.environ["PTI_VERSION"], version |
| 110 | + assert os.path.exists(os.path.join(libdir, "pti", "libpti.so")) |
| 111 | + licenses = {p.name for p in importlib.metadata.files("intel-pti") if "licenses" in p.parts} |
| 112 | + assert {"LICENSE", "third-party-programs.txt"} <= licenses, licenses |
| 113 | + print("smoke test OK: ptiVersionString() =", version) |
| 114 | + PYEOF |
| 115 | + ' |
| 116 | +
|
| 117 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 118 | + with: |
| 119 | + name: intel-pti-${{ env.PTI_VERSION }}-py3-none-manylinux_riscv64 |
| 120 | + path: dist/*.whl |
| 121 | + if-no-files-found: error |
| 122 | + |
| 123 | + publish: |
| 124 | + name: Publish intel-pti ${{ matrix.version }} |
| 125 | + needs: [setup, build_wheels] |
| 126 | + if: needs.setup.outputs.versions != '[]' |
| 127 | + strategy: |
| 128 | + fail-fast: false |
| 129 | + matrix: |
| 130 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 131 | + permissions: |
| 132 | + contents: write |
| 133 | + pull-requests: write |
| 134 | + uses: $/.github/workflows/_publish-wheel.yml |
| 135 | + secrets: |
| 136 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 137 | + with: |
| 138 | + artifact-pattern: intel-pti-${{ matrix.version }}-*-manylinux_riscv64 |
0 commit comments