S-exp GPU
All pages
Docs · The command lineMarkdown

check and watch

check compiles the whole experiment (evaluates the file, traces every graph, checks every shape, validates the IR) and reports every diagnostic. It reads the .sx and everything it requires; without --data it reads no data records. It writes nothing and needs no GPU. Large generated experiments can take several seconds.

$ sexpgpu check my-run.sx
ok: 32 parameters, 39 graphs, 20 steps
slug my-run

The ok: line, the slug run would report the same selection under (it reads SEXPGPU_RUN_SLUG too) and warnings go to standard error; warnings do not fail. watch prints no slug. Any error exits 1.

Check data samples

sexpgpu check my-run.sx --data also opens the training and evaluation sources, including later curriculum stages. It resolves manifests, inspects source metadata and projects the first record of every file through the same field rules as a run. It needs access to those files and the usual S3 credentials for s3:// sources, so it can take longer than a static check.

A shaped field needs one nested list per declared axis. A flat list of six values does not satisfy [2 3]: store two lists of three values, or declare [6] and reshape the tensor in prepare. Short lists are padded and long lists are truncated at each axis, as they are when a run reads them.

Parquet footer counts and manifest counts are checked against the per-file row limit. A sampled JSONL or MessagePack file with no declared count cannot have its total rows checked this way. A source containing no records fails the check; empty files within a nonempty source are allowed.

A failed sample is E-DATA-001, with the loader or evaluation pass, source file and projection error. --json keeps the same diagnostic-array format. Sampling does not validate later records or guarantee that a complete run will read every record successfully. It needs no GPU and does not start training. explain, watch and bundle do not perform this preflight.

Checkpoint selection

check <file> --checkpoint <location/step-N> checks the file under the checkpoint's recorded knobs, even when its defaults have changed. It reads checkpoint metadata, without loading weights. Repeat --set knob=value to apply an evaluation override that leaves the parameters unchanged. Selection differences go to standard error; --json keeps its diagnostic array. See checkpoint selection for locations, relocation and override rules. In this mode the checkpoint selection replaces the ordinary run-slug line.

A failure

$ sexpgpu check bad-shape.sx
error[E-DIM-001]: matmul: inner dims differ: [2, 16] x [32, 8]: 16 against 32
  --> bad-shape.sx:7:15
   |
 7 |   (lambda (x) (matmul x weight)))
   |               ^^^^^^^^^^^^^^^^^
note: operands: `x` [2, 16] f32, `weight` [32, 8] f32
note: applying model `model`
  --> bad-shape.sx:9:15
   |
 9 | (defvar model (tiny 32 8))
   |               ^^^^^^^^^^^
help: `(matmul a b)` contracts the last axis of `a` with the second to last of `b`
in: model -> matmul

Look codes up in diagnostic codes.

--json

check <file> --json puts an array on standard output instead, one object per diagnostic. Flags come after the file.

[{"code": "E-DIM-001",
  "message": "matmul: inner dims differ: [2, 16] x [32, 8]: 16 against 32",
  "span": {"file": ".../bad-shape.sx", "line": 7, "col": 15, "start": 248, "end": 265},
  "notes": [{"message": "operands: `x` [2, 16] f32, `weight` [32, 8] f32", "span": {...}},
            {"message": "applying model `model`", "span": {"line": 9, "col": 15, ...}}],
  "trace": ["model", "matmul"],
  "fix": "`(matmul a b)` contracts the last axis of `a` with the second to last of `b`"}]

span is null when there is no location. An empty array is a clean file.

--timings

check <file> --timings adds compile time and work counts on standard error, after the diagnostics; watch --timings prints them at the same place on every check. With --json, standard output stays the diagnostic array and standard error is one object, {"kind":"timings", ...}, with the fields below beside kind. A failed check reports the work it completed.

$ sexpgpu check my-run.sx --timings
ok: 32 parameters, 39 graphs, 20 steps
slug my-run
compile: 39.44 ms; read 4.60 ms (included)
  phases (ms): assemble=0.02 curriculum=0.00 evaluate=7.48 generate=0.01 load=13.79 optimizer=8.83 setup=0.05 train=8.59 validate=0.52
  work: 4 sources, 26354 bytes, 21472 evaluation units, 39 graphs, 818 nodes, 27 diagnostic observations

The fields:

fieldmeaning
total_mswall time of the compilation, before rendering
phases_mscompleted load, setup, generate, train, evaluate, optimizer, curriculum, assemble, and validate phases
read_mssource hashing and parsing, already included in the phase that requested the source
work_unitsevaluator work units, the same units as SEXPGPU_EVAL_LIMIT
sources, source_bytessources read, including the prelude and standard modules
graphs, nodesthe document's graphs, an update graph once however many parameters share it, and their nodes
diagnostic_observationsdiagnostic observations in those graphs, whether selected or not

load includes expansion, top-level evaluation and parameter construction; a tracing phase includes the evaluation that builds its graphs. No phase includes device compilation. total_ms can exceed the sum of the phases. All diagnostic graphs and IR validation still run.

Where a diagnostic points

The primary span is a line in a file you own. A failure raised in library code (the prelude, a standard module, or a file with a directory called lib in its path) moves its span to the innermost call that is yours: a model application, a function call, or the macro call whose expansion built the failing form. The line that raised it becomes the note "raised by this expression". Code generated by a macro keeps the macro call and template origin as notes. A failure while loading a required file notes every require on the way, each "file is required here".

Every diagnostic has a code and a fix when one is known. The message states the expected and the actual facts: the value it found, type and text (found string "4"), the axis and the sizes that disagree. A wrong name gets the nearest one that exists, and the list when it is short. A wrong argument count or keyword prints the callee's signature and notes where it is defined. An unclosed bracket names the form it opens and notes the first line inside it that starts a list or vector at the opener's indentation or an outer indentation, where the closer most likely belongs. W-* codes are warnings and never stop a compilation.

watch

sexpgpu watch <file.sx> runs check, then polls every file the last compilation attempted to read every 250 ms, clearing the terminal and checking again whenever one moves, appears or disappears. It never exits on its own; Ctrl-C stops it. Standard modules have no file on disk and are not watched. A required file that is missing stays watched: creating it checks again. It takes the selection and --timings.

Related: explain, diagnostic codes.