What: a Linux step after the CPU ICD step runs the runtime's device tests from that step's archive with LP_NATIVE_VECTOR_WIDTH=128 (lavapipe's subgroups of 4, the width arm64 lavapipe runs at) and MESA_SHADER_CACHE_DIR set to a directory of the leg's own in the workspace. It prints vulkaninfo's device name and subgroup sizes first and fails unless they show 128 bits and subgroups of 4, so a green step shows the width ran. scripts/lavapipe-image's nextest command takes --write and --env as run does, so the leg's cache directory and variables reach the container. scripts/linux-gate-ci gets the same step, as docs/VALIDATION.md asks of every Linux step. AGENTS.md's CI line and VALIDATION.md's note on the width name the leg and the cache rule. Nothing in product code reads either variable. Why: the planner wants a stand-in for a device whose SIMD group is 4 wide (tile GPUs are a target). The lab's 128-bit runs failed because of llvmpipe's disk cache, not our lowering. llvmpipe keys its texture functions (lp_texture_handle.c) and its cache id (lp_screen.c) without lp_native_vector_width (Mesa 26.2.4), so a cache that 256-bit runs filled gave a 128-bit shader an 8-wide texture function. A cache of the leg's own cannot collide with the 256-bit one. Verified on lavapipe (Mesa 26.2.4, LLVM 23.1.1, 128 bits, subgroups 4), at aeb0ca9560, the runtime's whole cpu_icd suite: - shared default cache: 989 tests run: 887 passed, 102 failed, 4 skipped (job m3-max-83853); - the cache off: 989 tests run: 989 passed (2 slow), 4 skipped (job m3-max-83888); - gdb on two of the crashes stops at the same JIT store, vmovaps of a ymm register, the 4th of four plus a byte at 0x80: an 8-wide texel struct written into a 4-wide caller (job m3-max-83878). The step itself ran in the lab from ci.yml's step text, in the pinned lavapipe image (Mesa 26.2.4-arch1.1, LLVM 23.1.1): deviceName = llvmpipe (LLVM 23.1.1, 128 bits), subgroupSize 4 (min and max 4); 764 runtime device tests listed; Summary 762 tests run: 762 passed, 231 skipped; job exit 0 (job m3-max-83928, on the RTX 5080 Laptop machine's lavapipe). scripts/linux-gate-ci's new step passed bash -n only; it has not run end to end. No Rust changed, so clippy, Rustdoc and the suites have the inputs they had.
112 lines
4.9 KiB
Bash
Executable File
112 lines
4.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# The Linux job of .github/workflows/ci.yml, step for step, for `scripts/linux-gate` to run inside
|
|
# its container (the default command). Not meant to run on the host: it expects the container's
|
|
# environment (a writable source copy as the working directory, CARGO_TARGET_DIR on the slot
|
|
# volume, CARGO_BUILD_JOBS set to the share, lavapipe as the only Vulkan ICD).
|
|
#
|
|
# Keep it in step with ci.yml: every Linux `run:` there has one `step` here, with the same command
|
|
# plus the explicit build share (`-j`, or `--build-jobs` for nextest, whose `-j` is its test-thread
|
|
# count), which ci.yml leaves to Cargo's default on a dedicated runner. Tests run with nextest's
|
|
# default parallelism, as in ci.yml.
|
|
set -euo pipefail
|
|
|
|
: "${CARGO_BUILD_JOBS:?linux-gate-ci runs inside scripts/linux-gate}"
|
|
: "${CARGO_TARGET_DIR:?linux-gate-ci runs inside scripts/linux-gate}"
|
|
jobs=$CARGO_BUILD_JOBS
|
|
|
|
# ci.yml job-level env.
|
|
export CARGO_TERM_COLOR=always
|
|
export RUSTFLAGS=-Dwarnings
|
|
# ci.yml's Ubuntu tool step exports this to every later step (GITHUB_ENV).
|
|
export METAL2VULKAN_TEST_REQUIRE_PINNED_LLVM=1
|
|
|
|
gate_start=$SECONDS
|
|
step() {
|
|
local name=$1
|
|
shift
|
|
local start=$SECONDS
|
|
echo "::: linux-gate step: ${name}"
|
|
"$@"
|
|
echo "::: linux-gate step ok: ${name} ($((SECONDS - start)) s)"
|
|
}
|
|
|
|
tools_probe() {
|
|
command -v llvm-dis
|
|
command -v spirv-val
|
|
command -v spirv-as
|
|
shopt -s nullglob
|
|
local icds=(/usr/share/vulkan/icd.d/*.json /etc/vulkan/icd.d/*.json)
|
|
echo "Vulkan ICDs: ${icds[*]:-none}"
|
|
test "${#icds[@]}" -gt 0
|
|
}
|
|
|
|
cpu_icd_tests() {
|
|
# A separate target dir keeps the ordinary (`-Dwarnings`) build warm: a RUSTFLAGS change would
|
|
# otherwise rebuild the whole tree in place on every run.
|
|
CARGO_TARGET_DIR="${CARGO_TARGET_DIR}-cpu-icd" \
|
|
RUSTFLAGS='-Dwarnings --cfg m2v_cpu_icd' LP_NUM_THREADS=1 \
|
|
cargo nextest run -p metal2vulkan-validation -p metal2vulkan-runtime --all-features \
|
|
--build-jobs "$jobs"
|
|
}
|
|
|
|
cpu_icd_tests_128() {
|
|
# The runtime's again, with llvmpipe at 128-bit vectors (subgroups of 4) and a Mesa shader cache
|
|
# of its own: llvmpipe keys its disk cache without the vector width.
|
|
local cache="${CARGO_TARGET_DIR}-cpu-icd/mesa-shader-cache-128"
|
|
mkdir -p "$cache"
|
|
CARGO_TARGET_DIR="${CARGO_TARGET_DIR}-cpu-icd" \
|
|
RUSTFLAGS='-Dwarnings --cfg m2v_cpu_icd' LP_NUM_THREADS=1 LP_NATIVE_VECTOR_WIDTH=128 \
|
|
MESA_SHADER_CACHE_DIR="$cache" \
|
|
cargo nextest run -p metal2vulkan-runtime --all-features --build-jobs "$jobs"
|
|
}
|
|
|
|
feature_clippy() {
|
|
local features
|
|
for features in "" serde ash cli; do
|
|
echo "::group::features=${features:-none}"
|
|
cargo clippy -p metal2vulkan --all-targets --no-default-features --features "$features" \
|
|
-j "$jobs" -- -D warnings
|
|
echo "::endgroup::"
|
|
done
|
|
for features in "" serde; do
|
|
echo "::group::metal2vulkan-air features=${features:-none}"
|
|
cargo clippy -p metal2vulkan-air --all-targets --no-default-features --features "$features" \
|
|
-j "$jobs" -- -D warnings
|
|
echo "::endgroup::"
|
|
done
|
|
}
|
|
|
|
gpu_cfg_clippy() {
|
|
# As cpu_icd_tests, a sibling target dir keeps the ordinary build warm.
|
|
CARGO_TARGET_DIR="${CARGO_TARGET_DIR}-gpucfg" RUSTFLAGS='-Dwarnings --cfg m2v_gpu' \
|
|
cargo clippy --workspace --all-targets --all-features -j "$jobs" -- -D warnings
|
|
}
|
|
|
|
qualify_public_cases() {
|
|
cargo build -p metal2vulkan-validation --bins -j "$jobs"
|
|
LP_NUM_THREADS=1 bash scripts/qualify-public-cases "${CARGO_TARGET_DIR}/debug"
|
|
}
|
|
|
|
step "Install LLVM + SPIR-V tools (probe)" tools_probe
|
|
step "Format" cargo fmt --all -- --check
|
|
step "Clippy (warnings denied)" \
|
|
cargo clippy --workspace --all-targets --all-features -j "$jobs" -- -D warnings
|
|
step "Clippy under each feature alone (warnings denied)" feature_clippy
|
|
step "Clippy under --cfg m2v_gpu (warnings denied)" gpu_cfg_clippy
|
|
step "Build public documentation (warnings denied)" \
|
|
env RUSTDOCFLAGS=-Dwarnings cargo doc --workspace --all-features --no-deps -j "$jobs"
|
|
step "Build the new API's consumer reference (warnings denied)" scripts/api-docs
|
|
step "Package the published crates" \
|
|
cargo package --workspace --exclude metal2vulkan-validation --exclude metal2vulkan-devtools \
|
|
-j "$jobs"
|
|
step "Test metal2vulkan" \
|
|
cargo nextest run -p metal2vulkan -p metal2vulkan-air -p metal2vulkan-runtime \
|
|
-p metal2vulkan-devtools --all-features --build-jobs "$jobs"
|
|
step "Test validation suite" \
|
|
cargo nextest run -p metal2vulkan-validation --all-features --build-jobs "$jobs"
|
|
step "Doc tests" cargo test --workspace --all-features --doc -j "$jobs"
|
|
step "Test validation suite and the runtime on the CPU Vulkan ICD (Linux)" cpu_icd_tests
|
|
step "Test the runtime on the CPU Vulkan ICD at 128-bit vectors (Linux)" cpu_icd_tests_128
|
|
step "Qualify public cases on native Vulkan (Linux)" qualify_public_cases
|
|
echo "::: linux-gate: all ci.yml Linux steps passed ($((SECONDS - gate_start)) s)"
|