S-exp GPU
All pages
Docs · ReferenceMarkdown

Diagnostic codes

Every diagnostic has a code, a primary span in a file you own, the expected and actual facts, and a fix when one is known; see check. A wrong name gets the nearest one that exists, a wrong count or keyword the signature, and a value of the wrong kind its type and text. W-* codes are warnings and never stop a compilation. sexpgpu check <file> --json gives them as an array.

Reading and evaluating

codewhat it meansusual fix
E-READ-001the file ends inside a form or a string; the message names the form by its first lineadd the closer; the note marks the first line inside it that starts a list or vector at the opener's indentation or an outer indentation, where it most likely belongs
E-READ-002a ) or ] with nothing open, or the wrong one for what is openremove it, or close with the bracket the fix names; the note shows the open one
E-READ-003a token that is not a number, keyword, string or symbol, including an out-of-range integer0.5 not .5; use an i64-range integer; : plus a name for a keyword; a symbol is letters, digits and -+*/<>=!?.&_%
E-READ-004forms nest more than 256 deep, counting brackets and quotes; the span is the opener that goes past. What a macro expands to may nest deepername inner forms with let* or defun, or build deep data with a function
E-EVAL-001the program called (error ...)read the message
E-EVAL-002an (assert ...) failedread the message
E-EVAL-003a name is not bound, or setq of one that is not, a knob used before its defknobs included. A name a macro wrote is looked up in the macro's module and the prelude, which the message namesthe fix names the module that defines it, or the nearest name; for a macro's name, define it in the macro's module or pass it as an argument
E-EVAL-004calling something that is not a function, or a macro as a functionthe span is the head and the message states its value; wrap a macro in a lambda
E-EVAL-005a malformed special form, lambda list, or a binding of reserved syntaxthe fix writes the form's shape; see special forms
E-EVAL-006an argument of the wrong type, a bad destructuring, a bad dtype keyword, a draw's :stream that is not a name or is in a parameter initializerthe message states the value it found, type and text; min or max of a tensor given a second value points to minimum or maximum
E-EVAL-007integer overflow, mod and the numbers in front of a tensor in + - * / included; floor of a float no integer holds; or division by a zero number, as (mod x 0)an integer is 64-bit: write one operand as a float, as 2.0; check the divisor
E-EVAL-010a keyword argument that is not a keyword, unknown, or has no valuethe fix names the nearest keyword and lists the accepted ones, or prints the signature; a note shows the definition
E-EVAL-011the wrong number of argumentsthe fix prints the signature, and a note shows the definition
E-EVAL-030a file requires itself; the message spells the loopmove what both files need into a third file that both require
E-EVAL-031a required file cannot be read; the message names the path it looked forpaths are relative to the file holding the require
E-EVAL-032a require path is neither relative nor a package./name.sx, or sexpgpu/<module>
E-EVAL-033no such standard modulethe fix lists the ones that exist
E-EVAL-034a require names nothing or is in a local scopelist names, at module top level
E-EVAL-035a require names what the file does not definethe fix is the nearest name it does
E-EVAL-036a name bound twice in one file, by two imports (from one module or two) or an import and a definitionrename, or import once
E-EVAL-037an import the file never writes outside its requires. A name on a branch the selection skips counts as used, as does a contract name imported into the run filetake the name out of the require
E-EVAL-040recursion deeper than 256 calls; the message names the function and points at its recursive callno tail calls; check the base case, or loop with repeat, reduce or dotimes
E-EVAL-041compile-time work budget exceeded or invalidraise SEXPGPU_EVAL_LIMIT for finite generators
E-EVAL-042--expr received zero or multiple formspass one form; combine forms with progn or let*
E-EVAL-043a macro expands to itself, directly or through others: the call is still a macro call after 10,000 expansions in a rowgive the macro a case that expands to something other than a macro call, or recurse in a function
E-PROBE-001a probe reads loaded or runtime state, or emits metrics, counters, guards or selected diagnosticsreturn tensors computed from initialized parameters; use run for runtime state; --diagnostics '' selects none
E-PROBE-002probe intermediate and output elements exceed --max-elementsshrink the fixture or explicitly raise the limit
E-PROBE-003the reference interpreter refused an operation; the message is its reason, after initializing <path>: when the operation is in the initializer of a parameter or buffer the expression readscheck the shapes and values the expression or that initializer gives the operation

