Adding a Model Family¶
A family is one retained model architecture the frontends serve: MH-0
MACE/MACEField, MH-1 (MACE_Nonlinear), and MACE Polar. A family
owns its scientific kernels, its contract, its code generator, its artifact
adapters, and its frontend. The shared layer owns only the contracts a family
plugs into, so porting a family is parallel-friendly inside the family files and
mechanical everywhere else.
This page is the landing checklist: the family-side pattern, every shared-file edit the tree actually requires, the worked example, the qualification gates, and the evidence conventions.
Family-side pattern¶
Read symmetrix/source/symmetrix/mace_family.py,
mace_nonlinear_family.py, and mace_polar_family.py before
writing yours; each is a declaration-only module of the same shape.
FamilyEntry carries key, precedence, detection, evaluators, modes,
schema, extractor, contract, generated_contract, codegen, adapters,
capabilities, frontend_adapter, routings, variants, surfaces, and
artifacts:
Detection(model_types=..., architectures=...)— the model-file keys that admit a model. MACE and MH-1 detect bymodel_type.EvaluatorVariant— exactly one evaluator class per precision (float32/float64);declared_errornames the build-support failure a backend without the class must report before initializing a runtime.Symbol— a module or module attribute resolved lazily against the declaring package, so the entry names its schema, extractor, code generator, and adapter modules without importing them at declaration time.CapabilityDeclaration— the capability family string the native evaluators report; its key set isfamily_registry.CAPABILITY_KEYS, one cross-language contract read by the conformance suites, the generated matrix, and the frontend readiness gate.EvaluatorSurface— one evaluator capability (key, boundmethods,readinesscapability keys, optionalkokkosscope). A frontend that commits to a surface raisesMissingCapabilityErrornaming the missing method instead of running a fallback branch.ArtifactAdapter— one entry point per (routing, target) that prepares and caches an artifact. It is calledprepare(model_path, precision=..., target=...)and declares which result attributes hold the library (artifact_path), the identity envelope (manifest_path), and which evaluator keywords receive the library and identity. A family whose frontend prepares inline, or whose adapter takes rendered source rather than a model file, declares none; a consumer that needs one then fails naming the routing and target.
ModeVocabulary is the accepted-spelling table: aliases, primary, and
deprecated. Every non-direct spelling resolves to the single reference
routing — that is why materialized is an alias and not a routing of its own.
Each Routing(key, native_mode, surface, reduces_stress) names the neutral
routing (direct or reference), the spelling its native evaluator accepts,
the surface it drives, and whether it leaves a completed evaluation the stress
reduction can consume. The two compact families share
family_registry.COMPACT_MODE_VOCABULARY, declared beside the entry data model
rather than inside one family’s declaration, so a compact declaration points at
it instead of owning it; a family with different rules declares its own literal
ModeVocabulary.
The three R1 artifact adapters share
symmetrix/source/symmetrix/mace_jit_artifact_common.py: read_model_json,
native_evaluator, and require_matching_generation_version are the Python
side of the artifact contract, so they live there once. What differs stays with
the adapter and is passed in — its own error type and message label, and the
streamed-edge policy its contract requires ("direct" for the compact host
adapter, "factorized" for its device sibling).
Plan space, when the family has one. libsymmetrix/source/plan_candidate_space.hpp
gives PlanCandidateSpace::declare(id, evaluate) and PlanCandidateDescriptor;
a family registers one descriptor per whole plan it can run, in declaration
order. The plan ids are the cross-language string contract — the same ids the
Python calculators accept as _debug_execution_plan and the native plan pin
validates — so they are family data with one native owner, never a planner-owned
table. A family that declares no plan space reports its one selected plan as an
implicit candidate.
Names. Family files in libsymmetrix/source/ and
symmetrix/source/symmetrix/ are prefixed with the family token followed by
_ or .. The prefix is derived from the declared entries
(FAMILY_PREFIX = _family_prefix(family_registry.declared_entries()) in
symmetrix/test/test_family_naming_contract.py), so declaring a family admits
its own files with no edit to that module;
test_a_newly_declared_family_admits_its_files_without_editing_this_module
pins exactly that. The token set the shared-layer leak scan greps for
(FAMILY_TOKEN) is still hand-maintained, because the scan looks for the
spellings a token takes in prose and not only in basenames. One family never
leaks into the shared layer: family_interface.hpp,
implementation_registry.hpp, plan_candidate_space.hpp, execution_mode.hpp,
and family_registry.py carry no family token.
Qualification expectations for a new family¶
Declaration and naming contracts —
pytest symmetrix/test/test_family_registry.py symmetrix/test/test_family_naming_contract.py. These are the fast gates: a missing surface, a duplicate precedence, a stray family token in the shared layer, or an unprefixed basename fails here first.Conformance —
symmetrix/test/test_family_conformance.pydrives the neutral lifecycle (prepare, bind geometry, evaluate, reduce forces, reduce stress where declared) for every instance your cases module registers, and asserts tier parity per operator kind and portable coverage per admitted instance. The adapters and instance specs are yours, in your own module; the shared suite names no family. A surface the runner cannot qualify must be reported with the runner it requires, never skipped or represented by a fake shared-lifecycle instance.Interface conformance — the per-evaluator surface assertions live in your cases module beside the declarations they drive;
symmetrix/test/test_family_interface_conformance.pyholds the one runtime contract stated once for every family (an empty artifact path stays a readiness query), and the compile-time half is thestatic_assertin the family’s own translation unit.Routing parity — the case you declare in that module is what
symmetrix/test/test_execution_routing_parity.pyparametrizes over: the two routings agree within the family’s own tolerance, andreferenceevaluates with an empty cache and RTC disabled whiledirectfails at preparation rather than falling back.Matrix regeneration with drift check — regenerate the support matrix and confirm the drift test is green (
--checkortest_execution_support_matrix.py).Backend battery — run the applicable full suite on each backend the family claims, keeping the qualification rules from
AGENTS.md: CPU, CUDA, HIP, and LAMMPS builds live in separate fresh environments and task-specific build roots;symmetrix doctor --jsonmust report one loaded OpenMP runtime andstatus: okfor OpenMP deployment; an accelerator tier is only qualified on a backend build compiled for that architecture; LAMMPS requires a relink after every native-library change and per-family host/device artifacts. A backend a family does not serve is reported unsupported, never silently degraded.Required-test manifests — when the family owns a node an accelerator qualification run must execute, add it to
symmetrix/test/cuda_runtime_required_tests.json,cuda_compiler_required_tests.json, orhip_required_tests.jsonso a missing node fails the run instead of shrinking it.
Evidence conventions¶
Qualification records are session-tagged and never overwritten, and every record
carries the extension SHA-256 it was produced with
(identity.native_extension_sha256). Report us/atom (us/atom/step for MPI)
as the primary metric with model, precision, backend, atom count, cutoff, skin,
effective cutoff, directed edges, timing, and memory; parse the record back and
check it against the command rather than trusting the filename. Keep raw
measurements under benchmarks/ and prune superseded reports instead of letting
several sessions’ numbers coexist. Do not commit benchmark records or generated
binaries to the documentation tree.
Known friction¶
The shared-file edits above are mechanical, but they are real: a family cannot land without them, and the largest shared test file is a rebase collision point. The five simplifications this page used to carry as planned work have all landed, and each one removed a hand edit from the checklist:
Binding-report authority.
selected_implementation_idis a per-node field of the binding report (implementation_registry.hpp:125), seeded byplan_program()and overridable by a family resolver, and every report serializes it verbatim — so the report is what ran, not a second derivation, and a consumer never recomputes it from the tier.Serializer hoisting.
read_model_json,native_evaluator, andrequire_matching_generation_versionlive once insymmetrix/source/symmetrix/mace_jit_artifact_common.py, parameterized by the adapter’s error type, label, and streamed-edge policy. A new adapter writes only what differs.Vocabulary relocation.
COMPACT_MODE_VOCABULARYis declared infamily_registry.pybeside theFamilyEntrydata model, so no family module owns another family’s vocabulary and the calculator imports no declaration. That removed the declaration import from item 4’s edit surface.Derived
FAMILY_PREFIX. The prefix is_family_prefix(family_registry.declared_entries()), so a new family admits its own files with no edit to the naming contract. The former “extend theFAMILY_PREFIXregex” item is gone from the list; onlyFAMILY_TOKEN(item 7) stays hand-maintained.Conformance-adapter split. Per-family adapters, instance specs, structures, session models, readiness cases, and the routing-parity case are declared in the family’s own
test_family_<family>_conformance_cases.pyand discovered by pattern (conformance/registry.py). Items 8, 9, and 11 are therefore one new file plus two declarations inside it, and the three shared suites (test_family_conformance.py,test_family_interface_conformance.py,test_execution_routing_parity.py) need no edit at all.
What is left is friction the tree has chosen not to hide rather than debt:
The build graph is explicit. CMake source lists (items 1–2) cannot be globbed here; an unlisted translation unit does not build, and a silent glob would make a family’s absence from a backend invisible.
The shipped set is asserted, not inferred.
SHIPPED(item 3) is the enforcement point for both the family set and its precedence order, and theprecedenceinteger (item 6) is a family value coupled to it.The generated matrix is drift-pinned. Item 10’s tables are authored data and the regenerated block is checked byte-for-byte, which is what keeps the support matrix from becoming a second, drifting source of truth.
test_mace_streamed_edges.pyremains the largest shared collision point (item 12). It carries no family switch, but plan-id data crosses it, so a family that adds plan ids rebases there.The leak scan’s token set is prose-aware (item 7): a token a family’s name takes in a comment or a string is not derivable from the declaration.