diff --git a/.dockerignore b/.dockerignore index b2c01fa9d..285c6fb0e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,5 +9,9 @@ !src/ !src/eval_tools/ !src/eval_tools/** +# The TileLens image's startup control runs the lane's concrete bounds check. +!src/tools/ +!src/tools/arena_eval/ +!src/tools/arena_eval/sanitize.py **/__pycache__/ **/*.py[cod] diff --git a/AGENTS.md b/AGENTS.md index 92f61a36c..207ee4357 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -190,9 +190,12 @@ prompt/post-processing routing, configuration, docs, and tests. A `src/module_registration.py` as the registry source of truth. Evaluation tools belong to the trusted evaluator control plane, not to agent -skills or prompts. Keep them opt-in, isolated, capability-checked, attested, and -fail-closed as described in `docs/how-to/use-evaluation-tools.md`. Do not claim -that a candidate was analyzed merely because a tool exists or its sidecar ran. +skills or prompts. Keep them isolated, capability-checked, attested, and +fail-closed as described in `docs/how-to/use-evaluation-tools.md`. Schema-v3 +runs enable the default set in `src/eval_tools/defaults.py`; a tool joins it +only after its positive controls and a baseline campaign pass on hardware, and +anything else stays opt-in. Do not claim that a candidate was analyzed merely +because a tool exists or its sidecar ran. ## Verification guide diff --git a/docker/eval-tools/csan/Dockerfile b/docker/eval-tools/csan/Dockerfile new file mode 100644 index 000000000..418fbfbfe --- /dev/null +++ b/docker/eval-tools/csan/Dockerfile @@ -0,0 +1,13 @@ +ARG BASE_IMAGE=lmsysorg/sglang:v0.5.20-rocm10-mi35x@sha256:e20849665c105d389ef91d23c0dc73931aaa6f02056dd10e7b43e4f16c79df69 +FROM ${BASE_IMAGE} + +LABEL org.opencontainers.image.title="AgentKernelArena PyTorch CUDA Sanitizer tool runtime" \ + org.opencontainers.image.base.digest="sha256:e20849665c105d389ef91d23c0dc73931aaa6f02056dd10e7b43e4f16c79df69" + +# CSAN ships with the base image's PyTorch (torch.cuda._sanitizer). +RUN python -c "import torch.cuda._sanitizer as s; assert callable(s.enable_cuda_sanitizer)" + +COPY src/eval_tools /opt/aka-eval-tools/src/eval_tools + +ENV AKA_EVAL_TOOL_FRAMEWORK_ROOT=/opt/aka-eval-tools \ + PYTHONPATH=/opt/aka-eval-tools diff --git a/docker/eval-tools/page-fault-guard/Dockerfile b/docker/eval-tools/page-fault-guard/Dockerfile new file mode 100644 index 000000000..a43e17485 --- /dev/null +++ b/docker/eval-tools/page-fault-guard/Dockerfile @@ -0,0 +1,12 @@ +ARG BASE_IMAGE=lmsysorg/sglang:v0.5.20-rocm10-mi35x@sha256:e20849665c105d389ef91d23c0dc73931aaa6f02056dd10e7b43e4f16c79df69 +FROM ${BASE_IMAGE} + +LABEL org.opencontainers.image.title="AgentKernelArena page-fault guard tool runtime" \ + org.opencontainers.image.base.digest="sha256:e20849665c105d389ef91d23c0dc73931aaa6f02056dd10e7b43e4f16c79df69" + +# The guard needs nothing beyond the scoring base: it reruns correctness with +# PyTorch's caching allocator and ROCr's fragment allocator turned off. +COPY src/eval_tools /opt/aka-eval-tools/src/eval_tools + +ENV AKA_EVAL_TOOL_FRAMEWORK_ROOT=/opt/aka-eval-tools \ + PYTHONPATH=/opt/aka-eval-tools diff --git a/docker/eval-tools/tilelens/Dockerfile b/docker/eval-tools/tilelens/Dockerfile new file mode 100644 index 000000000..478dd255e --- /dev/null +++ b/docker/eval-tools/tilelens/Dockerfile @@ -0,0 +1,24 @@ +ARG BASE_IMAGE=lmsysorg/sglang:v0.5.20-rocm10-mi35x@sha256:e20849665c105d389ef91d23c0dc73931aaa6f02056dd10e7b43e4f16c79df69 +FROM ${BASE_IMAGE} + +LABEL org.opencontainers.image.title="AgentKernelArena TileLens tool runtime" \ + org.opencontainers.image.base.digest="sha256:e20849665c105d389ef91d23c0dc73931aaa6f02056dd10e7b43e4f16c79df69" \ + org.opencontainers.image.version="tilelens-3.1.1" + +# TileLens lives beside, not inside, the base environment: only the sanitizer +# lane puts /opt/tilelens/site-packages on its import path. +COPY docker/eval-tools/tilelens/requirements.lock /opt/tilelens/requirements.lock +RUN /opt/venv/bin/python -m pip install --no-cache-dir --no-deps --require-hashes --only-binary=:all: \ + --target /opt/tilelens/site-packages -r /opt/tilelens/requirements.lock \ + && PYTHONPATH=/opt/tilelens/site-packages /opt/venv/bin/python -c \ + "import tilelens, z3; from tilelens.clients import Sanitizer; print('tilelens', z3.get_version_string())" + +COPY src/eval_tools /opt/aka-eval-tools/src/eval_tools +# The startup control exercises the lane's concrete bounds check, which +# confirms a TileLens finding before it counts. +COPY src/tools/arena_eval/sanitize.py /opt/aka-eval-tools/src/tools/arena_eval/sanitize.py + +ENV AKA_EVAL_TOOL_FRAMEWORK_ROOT=/opt/aka-eval-tools \ + PYTHONPATH=/opt/aka-eval-tools \ + AKA_TILELENS_ROOT=/opt/tilelens/site-packages \ + AKA_TILELENS_VERSION=3.1.1 diff --git a/docker/eval-tools/tilelens/requirements.lock b/docker/eval-tools/tilelens/requirements.lock new file mode 100644 index 000000000..d16eb04b6 --- /dev/null +++ b/docker/eval-tools/tilelens/requirements.lock @@ -0,0 +1,10 @@ +# TileLens and the modules its sanitizer imports, installed with --no-deps +# into /opt/tilelens/site-packages: the base image's PyTorch, Triton and NumPy +# stay authoritative. Hashes are the PyPI wheels for CPython 3.12 / x86_64. +tilelens==3.1.1 --hash=sha256:25f281f3fd7df260fe0689162d550a747b8cbb264b0e6107ce415b746a9bc9a7 +z3-solver==4.15.3.0 --hash=sha256:a9afd9ceb290482097474d43f08415bcc1874f433189d1449f6c1508e9c68384 +anytree==2.13.0 --hash=sha256:4cbcf10df36b1f1cba131b7e487ff3edafc9d6e932a3c70071b5b768bab901ff +tqdm==4.70.1 --hash=sha256:c293e525e6fef9c20e8728fd4612df02a0aa31bb5fe91ecd93e123b1b7bffa73 +ml-dtypes==0.6.0 --hash=sha256:3b4a480aa8fd54a1805b8ac10f3f91763926a74f73c0c364c10f9231854f4170 +pyarrow==26.0.1 --hash=sha256:c718bf97a92a6dea97fd1062c3b9f9e2e83cb9cc926e752289fa4ffff41738f9 +flask==3.1.3 --hash=sha256:f4bcbefc124291925f1a26446da31a5178f9483862233b23c0c96a20701f670c diff --git a/docs/how-to/add-task.md b/docs/how-to/add-task.md index 9fb802c68..bc0e23271 100644 --- a/docs/how-to/add-task.md +++ b/docs/how-to/add-task.md @@ -359,6 +359,14 @@ python3 -m _aka_eval.evaluate candidate {compile|correctness|performance} - **Scoring.** The per-case speedup is baseline time over candidate time; the task's speedup is their geometric mean. Any failed correctness case scores 0. The final evaluation remeasures the baseline next to the candidate. +- **Sanitizers.** On MI355X the final evaluation also runs the default + sanitizers between correctness and performance (see + [Default sanitizers for schema-v3 tasks](use-evaluation-tools.md#default-sanitizers-for-schema-v3-tasks)). + A gate's definite finding stops performance, so the candidate scores 0, + unless the baseline shares it. Keep the baseline clean in every lane: a + finding the baseline shares leaves that lane unable to protect the task. + The framework runs `python3 -m _aka_eval.evaluate {baseline|candidate} + sanitize LANE` itself. ## Run configuration diff --git a/docs/how-to/run-evaluation.md b/docs/how-to/run-evaluation.md index 0001760ef..13638ab9a 100644 --- a/docs/how-to/run-evaluation.md +++ b/docs/how-to/run-evaluation.md @@ -26,7 +26,7 @@ ships quickstarts and specialized examples, including: | `example_configs/quickstart_claude_mi300a.yaml` | Claude Code RMSNorm task with the MI300A hardware profile (`gfx942`). | | `example_configs/quickstart_claude_mi355x.yaml` | One Claude Code RMSNorm task on MI355X (`gfx950`). | | `example_configs/benchmark_cursor_mi355x.yaml` | Cursor Agent over a whole task category on MI355X; use only after installing and authenticating Cursor Agent. | -| `example_configs/evaluation_tools_advisory_mi355x.yaml` | Default-disabled template for experimental `gfx950` evaluation-tool sidecars. It still requires task-specific adapters before opt-in. | +| `example_configs/evaluation_tools_advisory_mi355x.yaml` | Template with an explicit, disabled `evaluation_tools` section for task-declared adapters on `gfx950`. Schema-v3 runs need no section: the default sanitizers run without one. | | `example_configs/qa_audit_all_mi355x.yaml` | [QA audit](qa-auditor.md) of every task on MI355X. | | `example_configs/e2e_*_qa_mi355x.yaml` | QA audit of an end-to-end serving task. | @@ -128,10 +128,12 @@ is missing fails the run before it starts. See the See [Configuration and API reference](../reference/api-reference.md) for the full set of run-configuration fields. -Optional sanitizer and analysis sidecars run after ordinary correctness and -before performance. They are disabled by default, verified only on `gfx950`, -and require language/task-specific adapters. See [Check kernels with evaluation -tools](use-evaluation-tools.md) before enabling them. +Sanitizer sidecars run after ordinary correctness and before performance. On +MI355X (`gfx950`) a run configuration without an `evaluation_tools` section +runs the default schema-v3 set; the runner builds any missing sidecar image on +first use, which needs network access, and stops the run if a build fails. +Set `evaluation_tools: false` to turn it off. See [Check kernels +with evaluation tools](use-evaluation-tools.md#default-sanitizers-for-schema-v3-tasks). ## Start a run diff --git a/docs/how-to/use-evaluation-tools.md b/docs/how-to/use-evaluation-tools.md index cd5565dbf..6026f24a9 100644 --- a/docs/how-to/use-evaluation-tools.md +++ b/docs/how-to/use-evaluation-tools.md @@ -1,16 +1,21 @@ --- myst: html_meta: - "description": "Run Triton FpSan, ROCm GPU AddressSanitizer, rocJITsu Race Detector, Waitcheck, ConSan, and HIP-FpSan as isolated AgentKernelArena evaluation tools." - "keywords": "AgentKernelArena, sanitizer, Triton FpSan, GPU ASan, rocJITsu, Waitcheck, ConSan, HIP-FpSan, ROCm, gfx950" + "description": "Run the default schema-v3 sanitizers (page-fault guard, PyTorch CSAN, TileLens, Waitcheck, rocJITsu, Triton FpSan) and opt-in GPU AddressSanitizer, ConSan and HIP-FpSan as isolated AgentKernelArena evaluation tools." + "keywords": "AgentKernelArena, sanitizer, page-fault guard, CSAN, TileLens, Triton FpSan, GPU ASan, rocJITsu, Waitcheck, ConSan, HIP-FpSan, ROCm, gfx950" --- # Check kernels with evaluation tools -AgentKernelArena can run optional kernel-analysis tools after ordinary -compilation and correctness checks and before performance measurement. The -initial tool set is: +AgentKernelArena runs kernel-analysis tools after ordinary compilation and +correctness checks and before performance measurement. Schema-v3 kernel tasks +on MI355X run a default set with no configuration; see +[Default sanitizers for schema-v3 tasks](#default-sanitizers-for-schema-v3-tasks). +The tool set is: +- A page-fault guard that reruns correctness with the caching allocators off. +- PyTorch's CUDA Sanitizer (CSAN) for cross-stream races. +- TileLens for symbolic out-of-bounds checks of Triton kernels. - Triton FpSan for reference-versus-candidate floating-point semantic comparison. - ROCm GPU AddressSanitizer (GPU ASan) for invalid device-memory accesses. @@ -21,23 +26,146 @@ initial tool set is: exact code object launched by a focused native harness. - HIP-FpSan for explicitly ported HIP/C++ floating-point comparisons. -This feature is experimental and opt-in. Capability and evidence checks fail -closed; whether an incomplete result blocks performance is controlled by the -`advisory` or `required` policy. It is not a general sanitizer suite: +Capability and evidence checks fail closed; whether a finding or an +incomplete result blocks performance is controlled by the `advisory`, +`required` or `gated` policy. It is not a general sanitizer suite: every result is qualified by the kernel language, generated artifact, adapter, tool image, GPU architecture, and evidence that the intended kernel was actually instrumented or dispatched. > **Current validation boundary:** sidecar build locks, integrated startup -> controls, and end-to-end fixtures exist only for MI355X (`gfx950`). The ROCm 10 -> migration has passed five runtime startup controls; GPU ASan qualification is -> blocked by failing safe probes on the tested hosts. See the +> controls, and end-to-end fixtures exist only for MI355X (`gfx950`). GPU ASan +> passes its safe and out-of-bounds probes on bare-metal MI355X hosts and fails +> on virtualized hosts, whose GPUs cannot service recoverable page faults on +> host memory (XNACK); it is therefore not a default. See the > [runtime compatibility guide](../reference/mi355x-runtime.md). > Candidate readiness still depends on language, artifact, adapter, and attestation. > `gfx942` is unverified, and the Docker runner currently rejects > evaluation-tool sidecars on that architecture. Do not interpret normal > MI300/MI325 task support as sanitizer support. +## Default sanitizers for schema-v3 tasks + +A run configuration without an `evaluation_tools` section runs the tools below +on every schema-v3 kernel task when the host is a `gfx950` MI355X. A task +declares nothing: each tool runs the generated workspace runner's +`python3 -m _aka_eval.evaluate ROLE sanitize LANE` action +(`src/tools/arena_eval/sanitize.py`) in its own sidecar, on the task's own +correctness cases, for whatever `target_language` the run selected. +`src/eval_tools/defaults.py` is the single source of truth for the set, the +roles and the policy; the Docker runner builds any missing default image on +first use. That build needs network access to the pinned package and source +locations; if it fails the run stops before any task starts, rather than run +without a default tool. Build the images ahead of time on hosts with limited +network access (see below), or set `evaluation_tools: false`. + +| Tool | Default | Role | What it checks | Languages | +| --- | --- | --- | --- | --- | +| `page_fault_guard` | on | gate | Every correctness case with PyTorch's caching allocator and ROCr's fragment allocator off. An access past an allocation then reaches an unmapped page and the GPU faults instead of landing silently in a neighbouring tensor; an output that passed correctness but then fails it far outside its bound (a non-finite value, more than 10 times the bound, or more than 1% of elements, and at least 8, over it) is also a finding; a smaller excess is recorded as unverified, since split-K and atomic kernels vary that much from run to run. | Triton, Gluon, HIP, FlyDSL, asm | +| `csan` | on | gate | Every correctness case under PyTorch's CUDA Sanitizer: unsynchronized access to a tensor from two streams by PyTorch-visible work, which includes a HIP candidate's custom op. Raw Triton, Gluon, FlyDSL and asm launches are not visible to it. | all five | +| `tilelens` | on | gate | The smallest case with every Triton kernel run by TileLens 3.1.1 in Triton's CPU interpreter; each load and store address is checked against its tensor symbolically (z3 over program id, mask and loop bounds). A reported access is a finding only when a concrete rerun of the same case in the interpreter, with every active load, store and atomic address checked against the launch's argument buffers, reproduces an out-of-bounds access; otherwise it is unverified. Uses no GPU time. The check reads the source, so an out-of-bounds address blocks even on a load whose value is unused or that the compiler removes; `CANDIDATE.md` says so. Gluon is reported unsupported. | Triton | +| `rocjitsu_waitcheck` | on | gate | Static missing or too-weak wait detection on every kernel the role dispatched. One call on the smallest case captures the final code objects (Triton/Gluon cache, the HIP extension's embedded bundle, FlyDSL's embedded HSACO, every code object `aka_asm` loaded). | all five | +| `rocjitsu` | on | gate | rocJITsu's simulated LDS/register race detector. Each captured Triton or Gluon launch becomes a replay capsule (code object, lowered ABI, launch geometry, memory before and after) replayed once in the simulator. Assembly launches are not captured as capsules yet, so `asm` is unsupported. | Triton, Gluon | +| `triton_fpsan` | on | signal | The smallest case through Triton FpSan for the candidate and the baseline. A different digest means a different floating-point expression, which a correct rewrite (online softmax, another reduction order or precision) also produces, so this never blocks. | Triton or Gluon candidate with a Triton or Gluon baseline | +| `gpu_asan` | **off** | gate | Every correctness case with GPU AddressSanitizer instrumentation: HIP rebuilt with `-fsanitize=address -shared-libsan --offload-arch=gfx950:xnack+`, Triton and Gluon compiled with `TRITON_ENABLE_ASAN=1` and buffer ops off. | HIP, Triton, Gluon; bare-metal hosts only (hand-written `asm` carries no instrumentation) | + +Turn the stage off with `evaluation_tools: false` (or `enabled: []`). Any +explicit `evaluation_tools` section is used exactly as written instead of the +defaults. A `qa_auditor` run starts no default tools, because it never +evaluates a candidate. The default tools do not run on a multi-GPU task (a +contract with `world_size` above 1): each lane calls the operator in one +process on one GPU, so every tool records the task as `unsupported`. To add +GPU ASan on a bare-metal host, list the defaults plus `gpu_asan`: + +```yaml +evaluation_tools: + policy: gated + enabled: [page_fault_guard, csan, tilelens, triton_fpsan, rocjitsu_waitcheck, rocjitsu, gpu_asan] +``` + +### Gate and signal roles + +The default `gated` policy reads each tool's `role` (`gate` unless the tool is +a semantic comparison; set `evaluation_tools.tools..role` to override): + +- A `gate` blocks performance, and therefore the score, only on a definite + finding: a fault, a sanitizer report, a race or hazard record, or an output + far outside its bound with the allocator changed. +- After a candidate finding the manager reruns the same tool on the task's + baseline. When the baseline reports every candidate finding, the finding is + recorded with `baseline_also_found: true` and does not block: the reference + implementation does the same thing. A finding that names a kernel or a + location (Waitcheck, rocJITsu, TileLens) must match a baseline finding in + kind, kernel and location; one with neither (a page fault, an + allocator-sensitive output, a CSAN race) matches by kind. TileLens locations + are relative to the role's directory, so a candidate that copies the + baseline reports the same location. The record's `baseline_check` lists the + baseline's findings (`findings`) and the candidate findings this excused + (`excused`), each with its kind, kernel and locations, and the run log names + the excused kinds. Any other finding blocks, including a new race or + out-of-bounds access in a kernel whose baseline already has one elsewhere. + On a task whose baseline has an unlocated finding (it faults with the + caching allocators off), that tool cannot block a candidate's finding of + the same kind; the other gates still apply. +- Anything that is not a definite finding — an unsupported construct, a + kernel TileLens cannot interpret, a tool error, a timeout, a capture that + recorded nothing — is recorded as unverified (`policy_satisfied: false`) and + does not block. +- A `signal` never blocks. + +The `gated` default is a scoring gate, not a security boundary. A gate can +only withhold performance scoring: a candidate that evades or interferes +with a tool scores no higher than it would with the stage off, and what it +can hide is a finding. That makes the stage safe to run by default even +though, as described under the phase boundary below, its sidecars run in the +same phase as the agent and its results are not tamper-resistant evidence +about an adversarial candidate. + +`decision.blocking` lists the findings that stopped performance; a gated +report's `decision.reasons` still lists every unverified tool. Monitor the +unverified rate per language: a candidate that a lane cannot analyze (for +example inline assembly that TileLens approximates) shows up there, not as clean. The +default per-tool deadline is 1200 seconds. + +### What each lane covers and misses + +- The page-fault guard catches an access only when it leaves the mapped + allocation; a small overrun inside an allocation's rounding slack is missed. + A buffer instruction whose descriptor carries the tensor's real size clamps + instead of faulting. The FlyDSL baselines tested build descriptors that do + not clamp at the tensor end, so their out-of-bounds stores fault under the + guard. +- GPU ASan does not see Triton buffer operations (the lane turns them off, + so it checks a slightly different kernel than the one timed) or Gluon's + explicit `gl.amd.cdna4.buffer_load`/`buffer_store`, which the page-fault + guard covers instead. An ASan-built HIP extension loads only in a process + with the ASan runtime preloaded, so the lane is always a separate process. +- TileLens approximates inline assembly, which is unverified, not clean. + Its symbolic model also over-approximates loop-carried pointer updates and + loaded indices, so it can report an access that no execution reaches; the + concrete rerun decides. That rerun checks only the smallest case's actual + execution, and only against whole argument storages: an access outside a + view but inside the storage it was sliced from is not caught. + Its interpreter failed on every schema-v3 Gluon kernel tried (symbolic + program ids, tuple values, `@triton.jit` helpers called from Gluon), so a + Gluon role is reported `unsupported` rather than run. +- rocJITsu replays only what the capture recorded: up to 16 launches and + 256 MiB of reachable memory per call. A replay counts only when the + simulator reproduced the outputs the GPU wrote; a race reported by a replay + that did not (for example where emulated MFMA or FP8 arithmetic differs) is + recorded as inconclusive, not as a finding. Tensor-descriptor arguments and + non-zero global scratch cannot be lowered yet, and HIP and FlyDSL launches + expose no lowered ABI to capture, so those are unverified. +- CSAN sees PyTorch dispatches only; AKA's static policy already forbids + candidates from switching streams. + +Not enabled for v3 candidates: ConSan (it needs a focused native loader and an +independent oracle per code object; rocJITsu covers LDS races on the same +captures), HIP-FpSan (each candidate must be hand-ported to `fpsan::Value`), +and Triton's own `consan`/`gsan` instrumentation modes (`consan` is +implemented only for `gfx1250` and is a silent no-op on `gfx950` even though +the compile metadata records it; `gsan` is NVIDIA-only). + ## Keep the scoring runtime unchanged Evaluation tools do not get installed into the agent or scoring container. @@ -122,6 +250,9 @@ The pinned sidecar dependencies are recorded in | `rocjitsu_waitcheck` | rocJITsu Waitcheck C API and CLI from pinned `rocm-systems` commit `ed35c0b...`; zstd source is separately checksum-locked. | | `rocjitsu_consan` | rocJITsu ConSan HSA hook from the same pinned `ed35c0b...` source, forced to strict record/replay mode. | | `hip_fpsan` | HIP-FpSan headers/source from pinned commit `0ac9be8a...`. | +| `page_fault_guard` | None: the scoring base unchanged (the lane only switches allocators off). | +| `csan` | None: PyTorch's bundled `torch.cuda._sanitizer`. | +| `tilelens` | TileLens `3.1.1` and the wheels its sanitizer imports, hash-locked in `docker/eval-tools/tilelens/requirements.lock` and installed with `--no-deps` into `/opt/tilelens/site-packages`, which only the TileLens lane imports. | ## Understand support levels @@ -167,6 +298,11 @@ remain experimental. ### Strict support matrix +For schema-v3 tasks the framework supplies every adapter itself; see +[Default sanitizers for schema-v3 tasks](#default-sanitizers-for-schema-v3-tasks), +which supersedes the Gluon row and the "adapter required" entries below for +those tasks. The matrix describes task-declared adapters. + The following table describes the current end-to-end evaluator, not just a successful standalone experiment. “Ready with adapter” means the task must provide the dedicated argv/harness and required attestation described later; @@ -242,12 +378,21 @@ Additional boundaries: Building requires Docker and network access to the pinned package and source locations. Runtime sidecars themselves start with networking disabled. -Build all six local `gfx950` images from the repository root: +Build all nine local `gfx950` images from the repository root (a run builds +any missing default image on first use): ```bash src/scripts/docker_benchmark.sh build-eval-tool-images ``` +Each image runs its own copy of `src/eval_tools`. A build labels the image +with a SHA-256 of its Dockerfile and every checkout file the Dockerfile copies +(`com.amd.agent-kernel-arena.eval-tool-source`). Before it starts a sidecar, +the runner compares that label with the current checkout and rebuilds a +default image built from other sources. An image named by +`AKA_EVAL_TOOL_IMAGE_` is used as given, with a warning when its label +differs. + The default local tags are: ```text @@ -257,6 +402,9 @@ agent-kernel-arena/eval-tool-rocjitsu:gfx950-rocm10 agent-kernel-arena/eval-tool-rocjitsu-waitcheck:gfx950-rocm10 agent-kernel-arena/eval-tool-rocjitsu-consan:gfx950-rocm10 agent-kernel-arena/eval-tool-hip-fpsan:gfx950-rocm10 +agent-kernel-arena/eval-tool-page-fault-guard:gfx950-rocm10 +agent-kernel-arena/eval-tool-csan:gfx950-rocm10 +agent-kernel-arena/eval-tool-tilelens:gfx950-rocm10 ``` Check that the workers start and report their pinned assets: @@ -292,6 +440,9 @@ worker: | `rocjitsu_waitcheck` | Compile unbundled `gfx950` code objects and run the production entrypoint, inventory, C API, and parser on the correct-wait and missing-wait fixtures; retain a direct CLI hazard check as an independent engine control. | | `rocjitsu_consan` | Compile raw safe/racy HSACOs plus an image-owned module launcher, run the production entrypoint with separate instrumented/oracle argv, require the oracle environment to be scrubbed, and make the production parser return clean/finding with exact FNV attribution. | | `hip_fpsan` | Require explicitly ported equivalent expressions to match and a known-wrong expression to produce a different digest. | +| `page_fault_guard` | With the caching allocators off, a safe Triton copy must pass and a store 256 MiB past its output must fault. | +| `csan` | A side-stream read ordered with `wait_stream` in both directions (after the write, before the next default-stream use) must pass; without the waits CSAN must report a race. | +| `tilelens` | Through the lane's programmatic API (a `Sanitizer` with `abort_on_error` off), an in-bounds Triton copy must record no violation and an off-by-one copy at least one; the lane's concrete interpreter check, which confirms TileLens findings, must agree on both copies. | `eval-tools-smoke` prints this evidence and exits nonzero if a worker reports `degraded`, including a failed nested positive control. Inspect and retain the @@ -338,11 +489,12 @@ global milestone. | 6. Narrow required gates | Change only individually qualified task/tool pairs to `required`; leave unsupported and not-yet-qualified paths advisory or disabled. | Required gates block seeded findings and infrastructure failures without changing ordinary correctness semantics or the scoring performance baseline. | | 7. Add `gfx942` separately | Build architecture-specific images/configs and rerun every startup, adapter, security, and workload fixture on MI300X/MI325X. | Only mark `gfx942` supported after independent qualification; do not infer it from `gfx950`. | -Phase 0, the six integrated startup controls, complete plan serialization, the -narrower runner mounts, and the trusted AOT replay core exist. No bundled task -has completed production qualification through phases 2–6. Automatic capsule -capture, exact candidate/dispatch provenance, top-level resume freshness, and -the same-phase agent/evaluator boundary remain blockers. +This plan governs task-declared adapters. Schema-v3 tasks follow the default +set instead: framework adapters replace phase 2, the v3 capture closes phase 3 +for Triton and Gluon launches (FlyDSL and HIP code objects are captured for +Waitcheck, not replay), and the `gated` policy with baseline rechecks replaces +the advisory/required choice of phases 5–6. Top-level resume freshness and the +same-phase agent/evaluator boundary of phase 4 remain open for every path. ## Start from the disabled example @@ -373,7 +525,7 @@ evaluation_tools: options: {} ``` -Do not enable all six tools merely because all six images exist. On a +Do not enable every tool merely because every image exists. On a heterogeneous task set, irrelevant tools become `not_applicable`, unsupported paths remain visible as unsupported, and missing adapters remain `adapter_required`. @@ -398,8 +550,10 @@ make docker-run CONFIG=my_sanitized_run.yaml RUN_ARGS='--run-suffix asan_advisor The override names are `AKA_EVAL_TOOL_IMAGE_TRITON_FPSAN`, `AKA_EVAL_TOOL_IMAGE_GPU_ASAN`, `AKA_EVAL_TOOL_IMAGE_ROCJITSU`, `AKA_EVAL_TOOL_IMAGE_ROCJITSU_WAITCHECK`, -`AKA_EVAL_TOOL_IMAGE_ROCJITSU_CONSAN`, and -`AKA_EVAL_TOOL_IMAGE_HIP_FPSAN`. +`AKA_EVAL_TOOL_IMAGE_ROCJITSU_CONSAN`, +`AKA_EVAL_TOOL_IMAGE_HIP_FPSAN`, `AKA_EVAL_TOOL_IMAGE_PAGE_FAULT_GUARD`, +`AKA_EVAL_TOOL_IMAGE_CSAN`, and `AKA_EVAL_TOOL_IMAGE_TILELENS`. An overridden +image must already exist; only the default tags are built on demand. After selecting a tool-image reference, the runner resolves its local immutable image ID with `docker image inspect`, launches the sidecar by that bare @@ -432,14 +586,15 @@ capability limits. For a schema-v3 kernel task the candidate is the `solution/` tree (the only editable tree; its entry is the host function `run()`, so no GPU dispatch symbol is declared), and the protected set includes `_aka_eval/` and `task.yaml`. The -language is the run's `target_language`: `triton`, `hip` and `flydsl` map to the -tool lanes below, while `gluon` and any unknown language report `unsupported`, -so a `required` tool cannot pass silently. The `task.yaml` schema has no -`evaluation_profile` or `evaluation_tools` fields, and the execution config the -framework generates contains none, so a v3 task cannot register task-level -adapters; the `evaluation_profile` and task-level `evaluation_tools` examples in -this section describe task kinds whose execution config carries them and are not -verified against a v3 kernel task. +language is the run's `target_language`. The `task.yaml` schema has no +`evaluation_profile` or `evaluation_tools` fields and needs none: every tool +uses the framework's own v3 adapter (the workspace runner's `sanitize` lanes +and the image-owned `aka_v3_entrypoint` capture for Waitcheck and rocJITsu), +described in +[Default sanitizers for schema-v3 tasks](#default-sanitizers-for-schema-v3-tasks). +A language a tool cannot handle reports `unsupported` or `not_applicable` +there. The `evaluation_profile` and task-level `evaluation_tools` examples in +this section describe task kinds whose execution config carries them. Run-level configuration chooses tools, policy, optional image-identity assertions, and maximum timeout. A task may register adapters for known tools, @@ -663,6 +818,7 @@ rewrite `pass_correctness`. | --- | --- | --- | | `advisory` | Recorded; `policy_satisfied: false` | Continues (`allowed: true`) | | `required` | Recorded with a reason | Skipped (`allowed: false`) | +| `gated` | Recorded; only a `gate` tool's definite finding that the baseline does not share is listed in `decision.blocking` | Skipped only when `decision.blocking` is non-empty | An explicitly `not_applicable` tool is ignored by the gate. Under `required`, every other selected tool must have effective capability `ready`, execution @@ -974,7 +1130,8 @@ generate attestations and AOT capsules there. Per-tool socket directories and a narrow per-worker artifact mount are already implemented, but the current single-container runner does not automate this phase boundary, so its tool results should be treated as diagnostic evidence rather than tamper-resistant -rewards. +rewards. The default `gated` policy fits within that limit: it uses a finding +only to withhold a score, never to raise one. ### Held-out integrity @@ -1006,11 +1163,12 @@ the following: - Only `gfx950` has pinned sidecar locks, passing integrated startup controls, and end-to-end fixtures; `gfx942` is unverified and rejected by the host runner. -- Every useful task still needs a reviewed adapter command. Tool installation - alone usually produces `adapter_required`. -- Five startup controls pass for the ROCm 10 profile. GPU ASan remains - unqualified on the tested hosts. Passing controls qualify tool installation, - not candidate coverage. +- Schema-v3 tasks need no adapter. Every other task kind still needs a + reviewed adapter command; tool installation alone usually produces + `adapter_required`. +- GPU ASan's startup control passes only on bare-metal hosts; on virtualized + hosts the tool is `unavailable_runtime`. Passing controls qualify tool + installation, not candidate coverage. - Runtime-internal asset paths are injected from verified sidecar health and cannot be supplied by task configuration. - Build-attestation artifact paths must be relative to the attestation file; @@ -1038,8 +1196,11 @@ the following: submission evidence or explicit digests. The report serializes the complete tool plan. - Triton/FlyDSL AOT replay is implemented for validated, single-dispatch - `gfx950` capsules and forbids arbitrary launchers. Automatic evaluator-owned - capsule extraction and correctness-run provenance are not implemented. + `gfx950` capsules and forbids arbitrary launchers. For schema-v3 Triton and + Gluon candidates the image-owned entry point captures each launch of one + call on the smallest case and builds its capsule; the capture runs in the + same process as the candidate, guarded by the evaluator's integrity + snapshot, so it is evaluator-recorded but not independent of the candidate. - FlyDSL GPU ASan and Triton FpSan instrumentation are unavailable. - Precompiled AITER, rocBLAS, RCCL, and other library kernels are not covered unless the exact source is rebuilt through a supported and attested path. diff --git a/docs/reference/api-reference.md b/docs/reference/api-reference.md index c66ad8cec..44dcc53ff 100644 --- a/docs/reference/api-reference.md +++ b/docs/reference/api-reference.md @@ -63,17 +63,23 @@ workspace_directory_prefix: workspace ## Evaluation tools -`evaluation_tools` configures optional, isolated kernel-analysis sidecars. The -section is disabled when it is absent, `null`, or `false`. A configured mapping -with no enabled tools is also disabled unless the host runner supplies +`evaluation_tools` configures isolated kernel-analysis sidecars. When the +section is absent, the Docker runner starts the default set from +`src/eval_tools/defaults.py` on `gfx950` (`page_fault_guard`, `csan`, +`tilelens`, `triton_fpsan`, `rocjitsu_waitcheck`, `rocjitsu`) and the scoring +process plans it under the `gated` policy with a 1200-second per-tool deadline; +elsewhere, or without the runner, an absent section is disabled. `null`, +`false` and an empty `enabled` list disable the stage. A configured mapping with +no enabled tools is also disabled unless the host runner supplies `AKA_EVAL_TOOLS`; for a mapping, that host subset replaces its `enabled` value. The built-in IDs are `triton_fpsan`, `gpu_asan`, `rocjitsu`, -`rocjitsu_waitcheck`, `rocjitsu_consan`, and `hip_fpsan`. +`rocjitsu_waitcheck`, `rocjitsu_consan`, `hip_fpsan`, `page_fault_guard`, +`csan`, and `tilelens`. Sidecar build locks, integrated positive controls, and end-to-end fixtures -currently exist only for `gfx950`. The ROCm 10 migration has five passing -startup controls; GPU ASan remains unqualified, as recorded in the -[runtime compatibility guide](mi355x-runtime.md). Each applicable candidate still needs a task-specific +currently exist only for `gfx950`. GPU ASan's controls pass only on bare-metal +hosts, as recorded in the [runtime compatibility guide](mi355x-runtime.md). +Schema-v3 tasks use framework adapters; other task kinds need a task-specific adapter and attestation, and enabling an image alone does not imply that a kernel was analyzed. See [Check kernels with evaluation tools](../how-to/use-evaluation-tools.md) for the support matrix and operational @@ -91,14 +97,15 @@ submount remains writable when the quality-loop repository root is read-only. | Field | Type | Default | Description | | --- | --- | --- | --- | -| `evaluation_tools.enabled` | boolean, string, or list of strings | empty | Tool IDs to plan. `true` expands to all six built-ins; `false` disables the feature. A single string is accepted. Hyphens are normalized to underscores. When the host sets `AKA_EVAL_TOOLS`, its normalized subset is authoritative for both started sidecars and the in-container plan. | -| `evaluation_tools.policy` | `advisory` or `required` | `advisory` | `advisory` always permits performance but records an unsatisfied policy. `required` permits performance only when every applicable selected tool is ready, completes, and reports `clean`. | +| `evaluation_tools.enabled` | boolean, string, or list of strings | empty | Tool IDs to plan. `true` expands to all nine built-ins; `false` disables the feature. A single string is accepted. Hyphens are normalized to underscores. When the host sets `AKA_EVAL_TOOLS`, its normalized subset is authoritative for both started sidecars and the in-container plan. | +| `evaluation_tools.policy` | `advisory`, `required` or `gated` | `advisory` for an explicit section; `gated` for the default set | `advisory` always permits performance but records an unsatisfied policy. `required` permits performance only when every applicable selected tool is ready, completes, and reports `clean`. `gated` blocks only on a `gate` tool's definite finding that the task's baseline, rechecked with the same tool, does not share. | | `evaluation_tools.positive_control` | `required`, `optional`, `disabled`, or boolean | `required` | Requires the applicable synthetic known-bug startup control to pass before runtime capability is ready. `optional`, `disabled`, and `false` normalize to not required; the worker still runs and reports its control. | | `evaluation_tools.timeout_s` | exact integer from 1 through 3600 | `3600` | Default maximum execution time for each selected tool. Booleans, floats, and numeric strings are rejected. | | `evaluation_tools.runtime_profile` | string or `null` | `null` | Fallback runtime-identity assertion for plans whose tool has no `runtime_ref`. It does not select an image and must exactly match worker health when set. | | `evaluation_tools.tools` | mapping | `{}` | Per-tool configuration keyed by normalized tool ID. Entries do not enable tools. | | `evaluation_tools.tools..runtime_ref` | string or `null` | automatic host image ID | Exact bare local Docker image ID (`sha256:...`) asserted by the plan and compared with worker health. The `image_digest` key is an alias. This field does not select an image; omit it when using automatic host injection. | | `evaluation_tools.tools..timeout_s` | exact integer from 1 through 3600 | top-level timeout | Per-tool timeout; it cannot exceed the top-level timeout. | +| `evaluation_tools.tools..role` | `gate` or `signal` | `signal` for `triton_fpsan` and `hip_fpsan`, otherwise `gate` | How the `gated` policy treats the tool's findings. Part of the plan and its fingerprint. | | `evaluation_tools.tools..options` | mapping | `{}` | Adapter options, including argv lists and candidate-evidence paths. Reserved framework keys are rejected at run and task level: `positive_control_required`; GPU ASan runtime/preload/library keys; rocJITsu binary/config keys; Waitcheck CLI/C API keys; ConSan hook keys; and HIP-FpSan include/header keys. | The exact reserved option keys are `positive_control_required` for every tool; @@ -232,11 +239,11 @@ ignored, so use only the documented keys. ### Task-level tool adapters -Schema-v3 kernel tasks cannot declare `evaluation_profile` or `evaluation_tools`: the -`task.yaml` contract has no such fields, the candidate is the `solution/` tree and -the language is the run's `target_language` (not verified against a v3 task). The -rest of this section applies to task kinds whose execution config carries these -sections. +Schema-v3 kernel tasks declare neither `evaluation_profile` nor `evaluation_tools`: +the `task.yaml` contract has no such fields, and every tool uses the framework's +own v3 adapter. The candidate is the `solution/` tree and the language is the +run's `target_language`. The rest of this section applies to task kinds whose +execution config carries these sections. A task can register adapters for known tools, including tools the current run does not enable. Disabled adapters are validated and remain dormant. The only @@ -325,11 +332,11 @@ Each task produces a `task_result.yaml` in its workspace: | `schema_version` | Evaluation-tool result schema version. | | `plan_fingerprint` | SHA-256 over normalized configuration, resolved task profile, plugin versions, captured original/candidate evidence for declared paths, verified scoring-image reference/ID, and the content digest of a configured replay capsule. | | `plan` | Complete immutable plan: schema, policy, profile, ordered tool records (runtime reference, plugin version, timeout, and options), fingerprint, and source evidence. | -| `policy` | `advisory` or `required`. | +| `policy` | `advisory`, `required` or `gated`. | | `overall_status` | `clean`, `finding`, `incomplete`, or `not_applicable`. | | `resolved_task_profile` | Inferred profile plus auditable explicit overrides. | | `source_evidence` | Captured-original and candidate fingerprints plus manifest metadata, including `metadata.scoring_runtime.image_id` and `.reference` when tools run. | -| `decision` | `allowed`, `policy_satisfied`, and machine-readable reason strings. | +| `decision` | `allowed`, `policy_satisfied`, machine-readable reason strings, and under `gated` the `blocking` findings that stopped performance. | | `tools..capability` | Separate `engine`, `adapter`, `runtime`, and resolved `effective` checks. | | `tools..result.execution` | `not_run`, `completed`, `tool_error`, or `timeout`. | | `tools..result.finding` | `not_evaluated`, `clean`, `found`, or `inconclusive`. | diff --git a/docs/reference/mi355x-runtime.md b/docs/reference/mi355x-runtime.md index f0de2a33a..33d692089 100644 --- a/docs/reference/mi355x-runtime.md +++ b/docs/reference/mi355x-runtime.md @@ -3,12 +3,17 @@ The MI355X default is the immutable SGLang 0.5.20 / ROCm 10 manifest selected in [`docker_benchmark.sh`](https://github.com/AMD-AGI/AgentKernelArena/blob/main/src/scripts/docker_benchmark.sh). The `gfx942` and `gfx1201` defaults are unchanged. Explicit image overrides and -task-specific runtime requirements still apply. GPU ASan is **unqualified** on -the tested hosts and remains unavailable when its required controls fail. The -scoring-runtime migration does not qualify this optional analysis tool. Earlier -image qualifications do not qualify a changed source/image combination. +task-specific runtime requirements still apply. GPU ASan passes its safe and +out-of-bounds HIP, HIP-extension, Triton and Gluon probes with this image on +bare-metal MI355X hosts, under ordinary and hardened container flags. It fails +on virtualized MI355X hosts: there the GPU reports `xnack+` and pageable +memory access with `HSA_XNACK=1`, yet a kernel touching `malloc()` memory +faults, and so does the ASan runtime's heap-initialization kernel. GPU ASan is +therefore opt-in, for bare-metal hosts, and stays unavailable wherever its +startup controls fail. Earlier image qualifications do not qualify a changed +source/image combination. -All six optional tool runtimes use the same scoring base and distinct +All nine evaluation-tool runtimes use the same scoring base and distinct `gfx950-rocm10` tags. The scoring-image verifier rejects mismatched images and freezes accepted aliases to their local image IDs. See the maintained [tool capability matrix](../how-to/use-evaluation-tools.md) for startup and diff --git a/docs/reference/release-notes.md b/docs/reference/release-notes.md index df5765c1d..15762af6d 100644 --- a/docs/reference/release-notes.md +++ b/docs/reference/release-notes.md @@ -58,6 +58,41 @@ This topic summarizes the features available in each AgentKernelArena release. F `Aiter-task-mi300`, `image_kernel`) are replaced by the new tasks; no compatibility layer is provided. The end-to-end serving tasks keep schema v2. +### Default sanitizers for schema-v3 tasks + +- A run configuration without an `evaluation_tools` section now runs sanitizers + on every schema-v3 kernel task on MI355X (`gfx950`), for any target language + and with no task configuration. `src/eval_tools/defaults.py` defines the set: + - the new page-fault guard (correctness with the caching allocators off); + - PyTorch CSAN; + - TileLens (symbolic out-of-bounds checks of Triton kernels; a reported access + counts only when a concrete interpreter rerun reproduces it); + - rocJITsu Waitcheck and the rocJITsu race detector, fed by an automatic + capture of the kernels each call dispatches; + - Triton FpSan. +- The new `gated` policy gives each tool a role: + - A `gate` blocks performance only on a definite finding that the task's + baseline, rechecked with the same tool, does not share. + - A `signal` (FpSan) never blocks. + - Unverified results (unsupported, tool error, timeout, inconclusive) are + recorded and never count as clean. +- GPU ASan supports HIP (including the torch-extension build), Triton and + Gluon. It needs a bare-metal host and stays opt-in: virtualized GPU hosts + cannot run its runtime. +- Gluon candidates are supported by FpSan, GPU ASan, Waitcheck and rocJITsu + through the v3 path; TileLens 3.1.1 reports Gluon unsupported. +- The runner builds missing default sidecar images on first use and rebuilds + one whose recorded tool sources differ from the checkout. The Waitcheck + sidecar now gets the worker's GPU for capture. +- The defaults do not start for a `qa_auditor` run, and every default tool + records a multi-GPU task as `unsupported`. +- `asm` candidates get the page-fault guard, CSAN and Waitcheck (on every code + object `aka_asm` loaded); rocJITsu and GPU ASan report them unsupported. +- A baseline recheck excuses a finding only when the baseline reports it in + the same kernel at the same location (unlocated findings: the same kind). +- `evaluation_tools: false` disables the stage. See + [Check kernels with evaluation tools](../how-to/use-evaluation-tools.md#default-sanitizers-for-schema-v3-tasks). + ### Roofline floors - `python3 -m src.roofline` computes a theoretical lower bound (floor) on the diff --git a/example_configs/evaluation_tools_advisory_mi355x.yaml b/example_configs/evaluation_tools_advisory_mi355x.yaml index 9a4596971..febc1de31 100644 --- a/example_configs/evaluation_tools_advisory_mi355x.yaml +++ b/example_configs/evaluation_tools_advisory_mi355x.yaml @@ -1,8 +1,11 @@ -# Experimental evaluation-tool template for MI355X (gfx950). +# Evaluation-tool template for MI355X (gfx950) with task-declared adapters. # -# This example is intentionally disabled. With host AKA_EVAL_TOOLS unset, it can -# be copied and run without building or starting any sanitizer sidecars. Before -# opting in: +# A run configuration WITHOUT an evaluation_tools section runs the default +# schema-v3 sanitizers (src/eval_tools/defaults.py); see +# docs/how-to/use-evaluation-tools.md. This example sets the section explicitly +# and disables it, so with host AKA_EVAL_TOOLS unset it can be copied and run +# without building or starting any sanitizer sidecars. Before opting in to the +# task-adapter path: # 1. build and validate the pinned sidecar images; # 2. configure task-specific argv adapters and attestations; # 3. enable only applicable tools; and @@ -11,10 +14,13 @@ # The runner already uses one writable socket directory per tool and a narrow # repository-root `.eval-tool-artifacts/