Tensors and staging

codewhat it meansusual fix
E-DIM-001shapes do not fit; the message names the axis or the dims that disagree. Also a shape whose dim or element count is past the largest integer, written or made by an operation, an axis of a rank-0 value, which has none, a sum or max listing one axis twice ([1 -1] on a rank-2 tensor), a table-scan :start that is not a state of its table, and a matrix-scan whose a is not [.., n, n] on b's [.., n, m] or whose n is above 16the note names both operands as you wrote them; the fix states the rule, or says to list each axis once
E-DIM-002dtypes differ, :x is not a dtype, a where mask that is not :bool, a table-scan table or symbols are not :i32, integer ids or indices given as floats, a float operation given an integer tensor, or an operation inside high-precision does not support F64(cast x :f32); dtypes are :f64 :f32 :bf16 :i32 :i64 :bool; keep unsupported operations outside high-precision
E-DIM-003a tensor was expected; the message states what was found
E-DIM-004reshape has multiple -1 extents, a nondivisible element count or an ambiguous zero productuse one inferred extent and an exactly dividing nonzero known product
E-EINSUM-001malformed spec, operand count mismatch or an output label absent from all operandswrite a string spec such as "bij,bjk->bik" with one tensor per input term
E-EINSUM-002a repeated label within one operand or the outputextract diagonals explicitly; list each output label once
E-EINSUM-003operand rank, shared extent or grouped extent mismatchmatch the labels to tensor axes; shared extents must agree or be 1
E-FLOW-001compile-time truth on a tensor; includes the final operand of and or oruse logical-and, logical-or, logical-not, logical-xor, or select with (where test then else)
E-FLOW-002a tensor from another graph; the message names its first bindingrecompute it in this graph instead of keeping it in a variable
E-FLOW-003a tensor operation with no graph being tracedtensors exist in prepare, a model, objective, evaluate, an optimizer body, an initializer or curriculum
E-FUNC-001Invalid functional-call bindings or a missing trainable, buffer or frozen pathCombine (parameters model), (buffers model) and (frozen-parameters model) with tree-merge; see functional-call
E-FUNC-002Functional-call binding has the wrong shape or kindMatch the parameter declaration's shape and kind
E-FUNC-003A model-value query ran before canonical model paths were assigned during top-level loadingQuery parameters, buffers or frozen-parameters inside a function or lambda
E-TREE-001Invalid tensor/model-root tree, mismatched structure or conflicting merge/shared leavesUse compatible trees and disjoint merge keys, or reuse the same tensor for overlaps; see tree-merge
E-TRANSFORM-001Invalid function, argument selection or transform optionPass a callable and distinct static argument indices; see grad
E-TRANSFORM-002Invalid differentiated tree, cotangent/tangent type or scalar grad resultUse matching float trees for vjp/jvp; grad requires a scalar float result
E-TRANSFORM-003A transformed call declares training objects or emits reporting/guard effectsReturn auxiliary data and report or validate it outside the transformed function
E-TRANSFORM-004The named derivative operation cannot be transformedUse the supported pure tensor operations or simplify the derivative composition
E-GRAD-001(gradient y x) where y is not one float value; the message gives its shape and dtypereduce y with sum or mean first
E-GRAD-002(gradient y x) where x is an integer or boolean tensortake it with respect to a float tensor y is computed from
E-GRAD-003(gradient y x) where y is not computed from x, so the gradient would be zerosdifferentiate with respect to a tensor y reads, or write (zeros-like x)
E-GRAD-004(gradient y x) where y reads the gradient a tap-gradient lambda is given, which exists only after the training backwardtake gradient of a value computed without it
E-GRAD-005(checkpoint body...) whose body records no tensor operation, as (checkpoint state) does; the message gives what it returnswrap the computation that carries the state, (setq state (checkpoint (step state))); see recomputing a loop body
E-GRAD-006a derivative through an operation that has none, qrwrap its argument in stop-gradient to use the result as a constant; see qr
E-CREDIT-001a forward-credit argument belongs to another graphcompute all four arguments in the same training graph
E-CREDIT-002the local credit score is not a floating tensor with the activation's shapecompute an activation-shaped floating error
E-CREDIT-003the local-credit activation is not floating point, or its input is neither floating point nor integer idscast the activation to :f32, or use a floating layer input or integer embedding ids
E-CREDIT-004the local-credit activation and input do not share their leading axesuse the layer input and output for the same batch and sequence axes
E-CREDIT-005the mapped value is not a direct parameter readpass the parameter itself, without a reshape, transpose, cast or stop-gradient
E-CREDIT-006the parameter shape does not match the input and activation feature axes; matrices use [input, output]use a matching outer-product map, or mark the parameter :trainable false
E-SCAN-001malformed element-scan call, a :reverse that is not true or false, implicit parameter or context read, a :state-axis that is not the sequences' last axis, or a body outside the lane contract: pointwise math, and with :state-axis reductions of vectors of at most 16 valuespass tensor reads as explicit sequences and return one f32 value of the state's shape; see element scans
E-SCAN-002invalid scan length, sequence shape, carried shape, dtype or structurekeep a fixed tensor state and matching sequence lengths; see scan
E-SCAN-003a declaration or reporting effect inside a scan bodydeclare state outside and return tensors to report after the scan
E-SCAN-004a scan used with an unsupported training mode or inspection operationuse reverse-mode training and inspect the full document

