| name | add-tsl-extension |
| description | Add a target extension or machine-profile family through TSL source data, typed compiler capabilities, generated artifacts, verification, and tests. Use when asked to add a SIMD ISA or extension, fixed or scalable profile, compiler-vector overlay, target family, machine profile, feature or compile mode, or the first primitive slice for a new target. |
Add TSL Extension
Workflow
- Read
AGENTS.md, CHARTER.md, PLANS.md, tsldata/AGENTS.md,
tslc/AGENTS.md, tslc/CHARTER.md, and docs/add-extension.md completely.
Inspect the closest extension family, target family, and machine profiles.
- Define the target contract before editing: extension/family names, vector
width model, inheritance/superseding, supported backends, feature and compile
modes, profile selection, target triples/flags, headers/modules, and runner.
- Add source-owned routing and capabilities in
tsldata/detail/target_families.tsl, extension metadata in
tsldata/extensions/extension.tsl, and machine instances in
supplementary/buildsystem/machine_profiles.json. Do not branch on the new
name in generic compiler stages.
- Add typed catalog/schema/backend support only for concepts the current model
cannot express. Keep selection and lowering driven by source capabilities;
keep target syntax and intrinsic composition backend-owned.
- Prove one small primitive/type slice through selection, lowering, rendering,
generated build, and value tests before broadening coverage. Use the
primitive or primitive-implementation skill for that slice when applicable.
- If the target needs a new compiler, cross-target path, runner, emulator, or
preflight behavior, also use
extend-tslc-verification. Keep tool paths
injectable and unavailable hardware/toolchains skip-safe.
- Test catalog promotion, capability validation, profile selection, lowering,
backend spelling, verifier configuration, and deterministic diagnostics.
- Run a focused smoke generation, inspect emitted target facts, then broaden
to the full Python suite and generated gates justified by the slice.
Checks
- The next similar extension should mostly add source data, profiles,
implementations, and tests rather than new name classifiers.
- Unsupported backend/profile/type combinations must remain explicit.
- Templates must format typed decisions, not infer target semantics.
- Update coverage ratchets only after generated build/value behavior is stable
and the task explicitly authorizes baseline changes.
Useful Commands
python -m compileall -q tslc/src/tslc
PYTHONPATH=tslc/src python -m pytest -q tslc/tests/test_catalog.py tslc/tests/test_catalog_validation.py
PYTHONPATH=tslc/src python -m pytest -q tslc/tests/test_backend_target_capability.py tslc/tests/test_profile_rendering.py
PYTHONPATH=tslc/src python -m pytest -q tslc/tests/test_select_and_lower*.py tslc/tests/test_build_verify_config.py
PYTHONPATH=tslc/src python -m pytest -q tslc/tests