diff --git a/docs/VALIDATION.md b/docs/VALIDATION.md index fe0790047..0c499c984 100644 --- a/docs/VALIDATION.md +++ b/docs/VALIDATION.md @@ -269,7 +269,7 @@ note under `refs/notes/matrix`: one JSON document per commit, kept in the local never pushed. `scripts/matrix/matrix show SHA` prints a note's verdicts, one line per leg. CONTRIBUTING.md says how to run it. -A leg is one GPU, named by its PCI `vendor:device`, or `lavapipe`. Each GPU runs on one node, and +A leg is one GPU, named by its PCI `vendor:device`, or `lavapipe`, or `lint`. Each GPU runs on one node, and the nodes run at once; a node with several leg GPUs runs them in turn in one job that holds them. | Leg | Runs | Built | @@ -277,6 +277,7 @@ the nodes run at once; a node with several leg GPUs runs them in turn in one job | Each GPU of a Linux node | `metal2vulkan-rt`'s tests under `--cfg m2v_gpu`, the GPU chosen by `VK_DRIVER_FILES` and, on Mesa, `MESA_VK_DEVICE_SELECT='vendor:device!'`; then, in a job that holds the node alone (`--exclusive`), the harness's timed workloads (`harness --runtime `, `crates/metal2vulkan-harness`) | Once per commit on a CPU node: the tests as a nextest archive, the harness as a release build; both carried to the GPU nodes, which only run them. The archive holds its build's paths, so every node lays the tree out at the same per-commit path. Its binaries run only where the builder's do: a node of another CPU builds its own, in a job that holds no GPU | | The Windows host's GPU | The same tests and harness, built on the host under MSYS2 CLANG64 (the pinned nightly's `x86_64-pc-windows-gnullvm` toolchain) | On the host, in a job that holds no GPU | | `lavapipe` | The gate's suites and the device tests in one build under `--cfg m2v_cpu_icd` (`cargo nextest run --workspace`, then the doctests), `LP_NUM_THREADS=1` | In place, on the builder | +| `lint` | The gate's `cargo fmt --all --check`, clippy with `-D warnings` plain, under `--cfg m2v_gpu` and under `--cfg m2v_cpu_icd`, and Rustdoc with `-D warnings`, each its own suite | In place, on the builder, beside its other jobs | A leg passes when every suite passed and no rule below fails. Its line names the device and driver as `vulkaninfo` reported them, the node, the tests passed of those run, the records, the diff --git a/scripts/matrix/matrix b/scripts/matrix/matrix index be709a351..2b44c9e90 100755 --- a/scripts/matrix/matrix +++ b/scripts/matrix/matrix @@ -53,7 +53,7 @@ HARNESS_RUNTIMES = ("old",) #: A node's Vulkan driver manifest by PCI vendor, and whether Mesa's device select picks the GPU. ICDS = {"1002": ("radeon", True), "10de": ("nvidia", False), "8086": ("intel", False)} #: (RAM GiB, minutes) of each job kind before a run of it was measured; the minutes stay its floor. -DEFAULTS = {"build": (16, 30), "gpu": (4, 15), "time": (4, 20), "lavapipe": (32, 60), "winbuild": (16, 60), +DEFAULTS = {"build": (16, 30), "gpu": (4, 15), "time": (4, 20), "lavapipe": (32, 60), "lint": (16, 60), "winbuild": (16, 60), "winrun": (4, 15), "wintime": (4, 20)} #: The awk filter between nextest and the job's log: every line up to the summary, then only the #: captured output of tests that did not pass, and the records of those that did. @@ -144,9 +144,13 @@ class Leg: self.started = self.ended = None +#: The legs that need no GPU, both run on the builder. +CPU_LEGS = ("lavapipe", "lint") + + def plan(nodes, cfg, only): """The legs: each lab GPU on one node, the nodes' loads kept even (the GPUs on fewest nodes - placed first), lavapipe, and each Windows GPU on its host.""" + placed first), each Windows GPU on its host, lavapipe and the lint.""" skip = set(cfg.get("skip_gpus", [])) linux = {n: f for n, f in nodes.items() if f["os"] == "linux"} where = {} @@ -170,7 +174,7 @@ def plan(nodes, cfg, only): if facts["os"] == "windows": legs += [Leg(f"{g['vendor']}:{g['device']}", name, g["id"]) for g in facts["gpus"] if f"{g['vendor']}:{g['device']}" not in skip] - legs.append(Leg("lavapipe", None)) + legs += [Leg(leg_id, None) for leg_id in CPU_LEGS] if only: unknown = set(only) - {leg.id for leg in legs} if unknown: @@ -281,6 +285,30 @@ echo "M2V-SUITE lavapipe doctests exit $d" """ +def lint_script(setup): + """The gate's format check, clippy in each configuration and Rustdoc, each its own suite, in a + tree of its own so they run beside the builder's other jobs.""" + show = "awk 'n < 40 && /^(error|warning)|^ *--> / { print; n++ }'" + return f"""set -u +{setup} +echo "M2V-LEG lint begin" +all=0 +step() {{ + name=$1; shift + "$@" 2>&1 | {show} + rc=${{PIPESTATUS[0]}} + echo "M2V-SUITE lint $name exit $rc" + [ $rc -eq 0 ] || all=1 +}} +step fmt cargo fmt --all --check +step clippy cargo clippy --workspace --all-targets --all-features -- -D warnings +step clippy-gpu env RUSTFLAGS='--cfg m2v_gpu' CARGO_TARGET_DIR=target/gpucfg cargo clippy --workspace --all-targets --all-features -- -D warnings +step clippy-cpu-icd env RUSTFLAGS='--cfg m2v_cpu_icd' CARGO_TARGET_DIR=target/cpuicd cargo clippy --workspace --all-targets --all-features -- -D warnings +step rustdoc env RUSTDOCFLAGS='-D warnings' cargo doc --workspace --all-features --no-deps +exit $all +""" + + def windows_head(): """Windows jobs build and run under MSYS2 CLANG64 with the pinned nightly's gnullvm host toolchain; `scripts/rustc-wrapper` is a shell script, which cargo cannot run there.""" @@ -517,14 +545,20 @@ class Run: space="lavapipe") self.finish([leg], code, out, rec, "lavapipe") + def lint(self, leg): + leg.node = self.build_node["node"] + leg.started = time.time() + code, out, rec = self.job("lint", leg.node, lint_script(self.setup(leg.node)), "lint", space="lint") + self.finish([leg], code, out, rec, "lint") + def go(self): - """Every chain of jobs at once: the builder (its build, its GPU legs if any, lavapipe), - each other Linux GPU node (its own build where the builder's archive cannot run there, + """Every chain of jobs at once: the builder (its build, its GPU legs if any, lavapipe), the + lint beside it on the builder, each other Linux GPU node (its own build where the builder's archive cannot run there, then its legs), and each Windows host (build, then its leg).""" b = self.build_node["node"] by_node = {} for leg in self.legs: - if leg.id != "lavapipe" and self.nodes[leg.node]["os"] == "linux": + if leg.id not in CPU_LEGS and self.nodes[leg.node]["os"] == "linux": by_node.setdefault(leg.node, []).append(leg) built = threading.Event() box = {} @@ -558,6 +592,9 @@ class Run: lavapipe = [leg for leg in self.legs if leg.id == "lavapipe"] start(by_node.get(b, []) + lavapipe, builder_chain) + for leg in self.legs: + if leg.id == "lint": + start([leg], self.lint, leg) cpu = self.nodes[b]["cpu_model"] for node, legs in sorted(by_node.items()): if node == b: @@ -567,7 +604,7 @@ class Run: else: start(legs, self.gpu_node, node, legs, lambda node=node: self.linux_build(node, f"build-{node}")) for leg in self.legs: - if leg.id != "lavapipe" and self.nodes[leg.node]["os"] == "windows": + if leg.id not in CPU_LEGS and self.nodes[leg.node]["os"] == "windows": start([leg], self.windows, leg) for t in threads: t.join() @@ -595,7 +632,7 @@ def leg_entry(run, leg): problems.append("no suite reported") dev = parsed["device"] return dict( - node=leg.node, gpu=leg.id if leg.id != "lavapipe" else None, jobs=leg.jobs, + node=leg.node, gpu=leg.id if leg.id not in CPU_LEGS else None, jobs=leg.jobs, device=dev.get("deviceName"), driver=" ".join(v for v in (dev.get("driverName"), dev.get("driverInfo")) if v) + (f" ({dev['driverVersion']})" if dev.get("driverVersion") else "") or None, started=leg.started and datetime.fromtimestamp(leg.started, timezone.utc).isoformat(timespec="seconds"),