Models and optimizers

codewhat it meansusual fix
E-PARAM-002defparam outside a modelparameters live inside defmodel
E-PARAM-003an initializer reads another valuean initializer is closed: shapes, constants, random nodes
E-PARAM-004a model body does not end in a function; the message shows the form it ends inreturn (lambda (x) ...) last
E-PARAM-005named on something that is not a model or a parameter
E-PARAM-006an unknown parameter option, or :numerics other than :highthe fix names the nearest; the options are :tags, :numerics, :trainable and :load
E-PARAM-007:trainable that is not a boolean, or :load that is not a file and a tensor name; a with-loaded header that is not a file, a function and optional :trainable and :buffers booleans, or a function returning a non-string for a path, which the message names with the value:trainable false, :load ["model.safetensors" "name"], a name function that returns a string
E-PARAM-008a model under two parameter roots: bound to two top-level names, or reachable from two roots; the note shows the other bindingbind each model to one top-level name
E-PARAM-009a graph reads a parameter of a model not bound by itself at the top level: built in a let, a function or a top-level listbind it with defvar at the top of the run file, or build it inside the defmodel that uses it
E-PARAM-010a model or parameter name holds a ., which joins the names of a pathwrite - or _ within a name
E-PARAM-011distinct parameters share one checkpoint path; the diagnostic names the path and the declarations or model constructionsgive each parameter or model instance a unique name with named; include the index for repeated construction; tie weights by reusing one parameter value
E-BUFFER-001a defbuffer with an unknown option, :trainable or :load, or without an :after-step function; or whose update changes its shape or dtype, reads a field, a gradient, rank-local context or a random draw, or emits a metric, counter or guard; the message names which(defbuffer average weight :after-step (lambda (old ctx) (+ (* 0.99 old) (* 0.01 weight)))); :tags, :numerics and a buffer outside a model report as for defparam
W-PARAM-001a model is never bound to a namebind it with let, or named
E-OPT-001a selector matches no parameterthe fix names the nearest parameter path and lists them; or widen the glob
E-OPT-002a parameter is in more than one groupnarrow one selector with select-not
E-OPT-003a misplaced or duplicate state, or a state initializer that is not a zero constantstart it at zero: zeros-like, zeros or a zero full
E-OPT-004an optimizer body does not end in optimizer-update, or drops a state; the message lists declared and returned statesreturn every declared state exactly once
E-OPT-005a malformed select, group, :groups or :optimizer, a negative rank in select, or an inner optimizer with :groups; the message states what was giventhe fix prints the shape
E-OBJ-001objective does not return one float scalarreduce the loss; report the parts with metric
E-OBJ-002invalid objective-term: not a float scalar in objective, duplicate or invalid name, or absent from the returned objectiveregister each complete weighted scalar once under a unique metric-style name, and sum the returned values

The contract

