omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / .github / workflows / irspirv-intel-cpu.yml
| 1 | # irspirv-intel-cpu: replays the irspirv SPIR-V suite through Intel's CPU OpenCL runtime. |
| 2 | # Job "modules" (ubuntu-24.04-arm) runs seed/spirv/gate-irspirv.sh unchanged on the committed |
| 3 | # seed/out/omc: it builds the translator, the 13+ unit modules and the AArch64 native dumps, and |
| 4 | # checks them against PoCL 7.2 (built here at the commit the Spark oracle uses). Job "intel-cpu" |
| 5 | # (ubuntu-24.04, x86-64) installs intel-oneapi-runtime-opencl, builds seed/spirv/opencl-host.c |
| 6 | # pinned to libintelocl.so and its platform name, and runs seed/spirv/ocl-vendor-matrix.sh over the |
| 7 | # 129 cases.tsv rows plus demo and regression rows, then the mutant negative control, then the same |
| 8 | # rows again under intel/opencl-intercept-layer (cliloader) to capture build logs and API errors. |
| 9 | # The matrix reports per row (built, ran, matches native, error text); mismatches are findings, |
| 10 | # so only the negative control and setup failures fail this job. CPU evidence only. Advisory. |
| 11 | name: irspirv-intel-cpu |
| 12 | on: |
| 13 | workflow_dispatch: |
| 14 | pull_request: |
| 15 | paths: ["seed/spirv/**", "seed/wasm/cases.tsv", "seed/out/omc", ".github/workflows/irspirv-intel-cpu.yml"] |
| 16 | permissions: |
| 17 | contents: read |
| 18 | env: |
| 19 | POCL_SHA: 888c9774b94590fff1afef003154ca2c0ea66605 # PoCL v7.2, same as the Spark oracle |
| 20 | INTERCEPT_TAG: v3.0.6 |
| 21 | jobs: |
| 22 | modules: |
| 23 | runs-on: ubuntu-24.04-arm |
| 24 | timeout-minutes: 75 |
| 25 | steps: |
| 26 | - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 27 | - name: toolchain (distro oracles) |
| 28 | run: | |
| 29 | sudo apt-get update -q |
| 30 | sudo apt-get install -y -q --no-install-recommends cmake ninja-build pkg-config python3 \ |
| 31 | llvm-18-dev clang-18 libclang-18-dev libclang-cpp18-dev llvm-spirv-18 libllvmspirvlib-18-dev \ |
| 32 | ocl-icd-dev ocl-icd-opencl-dev opencl-c-headers libhwloc-dev spirv-tools |
| 33 | dpkg-query -W llvm-18-dev clang-18 llvm-spirv-18 libllvmspirvlib-18-dev ocl-icd-libopencl1 spirv-tools |
| 34 | - id: pocl-cache |
| 35 | uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
| 36 | with: |
| 37 | path: /opt/pocl |
| 38 | key: pocl-${{ env.POCL_SHA }}-llvm18-ubuntu2404-arm64 |
| 39 | - name: build PoCL |
| 40 | if: steps.pocl-cache.outputs.cache-hit != 'true' |
| 41 | run: | |
| 42 | git clone --quiet https://github.com/pocl/pocl.git /tmp/pocl |
| 43 | git -C /tmp/pocl checkout --quiet --detach "$POCL_SHA" |
| 44 | cmake -S /tmp/pocl -B /tmp/pocl/build -G Ninja -DCMAKE_BUILD_TYPE=Release \ |
| 45 | -DCMAKE_INSTALL_PREFIX=/opt/pocl -DWITH_LLVM_CONFIG=/usr/bin/llvm-config-18 \ |
| 46 | -DENABLE_ICD=ON -DENABLE_SPIRV=ON -DHOST_CPU_ENABLE_SPIRV=ON \ |
| 47 | -DENABLE_TESTS=OFF -DENABLE_EXAMPLES=OFF -DENABLE_POCLCC=OFF |
| 48 | cmake --build /tmp/pocl/build |
| 49 | sudo cmake --install /tmp/pocl/build |
| 50 | - name: gate-irspirv (PoCL baseline; produces modules and native dumps) |
| 51 | run: | |
| 52 | lib=$(find /opt/pocl -name 'libpocl.so.*.*' -type f | head -1) |
| 53 | echo "PoCL library $lib" |
| 54 | export POCL_LIBRARY="$lib" POCL_CACHE_DIR=/tmp/pocl-cache |
| 55 | set +e |
| 56 | sh seed/spirv/gate-irspirv.sh > gate.out 2>&1 |
| 57 | rc=$? |
| 58 | set -e |
| 59 | cat gate.out |
| 60 | echo "gate exit $rc" |
| 61 | test "$rc" = 0 |
| 62 | - name: bundle |
| 63 | if: ${{ !cancelled() }} |
| 64 | run: tar cf irspirv-bundle.tar build/seed/spirv gate.out |
| 65 | - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 |
| 66 | if: ${{ !cancelled() }} |
| 67 | with: |
| 68 | name: irspirv-bundle |
| 69 | path: irspirv-bundle.tar |
| 70 | intel-cpu: |
| 71 | needs: modules |
| 72 | if: ${{ !cancelled() }} |
| 73 | runs-on: ubuntu-24.04 |
| 74 | timeout-minutes: 45 |
| 75 | steps: |
| 76 | - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 77 | - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 |
| 78 | with: |
| 79 | name: irspirv-bundle |
| 80 | - name: unpack AArch64 bundle |
| 81 | run: tar xf irspirv-bundle.tar && grep -E '^(SUMMARY|PASS IRSPIRV|FAIL|NOT_RUN)' gate.out |
| 82 | - name: Intel CPU OpenCL runtime (oneAPI apt repository) |
| 83 | run: | |
| 84 | wget -q -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | |
| 85 | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null |
| 86 | echo 'deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main' | |
| 87 | sudo tee /etc/apt/sources.list.d/oneAPI.list |
| 88 | sudo apt-get update -q |
| 89 | sudo apt-get install -y -q --no-install-recommends intel-oneapi-runtime-opencl \ |
| 90 | ocl-icd-opencl-dev opencl-c-headers clinfo cmake ninja-build |
| 91 | dpkg-query -W -f '${db:Status-Abbrev} ${Package} ${Version}\n' 'intel-oneapi-runtime-*' ocl-icd-libopencl1 | |
| 92 | awk '$1=="ii"' | tee runtime.txt |
| 93 | ls /etc/OpenCL/vendors/ && cat /etc/OpenCL/vendors/* | tee -a runtime.txt |
| 94 | # The ICD file names the library; it must exist. Record its owning package (if dpkg knows it). |
| 95 | lib=$(grep -h '/libintelocl\.so$' /etc/OpenCL/vendors/*.icd | head -1) |
| 96 | test -n "$lib" && test -f "$lib" |
| 97 | { dpkg -S "$lib" || dpkg -S "$(readlink -f "$lib")" || echo "owner of $lib unknown to dpkg"; } 2>&1 | tee -a runtime.txt |
| 98 | echo "INTEL_LIB=$lib" >> "$GITHUB_ENV" |
| 99 | echo "library $lib" | tee -a runtime.txt |
| 100 | lscpu | sed -n '1,20p' | tee -a runtime.txt |
| 101 | ls -l /dev/dri 2>&1 | tee -a runtime.txt || true |
| 102 | # oneAPI's redist/lib ships a Khronos libOpenCL.so.1 that ldconfig may prefer; opencl-host |
| 103 | # relies on ocl-icd semantics (absolute library path in OCL_ICD_VENDORS), so pin ocl-icd. |
| 104 | ldconfig -p | grep 'libOpenCL\.so' | tee -a runtime.txt |
| 105 | icd=$(dpkg -L ocl-icd-libopencl1 | grep '/libOpenCL\.so\.1$' | head -1) |
| 106 | test -n "$icd" |
| 107 | echo "OCL_ICD_DIR=$(dirname "$icd")" >> "$GITHUB_ENV" |
| 108 | echo "loader $icd" | tee -a runtime.txt |
| 109 | - name: clinfo (pinned library only) |
| 110 | run: | |
| 111 | LD_LIBRARY_PATH="$OCL_ICD_DIR" OCL_ICD_VENDORS="$INTEL_LIB" clinfo | tee clinfo.txt |
| 112 | name=$(LD_LIBRARY_PATH="$OCL_ICD_DIR" OCL_ICD_VENDORS="$INTEL_LIB" clinfo -l | sed -n 's/^Platform #0: //p') |
| 113 | test -n "$name" |
| 114 | echo "INTEL_PLATFORM=$name" >> "$GITHUB_ENV" |
| 115 | echo "platform $name" | tee -a runtime.txt |
| 116 | - name: build opencl-host pinned to Intel CPU runtime |
| 117 | run: | |
| 118 | cc -std=c11 -O2 -Wall -Wextra -Werror "-DIRSPIRV_POCL_LIBRARY=\"$INTEL_LIB\"" \ |
| 119 | '-DIRSPIRV_OCL_LIBRARY_BASE="libintelocl.so"' "-DIRSPIRV_OCL_PLATFORM=\"$INTEL_PLATFORM\"" \ |
| 120 | seed/spirv/opencl-host.c -o intel-host -Wl,--disable-new-dtags,-rpath,"$OCL_ICD_DIR" -lOpenCL |
| 121 | ldd intel-host | grep libOpenCL | tee -a runtime.txt | grep -q "$OCL_ICD_DIR/libOpenCL.so.1" |
| 122 | sha256sum intel-host seed/spirv/opencl-host.c seed/spirv/ocl-vendor-matrix.sh | tee -a runtime.txt |
| 123 | ./intel-host build/seed/spirv/demo.spv avgu32 7 10 2>&1 | tee smoke.txt; test "${PIPESTATUS[0]}" = 0 |
| 124 | - name: host control (a PoCL-pinned build must refuse the Intel library) |
| 125 | run: | |
| 126 | cc -std=c11 -O2 "-DIRSPIRV_POCL_LIBRARY=\"$INTEL_LIB\"" seed/spirv/opencl-host.c -o pocl-pinned-host \ |
| 127 | -Wl,--disable-new-dtags,-rpath,"$OCL_ICD_DIR" -lOpenCL |
| 128 | set +e; ./pocl-pinned-host build/seed/spirv/demo.spv avgu32 7 10 > control.out 2> control.err; rc=$?; set -e |
| 129 | cat control.err; test "$rc" = 3; test ! -s control.out |
| 130 | - name: matrix (Intel CPU runtime) |
| 131 | run: | |
| 132 | mkdir -p results |
| 133 | B=build/seed/spirv |
| 134 | for t in "seed/wasm/cases.tsv case" "seed/spirv/demo.tsv demo-case" "seed/spirv/regression.tsv regression-case"; do |
| 135 | set -- $t |
| 136 | bash seed/spirv/ocl-vendor-matrix.sh $B ./intel-host $1 $2 results/$2-intel.tsv | tee -a results/summary.txt || true |
| 137 | done |
| 138 | test "$(awk 'END{print NR-1}' results/case-intel.tsv)" = 129 |
| 139 | - name: negative control (mutant module must mismatch exactly mutant.mutadd) |
| 140 | run: | |
| 141 | set +e |
| 142 | bash seed/spirv/ocl-vendor-matrix.sh build/seed/spirv ./intel-host seed/wasm/cases.tsv case \ |
| 143 | results/case-intel-mutant.tsv --mutant-baseline | tee -a results/summary.txt |
| 144 | rc=${PIPESTATUS[0]} |
| 145 | set -e |
| 146 | test "$rc" = 1 |
| 147 | awk -F'\t' 'NR>1 && $11!="yes"' results/case-intel-mutant.tsv | tee results/negative.txt |
| 148 | grep -q $'\tmutant\tmutadd\t19,7\t0\t26\tyes\tyes\t12\t0\tno\t' results/negative.txt |
| 149 | # Every other row must be identical to the main matrix (mutant row aside). |
| 150 | diff <(awk -F'\t' 'NR>1 && $2!="mutant"' results/case-intel.tsv | cut -f1-12) \ |
| 151 | <(awk -F'\t' 'NR>1 && $2!="mutant"' results/case-intel-mutant.tsv | cut -f1-12) |
| 152 | - name: intercept layer (cliloader, build and error logging) |
| 153 | run: | |
| 154 | git clone --quiet https://github.com/intel/opencl-intercept-layer.git /tmp/cli |
| 155 | git -C /tmp/cli checkout --quiet "$INTERCEPT_TAG" |
| 156 | git -C /tmp/cli rev-parse HEAD | tee -a runtime.txt |
| 157 | cmake -S /tmp/cli -B /tmp/cli/build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_CLILOADER=ON |
| 158 | cmake --build /tmp/cli/build |
| 159 | loader=$(find /tmp/cli/build -name cliloader -type f -perm -u+x | head -1) |
| 160 | test -n "$loader" |
| 161 | export CLI_BuildLogging=1 CLI_ErrorLogging=1 CLI_CallLogging=1 CLI_ReportToStderr=1 CLI_LogToFile=0 |
| 162 | export CLI_OpenCLFileName="$OCL_ICD_DIR/libOpenCL.so.1" |
| 163 | export HOST_WRAP="$loader" |
| 164 | for t in "seed/wasm/cases.tsv case" "seed/spirv/demo.tsv demo-case" "seed/spirv/regression.tsv regression-case"; do |
| 165 | set -- $t |
| 166 | bash seed/spirv/ocl-vendor-matrix.sh build/seed/spirv ./intel-host $1 $2 results/$2-intel-intercept.tsv | tee -a results/summary.txt || true |
| 167 | done |
| 168 | # The intercept layer must be live: its banner appears in the per-row stderr. |
| 169 | grep -l 'CLIntercept (64-bit) is loading' results/case-intel-intercept.logs/1.err |
| 170 | - name: bundle results |
| 171 | if: ${{ !cancelled() }} |
| 172 | run: | |
| 173 | cat results/summary.txt || true |
| 174 | tar cf intel-cpu-results.tar results runtime.txt clinfo.txt smoke.txt gate.out || true |
| 175 | - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 |
| 176 | if: ${{ !cancelled() }} |
| 177 | with: |
| 178 | name: irspirv-intel-cpu |
| 179 | path: intel-cpu-results.tar |