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
GitHub aien-dev/omega-mv#884 (code only)
Fetch it
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/b68e08cfa36d9d2c.bundle -o b68e08cfa36d9d2c.bundle git fetch b68e08cfa36d9d2c.bundle refs/pull/884/head
Provenance
github-import 1
aien-dev/omega-mv
884
7389f1a766c97df78c0f13d6faaae6465f46ceb5
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":884,"url":"https://github.com/aien-dev/omega-mv/pull/884","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:08Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/.crumb b/.crumb index e140b6330..9c65d8602 100644 --- a/.crumb +++ b/.crumb @@ -42,13 +42,13 @@ "children": [ { "digest": "9f19f11674ca5dfc3c9c3ae35fe6106557aee9583210da13d257e1b9d88e052c", - "last_commit": "190ff8912", + "last_commit": "d863780eb", "name": "calibration", "purpose": "Directory calibration. Purpose not yet described by a human." }, { - "digest": "d74cddad4fb68d35451857af81f4cb7f69412a595c44af8f3de8baaf602dc1b9", - "last_commit": "3a995ba8d", + "digest": "7ef7796693f23ad68d9a5bcaaee0f635018f4371139a040ba202d4ce7083ede8", + "last_commit": "851476aba", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, @@ -60,50 +60,50 @@ }, { "digest": "8f0e5cb325040247440527f6b54b65cf72c47ff5adca75b4f32a1ddf2b2d6ade", - "last_commit": "ae4ad9c0a", + "last_commit": "43f25831b", "name": "mk", "purpose": "Directory mk. Purpose not yet described by a human." }, { "digest": "62b92244c52fa8af6f511012dee2967e98dff162cc1d8bf45d0b2f15cb0adc5f", - "last_commit": "5901baa51", + "last_commit": "450bbefd4", "name": "research", "purpose": "Directory research. Purpose not yet described by a human." }, { "digest": "1cef97c8f2d852990d04fe5e791e877015c74a751648a020033a2459e02c5148", - "last_commit": "43d8d20da", + "last_commit": "faebae8c1", "name": "spec", "purpose": "Directory spec. Purpose not yet described by a human." }, { "digest": "199749684598b36b610b14a4c5b59703df5e53bba1db2b5939297c55ac423153", - "last_commit": "333091a6f", + "last_commit": "82a399b9f", "name": "src", "purpose": "Directory src. Purpose not yet described by a human." }, { "digest": "ea8ae97d49edc85af090218634c9bad13bcc91fa84f96e0d33fefe313704e111", - "last_commit": "3a995ba8d", + "last_commit": "f401f2baa", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, { "digest": "4e83dea21da137c30076c2dc0ca4f3a488f576f30a94e334558ad5ea523f3a6b", - "last_commit": "88e24bdd5", + "last_commit": "a50c3bd41", "name": "tools", "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:1ef53b95bc495764c6a325611a2941905bbaf617c12cdbe236408a5f72812766", - "compiled_at": "2026-10-29T19:08:03Z", + "children_root": "sha256:8091287983f9252d3cbab774326dd2cc2641e8e724c75b7b59bbbb319ceb72c9", + "compiled_at": "2026-10-30T02:47:38Z", "compiler": "crumb-compile/1", - "digest": "sha256:fd5b27b23c524c67fd5e889f9e13815cbe239cd6e8520e4b6874f314ccf6c199", + "digest": "sha256:a1204166d25f213563dd1d6a90e11e05ede0b1b1dad70e0a74c29b8b3300bf8c", "evidence_files": 12611, "evidence_root": "sha256:9ee1ecc8a32bd724cae4237a844b3cb2e82a8e6af89626fa84c2b5ea77bec79e", - "files": 17819, - "generated_at_commit": "8975287573f284dd2140b2f2b169619d3e145cf1", - "source_tree": "sha256:1d172b7096a6e23d4a2746e09293f7f97656c5d1b4d1ffd808ff5ff5c6dce805" + "files": 17821, + "generated_at_commit": "e615e9ff47d03199514580f655d7670e61ab7e2f", + "source_tree": "sha256:0ba3034275cdc2e57d2ac8280179bd4903fdfe0147a9a64ed54db7a1df23d48f" }, "owner_lane": "", "provenance": { diff --git a/.github/workflows/irspirv-intel-cpu.yml b/.github/workflows/irspirv-intel-cpu.yml new file mode 100644 index 000000000..68df094c0 --- /dev/null +++ b/.github/workflows/irspirv-intel-cpu.yml @@ -0,0 +1,179 @@ +# irspirv-intel-cpu: replays the irspirv SPIR-V suite through Intel's CPU OpenCL runtime. +# Job "modules" (ubuntu-24.04-arm) runs seed/spirv/gate-irspirv.sh unchanged on the committed +# seed/out/omc: it builds the translator, the 13+ unit modules and the AArch64 native dumps, and +# checks them against PoCL 7.2 (built here at the commit the Spark oracle uses). Job "intel-cpu" +# (ubuntu-24.04, x86-64) installs intel-oneapi-runtime-opencl, builds seed/spirv/opencl-host.c +# pinned to libintelocl.so and its platform name, and runs seed/spirv/ocl-vendor-matrix.sh over the +# 129 cases.tsv rows plus demo and regression rows, then the mutant negative control, then the same +# rows again under intel/opencl-intercept-layer (cliloader) to capture build logs and API errors. +# The matrix reports per row (built, ran, matches native, error text); mismatches are findings, +# so only the negative control and setup failures fail this job. CPU evidence only. Advisory. +name: irspirv-intel-cpu +on: + workflow_dispatch: + pull_request: + paths: ["seed/spirv/**", "seed/wasm/cases.tsv", "seed/out/omc", ".github/workflows/irspirv-intel-cpu.yml"] +permissions: + contents: read +env: + POCL_SHA: 888c9774b94590fff1afef003154ca2c0ea66605 # PoCL v7.2, same as the Spark oracle + INTERCEPT_TAG: v3.0.6 +jobs: + modules: + runs-on: ubuntu-24.04-arm + timeout-minutes: 75 + steps: + - uses: actions/checkout@v4 + - name: toolchain (distro oracles) + run: | + sudo apt-get update -q + sudo apt-get install -y -q --no-install-recommends cmake ninja-build pkg-config python3 \ + llvm-18-dev clang-18 libclang-18-dev libclang-cpp18-dev llvm-spirv-18 libllvmspirvlib-18-dev \ + ocl-icd-dev ocl-icd-opencl-dev opencl-c-headers libhwloc-dev spirv-tools + dpkg-query -W llvm-18-dev clang-18 llvm-spirv-18 libllvmspirvlib-18-dev ocl-icd-libopencl1 spirv-tools + - id: pocl-cache + uses: actions/cache@v4 + with: + path: /opt/pocl + key: pocl-${{ env.POCL_SHA }}-llvm18-ubuntu2404-arm64 + - name: build PoCL + if: steps.pocl-cache.outputs.cache-hit != 'true' + run: | + git clone --quiet https://github.com/pocl/pocl.git /tmp/pocl + git -C /tmp/pocl checkout --quiet --detach "$POCL_SHA" + cmake -S /tmp/pocl -B /tmp/pocl/build -G Ninja -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/opt/pocl -DWITH_LLVM_CONFIG=/usr/bin/llvm-config-18 \ + -DENABLE_ICD=ON -DENABLE_SPIRV=ON -DHOST_CPU_ENABLE_SPIRV=ON \ + -DENABLE_TESTS=OFF -DENABLE_EXAMPLES=OFF -DENABLE_POCLCC=OFF + cmake --build /tmp/pocl/build + sudo cmake --install /tmp/pocl/build + - name: gate-irspirv (PoCL baseline; produces modules and native dumps) + run: | + lib=$(find /opt/pocl -name 'libpocl.so.*.*' -type f | head -1) + echo "PoCL library $lib" + export POCL_LIBRARY="$lib" POCL_CACHE_DIR=/tmp/pocl-cache + set +e + sh seed/spirv/gate-irspirv.sh > gate.out 2>&1 + rc=$? + set -e + cat gate.out + echo "gate exit $rc" + test "$rc" = 0 + - name: bundle + if: ${{ !cancelled() }} + run: tar cf irspirv-bundle.tar build/seed/spirv gate.out + - uses: actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: irspirv-bundle + path: irspirv-bundle.tar + intel-cpu: + needs: modules + if: ${{ !cancelled() }} + runs-on: ubuntu-24.04 + timeout-minutes: 45 + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: irspirv-bundle + - name: unpack AArch64 bundle + run: tar xf irspirv-bundle.tar && grep -E '^(SUMMARY|PASS IRSPIRV|FAIL|NOT_RUN)' gate.out + - name: Intel CPU OpenCL runtime (oneAPI apt repository) + run: | + wget -q -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | + gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null + echo 'deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main' | + sudo tee /etc/apt/sources.list.d/oneAPI.list + sudo apt-get update -q + sudo apt-get install -y -q --no-install-recommends intel-oneapi-runtime-opencl \ + ocl-icd-opencl-dev opencl-c-headers clinfo cmake ninja-build + dpkg-query -W -f '${db:Status-Abbrev} ${Package} ${Version}\n' 'intel-oneapi-runtime-*' ocl-icd-libopencl1 | + awk '$1=="ii"' | tee runtime.txt + ls /etc/OpenCL/vendors/ && cat /etc/OpenCL/vendors/* | tee -a runtime.txt + # The ICD file names the library; it must exist. Record its owning package (if dpkg knows it). + lib=$(grep -h '/libintelocl\.so$' /etc/OpenCL/vendors/*.icd | head -1) + test -n "$lib" && test -f "$lib" + { dpkg -S "$lib" || dpkg -S "$(readlink -f "$lib")" || echo "owner of $lib unknown to dpkg"; } 2>&1 | tee -a runtime.txt + echo "INTEL_LIB=$lib" >> "$GITHUB_ENV" + echo "library $lib" | tee -a runtime.txt + lscpu | sed -n '1,20p' | tee -a runtime.txt + ls -l /dev/dri 2>&1 | tee -a runtime.txt || true + # oneAPI's redist/lib ships a Khronos libOpenCL.so.1 that ldconfig may prefer; opencl-host + # relies on ocl-icd semantics (absolute library path in OCL_ICD_VENDORS), so pin ocl-icd. + ldconfig -p | grep 'libOpenCL\.so' | tee -a runtime.txt + icd=$(dpkg -L ocl-icd-libopencl1 | grep '/libOpenCL\.so\.1$' | head -1) + test -n "$icd" + echo "OCL_ICD_DIR=$(dirname "$icd")" >> "$GITHUB_ENV" + echo "loader $icd" | tee -a runtime.txt + - name: clinfo (pinned library only) + run: | + LD_LIBRARY_PATH="$OCL_ICD_DIR" OCL_ICD_VENDORS="$INTEL_LIB" clinfo | tee clinfo.txt + name=$(LD_LIBRARY_PATH="$OCL_ICD_DIR" OCL_ICD_VENDORS="$INTEL_LIB" clinfo -l | sed -n 's/^Platform #0: //p') + test -n "$name" + echo "INTEL_PLATFORM=$name" >> "$GITHUB_ENV" + echo "platform $name" | tee -a runtime.txt + - name: build opencl-host pinned to Intel CPU runtime + run: | + cc -std=c11 -O2 -Wall -Wextra -Werror "-DIRSPIRV_POCL_LIBRARY=\"$INTEL_LIB\"" \ + '-DIRSPIRV_OCL_LIBRARY_BASE="libintelocl.so"' "-DIRSPIRV_OCL_PLATFORM=\"$INTEL_PLATFORM\"" \ + seed/spirv/opencl-host.c -o intel-host -Wl,--disable-new-dtags,-rpath,"$OCL_ICD_DIR" -lOpenCL + ldd intel-host | grep libOpenCL | tee -a runtime.txt | grep -q "$OCL_ICD_DIR/libOpenCL.so.1" + sha256sum intel-host seed/spirv/opencl-host.c seed/spirv/ocl-vendor-matrix.sh | tee -a runtime.txt + ./intel-host build/seed/spirv/demo.spv avgu32 7 10 2>&1 | tee smoke.txt + - name: host control (a PoCL-pinned build must refuse the Intel library) + run: | + cc -std=c11 -O2 "-DIRSPIRV_POCL_LIBRARY=\"$INTEL_LIB\"" seed/spirv/opencl-host.c -o pocl-pinned-host \ + -Wl,--disable-new-dtags,-rpath,"$OCL_ICD_DIR" -lOpenCL + set +e; ./pocl-pinned-host build/seed/spirv/demo.spv avgu32 7 10 > control.out 2> control.err; rc=$?; set -e + cat control.err; test "$rc" = 3; test ! -s control.out + - name: matrix (Intel CPU runtime) + run: | + mkdir -p results + B=build/seed/spirv + for t in "seed/wasm/cases.tsv case" "seed/spirv/demo.tsv demo-case" "seed/spirv/regression.tsv regression-case"; do + set -- $t + bash seed/spirv/ocl-vendor-matrix.sh $B ./intel-host $1 $2 results/$2-intel.tsv | tee -a results/summary.txt || true + done + test "$(awk 'END{print NR-1}' results/case-intel.tsv)" = 129 + - name: negative control (mutant module must mismatch exactly mutant.mutadd) + run: | + set +e + bash seed/spirv/ocl-vendor-matrix.sh build/seed/spirv ./intel-host seed/wasm/cases.tsv case \ + results/case-intel-mutant.tsv --mutant-baseline | tee -a results/summary.txt + rc=${PIPESTATUS[0]} + set -e + test "$rc" = 1 + awk -F'\t' 'NR>1 && $11!="yes"' results/case-intel-mutant.tsv | tee results/negative.txt + grep -q $'\tmutant\tmutadd\t19,7\t0\t26\tyes\tyes\t12\t0\tno\t' results/negative.txt + # Every other row must be identical to the main matrix (mutant row aside). + diff <(awk -F'\t' 'NR>1 && $2!="mutant"' results/case-intel.tsv | cut -f1-12) \ + <(awk -F'\t' 'NR>1 && $2!="mutant"' results/case-intel-mutant.tsv | cut -f1-12) + - name: intercept layer (cliloader, build and error logging) + run: | + git clone --quiet https://github.com/intel/opencl-intercept-layer.git /tmp/cli + git -C /tmp/cli checkout --quiet "$INTERCEPT_TAG" + git -C /tmp/cli rev-parse HEAD | tee -a runtime.txt + cmake -S /tmp/cli -B /tmp/cli/build -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_CLILOADER=ON + cmake --build /tmp/cli/build + loader=$(find /tmp/cli/build -name cliloader -type f -perm -u+x | head -1) + test -n "$loader" + export CLI_BuildLogging=1 CLI_ErrorLogging=1 CLI_CallLogging=1 CLI_ReportToStderr=1 CLI_LogToFile=0 + export CLI_OpenCLFileName="$OCL_ICD_DIR/libOpenCL.so.1" + export HOST_WRAP="$loader" + for t in "seed/wasm/cases.tsv case" "seed/spirv/demo.tsv demo-case" "seed/spirv/regression.tsv regression-case"; do + set -- $t + 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 + done + # The intercept layer must be live: its banner appears in the per-row stderr. + grep -l 'CLIntercept (64-bit) is loading' results/case-intel-intercept.logs/1.err + - name: bundle results + if: ${{ !cancelled() }} + run: | + cat results/summary.txt || true + tar cf intel-cpu-results.tar results runtime.txt clinfo.txt smoke.txt gate.out || true + - uses: actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: irspirv-intel-cpu + path: intel-cpu-results.tar diff --git a/docs/.crumb b/docs/.crumb index 4794c5604..433100df5 100644 --- a/docs/.crumb +++ b/docs/.crumb @@ -82,19 +82,19 @@ }, { "digest": "8b926a045985692f116d9469af5aaa06d778bca78cf5d7e891e68c2486ed789e", - "last_commit": "95829f2ab", + "last_commit": "8ec82485d", "name": "numeric", "purpose": "Directory docs/numeric. Purpose not yet described by a human." }, { "digest": "1a26b15f795aa3581a03400a21d5635e85c71f3f544fcc3676fa58064402c7ad", - "last_commit": "f37bf0fda", + "last_commit": "968734c7e", "name": "osc", "purpose": "Directory docs/osc. Purpose not yet described by a human." }, { "digest": "645b6abb9d46a13dff6c9091d79acf0318fcfdc447a2dc50a3b70cd0dcfaa548", - "last_commit": "61c094113", + "last_commit": "968734c7e", "name": "polyglot", "purpose": "Directory docs/polyglot. Purpose not yet described by a human." }, @@ -118,20 +118,20 @@ }, { "digest": "5db2869ff0b78866ad0ce38f77b262e81fdbc89408e94968491c4e6548177278", - "last_commit": "b7a788e82", + "last_commit": "968734c7e", "name": "turing", "purpose": "Directory docs/turing. Purpose not yet described by a human." } ], "children_root": "sha256:c81d43c0c392dfec2b6ed5b38ba95ea7c592782b283950e32b777e7b9cfd9d61", - "compiled_at": "2026-10-29T19:08:03Z", + "compiled_at": "2026-10-30T02:47:38Z", "compiler": "crumb-compile/1", - "digest": "sha256:d74cddad4fb68d35451857af81f4cb7f69412a595c44af8f3de8baaf602dc1b9", + "digest": "sha256:7ef7796693f23ad68d9a5bcaaee0f635018f4371139a040ba202d4ce7083ede8", "evidence_files": 34, "evidence_root": "sha256:589d8b3706e6d7a202ab20b278dac5fc5bafc973f1c2a867b2668aa7210b65cc", "files": 138, - "generated_at_commit": "8975287573f284dd2140b2f2b169619d3e145cf1", - "source_tree": "sha256:abb09cc035f59b1712633bf8bda4a6ce248b5ad20c663a538879609ae2cec06f" + "generated_at_commit": "e615e9ff47d03199514580f655d7670e61ab7e2f", + "source_tree": "sha256:ba44cf86b50127e2ec3824c2e913e032178628d69910a85ca9125cc1ed960bb5" }, "owner_lane": "", "provenance": { diff --git a/docs/SPIRV.md b/docs/SPIRV.md index 94cf6e01a..a7295e98e 100644 --- a/docs/SPIRV.md +++ b/docs/SPIRV.md @@ -161,6 +161,22 @@ outputs/statuses, validator logs, and the rejected mutant comparison table under `build/seed/spirv`. A gate run replaces this scratch directory; archive receipts before rerunning. Published evidence is retained under `evidence/IRSPIRV/`. +## Replay on Intel's CPU OpenCL runtime (x86-64 CI) + +`.github/workflows/irspirv-intel-cpu.yml` replays the gate's modules and AArch64 +native dumps on an x86-64 runner through `intel-oneapi-runtime-opencl` +(`libintelocl.so`, taken from its ICD file). `opencl-host.c` is rebuilt with +`IRSPIRV_POCL_LIBRARY`, `IRSPIRV_OCL_LIBRARY_BASE=libintelocl.so` and +`IRSPIRV_OCL_PLATFORM`, and rpath-pinned to the distro ocl-icd loader: oneAPI's +redist ships a Khronos `libOpenCL.so.1` that the ld.so cache prefers, and that +loader ignores a library path in `OCL_ICD_VENDORS`. +`seed/spirv/ocl-vendor-matrix.sh BUILD_DIR HOST TABLE PREFIX OUT.tsv [--mutant-baseline]` +records built/ran/match and error text per row instead of stopping at the first +failure; the mutant substitution must mismatch exactly `mutant.mutadd`. Rows are +also replayed under intel/opencl-intercept-layer v3.0.6. Run 40441577102 +(runtime 2026.2.0-863, AMD EPYC 7763 runner): cases 129/129, demo 3/3, +regression 8/8 matched; mutant 128/129. CPU evidence only, advisory. + ## External oracle/toolchain ledger These are verification/demo dependencies, not translator implementation or diff --git a/seed/spirv/.crumb b/seed/spirv/.crumb index c3e8a55bd..928d753b7 100644 --- a/seed/spirv/.crumb +++ b/seed/spirv/.crumb @@ -3,14 +3,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-29T01:41:23Z", + "compiled_at": "2026-10-30T02:47:38Z", "compiler": "crumb-compile/1", - "digest": "sha256:fce1a5e21ee6196b27311b71962ae921bf67ec46b08ec8496b2bf6b1adc99f6f", + "digest": "sha256:5f020e7aff4e0e4ee99850657b13648d5cc5bab1486819d031313ea4c7b20eae", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 8, - "generated_at_commit": "28a7b749a6da68407af60a7cccaf34dc2e5eab48", - "source_tree": "sha256:4de38a7cc086f62c54f17ec6bfe984bfd9c38ab68953b3ea12a9314546ece1b9" + "files": 9, + "generated_at_commit": "e615e9ff47d03199514580f655d7670e61ab7e2f", + "source_tree": "sha256:8c9b45dd9c78e61f753f08275f0a356c8d3deb20ea5b6d4777a674e4d52b0bb8" } }, "layer": "seed", diff --git a/seed/spirv/ocl-vendor-matrix.sh b/seed/spirv/ocl-vendor-matrix.sh new file mode 100755 index 000000000..a9d53dc72 --- /dev/null +++ b/seed/spirv/ocl-vendor-matrix.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash +# Verification only: replays gate-irspirv artifacts (modules plus native dumps produced on +# AArch64 by seed/spirv/gate-irspirv.sh) through one opencl-host build that pins another CPU +# OpenCL runtime. Unlike parity.py it does not stop at the first API failure: every row gets +# built/ran/match columns and the host's error text, because the point is to list what breaks. +# usage: ocl-vendor-matrix.sh BUILD_DIR HOST TABLE PREFIX OUT.tsv [--mutant-baseline] +# --mutant-baseline substitutes mutant-flipped.spv for unit "mutant" (negative control). +# Exit 0 when every row built, ran and matched; 1 when any row did not; 2 on usage/artifact error. +# HOST_WRAP (optional) is a command prefix such as an intercept-layer loader. +set -u +[ $# -eq 5 ] || [ $# -eq 6 ] || { echo 'usage: ocl-vendor-matrix.sh BUILD_DIR HOST TABLE PREFIX OUT.tsv [--mutant-baseline]' >&2; exit 2; } +B=$1 HOST=$2 TABLE=$3 PREFIX=$4 OUT=$5 MUTANT=${6:-} +[ -z "$MUTANT" ] || [ "$MUTANT" = --mutant-baseline ] || { echo "unknown option $MUTANT" >&2; exit 2; } +tag=${MUTANT:+mutant}; tag=${tag:-vendor} +LOGS=${OUT%.tsv}.logs # per-row host stdout/stderr, beside the table +mkdir -p "$LOGS" +printf 'case\tunit\tkernel\targs\tnative_status\tnative_bits\tbuilt\tran\tresult_bits\tresult_status\tmatch\thost_exit\terror\n' > "$OUT" +i=0 bad=0 +while IFS=$'\t' read -r unit name _ret typed status; do + case "$unit" in ''|'#'*) continue ;; esac + i=$((i+1)) + module=$B/$unit.spv + [ -n "$MUTANT" ] && [ "$unit" = mutant ] && module=$B/mutant-flipped.spv + [ -f "$module" ] || { echo "missing module $module" >&2; exit 2; } + [ -f "$B/$PREFIX-$i.status" ] || { echo "missing native $B/$PREFIX-$i.status" >&2; exit 2; } + nstatus=$(cat "$B/$PREFIX-$i.status") + [ "$nstatus" = "$status" ] || { echo "row $i native status $nstatus expected $status" >&2; exit 2; } + if [ "$nstatus" = 0 ]; then + [ "$(wc -c < "$B/$PREFIX-$i.out")" = 8 ] || { echo "row $i incomplete native dump" >&2; exit 2; } + nbits=$(od -An -t u8 "$B/$PREFIX-$i.out" | tr -d ' \n') + else + nbits=0 + fi + args=() + if [ "$typed" != - ]; then + IFS=, read -ra parts <<< "$typed" + for p in "${parts[@]}"; do + kind=${p%%:*} v=${p#*:} + if [ "$kind" = bool ]; then + case "$v" in true) args+=(1) ;; false) args+=(0) ;; *) echo "bad bool $v" >&2; exit 2 ;; esac + elif [ "${v#-}" != "$v" ]; then + args+=("$(printf '%u' "$v")") # two's complement, as parity.py masks to 64 bits + else + args+=("$v") + fi + done + fi + base=$LOGS/$i + # shellcheck disable=SC2086 # HOST_WRAP is an intentional word-split prefix + timeout 120 ${HOST_WRAP:-} "$HOST" "$module" "$name" "${args[@]}" > "$base.out" 2> "$base.err" + rc=$? + built=yes ran=no rbits=- rstatus=- match=no + case $rc in + 0) ran=yes ;; + 6) built=no ;; + 7|8) ;; + 3|4|5) built=env ;; + 124) built=unknown; echo "opencl-host: timed out after 120 s" >> "$base.err" ;; + *) built=unknown; echo "opencl-host: terminated with exit $rc" >> "$base.err" ;; + esac + if [ $rc = 0 ]; then + if read -r rbits rstatus < "$base.out" && [ -n "$rstatus" ]; then + [ "$rbits" = "$nbits" ] && [ "$rstatus" = "$nstatus" ] && match=yes + else + ran=no; rbits=-; rstatus=-; echo "opencl-host: malformed stdout" >> "$base.err" + fi + fi + # Error text: host stderr minus the identity lines and the success-path build log. + if [ "$match" = yes ]; then + err=- + else + err=$(grep -v -e '^opencl-host: library=' -e '^opencl-host: platform=' -e '^opencl-host: il=' "$base.err" | + tr '\t\n' ' ' | tr -s ' ' | cut -c1-400) + [ -n "$err" ] || err="result mismatch: native $nbits/$nstatus got $rbits/$rstatus" + [ "$ran" = yes ] && err="result mismatch: native $nbits/$nstatus got $rbits/$rstatus" + bad=$((bad+1)) + fi + printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' "$i" "$unit" "$name" \ + "$(IFS=,; echo "${args[*]:--}")" "$nstatus" "$nbits" "$built" "$ran" "$rbits" "$rstatus" \ + "$match" "$rc" "$err" >> "$OUT" +done < "$TABLE" +[ "$i" -gt 0 ] || { echo "empty table $TABLE" >&2; exit 2; } +built_no=$(awk -F'\t' 'NR>1 && $7!="yes"' "$OUT" | wc -l) +ran_no=$(awk -F'\t' 'NR>1 && $8!="yes"' "$OUT" | wc -l) +echo "MATRIX $PREFIX $tag rows=$i matched=$((i-bad)) not_matched=$bad not_built=$built_no not_ran=$ran_no table=$OUT" +[ "$bad" = 0 ] diff --git a/seed/spirv/opencl-host.c b/seed/spirv/opencl-host.c index 172404e23..db41c1cac 100644 --- a/seed/spirv/opencl-host.c +++ b/seed/spirv/opencl-host.c @@ -8,7 +8,10 @@ // runtime failure exits nonzero with a named stderr line and prints nothing on // stdout. Device and toolchain identity are recorded on stderr. // -// GPU isolation: the build pins one absolute PoCL shared-library path. Inherited +// GPU isolation: the build pins one absolute CPU OpenCL shared-library path and the +// platform name it must report (default PoCL: libpocl.so, "Portable Computing +// Language"; a vendor CPU runtime such as Intel's libintelocl.so may be pinned +// instead with IRSPIRV_OCL_LIBRARY_BASE and IRSPIRV_OCL_PLATFORM). Inherited // vendor/layer discovery settings are overwritten before the first OpenCL call. // Only CL_DEVICE_TYPE_CPU devices are enumerated; POCL_DEVICES is forced to cpu. @@ -39,6 +42,12 @@ enum { #ifndef IRSPIRV_POCL_LIBRARY #define IRSPIRV_POCL_LIBRARY "" #endif +#ifndef IRSPIRV_OCL_LIBRARY_BASE +#define IRSPIRV_OCL_LIBRARY_BASE "libpocl.so" +#endif +#ifndef IRSPIRV_OCL_PLATFORM +#define IRSPIRV_OCL_PLATFORM "Portable Computing Language" +#endif static int fail(int code, const char *what, cl_int err) { @@ -79,8 +88,9 @@ static int pin_loader(void) if (library[0] != '/') return refuse(EXIT_ENVIRONMENT, "build requires an absolute IRSPIRV_POCL_LIBRARY"); const char *base = strrchr(library, '/'); - if (base == NULL || strncmp(base + 1, "libpocl.so", 10) != 0) - return refuse(EXIT_ENVIRONMENT, "configured library is not libpocl.so"); + size_t base_len = strlen(IRSPIRV_OCL_LIBRARY_BASE); + if (base == NULL || base_len == 0 || strncmp(base + 1, IRSPIRV_OCL_LIBRARY_BASE, base_len) != 0) + return refuse(EXIT_ENVIRONMENT, "configured library is not " IRSPIRV_OCL_LIBRARY_BASE); if (setenv("OCL_ICD_VENDORS", library, 1) != 0 || unsetenv("OCL_ICD_FILENAMES") != 0 || unsetenv("OPENCL_LAYERS") != 0 || unsetenv("OPENCL_VENDOR_PATH") != 0 || @@ -195,11 +205,11 @@ int main(int argc, char **argv) goto out; } if (platforms != 1) { - rc = refuse(EXIT_DEVICE, "expected exactly one (PoCL) platform"); + rc = refuse(EXIT_DEVICE, "expected exactly one (pinned) platform"); goto out; } - if (platform_text(platform, CL_PLATFORM_NAME, text) != 0 || strcmp(text, "Portable Computing Language") != 0) { - rc = refuse(EXIT_DEVICE, "platform is not PoCL"); + if (platform_text(platform, CL_PLATFORM_NAME, text) != 0 || strcmp(text, IRSPIRV_OCL_PLATFORM) != 0) { + rc = refuse(EXIT_DEVICE, "platform is not " IRSPIRV_OCL_PLATFORM); goto out; } fprintf(stderr, "opencl-host: platform=%s", text);