codewhat it meansusual fix
E-CONTRACT-001a required top-level name is missingthe fix writes the form that defines it, (defrun :steps 300 :microbatches 4); see the run file
E-CONTRACT-002a contract name is the wrong kind of value; the span is where the file defines or imports itthe fix writes the form that defines it
E-CONTRACT-003an unknown keyword in a configuration form or a builtin's options, negative :steps, :seed or :diagnose-first, a count below 1 or past what it holds (:batch-size, :microbatches, :checkpoint-every, :diagnose-every, a pass's :every or :batches), a bad :precision or :evaluate, an :ema decay below 0 or not below 1, a top-level model bound to ema under :ema, :ema-debias without :ema or not a boolean, a pass's :ema or a matrix-scan :reverse or :projective that is not a boolean, a pass's :prepare or :evaluate that is not a function, a manifest :subsets that is not a non-empty vector of strings, or a loader or stage :shuffle that is not a positive integerthe fix names the nearest keyword and lists the accepted ones, or the range a value takes; a nonnegative :steps; :subsets ["context:512"]; a positive :shuffle, or none for source order
E-CONTRACT-004prepare did not return :inputs and :targets; the message lists the keys it did(list :inputs ... :targets ...); the fix names a near miss
E-CONTRACT-005the batch has no such fieldthe fix lists what the loader declares
E-CONTRACT-010counter outside preparecount where records are counted
E-CONTRACT-011metric in an optimizer bodya diagnostic, or compute it in objective or evaluate
E-CONTRACT-012a metric's metadata is over what Metrics accepts, runtime keys countedfewer or shorter keys
E-CONTRACT-013two defeval passes share a name
E-CONTRACT-014evaluate or curriculum with no evaluation pass (an explicit empty selection may disable inherited evaluate)declare a pass
E-CONTRACT-015a diagnostic without :reduce, with an unknown one, or two reducers for one nameone of :mean :min :max :sum
E-CONTRACT-016a diagnostics selection that names nothing the file definesthe fix lists the names
E-CONTRACT-017a metric, or a guard other than a diagnostic's bound, inside a tap-gradient lambdareport the gradient with diagnostic, and bound it with :below or :above
E-CONTRACT-018defrun :evaluate :offline (or run --evaluate offline) with no :checkpoint-every while a pass has an :every, or one that does not divide it: sexpgpu evaluate would miss that pass's stepsa :checkpoint-every that divides every :every, or evaluate :inline; see evaluation
E-CONTRACT-019a guard in a generator, a parameter initializer or the curriculum, which no step stops at; a diagnostic's bound in a generator is dropped with the diagnostic insteadguard in objective, evaluate or an optimizer body
E-CONTRACT-020a guard whose count is a bool(count-where mask), or (cast flag :f32)
E-CONTRACT-021a source's :weight is NaN or infinitefinite positive weights
E-CONTRACT-022a selected diagnostic reads a tap-gradient or requests per-term parameter gradients in a forward-only run, which computes no reverse gradient for itselect it in a :gradient :reverse run, or leave it out of :diagnostics
E-CONTRACT-023the training loaders declare one field name twice, or two that have stages name them differentlygive one field another name, keeping its column with :from; the same stage names in the same order, or one stage
E-INFER-001the model alone, which a run's checkpoints hold and export writes, returns something other than tensors; the message shows it. A run says so and checkpoints without itreturn only tensors from the model; see running a trained model

Generation

E-GEN-008 reports an unsupported persistent generator configuration or reset mask. Use one device, one trip without :until, and state rows that belong to one training loader. Return a bool vector with one reset flag per slot, or with several loaders a list of one mask per loader. Resume with the checkpoint's persistent state schema, loaders and microbatches, fork with the checkpoint's training loaders unchanged, or start a fresh run with loaded model weights.

codewhat it meansusual fix
E-GEN-001a generator's :init, :step or :finish returned something other than a plist of tensors; the span is the lambda, the message shows what it returned(list :sequence s :cache c), a keyword before each tensor
E-GEN-002:step returned other keys, shapes or dtypes than :init made; the message shows boththe state keeps its keys, shapes and dtypes on every trip
E-GEN-003the generator makes a name the training loader or a pass's loader reads as a field; the span is the lambda that returned it. A pass whose loader differs from the training loader in fields or batch size does not run the generator, so its prepare reading a generated name is E-CONTRACT-005rename it where the generator returns it; give the pass the training loader's fields and batch size, or name it in a generator's :passes
E-GEN-004a metric inside a generator, which would never be reported. A diagnostic there, or in a model the generator runs, is dropped; a selection naming only such a one is E-CONTRACT-016return the value in the state and report it from objective
E-GEN-005defgenerate without :trips, :init or :step, or :trips below 1; the message shows the value(defgenerate :trips 15 :init start :step next)
E-GEN-006a generator's :until returns anything but one bool scalar; the span is the lambda, the message shows the shape and dtype it returnedreduce over the rows to one flag, as in (> (min done) 0.5)
E-GEN-007:passes is not a vector of pass names, or names a pass no defeval declares, or a pass another :passes names; or the file has two generators without :passes. The note shows the firstthe fix names the nearest pass; name each pass in one :passes, and keep one training generator

Records

codewhat it meansusual fix
E-REC-001a record outside a pass's graph and the :finish of a generator of :passes: in training, or in a prepare training shares with the passrecord in the pass's own :prepare or :evaluate, or its generator's :finish
E-REC-002a record without a table name or a column, a table name of other than letters, digits, ., _ and - or starting with ., a column without a first axis or whose first axis differs from the others, a :keep of more than one value a row, a column twice, or a table recorded twice in one graph or by a pass and its generatorgive every column the rows as its first axis and each table a name of its own; the message names the column and its shape

Knobs

codewhat it meansusual fix
E-KNOB-001a knob is declared twicethe note shows the first; delete one
E-KNOB-002a knob the file declares and never reads; setting it in a variant, a sweep or --set is not a readread it, or delete it
E-KNOB-003a variant or sweep sets something that is not a knobthe fix names the nearest and lists the knobs
E-KNOB-004--variant or a sweep names a variant the file does not declare; the span is the nearest declarationthe fix names the nearest and lists the variants
E-KNOB-005--set, or a checkpoint's recorded selection, names a knob the file does not declare; the span is the nearest declarationthe fix names the nearest and lists the knobs; for a recorded one, --drop-recorded-knob
E-KNOB-006a variant declared twice, or after defknobsthe note shows the first or the knobs; move every defvariant above defknobs
E-KNOB-007a sweep axis lists one value twice, or its :rows one row twice in any key order: two points would be one run under one slug. The message says whichdrop the repeat
E-KNOB-008--set seed=v in a file that declares no seed knob, with a v that is not a nonnegative integer; the span is the file's first line--set seed=N with a nonnegative integer
E-KNOB-009a sweep declared twice; the note shows the firstsexpgpu sweep names a sweep, so rename one or delete it
E-KNOB-010--steps N in a file whose knob steps is not what defrun :steps reads, so the knob would say N while the run has another length. The span is :steps's value, the note the knob(defrun :steps steps ...), or rename a knob that counts something else

Run time and tools

codewhat it meansusual fix
E-DP-001 .. E-DP-008several GPUs or nodes: configuration, rendezvous and resumesee devices
E-CKPT-001a run without --resume into a checkpoint location that has checkpoints, or one forking --resume <location>/step-<n> into one whose first checkpoint was not forked from that path; the message names the location--resume latest to continue it, or a new, empty --checkpoint-dir; see checkpoints
E-CKPT-002another run opened this run's o41:// location, so this run stopped at its next checkpoint without saving itnothing: the other run continues the location; see checkpoints
E-CKPT-003a checkpoint a verb read, to resume, evaluate, bundle, take its choices or print it, is of a format this version does not read; the message names the version that wrote itresume or evaluate it with that version, installed beside this one with the line the message gives, or train the run again; see checkpoints
E-CHOICE-001a pinned run cannot take a recorded choice here: a stacking that does not fit or is not offered, a cuDNN engine this version cannot use on this device, a convolution the record has none for, or another dtype between nodes; the message names ita device like the recorded one, SEXPGPU_NODE_GRADIENTS as recorded, --choices missing for a choice the record has none for, or --choices fresh; see determinism
E-CHOICE-002--choices names no checkpoint or file with recorded choices, or --deterministic was given with --choices <record> or SEXPGPU_NODE_GRADIENTS=bf16a checkpoint written by this version, or one of the two
E-GUARD-001a guard counted something at a step, an evaluation pass, a parameter's update or the first microbatch of sexpgpu gradients; the message names the guard, its metadata, the count (an optimizer's names the first parameter that counted), the step and where it is writtenthe run stopped at that step and its last checkpoint stands; resume from it with a fix, or look at the guard/<name> series
E-DATA-001check --data could not read source metadata or project a sample record; the message names the loader or pass, file and expected/actual structurecheck file access and the declared field shape/dtype; use nested lists for a multi-axis field, or declare a flat field and reshape it in prepare; see data samples
E-LOAD-001a resume whose :load file is not the one the checkpoint's run read: another tensor, size or version (ETag, or SHA-256 of a local file); the message shows bothrestore the file, or start the run again; see checkpoints
E-MEM-001the smallest memory plan does not fit on the device, even with no execution cache; the message names the number and the largest partfewer rows per microbatch (raise :microbatches), recompute a loop body with checkpoint, or a device with more memory; across nodes the default gradient transfer costs 10 bytes per parameter per GPU and SEXPGPU_NODE_GRADIENTS=f32 saves 6 of them; see devices
E-MEM-002on Metal, a buffer exceeds the device's per-buffer limit, or allocation fails; the message names the bytes and the tensora smaller shape or more :microbatches; Metal has no memory plan, so this is its only check; see devices
E-MEM-003a CUDA training microbatch could not allocate even after a retry with the caches released, or was the third in a row to fail: the run needs more memory than planned. The message names the step, the microbatch, the planned memory and what is free nowfewer rows per microbatch (raise :microbatches), a smaller model, or a device with more memory; see devices
E-FMT-001the formatter refused its own output; the file was left as it wasa bug in SexpGPU: report it with sexpgpu feedback
E-INTERNAL-001the compiled program failed validationa bug in SexpGPU, never the experiment's fault: report it with sexpgpu feedback

Training phases

codemeaningfix
E-PHASE-001duplicate or reserved phase nameuse a unique name other than default
E-PHASE-002stage index outside the declared training stagesselect a declared zero-based stage index
E-PHASE-003phase preparation declares different countersdeclare the same counters in the same order

Run composition and pass values

CodeExpected and actualFix
E-RUN-001a literal first-form readable base path; malformed, misplaced or imported declaration insteadstart the run with (extends "./base.sx"); use require for libraries
E-RUN-002an acyclic chain of at most 64 links; a cycle or deeper chain insteadremove the circular link or shorten the chain
E-RUN-003one override per name and setting per layer; conflicting declarations insteadkeep one declaration; the note locates the other
E-PASS-001a nonempty pass name and a generator value when supplied; invalid constructor inputs insteaduse (eval-pass "dev" :loader dev-loader) and :generator (generator ...)
E-PASS-002a list of evaluation pass values; another type or element insteadwrite defrun :evals (list (eval-pass "dev" :loader dev-loader))
E-PASS-003a list of declared pass names; wrong types or absent names insteadwrite defrun :drop-evals ["dev"] naming declared passes

Batch mapping

CodeMeaningFix
E-VMAP-001Invalid function/axis signature, or no mapped tensor to infer an extent.Supply a function and a static axis or one axis/nil per argument.
E-VMAP-002Axis outside the tensor rank or unequal lane extents.Select an existing axis with the same extent in all mapped leaves.
E-VMAP-003A result cannot be stacked, or a captured input cannot be shared.Return a tensor tree and pass runtime tensors as explicit arguments.

See vmap for shared arguments and randomness.

Initialized state and transitions

codewhat it meansusual fix
E-BRANCH-001Lazy branch predicate or branch schemas differUse a bool scalar and equal structures, shapes, kinds, aliases and static reporting schemas
E-BRANCH-002A lazy branch contains an unsupported reporting effectKeep record tables, forward-credit and adjoint taps outside lazy branches
E-BRANCH-003A tensor-predicate branch occurs inside scan or vmapUse where for eager selection
E-BRANCH-004Differentiating changing-presence branches would exceed 16 specialized continuationsGive both arms the same dependence, or move the named branches outside the differentiated function
E-BRANCH-005An optimizer's lazy branch depends on device dataBuild the condition from host-known scalar ctx values and constants, or use where for eager selection